[gtk+/gtk-2-24] Make gtk_status_icon_set_name() work reliably



commit 627af13e74cd13d6837429442cb18e1ddb9283ed
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 27 01:26:48 2011 -0400

    Make gtk_status_icon_set_name() work reliably

 gtk/gtkstatusicon.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c
index d9a4f76..bd43da1 100644
--- a/gtk/gtkstatusicon.c
+++ b/gtk/gtkstatusicon.c
@@ -3015,7 +3015,18 @@ gtk_status_icon_set_name (GtkStatusIcon *status_icon,
   priv = status_icon->priv;
 
 #ifdef GDK_WINDOWING_X11
-  gtk_window_set_wmclass (GTK_WINDOW (priv->tray_icon), name, name);
+  if (gtk_widget_get_realized (priv->tray_icon))
+    {
+      /* gtk_window_set_wmclass() only operates on non-realized windows,
+       * so temporarily unrealize the tray here
+       */
+      gtk_widget_hide (priv->tray_icon);
+      gtk_widget_unrealize (priv->tray_icon);
+      gtk_window_set_wmclass (GTK_WINDOW (priv->tray_icon), name, name);
+      gtk_widget_show (priv->tray_icon);
+    }
+  else
+    gtk_window_set_wmclass (GTK_WINDOW (priv->tray_icon), name, name);
 #endif
 
   g_object_notify (G_OBJECT (status_icon), "name");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]