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

Proposed by Michael Terry
Status: Merged
Approved by: Ted Gould
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) Approve
Review via email: mp+59277@code.launchpad.net

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.
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Ronald Kinard (furyhunter) wrote :

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

Revision history for this message
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.

Revision history for this message
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
304. By Michael Terry

ref menu until we're done toggling its visibility

Revision history for this message
Ted Gould (ted) wrote :

Looks good.

review: Approve
Revision history for this message
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
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2011-04-27 02:39:06 +0000
+++ libdbusmenu-gtk/parser.c 2011-05-18 18:20:51 +0000
@@ -270,6 +270,16 @@
270 return item;270 return item;
271}271}
272272
273static gboolean
274toggle_widget_visibility (GtkWidget * widget)
275{
276 gboolean vis = gtk_widget_get_visible (widget);
277 gtk_widget_set_visible (widget, !vis);
278 gtk_widget_set_visible (widget, vis);
279 g_object_unref (G_OBJECT (widget));
280 return FALSE;
281}
282
273static void283static void
274watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu)284watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu)
275{285{
@@ -285,6 +295,14 @@
285 G_CALLBACK (child_removed_cb),295 G_CALLBACK (child_removed_cb),
286 mi);296 mi);
287 g_object_add_weak_pointer(G_OBJECT (menu), (gpointer*)&pdata->shell);297 g_object_add_weak_pointer(G_OBJECT (menu), (gpointer*)&pdata->shell);
298
299 /* Some apps (notably Eclipse RCP apps) don't fill contents of submenus
300 until the menu is shown. So we fake that by toggling the visibility of
301 any submenus we come across. Further, these apps need it done with a
302 delay while they finish initializing, so we put the call in the idle
303 queue. */
304 g_idle_add((GSourceFunc)toggle_widget_visibility,
305 g_object_ref (G_OBJECT (menu)));
288}306}
289307
290static void308static void

Subscribers

People subscribed via source and target branches