[gtk+] Make gtk_status_icon_set_name() work reliably



commit c8e8cdaaf49a6fc67d3e5c99cb9a0d266c748584
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 6e53bc9..8d5a0ef 100644
--- a/gtk/gtkstatusicon.c
+++ b/gtk/gtkstatusicon.c
@@ -2964,6 +2964,17 @@ 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
 }



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