[Xfce4-commits] <terminal:master> Unbind title dialog binding before destroy.

Nick Schermer noreply at xfce.org
Sun Jan 30 14:36:04 CET 2011


Updating branch refs/heads/master
         to 715a78dc3cc93ab3a49d9c59a88ca34a88824206 (commit)
       from ef462b1a24384045dc815d602e006b8040b2b382 (commit)

commit 715a78dc3cc93ab3a49d9c59a88ca34a88824206
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Jan 30 14:27:45 2011 +0100

    Unbind title dialog binding before destroy.
    
    Some versions of Gtk emit a properly change when destroying, resulting
    in an empty title. So unbind before closing the dialog.

 terminal/terminal-window.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 6294ef2..7f584a4 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -1520,8 +1520,9 @@ terminal_window_action_goto_tab (GtkRadioAction *action,
 
 
 static void
-title_dialog_response (GtkWidget *dialog,
-                       gint       response)
+title_dialog_response (GtkWidget         *dialog,
+                       gint              response,
+                       ExoMutualBinding *title_binding)
 {
   /* check if we should open the user manual */
   if (response == GTK_RESPONSE_HELP)
@@ -1532,6 +1533,7 @@ title_dialog_response (GtkWidget *dialog,
   else
     {
       /* close the dialog */
+      exo_mutual_binding_unbind (title_binding);
       gtk_widget_destroy (dialog);
     }
 }
@@ -1539,16 +1541,25 @@ title_dialog_response (GtkWidget *dialog,
 
 
 static void
+title_dialog_quit (GtkWidget *dialog)
+{
+  gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
+}
+
+
+
+static void
 terminal_window_action_set_title (GtkAction      *action,
                                   TerminalWindow *window)
 {
-  AtkRelationSet *relations;
-  AtkRelation    *relation;
-  AtkObject      *object;
-  GtkWidget      *dialog;
-  GtkWidget      *box;
-  GtkWidget      *label;
-  GtkWidget      *entry;
+  AtkRelationSet   *relations;
+  AtkRelation      *relation;
+  AtkObject        *object;
+  GtkWidget        *dialog;
+  GtkWidget        *box;
+  GtkWidget        *label;
+  GtkWidget        *entry;
+  ExoMutualBinding *title_binding;
 
   if (G_LIKELY (window->active != NULL))
     {
@@ -1572,7 +1583,7 @@ terminal_window_action_set_title (GtkAction      *action,
       entry = gtk_entry_new ();
       gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0);
       g_signal_connect_swapped (G_OBJECT (entry), "activate",
-                                G_CALLBACK (gtk_widget_destroy), dialog);
+                                G_CALLBACK (title_dialog_quit), dialog);
       gtk_widget_show (entry);
 
       /* set Atk description and label relation for the entry */
@@ -1583,10 +1594,11 @@ terminal_window_action_set_title (GtkAction      *action,
       atk_relation_set_add (relations, relation);
       g_object_unref (G_OBJECT (relation));
 
-      exo_mutual_binding_new (G_OBJECT (window->active), "custom-title", G_OBJECT (entry), "text");
+      title_binding = exo_mutual_binding_new (G_OBJECT (window->active), "custom-title",
+                                              G_OBJECT (entry), "text");
 
       g_signal_connect (G_OBJECT (dialog), "response",
-                        G_CALLBACK (title_dialog_response), NULL);
+                        G_CALLBACK (title_dialog_response), title_binding);
 
       gtk_widget_show (dialog);
     }



More information about the Xfce4-commits mailing list