Merge lp:~nick-dedekind/qmenumodel/lp1199423 into lp:qmenumodel

Proposed by Michal Hruby
Status: Work in progress
Proposed branch: lp:~nick-dedekind/qmenumodel/lp1199423
Merge into: lp:qmenumodel
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
Pete Woods (community) Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+196284@code.launchpad.net

This proposal supersedes a proposal from 2013-11-19.

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

> 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 : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote : Posted in a previous version of this proposal
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Pete Woods (pete-woods) wrote :

The changes look good to me, except for the ABI breakage in unitymenumodel.h

Are we sure that all of its consumers are only using the QML plug-in?

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

> The changes look good to me, except for the ABI breakage in unitymenumodel.h
>
> Are we sure that all of its consumers are only using the QML plug-in?

There are a few points where we used UnitMenuModel in it's C++ form, but only as a pointer.
Nothing used the actionsChanged signal though.

Revision history for this message
Pete Woods (pete-woods) wrote :

> > The changes look good to me, except for the ABI breakage in unitymenumodel.h
> >
> > Are we sure that all of its consumers are only using the QML plug-in?
>
> There are a few points where we used UnitMenuModel in it's C++ form, but only
> as a pointer.
> Nothing used the actionsChanged signal though.

Okay, so what's the rule regarding known "okay" ABI breakages then? Is it okay to skip the ABI version bump in this case?

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

> > > The changes look good to me, except for the ABI breakage in
> unitymenumodel.h
> > >
> > > Are we sure that all of its consumers are only using the QML plug-in?
> >
> > There are a few points where we used UnitMenuModel in it's C++ form, but
> only
> > as a pointer.
> > Nothing used the actionsChanged signal though.
>
> Okay, so what's the rule regarding known "okay" ABI breakages then? Is it okay
> to skip the ABI version bump in this case?

Is there an explicit ABI version? Or do you just mean bump to 0.2.8? If so, we can do that.

Revision history for this message
Pete Woods (pete-woods) wrote :

Well the ABI version is currently 0. If we're breaking it we should probably up this to 1, I'd have thought.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in libqmenumodel/src/unitymenumodel.cpp
Text conflict in libqmenumodel/src/unitymenumodel.h
2 conflicts encountered.

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-22 13:51:15 +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-22 13:51:15 +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