Merge lp:~nick-dedekind/qmenumodel/lp1199423 into lp:~phablet-team/qmenumodel/trunk

Proposed by Nick Dedekind
Status: Superseded
Proposed branch: lp:~nick-dedekind/qmenumodel/lp1199423
Merge into: lp:~phablet-team/qmenumodel/trunk
Diff against target: 78 lines (+30/-14)
2 files modified
libqmenumodel/src/unitymenumodel.cpp (+29/-13)
libqmenumodel/src/unitymenumodel.h (+1/-1)
To merge this branch: bzr merge lp:~nick-dedekind/qmenumodel/lp1199423
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+195818@code.launchpad.net

This proposal has been superseded by a proposal from 2013-11-22.

Commit message

Do not watch an empty busName & emit signals for parameter changes.

Description of the change

Do not watch an empty busName & emit signals for parameter changes.

To post a comment you must log in.
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Getting this message when qml initialising busName=""

(process:18007): GLib-GIO-CRITICAL **: g_bus_watch_name: assertion 'g_dbus_is_name (name)' failed

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> Getting this message when qml initialising busName=""
>
> (process:18007): GLib-GIO-CRITICAL **: g_bus_watch_name: assertion
> 'g_dbus_is_name (name)' failed

That is, I fixed this issue.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Unmerged revisions

97. By Nick Dedekind

Better management of busName & parameter changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libqmenumodel/src/unitymenumodel.cpp'
2--- libqmenumodel/src/unitymenumodel.cpp 2013-10-14 16:31:14 +0000
3+++ libqmenumodel/src/unitymenumodel.cpp 2013-11-19 16:24:46 +0000
4@@ -292,15 +292,23 @@
5
6 void UnityMenuModel::setBusName(const QByteArray &name)
7 {
8- priv->clearName();
9-
10- if (priv->nameWatchId)
11- g_bus_unwatch_name (priv->nameWatchId);
12-
13- priv->nameWatchId = g_bus_watch_name (G_BUS_TYPE_SESSION, name.constData(), G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
14- UnityMenuModelPrivate::nameAppeared, UnityMenuModelPrivate::nameVanished,
15- priv, NULL);
16- priv->busName = name;
17+ if (name != priv->busName) {
18+ priv->clearName();
19+
20+ if (priv->nameWatchId) {
21+ g_bus_unwatch_name (priv->nameWatchId);
22+ priv->nameWatchId = 0;
23+ }
24+
25+ if (!name.isEmpty()) {
26+ priv->nameWatchId = g_bus_watch_name (G_BUS_TYPE_SESSION, name.constData(), G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
27+ UnityMenuModelPrivate::nameAppeared, UnityMenuModelPrivate::nameVanished,
28+ priv, NULL);
29+ }
30+
31+ priv->busName = name;
32+ Q_EMIT busNameChanged(priv->busName);
33+ }
34 }
35
36 QVariantMap UnityMenuModel::actions() const
37@@ -310,8 +318,12 @@
38
39 void UnityMenuModel::setActions(const QVariantMap &actions)
40 {
41- priv->actions = actions;
42- priv->updateActions();
43+ if (actions != priv->actions) {
44+ priv->actions = actions;
45+ priv->updateActions();
46+
47+ Q_EMIT actionsChanged(priv->actions);
48+ }
49 }
50
51 QByteArray UnityMenuModel::menuObjectPath() const
52@@ -321,8 +333,12 @@
53
54 void UnityMenuModel::setMenuObjectPath(const QByteArray &path)
55 {
56- priv->menuObjectPath = path;
57- priv->updateMenuModel();
58+ if (path != priv->menuObjectPath) {
59+ priv->menuObjectPath = path;
60+ priv->updateMenuModel();
61+
62+ Q_EMIT menuObjectPathChanged(priv->menuObjectPath);
63+ }
64 }
65
66 ActionStateParser* UnityMenuModel::actionStateParser() const
67
68=== modified file 'libqmenumodel/src/unitymenumodel.h'
69--- libqmenumodel/src/unitymenumodel.h 2013-09-03 10:02:47 +0000
70+++ libqmenumodel/src/unitymenumodel.h 2013-11-19 16:24:46 +0000
71@@ -67,7 +67,7 @@
72
73 Q_SIGNALS:
74 void busNameChanged(const QByteArray &name);
75- void actionsChanged(const QByteArray &path);
76+ void actionsChanged(const QVariantMap &actions);
77 void menuObjectPathChanged(const QByteArray &path);
78 void actionStateParserChanged(ActionStateParser* parser);
79

Subscribers

People subscribed via source and target branches