Merge lp:~uriboni/unity-2d/clean-up-dash-dbus into lp:unity-2d/3.0
- clean-up-dash-dbus
- Merge into natty
Status: | Merged |
---|---|
Approved by: | Olivier Tilloy |
Approved revision: | no longer in the source branch. |
Merged at revision: | 429 |
Proposed branch: | lp:~uriboni/unity-2d/clean-up-dash-dbus |
Merge into: | lp:unity-2d/3.0 |
Diff against target: |
249 lines (+78/-36) 10 files modified
.bzrignore (+1/-0) launcher/UnityApplications/placeentry.cpp (+1/-1) launcher/app/gesturehandler.cpp (+1/-1) panel/applets/homebutton/homebuttonapplet.cpp (+1/-1) places/app/CMakeLists.txt (+5/-0) places/app/dash.xml (+47/-0) places/app/dashdeclarativeview.cpp (+17/-1) places/app/dashdeclarativeview.h (+2/-2) places/app/places.cpp (+2/-29) places/app/unity-2d-places.service.in (+1/-1) |
To merge this branch: | bzr merge lp:~uriboni/unity-2d/clean-up-dash-dbus |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Tilloy (community) | code functional | Approve | |
Review via email: mp+52037@code.launchpad.net |
Commit message
Description of the change
[dash] Avoid exposing the entire QObject to DBUS, expose instead only what we really use
Olivier Tilloy (osomon) wrote : | # |
Also, I compared the interfaces before and after your changes, and it seems a lot of methods are gone, some (or all?) of which are actually used in the other components:
List of methods before:
- activateHome
- activatePlaceEntry
- setActive
- setActivePlaceEntry
- setExpanded
List of methods after:
- activateHome
Ugo Riboni (uriboni) wrote : | # |
> Also, I compared the interfaces before and after your changes, and it seems a
> lot of methods are gone, some (or all?) of which are actually used in the
> other components:
Actually the only one that was really removed in error is activatePlaceEntry. The others are not actually used via DBUS.
I also fixed the interface name used by clients, as pointed out in the previous comment.
Olivier Tilloy (osomon) wrote : | # |
In places/
+ <method name="activateP
+ <dox:d>Activates the Dash and shows the specified Place</dox:d>
Should be "[…] shows the specified place entry".
+ <signal name="activePla
+ <dox:d>Signals when the currently active place in the Dash changes</dox:d>
Same here, and everywhere else really: "place" ≠ "place entry". Please make sure that the terminology is consistent.
Olivier Tilloy (osomon) wrote : | # |
The value of the 'Name' key in places/
Olivier Tilloy (osomon) wrote : | # |
Packages fail to build from source with the following error:
Building CXX object places/
cd /home/osomon/
In file included from /home/osomon/
/home/osomon/
Olivier Tilloy (osomon) wrote : | # |
Quoting Aurélien on IRC:
bzr bd uses a separate build dir (src dir != build dir),
dashdeclarative
adding ${CMAKE_
Ugo Riboni (uriboni) wrote : | # |
Build error when building package is fixed now. Aureliene suggestion was good.
Olivier Tilloy (osomon) wrote : | # |
It now builds and works as expected.
Florian Boucault (fboucault) wrote : | # |
Attempt to merge into lp:unity-2d failed due to conflicts:
text conflict in places/
Ugo Riboni (uriboni) wrote : | # |
Conflict is now fixed
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2011-02-10 13:44:13 +0000 | |||
3 | +++ .bzrignore 2011-03-08 11:26:49 +0000 | |||
4 | @@ -11,6 +11,7 @@ | |||
5 | 11 | places/UnityPlaces/libUnityPlaces.so* | 11 | places/UnityPlaces/libUnityPlaces.so* |
6 | 12 | places/app/unity-2d-places | 12 | places/app/unity-2d-places |
7 | 13 | places/app/unity-2d-places.service | 13 | places/app/unity-2d-places.service |
8 | 14 | places/app/dashadaptor.* | ||
9 | 14 | 15 | ||
10 | 15 | spread/app/unity-2d-spread | 16 | spread/app/unity-2d-spread |
11 | 16 | spread/app/unity-2d-spread.service | 17 | spread/app/unity-2d-spread.service |
12 | 17 | 18 | ||
13 | === modified file 'launcher/UnityApplications/placeentry.cpp' | |||
14 | --- launcher/UnityApplications/placeentry.cpp 2011-02-10 01:00:41 +0000 | |||
15 | +++ launcher/UnityApplications/placeentry.cpp 2011-03-08 11:26:49 +0000 | |||
16 | @@ -143,7 +143,7 @@ | |||
17 | 143 | static const char* UNITY_PLACE_ENTRY_INTERFACE = "com.canonical.Unity.PlaceEntry"; | 143 | static const char* UNITY_PLACE_ENTRY_INTERFACE = "com.canonical.Unity.PlaceEntry"; |
18 | 144 | static const char* SECTION_PROPERTY = "section"; | 144 | static const char* SECTION_PROPERTY = "section"; |
19 | 145 | 145 | ||
21 | 146 | static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d"; | 146 | static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash"; |
22 | 147 | static const char* DASH_DBUS_PATH = "/Dash"; | 147 | static const char* DASH_DBUS_PATH = "/Dash"; |
23 | 148 | static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash"; | 148 | static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash"; |
24 | 149 | 149 | ||
25 | 150 | 150 | ||
26 | === modified file 'launcher/app/gesturehandler.cpp' | |||
27 | --- launcher/app/gesturehandler.cpp 2011-02-21 00:25:44 +0000 | |||
28 | +++ launcher/app/gesturehandler.cpp 2011-03-08 11:26:49 +0000 | |||
29 | @@ -117,7 +117,7 @@ | |||
30 | 117 | - show the home page of the dash if the dash is closed | 117 | - show the home page of the dash if the dash is closed |
31 | 118 | - close the dash, if the dash is opened | 118 | - close the dash, if the dash is opened |
32 | 119 | */ | 119 | */ |
34 | 120 | QDBusInterface dashInterface("com.canonical.Unity2d", "/Dash", "com.canonical.Unity2d.Dash"); | 120 | QDBusInterface dashInterface("com.canonical.Unity2d.Dash", "/Dash", "com.canonical.Unity2d.Dash"); |
35 | 121 | bool dashActive = dashInterface.property("active").toBool(); | 121 | bool dashActive = dashInterface.property("active").toBool(); |
36 | 122 | 122 | ||
37 | 123 | if (dashActive) { | 123 | if (dashActive) { |
38 | 124 | 124 | ||
39 | === modified file 'panel/applets/homebutton/homebuttonapplet.cpp' | |||
40 | --- panel/applets/homebutton/homebuttonapplet.cpp 2011-02-15 11:47:42 +0000 | |||
41 | +++ panel/applets/homebutton/homebuttonapplet.cpp 2011-03-08 11:26:49 +0000 | |||
42 | @@ -31,7 +31,7 @@ | |||
43 | 31 | #include <QDBusServiceWatcher> | 31 | #include <QDBusServiceWatcher> |
44 | 32 | #include <QDBusConnectionInterface> | 32 | #include <QDBusConnectionInterface> |
45 | 33 | 33 | ||
47 | 34 | static const char* DBUS_SERVICE = "com.canonical.Unity2d"; | 34 | static const char* DBUS_SERVICE = "com.canonical.Unity2d.Dash"; |
48 | 35 | static const char* DBUS_PATH = "/Dash"; | 35 | static const char* DBUS_PATH = "/Dash"; |
49 | 36 | static const char* DBUS_IFACE = "com.canonical.Unity2d.Dash"; | 36 | static const char* DBUS_IFACE = "com.canonical.Unity2d.Dash"; |
50 | 37 | 37 | ||
51 | 38 | 38 | ||
52 | === modified file 'places/app/CMakeLists.txt' | |||
53 | --- places/app/CMakeLists.txt 2011-02-24 01:13:42 +0000 | |||
54 | +++ places/app/CMakeLists.txt 2011-03-08 11:26:49 +0000 | |||
55 | @@ -18,9 +18,14 @@ | |||
56 | 18 | # Build | 18 | # Build |
57 | 19 | configure_file(unity-2d-places.service.in unity-2d-places.service) | 19 | configure_file(unity-2d-places.service.in unity-2d-places.service) |
58 | 20 | 20 | ||
59 | 21 | qt4_add_dbus_adaptor(places_SRCS dash.xml | ||
60 | 22 | dashdeclarativeview.h DashDeclarativeView | ||
61 | 23 | ) | ||
62 | 24 | |||
63 | 21 | add_executable(unity-2d-places ${places_SRCS} ${places_MOC_SRCS}) | 25 | add_executable(unity-2d-places ${places_SRCS} ${places_MOC_SRCS}) |
64 | 22 | 26 | ||
65 | 23 | include_directories( | 27 | include_directories( |
66 | 28 | ${CMAKE_CURRENT_SOURCE_DIR} | ||
67 | 24 | ${CMAKE_CURRENT_BINARY_DIR} | 29 | ${CMAKE_CURRENT_BINARY_DIR} |
68 | 25 | ${QTGCONF_INCLUDE_DIRS} | 30 | ${QTGCONF_INCLUDE_DIRS} |
69 | 26 | ${GTK_INCLUDE_DIRS} | 31 | ${GTK_INCLUDE_DIRS} |
70 | 27 | 32 | ||
71 | === added file 'places/app/dash.xml' | |||
72 | --- places/app/dash.xml 1970-01-01 00:00:00 +0000 | |||
73 | +++ places/app/dash.xml 2011-03-08 11:26:49 +0000 | |||
74 | @@ -0,0 +1,47 @@ | |||
75 | 1 | <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | ||
76 | 2 | <node xmlns:dox="http://www.ayatana.org/dbus/dox.dtd"> | ||
77 | 3 | <dox:d><![CDATA[ | ||
78 | 4 | @mainpage | ||
79 | 5 | |||
80 | 6 | An interface to control the dash in Unity-2d. | ||
81 | 7 | ]]></dox:d> | ||
82 | 8 | <interface name="com.canonical.Unity2d.Dash" xmlns:dox="http://www.ayatana.org/dbus/dox.dtd"> | ||
83 | 9 | <dox:d> | ||
84 | 10 | An interface to control the dash in Unity-2d. | ||
85 | 11 | </dox:d> | ||
86 | 12 | <method name="activateHome"> | ||
87 | 13 | <dox:d>Activates the Dash and shows the home section</dox:d> | ||
88 | 14 | </method> | ||
89 | 15 | <method name="activatePlaceEntry"> | ||
90 | 16 | <dox:d>Activates the Dash and shows the specified place entry</dox:d> | ||
91 | 17 | <arg name="file" type="s" direction="in"> | ||
92 | 18 | <dox:d>The .place file for the place containing the entry that should be activated</dox:d> | ||
93 | 19 | </arg> | ||
94 | 20 | <arg name="entry" type="s" direction="in"> | ||
95 | 21 | <dox:d>The place entry that should be activated</dox:d> | ||
96 | 22 | </arg> | ||
97 | 23 | <arg name="section" type="i" direction="in"> | ||
98 | 24 | <dox:d>The section of the place entry that should be activated</dox:d> | ||
99 | 25 | </arg> | ||
100 | 26 | </method> | ||
101 | 27 | <property name="active" type="b" access="readwrite"> | ||
102 | 28 | <dox:d>True if the Dash is active</dox:d> | ||
103 | 29 | </property> | ||
104 | 30 | <property name="activePlaceEntry" type="s" access="readwrite"> | ||
105 | 31 | <dox:d>The currently active place entry</dox:d> | ||
106 | 32 | </property> | ||
107 | 33 | <signal name="activeChanged"> | ||
108 | 34 | <dox:d>Signals when the active status of the Dash changes</dox:d> | ||
109 | 35 | <arg name="active" type="b" direction="out"> | ||
110 | 36 | <dox:d>True if the Dash is active</dox:d> | ||
111 | 37 | </arg> | ||
112 | 38 | </signal> | ||
113 | 39 | <signal name="activePlaceEntryChanged"> | ||
114 | 40 | <dox:d>Signals when the currently active place entry in the Dash changes</dox:d> | ||
115 | 41 | <arg name="activePlaceEntry" type="s" direction="out"> | ||
116 | 42 | <dox:d>The currently active place entry</dox:d> | ||
117 | 43 | </arg> | ||
118 | 44 | </signal> | ||
119 | 45 | </interface> | ||
120 | 46 | </node> | ||
121 | 47 | |||
122 | 0 | 48 | ||
123 | === modified file 'places/app/dashdeclarativeview.cpp' | |||
124 | --- places/app/dashdeclarativeview.cpp 2011-03-08 09:57:38 +0000 | |||
125 | +++ places/app/dashdeclarativeview.cpp 2011-03-08 11:26:49 +0000 | |||
126 | @@ -15,6 +15,8 @@ | |||
127 | 15 | */ | 15 | */ |
128 | 16 | 16 | ||
129 | 17 | #include "dashdeclarativeview.h" | 17 | #include "dashdeclarativeview.h" |
130 | 18 | #include "dashadaptor.h" | ||
131 | 19 | |||
132 | 18 | #include <QDesktopWidget> | 20 | #include <QDesktopWidget> |
133 | 19 | #include <QApplication> | 21 | #include <QApplication> |
134 | 20 | #include <QBitmap> | 22 | #include <QBitmap> |
135 | @@ -22,8 +24,8 @@ | |||
136 | 22 | #include <QDeclarativeContext> | 24 | #include <QDeclarativeContext> |
137 | 23 | #include <QX11Info> | 25 | #include <QX11Info> |
138 | 24 | #include <QGraphicsObject> | 26 | #include <QGraphicsObject> |
139 | 27 | #include <QtDBus/QDBusConnection> | ||
140 | 25 | #include <QTimer> | 28 | #include <QTimer> |
141 | 26 | |||
142 | 27 | #include <QDebug> | 29 | #include <QDebug> |
143 | 28 | 30 | ||
144 | 29 | #include <X11/Xlib.h> | 31 | #include <X11/Xlib.h> |
145 | @@ -38,6 +40,9 @@ | |||
146 | 38 | static const int DASH_DESKTOP_COLLAPSED_HEIGHT = 115; | 40 | static const int DASH_DESKTOP_COLLAPSED_HEIGHT = 115; |
147 | 39 | static const int DASH_DESKTOP_EXPANDED_HEIGHT = 606; | 41 | static const int DASH_DESKTOP_EXPANDED_HEIGHT = 606; |
148 | 40 | 42 | ||
149 | 43 | static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash"; | ||
150 | 44 | static const char* DASH_DBUS_OBJECT_PATH = "/Dash"; | ||
151 | 45 | |||
152 | 41 | DashDeclarativeView::DashDeclarativeView() | 46 | DashDeclarativeView::DashDeclarativeView() |
153 | 42 | : QDeclarativeView() | 47 | : QDeclarativeView() |
154 | 43 | , m_mode(HiddenMode) | 48 | , m_mode(HiddenMode) |
155 | @@ -320,3 +325,14 @@ | |||
156 | 320 | { | 325 | { |
157 | 321 | return QX11Info::isCompositingManagerRunning(); | 326 | return QX11Info::isCompositingManagerRunning(); |
158 | 322 | } | 327 | } |
159 | 328 | |||
160 | 329 | bool | ||
161 | 330 | DashDeclarativeView::connectToBus() | ||
162 | 331 | { | ||
163 | 332 | bool ok = QDBusConnection::sessionBus().registerService(DASH_DBUS_SERVICE); | ||
164 | 333 | if (!ok) { | ||
165 | 334 | return false; | ||
166 | 335 | } | ||
167 | 336 | new DashAdaptor(this); | ||
168 | 337 | return QDBusConnection::sessionBus().registerObject(DASH_DBUS_OBJECT_PATH, this); | ||
169 | 338 | } | ||
170 | 323 | 339 | ||
171 | === modified file 'places/app/dashdeclarativeview.h' | |||
172 | --- places/app/dashdeclarativeview.h 2011-03-08 09:57:38 +0000 | |||
173 | +++ places/app/dashdeclarativeview.h 2011-03-08 11:26:49 +0000 | |||
174 | @@ -24,7 +24,6 @@ | |||
175 | 24 | Q_OBJECT | 24 | Q_OBJECT |
176 | 25 | Q_ENUMS(DashMode) | 25 | Q_ENUMS(DashMode) |
177 | 26 | 26 | ||
178 | 27 | Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity2d.Dash") | ||
179 | 28 | Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) | 27 | Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) |
180 | 29 | Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged) | 28 | Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged) |
181 | 30 | Q_PROPERTY(DashMode dashMode READ dashMode WRITE setDashMode NOTIFY dashModeChanged) | 29 | Q_PROPERTY(DashMode dashMode READ dashMode WRITE setDashMode NOTIFY dashModeChanged) |
182 | @@ -58,7 +57,8 @@ | |||
183 | 58 | 57 | ||
184 | 59 | /* methods */ | 58 | /* methods */ |
185 | 60 | Q_INVOKABLE void activatePlaceEntry(const QString& file, const QString& entry, const int section = 0); | 59 | Q_INVOKABLE void activatePlaceEntry(const QString& file, const QString& entry, const int section = 0); |
187 | 61 | Q_INVOKABLE void activateHome(); | 60 | Q_SLOT void activateHome(); |
188 | 61 | bool connectToBus(); | ||
189 | 62 | 62 | ||
190 | 63 | Q_SIGNALS: | 63 | Q_SIGNALS: |
191 | 64 | void activeChanged(bool); | 64 | void activeChanged(bool); |
192 | 65 | 65 | ||
193 | === modified file 'places/app/places.cpp' | |||
194 | --- places/app/places.cpp 2011-02-24 01:13:42 +0000 | |||
195 | +++ places/app/places.cpp 2011-03-08 11:26:49 +0000 | |||
196 | @@ -39,33 +39,6 @@ | |||
197 | 39 | #include "dashdeclarativeview.h" | 39 | #include "dashdeclarativeview.h" |
198 | 40 | #include "config.h" | 40 | #include "config.h" |
199 | 41 | 41 | ||
200 | 42 | /* Register a D-Bus service for activation and deactivation of the dash */ | ||
201 | 43 | static bool registerDBusService(DashDeclarativeView* view) | ||
202 | 44 | { | ||
203 | 45 | QDBusConnection bus = QDBusConnection::sessionBus(); | ||
204 | 46 | if (!bus.registerService("com.canonical.Unity2d")) { | ||
205 | 47 | qCritical() << "Failed to register DBus service, is there another instance already running?"; | ||
206 | 48 | return false; | ||
207 | 49 | } | ||
208 | 50 | /* FIXME: use an adaptor class in order not to expose all of the view's | ||
209 | 51 | properties and methods. */\ | ||
210 | 52 | if (!bus.registerObject("/Dash", view, QDBusConnection::ExportAllContents)) { | ||
211 | 53 | qCritical() << "Failed to register /Dash, this should not happen!"; | ||
212 | 54 | return false; | ||
213 | 55 | } | ||
214 | 56 | /* It would be nice to support the newly introduced (D-Bus 0.14 07/09/2010) | ||
215 | 57 | property change notification that Qt 4.7 does not implement. | ||
216 | 58 | |||
217 | 59 | org.freedesktop.DBus.Properties.PropertiesChanged ( | ||
218 | 60 | STRING interface_name, | ||
219 | 61 | DICT<STRING,VARIANT> changed_properties, | ||
220 | 62 | ARRAY<STRING> invalidated_properties); | ||
221 | 63 | |||
222 | 64 | ref.: http://randomguy3.wordpress.com/2010/09/07/the-magic-of-qtdbus-and-the-propertychanged-signal/ | ||
223 | 65 | */ | ||
224 | 66 | return true; | ||
225 | 67 | } | ||
226 | 68 | |||
227 | 69 | int main(int argc, char *argv[]) | 42 | int main(int argc, char *argv[]) |
228 | 70 | { | 43 | { |
229 | 71 | /* gtk needs to be inited, otherwise we get an assert failure in gdk */ | 44 | /* gtk needs to be inited, otherwise we get an assert failure in gdk */ |
230 | @@ -86,8 +59,8 @@ | |||
231 | 86 | 59 | ||
232 | 87 | qmlRegisterType<DashDeclarativeView>("Places", 1, 0, "DashDeclarativeView"); | 60 | qmlRegisterType<DashDeclarativeView>("Places", 1, 0, "DashDeclarativeView"); |
233 | 88 | DashDeclarativeView view; | 61 | DashDeclarativeView view; |
236 | 89 | 62 | if (!view.connectToBus()) { | |
237 | 90 | if (!registerDBusService(&view)) { | 63 | qCritical() << "Another instance of the Dash already exists. Quitting."; |
238 | 91 | return -1; | 64 | return -1; |
239 | 92 | } | 65 | } |
240 | 93 | 66 | ||
241 | 94 | 67 | ||
242 | === modified file 'places/app/unity-2d-places.service.in' | |||
243 | --- places/app/unity-2d-places.service.in 2011-01-14 20:47:33 +0000 | |||
244 | +++ places/app/unity-2d-places.service.in 2011-03-08 11:26:49 +0000 | |||
245 | @@ -1,3 +1,3 @@ | |||
246 | 1 | [D-BUS Service] | 1 | [D-BUS Service] |
248 | 2 | Name=com.canonical.Unity2d | 2 | Name=com.canonical.Unity2d.Dash |
249 | 3 | Exec=@CMAKE_INSTALL_PREFIX@/bin/unity-2d-places | 3 | Exec=@CMAKE_INSTALL_PREFIX@/bin/unity-2d-places |
You need to update the other components to activate the service on the new, normalized interface name:
$ grep -rn "\"com. canonical. Unity2d\ "" * UnityApplicatio ns/placeentry. cpp:146: static const char* DASH_DBUS_SERVICE = "com.canonical. Unity2d" ; app/gesturehand ler.cpp: 120: QDBusInterface dashInterface( "com.canonical. Unity2d" , "/Dash", "com.canonical. Unity2d. Dash"); homebutton/ homebuttonapple t.cpp:34: static const char* DBUS_SERVICE = "com.canonical. Unity2d" ;
launcher/
launcher/
panel/applets/