diff options
author | Ted Gould <ted@gould.cx> | 2011-05-31 16:37:28 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-05-31 16:37:28 -0500 |
commit | 6f48c29f8c416e2a386d16195072997c1d3a6ebe (patch) | |
tree | 398a9301d809a22da185cf12a10a912033f3a6e8 /libdbusmenu-gtk/parser.c | |
parent | a4b9fc5bddae5ec02c16a5aedb3f9199bde540d7 (diff) | |
parent | d75107a47c7fbf87f370cca0134a848d35c60eae (diff) | |
download | libdbusmenu-6f48c29f8c416e2a386d16195072997c1d3a6ebe.tar.gz libdbusmenu-6f48c29f8c416e2a386d16195072997c1d3a6ebe.tar.bz2 libdbusmenu-6f48c29f8c416e2a386d16195072997c1d3a6ebe.zip |
Toggle visibility to help Eclipse
Diffstat (limited to 'libdbusmenu-gtk/parser.c')
-rw-r--r-- | libdbusmenu-gtk/parser.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index a304511..96ae849 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -270,6 +270,16 @@ new_menuitem (GtkWidget * widget) return item; } +static gboolean +toggle_widget_visibility (GtkWidget * widget) +{ + gboolean vis = gtk_widget_get_visible (widget); + gtk_widget_set_visible (widget, !vis); + gtk_widget_set_visible (widget, vis); + g_object_unref (G_OBJECT (widget)); + return FALSE; +} + static void watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu) { @@ -285,6 +295,14 @@ watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu) G_CALLBACK (child_removed_cb), mi); g_object_add_weak_pointer(G_OBJECT (menu), (gpointer*)&pdata->shell); + + /* Some apps (notably Eclipse RCP apps) don't fill contents of submenus + until the menu is shown. So we fake that by toggling the visibility of + any submenus we come across. Further, these apps need it done with a + delay while they finish initializing, so we put the call in the idle + queue. */ + g_idle_add((GSourceFunc)toggle_widget_visibility, + g_object_ref (G_OBJECT (menu))); } static void |