diff options
author | Michael Terry <mike@mterry.name> | 2011-04-27 15:20:10 -0400 |
---|---|---|
committer | Michael Terry <mike@mterry.name> | 2011-04-27 15:20:10 -0400 |
commit | 7ac87e8939eabab399c33bada6ab29c48ad9b986 (patch) | |
tree | 4b3ba05c42e5ee544f677a5c45ba7a5f087cc35d | |
parent | dc52456c069c025cbbec8071eea4118d0c89214c (diff) | |
download | libdbusmenu-7ac87e8939eabab399c33bada6ab29c48ad9b986.tar.gz libdbusmenu-7ac87e8939eabab399c33bada6ab29c48ad9b986.tar.bz2 libdbusmenu-7ac87e8939eabab399c33bada6ab29c48ad9b986.zip |
toggle visibility of menus to fix Eclipse RCP apps
-rw-r--r-- | libdbusmenu-gtk/parser.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 4708a64..b6423ca 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -270,6 +270,15 @@ 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); + return FALSE; +} + static void watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu) { @@ -285,6 +294,13 @@ 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, menu); } static void |