Merge lp:~mterry/libdbusmenu/eclipse-rcp into lp:libdbusmenu/0.5

Proposed by Michael Terry on 2011-04-27
Status: Merged
Approved by: Ted Gould on 2011-05-31
Approved revision: 304
Merged at revision: 304
Proposed branch: lp:~mterry/libdbusmenu/eclipse-rcp
Merge into: lp:libdbusmenu/0.5
Diff against target: 35 lines (+18/-0)
1 file modified
libdbusmenu-gtk/parser.c (+18/-0)
To merge this branch: bzr merge lp:~mterry/libdbusmenu/eclipse-rcp
Reviewer Review Type Date Requested Status
Ted Gould (community) 2011-04-27 Approve on 2011-05-31
Review via email:

Description of the change

Yay, I finally figured out Eclipse and its RCP framework. Combined with the already-merged work for Emacs, this is the last piece.

This toggles the visibility of any menus we come across, which -- much like the fake 'activation' we do on toplevel items -- triggers RCP to fill out the menu.

I've tested this with both a sample RCP app and Eclipse itself (after disabling the blacklist in appmenu-gtk).

To post a comment you must log in.
Michael Terry (mterry) wrote :

Sorry, I should mention that it doesn't fix *all* issues with the menus. In particular, shortcuts still don't work right. But it's a lot of the way there.

Michael Terry (mterry) wrote :

Oy, and I forgot to get rid of the idle callback if the menuitem goes away. Don't merge this yet, I guess. I'll update with that fix.

Ted Gould (ted) wrote :

On Thu, 2011-04-28 at 13:45 +0000, Michael Terry wrote:
> Oy, and I forgot to get rid of the idle callback if the
> menuitem goes away. Don't merge this yet, I guess. I'll
> update with that fix.

It seems you could just ref() it? Seems that even if it survived a
little bit longer that wouldn't cause any harm.

Ronald Kinard (furyhunter) wrote :

If this change is merged, will it make it into Natty's package?

Ted Gould (ted) wrote :

Uhm, that'd would be the choice of the Ubuntu Desktop Team, but I'm willing to commit it to the dbusmenu 0.4 branch which would make it possible for them to put into Natty.

Michael Terry (mterry) wrote :

Finally got back to this and fixed the ref issue like you suggested, Ted. Please re-review this.

lp:~mterry/libdbusmenu/eclipse-rcp updated on 2011-05-18
304. By Michael Terry on 2011-05-18

ref menu until we're done toggling its visibility

Ted Gould (ted) wrote :

Looks good.

review: Approve
Ted Gould (ted) wrote :

I also merged this into the 0.4 branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-gtk/parser.c'
2--- libdbusmenu-gtk/parser.c 2011-04-27 02:39:06 +0000
3+++ libdbusmenu-gtk/parser.c 2011-05-18 18:20:51 +0000
4@@ -270,6 +270,16 @@
5 return item;
6 }
8+static gboolean
9+toggle_widget_visibility (GtkWidget * widget)
11+ gboolean vis = gtk_widget_get_visible (widget);
12+ gtk_widget_set_visible (widget, !vis);
13+ gtk_widget_set_visible (widget, vis);
14+ g_object_unref (G_OBJECT (widget));
15+ return FALSE;
18 static void
19 watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu)
20 {
21@@ -285,6 +295,14 @@
22 G_CALLBACK (child_removed_cb),
23 mi);
24 g_object_add_weak_pointer(G_OBJECT (menu), (gpointer*)&pdata->shell);
26+ /* Some apps (notably Eclipse RCP apps) don't fill contents of submenus
27+ until the menu is shown. So we fake that by toggling the visibility of
28+ any submenus we come across. Further, these apps need it done with a
29+ delay while they finish initializing, so we put the call in the idle
30+ queue. */
31+ g_idle_add((GSourceFunc)toggle_widget_visibility,
32+ g_object_ref (G_OBJECT (menu)));
33 }
35 static void


People subscribed via source and target branches