Merge lp:~mterry/unity/never-stop-oh-never-stop-the-scrubbing into lp:unity

Proposed by Michael Terry
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 791
Proposed branch: lp:~mterry/unity/never-stop-oh-never-stop-the-scrubbing
Merge into: lp:unity
Diff against target: 31 lines (+17/-2)
1 file modified
services/panel-service.c (+17/-2)
To merge this branch: bzr merge lp:~mterry/unity/never-stop-oh-never-stop-the-scrubbing
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+47581@code.launchpad.net

Description of the change

This branch lets the panel service handle IndicatorObjectEntries without menus gracefully. This is follow on work from an indicator-appmenu fix [1].

Basically, if the panel service finds itself with a menu-less entry, it previously halted a scrub in its tracks. To avoid that, I just create a dummy GtkMenu for the duration of the scrub.

In practice, we should rarely if ever hit this. But for the moment, when an application swaps out a toplevel menu, indicator-appmenu is able to remove it, but not put the new one in place. So you'll see this, for example, in empathy, if you open a contact window and scrub across the "Contact" menu item. You'll need [1] though or you'll just crash instead.

[1] https://code.launchpad.net/~mterry/indicator-appmenu/fix-empathy-contact-crash/+merge/47579

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'services/panel-service.c'
2--- services/panel-service.c 2010-12-29 17:30:12 +0000
3+++ services/panel-service.c 2011-01-26 19:58:23 +0000
4@@ -977,10 +977,25 @@
5 priv->last_menu_button = 0;
6 }
7
8- if (entry != NULL && GTK_IS_MENU (entry->menu))
9+ if (entry != NULL)
10 {
11+ if (GTK_IS_MENU (entry->menu))
12+ {
13+ priv->last_menu = entry->menu;
14+ }
15+ else
16+ {
17+ /* For some reason, this entry doesn't have a menu. To simplify the
18+ rest of the code and to keep scrubbing fluidly, we'll create a
19+ stub menu for the duration of this scrub. */
20+ priv->last_menu = GTK_MENU (gtk_menu_new ());
21+ g_signal_connect (priv->last_menu, "deactivate",
22+ G_CALLBACK (gtk_widget_destroy), NULL);
23+ g_signal_connect (priv->last_menu, "destroy",
24+ G_CALLBACK (gtk_widget_destroyed), &priv->last_menu);
25+ }
26+
27 priv->last_entry = entry;
28- priv->last_menu = entry->menu;
29 priv->last_x = x;
30 priv->last_y = y;
31 priv->last_menu_button = button;