Merge lp:~marcustomlinson/libdbusmenu-qt/recursive-menu-refresh into lp:libdbusmenu-qt

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Ted Gould
Approved revision: 252
Merged at revision: 253
Proposed branch: lp:~marcustomlinson/libdbusmenu-qt/recursive-menu-refresh
Merge into: lp:libdbusmenu-qt
Diff against target: 23 lines (+6/-0)
1 file modified
src/dbusmenuimporter.cpp (+6/-0)
To merge this branch: bzr merge lp:~marcustomlinson/libdbusmenu-qt/recursive-menu-refresh
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+196268@code.launchpad.net

Commit message

When adding a new submenu action, refresh() that action to ensure full menu hierarchy is built.

To post a comment you must log in.
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

We were experiencing a problem in HUD when updating the dbusmenu QMenu. We would have to continuously loop through the entire menu hierarchy repeatedly calling aboutToShow() on each menu and submenu until no more menus appeared. This fix now causes the contained menu hierarchy to be updated recursively allowing us to make only one pass through the QMenu structure getting all actions.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

In short, it should take only one pass through the menu hierarchy in order to refresh all submenus. Our workaround w/o this change: http://bazaar.launchpad.net/~unity-api-team/hud/refactor/view/head:/service/DBusMenuCollector.cpp#L136

Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dbusmenuimporter.cpp'
2--- src/dbusmenuimporter.cpp 2013-08-25 18:17:08 +0000
3+++ src/dbusmenuimporter.cpp 2013-11-22 12:14:20 +0000
4@@ -189,6 +189,7 @@
5 updateActionVisible(action, value);
6 } else if (key == "shortcut") {
7 updateActionShortcut(action, value);
8+ } else if (key == "children-display") {
9 } else {
10 DMWARNING << "Unhandled property update" << key;
11 }
12@@ -420,6 +421,11 @@
13 connect(action, SIGNAL(triggered()),
14 &d->m_mapper, SLOT(map()));
15 d->m_mapper.setMapping(action, dbusMenuItem.id);
16+
17+ if( action->menu() )
18+ {
19+ d->refresh( dbusMenuItem.id )->waitForFinished();
20+ }
21 }
22 #ifdef BENCHMARK
23 DMDEBUG << "- Menu filled:" << sChrono.elapsed() << "ms";

Subscribers

People subscribed via source and target branches