[Xfce4-commits] r29740 - in xfce4-panel/trunk: . plugins/launcher

Nick Schermer nick at xfce.org
Thu Apr 9 21:18:53 CEST 2009


Author: nick
Date: 2009-04-09 19:18:52 +0000 (Thu, 09 Apr 2009)
New Revision: 29740

Modified:
   xfce4-panel/trunk/NEWS
   xfce4-panel/trunk/plugins/launcher/launcher.c
   xfce4-panel/trunk/plugins/launcher/launcher.h
Log:
Disconnect the icon theme changed signal from a launcher when it
is destroyed to avoid crash when the icon theme changes.


Modified: xfce4-panel/trunk/NEWS
===================================================================
--- xfce4-panel/trunk/NEWS	2009-04-09 19:00:55 UTC (rev 29739)
+++ xfce4-panel/trunk/NEWS	2009-04-09 19:18:52 UTC (rev 29740)
@@ -7,6 +7,8 @@
 - Fix xfce-hvbox not working with gtk 2.16 (bug #5166).
 - Don't crash the launcher plugin when the launcher entry list is empty.
 - Add icon-name fallback to the show desktop plugin (bug #5117).
+- Disconnect the icon theme changed signal from a launcher when it
+  is destroyed to avoid crash when the icon theme changes.
 
 
 4.6.0

Modified: xfce4-panel/trunk/plugins/launcher/launcher.c
===================================================================
--- xfce4-panel/trunk/plugins/launcher/launcher.c	2009-04-09 19:00:55 UTC (rev 29739)
+++ xfce4-panel/trunk/plugins/launcher/launcher.c	2009-04-09 19:18:52 UTC (rev 29740)
@@ -1020,7 +1020,6 @@
 {
     LauncherPlugin *launcher;
     GtkIconTheme   *icon_theme;
-    GdkScreen      *screen;
 
     /* create launcher structure */
     launcher = panel_slice_new0 (LauncherPlugin);
@@ -1056,10 +1055,10 @@
     gtk_button_set_focus_on_click (GTK_BUTTON (launcher->arrow_button), FALSE);
 
     /* hook for icon themes changes */
-    screen = gtk_widget_get_screen (launcher->image);
-    icon_theme = gtk_icon_theme_get_for_screen (screen);
-    g_signal_connect (G_OBJECT (icon_theme), "changed",
-                      G_CALLBACK (launcher_utility_icon_theme_changed), launcher);
+    icon_theme = gtk_icon_theme_get_default ();
+    launcher->icon_theme_change_handler = 
+        g_signal_connect (G_OBJECT (icon_theme), "changed",
+                          G_CALLBACK (launcher_utility_icon_theme_changed), launcher);
 
     /* icon button signals */
     g_signal_connect (G_OBJECT (launcher->icon_button), "state-changed",
@@ -1474,11 +1473,18 @@
 launcher_plugin_free (LauncherPlugin  *launcher)
 {
     GtkWidget *dialog;
+    GtkIconTheme *icon_theme;
 
     /* check if we still need to destroy the properties dialog */
     dialog = g_object_get_data (G_OBJECT (launcher->panel_plugin), I_("launcher-dialog"));
     if (G_UNLIKELY (dialog != NULL))
         gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+        
+    /* disconnect icon theme change handler */
+    icon_theme = gtk_icon_theme_get_default ();
+    if (launcher->icon_theme_change_handler != 0)
+        g_signal_handler_disconnect (G_OBJECT (icon_theme), 
+            launcher->icon_theme_change_handler);
 
     /* stop timeout */
     if (G_UNLIKELY (launcher->popup_timeout_id))

Modified: xfce4-panel/trunk/plugins/launcher/launcher.h
===================================================================
--- xfce4-panel/trunk/plugins/launcher/launcher.h	2009-04-09 19:00:55 UTC (rev 29739)
+++ xfce4-panel/trunk/plugins/launcher/launcher.h	2009-04-09 19:18:52 UTC (rev 29740)
@@ -92,6 +92,9 @@
     /* settings */
     guint            move_first : 1;
     guint            arrow_position;
+    
+    /* icon theme changed handler */
+    gulong           icon_theme_change_handler;
 };
 
 enum




More information about the Xfce4-commits mailing list