add glebihans disappearing tray patch

This commit is contained in:
TingPing 2012-12-21 15:09:00 -05:00
parent b259595c9d
commit 9aa33ad1d3
1 changed files with 36 additions and 0 deletions

View File

@ -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
@ -420,6 +424,35 @@ tray_menu_restore_cb (GtkWidget *item, gpointer userdata)
tray_toggle_visibility (FALSE);
}
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)
{
@ -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