summaryrefslogtreecommitdiff
path: root/source/xap/xfce/patches/terminal.gtk.2.18.fix.diff
blob: 69a9e70e8620af9ec9d5eae0e13501b14b908e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From 028dc2efd846defe796c7fa097ed84818bb43431 Mon Sep 17 00:00:00 2001
From: Nick Schermer <nick@xfce.org>
Date: Sun, 21 Mar 2010 22:05:31 +0000
Subject: Disconnect bindings before closing the dialog.

This avoids possible problems when Gtk+ emits property
changes before the widgets are destroyed. This is currently
the case for text entries in some Gtk 2.18 releases.
---
diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 587bd92..8f33628 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -64,24 +64,28 @@ terminal_preferences_dialog_class_init (TerminalPreferencesDialogClass *klass)
 
 
 #define BIND_PROPERTIES(name, property) \
-  { object = gtk_builder_get_object (GTK_BUILDER (dialog), name); \
+  G_STMT_START { \
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), name); \
   terminal_return_if_fail (G_IS_OBJECT (object)); \
-  exo_mutual_binding_new (G_OBJECT (dialog->preferences), name, \
-                          G_OBJECT (object), property); }
+  binding = exo_mutual_binding_new (G_OBJECT (dialog->preferences), name, \
+                                    G_OBJECT (object), property); \
+  dialog->bindings = g_slist_prepend (dialog->bindings, binding); \
+  } G_STMT_END
 
 
 
 static void
 terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
 {
-  GError        *error = NULL;
-  guint          i;
-  GObject       *object, *object2;
-  GtkWidget     *editor;
-  gchar          palette_name[16];
-  GtkFileFilter *filter;
-  gchar         *file;
-  const gchar   *props_active[] = { "title-mode", "command-login-shell",
+  GError           *error = NULL;
+  guint             i;
+  GObject          *object, *object2;
+  GtkWidget        *editor;
+  gchar             palette_name[16];
+  GtkFileFilter    *filter;
+  gchar            *file;
+  ExoMutualBinding *binding;
+  const gchar      *props_active[] = { "title-mode", "command-login-shell",
                                     "command-update-records", "scrolling-single-line",
                                     "scrolling-on-output", "scrolling-on-keystroke",
                                     "scrolling-bar", "font-allow-bold",
@@ -94,9 +98,9 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
                                     , "font-anti-alias"
 #endif
                                     };
-  const gchar   *props_color[] =  { "color-foreground", "color-cursor",
-                                    "color-background", "tab-activity-color",
-                                    "color-selection" };
+  const gchar      *props_color[] =  { "color-foreground", "color-cursor",
+                                       "color-background", "tab-activity-color",
+                                       "color-selection" };
 
   dialog->preferences = terminal_preferences_get ();
 
@@ -248,6 +252,8 @@ terminal_preferences_dialog_response (GtkWidget                 *widget,
                                       gint                       response,
                                       TerminalPreferencesDialog *dialog)
 {
+  GSList *li;
+
   /* check if we should open the user manual */
   if (G_UNLIKELY (response == 1))
     {
@@ -256,6 +262,11 @@ terminal_preferences_dialog_response (GtkWidget                 *widget,
     }
   else
     {
+      /* disconnect all the bindings */
+      for (li = dialog->bindings; li != NULL; li = li->next)
+        exo_mutual_binding_unbind (li->data);
+      g_slist_free (dialog->bindings);
+
       /* close the preferences dialog */
       gtk_widget_destroy (widget);
     }
diff --git a/terminal/terminal-preferences-dialog.h b/terminal/terminal-preferences-dialog.h
index b2db4f5..268d70a 100644
--- a/terminal/terminal-preferences-dialog.h
+++ b/terminal/terminal-preferences-dialog.h
@@ -48,6 +48,7 @@ struct _TerminalPreferencesDialog
 
   TerminalPreferences *preferences;
   guint                signal_id;
+  GSList              *bindings;
 };
 
 GType      terminal_preferences_dialog_get_type (void) G_GNUC_CONST;
--
cgit v0.8.2.1