diff options
author | Ted Gould <ted@gould.cx> | 2011-05-31 16:38:54 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-05-31 16:38:54 -0500 |
commit | 4e209b214ebb906a18e8c33b204aab6c605fd614 (patch) | |
tree | 85ade6ee49d0b10cefda0630d7866d91e0cef660 | |
parent | 2b93a6778095ef3b928eea0e29a742db2eea4160 (diff) | |
parent | d75107a47c7fbf87f370cca0134a848d35c60eae (diff) | |
download | libdbusmenu-4e209b214ebb906a18e8c33b204aab6c605fd614.tar.gz libdbusmenu-4e209b214ebb906a18e8c33b204aab6c605fd614.tar.bz2 libdbusmenu-4e209b214ebb906a18e8c33b204aab6c605fd614.zip |
Fix to toggle visibility for Eclipse
-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 4708a64..7b27f4f 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 |