aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-03-21 07:20:21 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-03-21 07:20:21 -0500
commitbe73acbfefefb4581f82b19421fe5fc39941901e (patch)
treedcba22a23c37261b16835d16d4fa1b940c87980f
parent06c5fccf713238d14d999a966b373fc832371b97 (diff)
downloadlibdbusmenu-be73acbfefefb4581f82b19421fe5fc39941901e.tar.gz
libdbusmenu-be73acbfefefb4581f82b19421fe5fc39941901e.tar.bz2
libdbusmenu-be73acbfefefb4581f82b19421fe5fc39941901e.zip
Don't listen for "changed" events from the screen's default GtkIconTheme. Fixes lp bug #953509
The crash in #953509 was being caused by the last two lines of theme_changed_cb() (a) leaving a dangling handler id in priv.theme_changed_sig, and (b) not remembering the handler id of its own signal connection. However after testing I don't see any reason to keep any of the theme handling code at all. "But wait," you say. "How will our menu icons follow the theme changes?" It works in practice anyway because we always listen for property changes to our reference GtkImage, **and** we listen for property changes to its GtkImageMenuItem parent so that if the GtkImageMenuItem changes GtkImages we can stop listening to the old one and start listening to the new one.
-rw-r--r--libdbusmenu-gtk/parser.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index da1c8fa..b98f34b 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -45,7 +45,6 @@ typedef struct _ParserData
GtkWidget *image;
AtkObject *accessible;
- guint theme_changed_sig;
} ParserData;
typedef struct _RecurseContext
@@ -86,8 +85,6 @@ static void item_inserted_cb (GtkContainer * menu,
static void item_removed_cb (GtkContainer * menu,
GtkWidget * widget,
gpointer data);
-static void theme_changed_cb (GtkIconTheme * theme,
- gpointer data);
static void item_activated (DbusmenuMenuitem * item,
guint timestamp,
gpointer user_data);
@@ -216,29 +213,11 @@ parse_data_free (gpointer data)
g_object_remove_weak_pointer(G_OBJECT(pdata->accessible), (gpointer*)&pdata->accessible);
}
- if (pdata != NULL && pdata->theme_changed_sig != 0) {
- g_signal_handler_disconnect(gtk_icon_theme_get_default(), pdata->theme_changed_sig);
- pdata->theme_changed_sig = 0;
- }
-
g_free(pdata);
return;
}
-static void
-widget_freed (gpointer data, GObject * obj)
-{
- ParserData * pdata = (ParserData *)data;
-
- if (pdata->theme_changed_sig != 0) {
- g_signal_handler_disconnect(gtk_icon_theme_get_default(), pdata->theme_changed_sig);
- pdata->theme_changed_sig = 0;
- }
-
- return;
-}
-
/* Called when the dbusmenu item that we're keeping around
is finalized */
static void
@@ -247,12 +226,7 @@ dbusmenu_item_freed (gpointer data, GObject * obj)
ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA);
if (pdata != NULL && pdata->widget != NULL) {
- if (pdata->theme_changed_sig != 0) {
- g_signal_handler_disconnect(gtk_icon_theme_get_default(), pdata->theme_changed_sig);
- pdata->theme_changed_sig = 0;
- }
g_object_steal_data(G_OBJECT(pdata->widget), CACHED_MENUITEM);
- g_object_weak_unref(G_OBJECT(pdata->widget), widget_freed, pdata);
}
}
@@ -294,7 +268,6 @@ new_menuitem (GtkWidget * widget)
g_object_set_data_full(G_OBJECT(item), PARSER_DATA, pdata, parse_data_free);
g_object_weak_ref(G_OBJECT(item), dbusmenu_item_freed, NULL);
- g_object_weak_ref(G_OBJECT(widget), widget_freed, pdata);
pdata->widget = widget;
g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget);
@@ -757,10 +730,6 @@ update_icon (DbusmenuMenuitem *menuitem, ParserData * pdata, GtkImageMenuItem *
we can't get it easily, and those mean it's not changed just the icon
underneith, so we can ignore these larger impacts */
if (image != GTK_IMAGE(pdata->image) && gmenuitem != NULL) {
- if (pdata->theme_changed_sig != 0) {
- g_signal_handler_disconnect(gtk_icon_theme_get_default(), pdata->theme_changed_sig);
- pdata->theme_changed_sig = 0;
- }
if (pdata->image != NULL) {
g_signal_handlers_disconnect_by_func(pdata->image, G_CALLBACK(image_notify_cb), menuitem);
@@ -770,8 +739,6 @@ update_icon (DbusmenuMenuitem *menuitem, ParserData * pdata, GtkImageMenuItem *
pdata->image = GTK_WIDGET(image);
if (pdata->image != NULL) {
- pdata->theme_changed_sig = g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()),
- "changed", G_CALLBACK(theme_changed_cb), gmenuitem);
g_signal_connect (G_OBJECT (pdata->image),
"notify",
G_CALLBACK (image_notify_cb),
@@ -1287,24 +1254,6 @@ item_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data)
return;
}
-static void
-theme_changed_cb (GtkIconTheme *theme, gpointer data)
-{
- GtkWidget *image;
-
- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (data));
-
- gpointer pmi = g_object_get_data(G_OBJECT(data), CACHED_MENUITEM);
- if (pmi != NULL) {
- ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(pmi), PARSER_DATA);
- update_icon(DBUSMENU_MENUITEM(pmi), pdata, NULL, GTK_IMAGE(image));
- }
-
- /* Switch signal to new theme */
- g_signal_handlers_disconnect_by_func(theme, G_CALLBACK(theme_changed_cb), data);
- g_signal_connect(gtk_icon_theme_get_default(), "changed", G_CALLBACK(theme_changed_cb), data);
-}
-
static gboolean
should_show_image (GtkImage *image)
{