aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-09-24 18:06:38 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-09-24 18:06:38 +0200
commitf0830c2a375481110762f157180ac035591e4b31 (patch)
tree1ba1f09e242bbb29f253c97056628d671f328c1d
parent72c78368cd1771181f885be2da5a26ea13fa72ff (diff)
downloadlibdbusmenu-f0830c2a375481110762f157180ac035591e4b31.tar.gz
libdbusmenu-f0830c2a375481110762f157180ac035591e4b31.tar.bz2
libdbusmenu-f0830c2a375481110762f157180ac035591e4b31.zip
parser.c: make sure to disconnect from gtksettings::gtk-menu-images
-rw-r--r--libdbusmenu-gtk/parser.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 419c15f..39cc9f8 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -62,6 +62,7 @@ typedef struct _ParserData
gulong widget_visible_handler_id;
gulong widget_screen_changed_handler_id;
+ GtkSettings *settings;
gulong settings_notify_handler_id;
} ParserData;
@@ -303,14 +304,18 @@ parser_data_free (ParserData * pdata)
dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_toggle_handler_id);
dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_visible_handler_id);
dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_screen_changed_handler_id);
- dbusmenu_gtk_clear_signal_handler (gtk_widget_get_settings (GTK_WIDGET (o)),
- &pdata->settings_notify_handler_id);
g_object_remove_weak_pointer(o, (gpointer*)&pdata->widget);
/* since the DbusmenuMenuitem is being destroyed, uncache it from the GtkWidget */
g_object_steal_data(o, CACHED_MENUITEM);
}
+ if (pdata->settings != NULL) {
+ dbusmenu_gtk_clear_signal_handler (pdata->settings,
+ &pdata->settings_notify_handler_id);
+ g_object_unref (pdata->settings);
+ }
+
if (pdata->shell != NULL) {
GObject * o = G_OBJECT(pdata->shell);
dbusmenu_gtk_clear_signal_handler (o, &pdata->item_inserted_handler_id);
@@ -1309,10 +1314,15 @@ widget_screen_changed_cb (GtkWidget * widget, GdkScreen * old_screen, gpointer d
ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(mi), PARSER_DATA);
- if (old_screen != NULL)
- dbusmenu_gtk_clear_signal_handler (gtk_settings_get_for_screen (old_screen),
- &pdata->settings_notify_handler_id);
- pdata->settings_notify_handler_id = g_signal_connect (gtk_widget_get_settings (widget), "notify",
+ if (pdata->settings != NULL)
+ {
+ dbusmenu_gtk_clear_signal_handler (pdata->settings,
+ &pdata->settings_notify_handler_id);
+ g_object_unref (pdata->settings);
+ }
+
+ pdata->settings = g_object_ref (gtk_widget_get_settings (widget));
+ pdata->settings_notify_handler_id = g_signal_connect (pdata->settings, "notify",
G_CALLBACK (settings_notify_cb), mi);
/* And update widget now that we have a new GtkSettings */