summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2012-12-21 15:09:00 -0500
committerTingPing <tingping@tingping.se>2012-12-21 15:09:00 -0500
commit9aa33ad1d36c345a6fa34d142d2839127a742cde (patch)
treea7d033efbb01a17bf250a3003a07c27b6e695d0f /src/fe-gtk
parentb259595c9d5d27686e26f8aac2a74f4ef189555a (diff)
add glebihans disappearing tray patch
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/plugin-tray.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c
index 9f0eff32..73a7572b 100644
--- a/src/fe-gtk/plugin-tray.c
+++ b/src/fe-gtk/plugin-tray.c
@@ -73,9 +73,13 @@ static int tray_priv_count = 0;
 static int tray_pub_count = 0;
 static int tray_hilight_count = 0;
 static int tray_file_count = 0;
+static int tray_restore_timer = 0;
 
 
 void tray_apply_setup (void);
+static gboolean tray_menu_try_restore ();
+static void tray_cleanup (void);
+static void tray_init (void);
 
 
 static WinStatus
@@ -421,6 +425,35 @@ tray_menu_restore_cb (GtkWidget *item, gpointer userdata)
 }
 
 static void
+tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data)
+{
+    if (sticon && strcmp (pspec->name, "embedded") == 0)
+    {
+        if (!gtk_status_icon_is_embedded (sticon))
+        {
+            tray_restore_timer = g_timeout_add(500, (GSourceFunc)tray_menu_try_restore, NULL);
+        }
+        else
+        {
+            if (tray_restore_timer)
+            {
+                g_source_remove (tray_restore_timer);
+                tray_restore_timer = 0;
+            }
+        }
+    }
+}
+
+static gboolean
+tray_menu_try_restore ()
+{
+    tray_cleanup();
+    tray_init();
+    return TRUE;
+}
+
+
+static void
 tray_menu_quit_cb (GtkWidget *item, gpointer userdata)
 {
 	mg_open_quit_dialog (FALSE);
@@ -627,6 +660,9 @@ tray_init (void)
 
 	g_signal_connect (G_OBJECT (sticon), "activate",
 							G_CALLBACK (tray_menu_restore_cb), NULL);
+
+    g_signal_connect (G_OBJECT (sticon), "notify",
+							G_CALLBACK (tray_menu_notify_cb), NULL);
 }
 
 static int