Merge lp:~agateau/unity-2d/gtk3 into lp:unity-2d/3.0
- gtk3
- Merge into natty
Status: | Rejected |
---|---|
Rejected by: | Florian Boucault |
Proposed branch: | lp:~agateau/unity-2d/gtk3 |
Merge into: | lp:unity-2d/3.0 |
Prerequisite: | lp:~agateau/unity-2d/pre-gtk3-work |
Diff against target: |
963 lines (+28/-645) 23 files modified
CMakeLists.txt (+3/-3) debian/control (+3/-3) launcher/app/launcher.cpp (+2/-5) libunity-2d-private/Unity2d/CMakeLists.txt (+1/-1) libunity-2d-private/Unity2d/launcherapplication.cpp (+3/-5) libunity-2d-private/Unity2d/plugin.cpp (+0/-4) libunity-2d-private/Unity2d/screeninfo.cpp (+1/-3) libunity-2d-private/Unity2d/windowinfo.cpp (+1/-3) libunity-2d-private/Unity2d/workspacesinfo.cpp (+1/-3) panel/app/CMakeLists.txt (+2/-1) panel/app/main.cpp (+0/-2) panel/app/unity2dstyle.cpp (+0/-98) panel/app/unity2dstyle.h (+0/-44) panel/applets/CMakeLists.txt (+3/-6) panel/applets/indicator/abstractindicator.cpp (+0/-43) panel/applets/indicator/abstractindicator.h (+0/-53) panel/applets/indicator/datetimeindicator.cpp (+0/-94) panel/applets/indicator/datetimeindicator.h (+0/-53) panel/applets/indicator/indicator.c (+2/-1) panel/applets/indicator/indicatorapplet.cpp (+6/-43) panel/applets/indicator/indicatorapplet.h (+0/-3) panel/applets/indicator/indicatorservicemanager.cpp (+0/-120) panel/applets/indicator/indicatorservicemanager.h (+0/-54) |
To merge this branch: | bzr merge lp:~agateau/unity-2d/gtk3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Florian Boucault | Pending | ||
Review via email: mp+69099@code.launchpad.net |
This proposal supersedes a proposal from 2011-07-13.
Commit message
Description of the change
This branch has been extracted from the unity-core branch. It ports all GTK code from GTK2 to GTK3.
We can't use QGtkStyle anymore because it links to GTK2. Therefore we have to initialize GTK ourself. To ensure this is done consistently, I introduced Unity2dApplicat
(Resubmitted to make pre-gtk3-work as prerequisite branch)
Florian Boucault (fboucault) wrote : Posted in a previous version of this proposal | # |
Aurélien Gâteau (agateau) wrote : Posted in a previous version of this proposal | # |
> This MR contains changes that are completely compatible with Natty. For
> example the changes in the following files (creation of earlySetup):
>
> spread/
> spread/
> places/
> places/
> launcher/
>
>
> Please extract as much as possible as to minimize the delta.
Done. MR is here: https:/
- 639. By Aurélien Gâteau
-
Synced with trunk
Unmerged revisions
- 639. By Aurélien Gâteau
-
Synced with trunk
- 638. By Aurélien Gâteau
-
Merged pre-gtk3-work branch
- 637. By Aurélien Gâteau
-
Merge bring-back-po-files branch
- 636. By Aurélien Gâteau
-
Use gtk3 version of build-deps
- 635. By Aurélien Gâteau
-
[buildsystem] Fix detection of indicator3 lib
- 634. By Aurélien Gâteau
-
[panel] Remove dead code
- 633. By Aurélien Gâteau
-
[panel] Bring back indicators, using gtk3 version of libindicator
- 632. By Aurélien Gâteau
-
[libunity-2d] Depend on the GTK3 version of indicators
- 631. By Aurélien Gâteau
-
[panel] Factorize early setup code and default to QWindowsStyle.
Unity2dApplicat
ion::earlySetup () contains all the early setup code. - 630. By Aurélien Gâteau
-
[buildsystem] We can't use Unity2dStyle anymore
Unity2dStyle uses QGtkStyle, which uses gtk2. Since we can't mix gtk2 and gtk3,
we must get rid of Unity2dStyle.
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2011-07-25 14:59:39 +0000 |
3 | +++ CMakeLists.txt 2011-07-25 14:59:39 +0000 |
4 | @@ -25,10 +25,10 @@ |
5 | find_package(X11 REQUIRED) |
6 | find_package(Gettext REQUIRED) |
7 | pkg_check_modules(GLIB REQUIRED glib-2.0) |
8 | -pkg_check_modules(GDK REQUIRED gdk-2.0) |
9 | -pkg_check_modules(GTK REQUIRED gtk+-2.0) |
10 | +pkg_check_modules(GDK REQUIRED gdk-3.0) |
11 | +pkg_check_modules(GTK REQUIRED gtk+-3.0) |
12 | pkg_check_modules(GIO REQUIRED gio-2.0) |
13 | -pkg_check_modules(WNCK REQUIRED libwnck-1.0) |
14 | +pkg_check_modules(WNCK REQUIRED libwnck-3.0) |
15 | |
16 | |
17 | # GSettings schemas |
18 | |
19 | === modified file 'debian/control' |
20 | --- debian/control 2011-07-14 14:36:53 +0000 |
21 | +++ debian/control 2011-07-25 14:59:39 +0000 |
22 | @@ -10,15 +10,15 @@ |
23 | libqt4-dev, |
24 | libqt4-opengl-dev, |
25 | libglib2.0-dev, |
26 | - libwnck-dev, |
27 | + libwnck-3-dev, |
28 | libqtgconf-dev, |
29 | libdconf-qt-dev, |
30 | libqtbamf-dev, |
31 | libqtdee-dev, |
32 | libdbusmenu-qt-dev, |
33 | libx11-dev, |
34 | - libindicator-dev, |
35 | - libgtk2.0-dev, |
36 | + libindicator3-dev, |
37 | + libgtk-3-dev, |
38 | libutouch-geis-dev, |
39 | libstartup-notification0-dev |
40 | Standards-Version: 3.9.1 |
41 | |
42 | === modified file 'launcher/app/launcher.cpp' |
43 | --- launcher/app/launcher.cpp 2011-07-25 14:59:39 +0000 |
44 | +++ launcher/app/launcher.cpp 2011-07-25 14:59:39 +0000 |
45 | @@ -42,14 +42,11 @@ |
46 | #include "unity2dpanel.h" |
47 | #include "gesturehandler.h" |
48 | |
49 | -<<<<<<< TREE |
50 | -static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher"; |
51 | - |
52 | -======= |
53 | // libc |
54 | #include <stdlib.h> |
55 | |
56 | ->>>>>>> MERGE-SOURCE |
57 | +static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher"; |
58 | + |
59 | #if defined(QMLJSDEBUGGER) |
60 | #include <qt_private/qdeclarativedebughelper_p.h> |
61 | #endif |
62 | |
63 | === modified file 'libunity-2d-private/Unity2d/CMakeLists.txt' |
64 | --- libunity-2d-private/Unity2d/CMakeLists.txt 2011-07-25 14:59:39 +0000 |
65 | +++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-07-25 14:59:39 +0000 |
66 | @@ -4,7 +4,7 @@ |
67 | pkg_check_modules(QTDEE REQUIRED libqtdee) |
68 | pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt) |
69 | pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0) |
70 | -pkg_check_modules(INDICATOR REQUIRED indicator) |
71 | +pkg_check_modules(INDICATOR REQUIRED indicator3-0.4) |
72 | pkg_check_modules(DCONFQT REQUIRED dconf-qt) |
73 | |
74 | # Sources |
75 | |
76 | === modified file 'libunity-2d-private/Unity2d/launcherapplication.cpp' |
77 | --- libunity-2d-private/Unity2d/launcherapplication.cpp 2011-07-13 17:42:29 +0000 |
78 | +++ libunity-2d-private/Unity2d/launcherapplication.cpp 2011-07-25 14:59:39 +0000 |
79 | @@ -14,10 +14,6 @@ |
80 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
81 | */ |
82 | |
83 | -/* Those have to be included before any QObject-style header to avoid |
84 | - compilation errors. */ |
85 | -#include <gdk/gdk.h> |
86 | - |
87 | /* Note regarding the use of wnck: it is critically important that the client |
88 | type be set to pager because wnck will pass that type over to the window |
89 | manager through XEvents. |
90 | @@ -59,6 +55,7 @@ |
91 | #include <QX11Info> |
92 | |
93 | extern "C" { |
94 | +#include <gdk/gdk.h> |
95 | #include <libsn/sn.h> |
96 | } |
97 | |
98 | @@ -649,7 +646,8 @@ |
99 | GTimeVal timeval; |
100 | |
101 | g_get_current_time (&timeval); |
102 | - GObjectScopedPointer<GdkAppLaunchContext> context(gdk_app_launch_context_new()); |
103 | + GdkDisplay* display = gdk_display_get_default(); |
104 | + GObjectScopedPointer<GdkAppLaunchContext> context(gdk_display_get_app_launch_context(display)); |
105 | /* Using GDK_CURRENT_TIME doesn’t seem to work, launched windows |
106 | sometimes don’t get focus (see https://launchpad.net/bugs/643616). */ |
107 | gdk_app_launch_context_set_timestamp(context.data(), timeval.tv_sec); |
108 | |
109 | === modified file 'libunity-2d-private/Unity2d/plugin.cpp' |
110 | --- libunity-2d-private/Unity2d/plugin.cpp 2011-07-14 11:17:30 +0000 |
111 | +++ libunity-2d-private/Unity2d/plugin.cpp 2011-07-25 14:59:39 +0000 |
112 | @@ -20,10 +20,6 @@ |
113 | /* Required otherwise using wnck_set_client_type breaks linking with error: |
114 | undefined reference to `wnck_set_client_type(WnckClientType)' |
115 | */ |
116 | -extern "C" { |
117 | -#include <libwnck/util.h> |
118 | -} |
119 | - |
120 | #include "plugin.h" |
121 | |
122 | #include "launcherapplication.h" |
123 | |
124 | === modified file 'libunity-2d-private/Unity2d/screeninfo.cpp' |
125 | --- libunity-2d-private/Unity2d/screeninfo.cpp 2011-06-27 13:43:05 +0000 |
126 | +++ libunity-2d-private/Unity2d/screeninfo.cpp 2011-07-25 14:59:39 +0000 |
127 | @@ -1,7 +1,5 @@ |
128 | extern "C" { |
129 | -#include <libwnck/screen.h> |
130 | -#include <libwnck/window.h> |
131 | -#include <libwnck/workspace.h> |
132 | +#include <libwnck/libwnck.h> |
133 | } |
134 | |
135 | #include "bamf-matcher.h" |
136 | |
137 | === modified file 'libunity-2d-private/Unity2d/windowinfo.cpp' |
138 | --- libunity-2d-private/Unity2d/windowinfo.cpp 2011-02-08 11:48:16 +0000 |
139 | +++ libunity-2d-private/Unity2d/windowinfo.cpp 2011-07-25 14:59:39 +0000 |
140 | @@ -14,9 +14,7 @@ |
141 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
142 | */ |
143 | |
144 | -#include <libwnck/screen.h> |
145 | -#include <libwnck/window.h> |
146 | -#include <libwnck/workspace.h> |
147 | +#include <libwnck/libwnck.h> |
148 | |
149 | #include <glib-2.0/glib.h> |
150 | |
151 | |
152 | === modified file 'libunity-2d-private/Unity2d/workspacesinfo.cpp' |
153 | --- libunity-2d-private/Unity2d/workspacesinfo.cpp 2011-07-23 12:46:30 +0000 |
154 | +++ libunity-2d-private/Unity2d/workspacesinfo.cpp 2011-07-25 14:59:39 +0000 |
155 | @@ -4,9 +4,7 @@ |
156 | #include <debug_p.h> |
157 | |
158 | extern "C" { |
159 | -#include <libwnck/screen.h> |
160 | -#include <libwnck/window.h> |
161 | -#include <libwnck/workspace.h> |
162 | +#include <libwnck/libwnck.h> |
163 | } |
164 | |
165 | #include <QAbstractEventDispatcher> |
166 | |
167 | === modified file 'panel/app/CMakeLists.txt' |
168 | --- panel/app/CMakeLists.txt 2011-04-04 16:41:15 +0000 |
169 | +++ panel/app/CMakeLists.txt 2011-07-25 14:59:39 +0000 |
170 | @@ -1,7 +1,6 @@ |
171 | set(panel_SRCS |
172 | main.cpp |
173 | panelmanager.cpp |
174 | - unity2dstyle.cpp |
175 | ) |
176 | |
177 | qt4_automoc(${panel_SRCS}) |
178 | @@ -10,6 +9,7 @@ |
179 | include_directories( |
180 | ${CMAKE_CURRENT_BINARY_DIR} |
181 | ${CMAKE_CURRENT_SOURCE_DIR} |
182 | + ${GTK_INCLUDE_DIRS} |
183 | ${uqapplets_SOURCE_DIR} |
184 | ${uqapplets_SOURCE_DIR}/common |
185 | ${libunity-2d-private_SOURCE_DIR}/src |
186 | @@ -18,6 +18,7 @@ |
187 | target_link_libraries(unity-2d-panel |
188 | ${QT_QTGUI_LIBRARIES} |
189 | ${QT_QTCORE_LIBRARIES} |
190 | + ${GTK_LDFLAGS} |
191 | uqapplets |
192 | unity-2d-private |
193 | ) |
194 | |
195 | === modified file 'panel/app/main.cpp' |
196 | --- panel/app/main.cpp 2011-07-25 14:59:39 +0000 |
197 | +++ panel/app/main.cpp 2011-07-25 14:59:39 +0000 |
198 | @@ -27,7 +27,6 @@ |
199 | #include <gnomesessionclient.h> |
200 | #include <unity2ddebug.h> |
201 | #include <unity2dapplication.h> |
202 | -#include <unity2dstyle.h> |
203 | #include <unity2dtr.h> |
204 | |
205 | // Qt |
206 | @@ -54,7 +53,6 @@ |
207 | ThemeEngineHandler handler; |
208 | Unity2dApplication::earlySetup(argc, argv); |
209 | Unity2dApplication app(argc, argv); |
210 | - QApplication::setStyle(new Unity2dStyle); |
211 | |
212 | GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-panel.desktop"); |
213 | client.connectToSessionManager(); |
214 | |
215 | === removed file 'panel/app/unity2dstyle.cpp' |
216 | --- panel/app/unity2dstyle.cpp 2011-03-28 12:16:02 +0000 |
217 | +++ panel/app/unity2dstyle.cpp 1970-01-01 00:00:00 +0000 |
218 | @@ -1,98 +0,0 @@ |
219 | -/* |
220 | - * Plasma applet to display DBus global menu |
221 | - * |
222 | - * Copyright 2009 Canonical Ltd. |
223 | - * |
224 | - * Authors: |
225 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
226 | - * |
227 | - * This program is free software; you can redistribute it and/or modify |
228 | - * it under the terms of the GNU General Public License as published by |
229 | - * the Free Software Foundation; version 3. |
230 | - * |
231 | - * This program is distributed in the hope that it will be useful, |
232 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
233 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
234 | - * GNU General Public License for more details. |
235 | - * |
236 | - * You should have received a copy of the GNU General Public License |
237 | - * along with this program. If not, see <http://www.gnu.org/licenses/> |
238 | - */ |
239 | - |
240 | -// Self |
241 | -#include "unity2dstyle.h" |
242 | - |
243 | -// Local |
244 | - |
245 | -// libunity-2d-private |
246 | -#include <debug_p.h> |
247 | -#include <keyboardmodifiersmonitor.h> |
248 | - |
249 | -// Qt |
250 | -#include <QGtkStyle> |
251 | -#include <QMenu> |
252 | -#include <QPainter> |
253 | -#include <QStyleOptionFrame> |
254 | -#include <QWidget> |
255 | - |
256 | -Unity2dStyle::Unity2dStyle() |
257 | -: QProxyStyle(new QGtkStyle) |
258 | -{ |
259 | -} |
260 | - |
261 | -void Unity2dStyle::drawControl(QStyle::ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const |
262 | -{ |
263 | - if (element == QStyle::CE_MenuBarItem && widget) { |
264 | - QStyleOptionMenuItem opt = *qstyleoption_cast<const QStyleOptionMenuItem*>(option); |
265 | - if (!(opt.state & QStyle::State_Enabled) && (opt.state & QStyle::State_Sunken)) { |
266 | - // Reset State_Sunken flag to avoid drawing a frame on a disabled menu item |
267 | - // See https://bugs.launchpad.net/unity-2d/+bug/717744 |
268 | - opt.state ^= QStyle::State_Sunken; |
269 | - } |
270 | - // Skip "widget" parameter to avoid solid gray background behind the menubar items |
271 | - QProxyStyle::drawControl(element, &opt, painter, 0); |
272 | - } else if (element == QStyle::CE_MenuBarEmptyArea) { |
273 | - // Avoid gray borders around the menubar items |
274 | - } else { |
275 | - QProxyStyle::drawControl(element, option, painter, widget); |
276 | - } |
277 | -} |
278 | - |
279 | -int Unity2dStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option, const QWidget* widget) const |
280 | -{ |
281 | - if (metric == QStyle::PM_MenuBarVMargin) { |
282 | - // Avoid one-pixel gap above menuitem |
283 | - return 0; |
284 | - } else { |
285 | - return QProxyStyle::pixelMetric(metric, option, widget); |
286 | - } |
287 | -} |
288 | - |
289 | -QSize Unity2dStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget) const |
290 | -{ |
291 | - QSize size = QProxyStyle::sizeFromContents(type, option, contentsSize, widget); |
292 | - if (type == QStyle::CT_MenuBarItem && widget) { |
293 | - // Avoid three-pixel gap below menuitem |
294 | - size.setHeight(widget->height()); |
295 | - } |
296 | - return size; |
297 | -} |
298 | - |
299 | -int Unity2dStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWidget* widget, QStyleHintReturn* returnData) const |
300 | -{ |
301 | - if (hint == QStyle::SH_UnderlineShortcut) { |
302 | - // The shortcut of an opened menu can be triggered without holding Alt |
303 | - // down, so we always show the underline. For all other widgets we only |
304 | - // show the underlines if alt is down. |
305 | - // Note that this is a bit hackish: it only works reliably if the |
306 | - // widget repaints itself when alt is pressed or released. For now only |
307 | - // the MenuBarWidget from the AppNameApplets does this. |
308 | - if (qobject_cast<const QMenu*>(widget)) { |
309 | - return true; |
310 | - } else { |
311 | - return KeyboardModifiersMonitor::instance()->keyboardModifiers() == Qt::AltModifier; |
312 | - } |
313 | - } else { |
314 | - return QProxyStyle::styleHint(hint, option, widget, returnData); |
315 | - } |
316 | -} |
317 | |
318 | === removed file 'panel/app/unity2dstyle.h' |
319 | --- panel/app/unity2dstyle.h 2011-01-26 15:50:26 +0000 |
320 | +++ panel/app/unity2dstyle.h 1970-01-01 00:00:00 +0000 |
321 | @@ -1,44 +0,0 @@ |
322 | -/* |
323 | - * This file is part of unity-2d |
324 | - * |
325 | - * Copyright 2010 Canonical Ltd. |
326 | - * |
327 | - * Authors: |
328 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
329 | - * |
330 | - * This program is free software; you can redistribute it and/or modify |
331 | - * it under the terms of the GNU General Public License as published by |
332 | - * the Free Software Foundation; version 3. |
333 | - * |
334 | - * This program is distributed in the hope that it will be useful, |
335 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
336 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
337 | - * GNU General Public License for more details. |
338 | - * |
339 | - * You should have received a copy of the GNU General Public License |
340 | - * along with this program. If not, see <http://www.gnu.org/licenses/> |
341 | - */ |
342 | - |
343 | -#ifndef UNITY2DSTYLE_H |
344 | -#define UNITY2DSTYLE_H |
345 | - |
346 | -// Local |
347 | - |
348 | -// Qt |
349 | -#include <QProxyStyle> |
350 | - |
351 | -class Unity2dStyle : public QProxyStyle |
352 | -{ |
353 | -public: |
354 | - Unity2dStyle(); |
355 | - |
356 | - virtual void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = 0) const; |
357 | - |
358 | - virtual int pixelMetric(PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0) const; |
359 | - |
360 | - virtual QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget = 0) const; |
361 | - |
362 | - virtual int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const; |
363 | -}; |
364 | - |
365 | -#endif /* UNITY2DSTYLE_H */ |
366 | |
367 | === modified file 'panel/applets/CMakeLists.txt' |
368 | --- panel/applets/CMakeLists.txt 2011-07-25 14:59:39 +0000 |
369 | +++ panel/applets/CMakeLists.txt 2011-07-25 14:59:39 +0000 |
370 | @@ -14,11 +14,11 @@ |
371 | |
372 | pkg_check_modules(QTBAMF REQUIRED libqtbamf) |
373 | pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt) |
374 | -pkg_check_modules(INDICATOR REQUIRED indicator) |
375 | +pkg_check_modules(INDICATOR REQUIRED indicator3-0.4) |
376 | |
377 | # Get indicator dirs from pkgconfig |
378 | -read_pkg_variable(INDICATOR_DIR indicator indicatordir) |
379 | -read_pkg_variable(INDICATOR_ICONS_DIR indicator iconsdir) |
380 | +read_pkg_variable(INDICATOR_DIR indicator3 indicatordir) |
381 | +read_pkg_variable(INDICATOR_ICONS_DIR indicator3 iconsdir) |
382 | configure_file(indicator-config.h.in indicator-config.h) |
383 | |
384 | # Sources |
385 | @@ -32,10 +32,7 @@ |
386 | common/applet.cpp |
387 | homebutton/homebuttonapplet.cpp |
388 | homebutton/homebutton.cpp |
389 | - indicator/abstractindicator.cpp |
390 | - indicator/datetimeindicator.cpp |
391 | indicator/indicatorapplet.cpp |
392 | - indicator/indicatorservicemanager.cpp |
393 | indicator/indicator.c |
394 | legacytray/legacytrayapplet.cpp |
395 | legacytray/fdoselectionmanager.cpp |
396 | |
397 | === removed file 'panel/applets/indicator/abstractindicator.cpp' |
398 | --- panel/applets/indicator/abstractindicator.cpp 2011-01-15 01:41:03 +0000 |
399 | +++ panel/applets/indicator/abstractindicator.cpp 1970-01-01 00:00:00 +0000 |
400 | @@ -1,43 +0,0 @@ |
401 | -/* |
402 | - * This file is part of unity-2d |
403 | - * |
404 | - * Copyright 2010 Canonical Ltd. |
405 | - * |
406 | - * Authors: |
407 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
408 | - * |
409 | - * This program is free software; you can redistribute it and/or modify |
410 | - * it under the terms of the GNU General Public License as published by |
411 | - * the Free Software Foundation; version 3. |
412 | - * |
413 | - * This program is distributed in the hope that it will be useful, |
414 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
415 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
416 | - * GNU General Public License for more details. |
417 | - * |
418 | - * You should have received a copy of the GNU General Public License |
419 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
420 | - */ |
421 | - |
422 | -// Self |
423 | -#include "abstractindicator.h" |
424 | - |
425 | -// Local |
426 | - |
427 | -// Qt |
428 | -#include <QAction> |
429 | - |
430 | -AbstractIndicator::AbstractIndicator(QObject* parent) |
431 | -: QObject(parent) |
432 | -{ |
433 | -} |
434 | - |
435 | -AbstractIndicator::~AbstractIndicator() |
436 | -{ |
437 | -} |
438 | - |
439 | -void AbstractIndicator::init() |
440 | -{ |
441 | -} |
442 | - |
443 | -#include "abstractindicator.moc" |
444 | |
445 | === removed file 'panel/applets/indicator/abstractindicator.h' |
446 | --- panel/applets/indicator/abstractindicator.h 2011-01-15 01:41:03 +0000 |
447 | +++ panel/applets/indicator/abstractindicator.h 1970-01-01 00:00:00 +0000 |
448 | @@ -1,53 +0,0 @@ |
449 | -/* |
450 | - * This file is part of unity-2d |
451 | - * |
452 | - * Copyright 2010 Canonical Ltd. |
453 | - * |
454 | - * Authors: |
455 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
456 | - * |
457 | - * This program is free software; you can redistribute it and/or modify |
458 | - * it under the terms of the GNU General Public License as published by |
459 | - * the Free Software Foundation; version 3. |
460 | - * |
461 | - * This program is distributed in the hope that it will be useful, |
462 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
463 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
464 | - * GNU General Public License for more details. |
465 | - * |
466 | - * You should have received a copy of the GNU General Public License |
467 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
468 | - */ |
469 | - |
470 | -#ifndef ABSTRACTINDICATOR_H |
471 | -#define ABSTRACTINDICATOR_H |
472 | - |
473 | -// Local |
474 | - |
475 | -// Qt |
476 | -#include <QObject> |
477 | - |
478 | -class QAction; |
479 | - |
480 | -class AbstractIndicator : public QObject |
481 | -{ |
482 | - Q_OBJECT |
483 | -public: |
484 | - AbstractIndicator(QObject* parent=0); |
485 | - ~AbstractIndicator(); |
486 | - |
487 | - /** |
488 | - * Called when the indicator has been constructed and its owner is connected to signals. |
489 | - * It's the right place to emit actionAdded() |
490 | - */ |
491 | - virtual void init(); |
492 | - |
493 | -Q_SIGNALS: |
494 | - void actionAdded(QAction*); |
495 | - void actionRemoved(QAction*); |
496 | - |
497 | -private: |
498 | - Q_DISABLE_COPY(AbstractIndicator) |
499 | -}; |
500 | - |
501 | -#endif /* ABSTRACTINDICATOR_H */ |
502 | |
503 | === removed file 'panel/applets/indicator/datetimeindicator.cpp' |
504 | --- panel/applets/indicator/datetimeindicator.cpp 2011-02-10 01:10:19 +0000 |
505 | +++ panel/applets/indicator/datetimeindicator.cpp 1970-01-01 00:00:00 +0000 |
506 | @@ -1,94 +0,0 @@ |
507 | -/* |
508 | - * This file is part of unity-2d |
509 | - * |
510 | - * Copyright 2010 Canonical Ltd. |
511 | - * |
512 | - * Authors: |
513 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
514 | - * |
515 | - * This program is free software; you can redistribute it and/or modify |
516 | - * it under the terms of the GNU General Public License as published by |
517 | - * the Free Software Foundation; version 3. |
518 | - * |
519 | - * This program is distributed in the hope that it will be useful, |
520 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
521 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
522 | - * GNU General Public License for more details. |
523 | - * |
524 | - * You should have received a copy of the GNU General Public License |
525 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
526 | - */ |
527 | - |
528 | -// Self |
529 | -#include "datetimeindicator.h" |
530 | - |
531 | -// Local |
532 | -#include "indicatorservicemanager.h" |
533 | - |
534 | -// dbusmenu-qt |
535 | -#include "dbusmenuimporter.h" |
536 | - |
537 | -// Qt |
538 | -#include <QAction> |
539 | -#include <QDateTime> |
540 | - |
541 | -// From dbus-shared.h |
542 | -#define SERVICE_NAME "com.canonical.indicator.datetime" |
543 | -#define SERVICE_IFACE "com.canonical.indicator.datetime.service" |
544 | -#define SERVICE_OBJ "/com.canonical/indicator/datetime/service" |
545 | -#define SERVICE_VERSION 1 |
546 | - |
547 | -#define MENU_OBJ "/com.canonical/indicator/datetime/menu" |
548 | - |
549 | -#define DBUSMENU_CALENDAR_MENUITEM_TYPE "x-canonical-calendar-item" |
550 | -//// |
551 | - |
552 | -DateTimeIndicator::DateTimeIndicator(QObject* parent) |
553 | -: AbstractIndicator(parent) |
554 | -, m_action(new QAction(this)) |
555 | -, m_timer(new QTimer(this)) |
556 | -{ |
557 | - new IndicatorServiceManager(SERVICE_NAME, SERVICE_VERSION, this); |
558 | - |
559 | - readConfig(); |
560 | - setupMenu(); |
561 | - setupTimer(); |
562 | - updateText(); |
563 | -} |
564 | - |
565 | -void DateTimeIndicator::init() |
566 | -{ |
567 | - actionAdded(m_action); |
568 | -} |
569 | - |
570 | -void DateTimeIndicator::setupMenu() |
571 | -{ |
572 | - DBusMenuImporter* importer = new DBusMenuImporter(SERVICE_NAME, MENU_OBJ, this); |
573 | - m_action->setMenu(importer->menu()); |
574 | -} |
575 | - |
576 | -void DateTimeIndicator::setupTimer() |
577 | -{ |
578 | - m_timer->setSingleShot(false); |
579 | - connect(m_timer, SIGNAL(timeout()), SLOT(updateText())); |
580 | - updateTimer(); |
581 | - m_timer->start(); |
582 | -} |
583 | - |
584 | -void DateTimeIndicator::updateTimer() |
585 | -{ |
586 | - m_timer->setInterval(1000); |
587 | -} |
588 | - |
589 | -void DateTimeIndicator::updateText() |
590 | -{ |
591 | - QString text = QDateTime::currentDateTime().toString(m_format); |
592 | - m_action->setText(text); |
593 | -} |
594 | - |
595 | -void DateTimeIndicator::readConfig() |
596 | -{ |
597 | - m_format = "hh:mm:ss"; |
598 | -} |
599 | - |
600 | -#include "datetimeindicator.moc" |
601 | |
602 | === removed file 'panel/applets/indicator/datetimeindicator.h' |
603 | --- panel/applets/indicator/datetimeindicator.h 2011-01-15 01:41:03 +0000 |
604 | +++ panel/applets/indicator/datetimeindicator.h 1970-01-01 00:00:00 +0000 |
605 | @@ -1,53 +0,0 @@ |
606 | -/* |
607 | - * This file is part of unity-2d |
608 | - * |
609 | - * Copyright 2010 Canonical Ltd. |
610 | - * |
611 | - * Authors: |
612 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
613 | - * |
614 | - * This program is free software; you can redistribute it and/or modify |
615 | - * it under the terms of the GNU General Public License as published by |
616 | - * the Free Software Foundation; version 3. |
617 | - * |
618 | - * This program is distributed in the hope that it will be useful, |
619 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
620 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
621 | - * GNU General Public License for more details. |
622 | - * |
623 | - * You should have received a copy of the GNU General Public License |
624 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
625 | - */ |
626 | - |
627 | -#ifndef DATETIMEINDICATOR_H |
628 | -#define DATETIMEINDICATOR_H |
629 | - |
630 | -// Local |
631 | -#include "abstractindicator.h" |
632 | - |
633 | -// Qt |
634 | -#include <QTimer> |
635 | - |
636 | -class DateTimeIndicator : public AbstractIndicator |
637 | -{ |
638 | - Q_OBJECT |
639 | -public: |
640 | - DateTimeIndicator(QObject* parent=0); |
641 | - |
642 | - virtual void init(); |
643 | - |
644 | -private Q_SLOTS: |
645 | - void updateText(); |
646 | -private: |
647 | - Q_DISABLE_COPY(DateTimeIndicator) |
648 | - QAction* m_action; |
649 | - QTimer* m_timer; |
650 | - QString m_format; |
651 | - |
652 | - void setupTimer(); |
653 | - void setupMenu(); |
654 | - void readConfig(); |
655 | - void updateTimer(); |
656 | -}; |
657 | - |
658 | -#endif /* DATETIMEINDICATOR_H */ |
659 | |
660 | === modified file 'panel/applets/indicator/indicator.c' |
661 | --- panel/applets/indicator/indicator.c 2011-07-01 03:58:28 +0000 |
662 | +++ panel/applets/indicator/indicator.c 2011-07-25 14:59:39 +0000 |
663 | @@ -18,6 +18,7 @@ |
664 | #include <string.h> |
665 | |
666 | #include <gtk/gtk.h> |
667 | +#include <gtk/gtkx.h> |
668 | #include <libindicator/indicator-object.h> |
669 | |
670 | #include "indicator.h" |
671 | @@ -439,7 +440,7 @@ |
672 | |
673 | /* Build menu */ |
674 | indicator->menu = gtk_menu_bar_new(); |
675 | - GTK_WIDGET_SET_FLAGS (indicator->menu, GTK_WIDGET_FLAGS(indicator->menu) | GTK_CAN_FOCUS); |
676 | + gtk_widget_set_can_focus(GTK_WIDGET (indicator->menu), TRUE); |
677 | gtk_widget_set_name(GTK_WIDGET (indicator->menu), "indicator-applet-menubar"); |
678 | g_signal_connect(indicator->menu, "button-press-event", G_CALLBACK(on_menu_press), NULL); |
679 | //g_signal_connect_after(indicator->menu, "expose-event", G_CALLBACK(menu_on_expose), menu); |
680 | |
681 | === modified file 'panel/applets/indicator/indicatorapplet.cpp' |
682 | --- panel/applets/indicator/indicatorapplet.cpp 2011-06-22 14:49:34 +0000 |
683 | +++ panel/applets/indicator/indicatorapplet.cpp 2011-07-25 14:59:39 +0000 |
684 | @@ -23,26 +23,21 @@ |
685 | #include "indicatorapplet.h" |
686 | |
687 | // Local |
688 | -#include "abstractindicator.h" |
689 | -#include "datetimeindicator.h" |
690 | #include "debug_p.h" |
691 | #include "indicator.h" |
692 | |
693 | // Qt |
694 | -#include <QAction> |
695 | -#include <QDBusConnection> |
696 | #include <QHBoxLayout> |
697 | -#include <QMenu> |
698 | +#include <QTimer> |
699 | #include <QX11EmbedContainer> |
700 | |
701 | // Gtk |
702 | -#include <gdk/gdk.h> |
703 | #include <gtk/gtk.h> |
704 | +#include <gtk/gtkx.h> |
705 | |
706 | IndicatorApplet::IndicatorApplet() |
707 | { |
708 | setupUi(); |
709 | - loadIndicators(); |
710 | } |
711 | |
712 | void IndicatorApplet::setupUi() |
713 | @@ -58,10 +53,6 @@ |
714 | |
715 | void IndicatorApplet::createGtkIndicator() |
716 | { |
717 | - int* argc = 0; |
718 | - char*** argv = 0; |
719 | - gtk_init(argc, argv); |
720 | - |
721 | m_container = new QX11EmbedContainer; |
722 | layout()->addWidget(m_container); |
723 | |
724 | @@ -78,37 +69,9 @@ |
725 | |
726 | void IndicatorApplet::adjustGtkIndicatorSize() |
727 | { |
728 | - GtkRequisition requisition; |
729 | - gtk_widget_size_request(m_gtkIndicator->menu, &requisition); |
730 | - m_container->setFixedWidth(requisition.width); |
731 | -} |
732 | - |
733 | -void IndicatorApplet::loadIndicators() |
734 | -{ |
735 | -#if 0 |
736 | - // FIXME: Using Qt plugins |
737 | - QList<AbstractIndicator*> indicators = QList<AbstractIndicator*>() |
738 | - << new DateTimeIndicator(this) |
739 | - ; |
740 | - |
741 | - Q_FOREACH(AbstractIndicator* indicator, indicators) { |
742 | - connect(indicator, SIGNAL(actionAdded(QAction*)), SLOT(slotActionAdded(QAction*))); |
743 | - connect(indicator, SIGNAL(actionRemoved(QAction*)), SLOT(slotActionRemoved(QAction*))); |
744 | - indicator->init(); |
745 | - } |
746 | -#endif |
747 | -} |
748 | - |
749 | -void IndicatorApplet::slotActionAdded(QAction* action) |
750 | -{ |
751 | - UQ_VAR(action->text()); |
752 | - m_menuBar->addAction(action); |
753 | -} |
754 | - |
755 | -void IndicatorApplet::slotActionRemoved(QAction* action) |
756 | -{ |
757 | - m_menuBar->removeAction(action); |
758 | -} |
759 | - |
760 | + GtkRequisition minimum, natural; |
761 | + gtk_widget_get_preferred_size(m_gtkIndicator->menu, &minimum, &natural); |
762 | + m_container->setFixedWidth(minimum.width); |
763 | +} |
764 | |
765 | #include "indicatorapplet.moc" |
766 | |
767 | === modified file 'panel/applets/indicator/indicatorapplet.h' |
768 | --- panel/applets/indicator/indicatorapplet.h 2011-01-15 01:41:03 +0000 |
769 | +++ panel/applets/indicator/indicatorapplet.h 2011-07-25 14:59:39 +0000 |
770 | @@ -40,9 +40,6 @@ |
771 | IndicatorApplet(); |
772 | |
773 | private Q_SLOTS: |
774 | - void loadIndicators(); |
775 | - void slotActionAdded(QAction*); |
776 | - void slotActionRemoved(QAction*); |
777 | void createGtkIndicator(); |
778 | void adjustGtkIndicatorSize(); |
779 | |
780 | |
781 | === removed file 'panel/applets/indicator/indicatorservicemanager.cpp' |
782 | --- panel/applets/indicator/indicatorservicemanager.cpp 2011-02-10 01:10:19 +0000 |
783 | +++ panel/applets/indicator/indicatorservicemanager.cpp 1970-01-01 00:00:00 +0000 |
784 | @@ -1,120 +0,0 @@ |
785 | -/* |
786 | - * This file is part of unity-2d |
787 | - * |
788 | - * Copyright 2010 Canonical Ltd. |
789 | - * |
790 | - * Authors: |
791 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
792 | - * |
793 | - * This program is free software; you can redistribute it and/or modify |
794 | - * it under the terms of the GNU General Public License as published by |
795 | - * the Free Software Foundation; version 3. |
796 | - * |
797 | - * This program is distributed in the hope that it will be useful, |
798 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
799 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
800 | - * GNU General Public License for more details. |
801 | - * |
802 | - * You should have received a copy of the GNU General Public License |
803 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
804 | - */ |
805 | - |
806 | -// Self |
807 | -#include "indicatorservicemanager.h" |
808 | - |
809 | -// Local |
810 | -#include "debug_p.h" |
811 | - |
812 | -// Qt |
813 | -#include <QAction> |
814 | -#include <QDBusConnection> |
815 | -#include <QDBusConnectionInterface> |
816 | -#include <QDBusMessage> |
817 | -#include <QDBusServiceWatcher> |
818 | -#include <QDBusReply> |
819 | -#include <QDBusInterface> |
820 | - |
821 | -static const char* INDICATOR_SERVICE_INTERFACE = "com.canonical.indicator.service"; |
822 | -static const char* INDICATOR_SERVICE_OBJECT = "/com.canonical/indicator/service"; |
823 | -static const uint INDICATOR_SERVICE_VERSION = 1; |
824 | - |
825 | -IndicatorServiceManager::IndicatorServiceManager(const char* name, uint version, QObject* parent) |
826 | -: QObject(parent) |
827 | -, m_serviceName(name) |
828 | -, m_serviceVersion(version) |
829 | -{ |
830 | - QDBusServiceWatcher* serviceWatcher = new QDBusServiceWatcher(this); |
831 | - serviceWatcher->setConnection(QDBusConnection::sessionBus()); |
832 | - serviceWatcher->addWatchedService(m_serviceName); |
833 | - connect(serviceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), |
834 | - SLOT(slotServiceOwnerChanged(QString, QString, QString))); |
835 | - connectToService(); |
836 | -} |
837 | - |
838 | -IndicatorServiceManager::~IndicatorServiceManager() |
839 | -{ |
840 | - unwatchService(); |
841 | -} |
842 | - |
843 | -void IndicatorServiceManager::connectToService() |
844 | -{ |
845 | - QDBusConnectionInterface* iface = QDBusConnection::sessionBus().interface(); |
846 | - QDBusReply<bool> reply = iface->isServiceRegistered(m_serviceName); |
847 | - UQ_RETURN_IF_FAIL(reply.isValid()); |
848 | - |
849 | - if (reply.value()) { |
850 | - watchService(); |
851 | - } else { |
852 | - QDBusReply<void> reply = iface->startService(m_serviceName); |
853 | - if (!reply.isValid()) { |
854 | - UQ_WARNING << reply.error().message(); |
855 | - } |
856 | - } |
857 | -} |
858 | - |
859 | -void IndicatorServiceManager::watchService() |
860 | -{ |
861 | - QDBusInterface iface(m_serviceName, INDICATOR_SERVICE_OBJECT, INDICATOR_SERVICE_INTERFACE); |
862 | - QDBusPendingCall pending = iface.asyncCall("Watch"); |
863 | - QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(pending, this); |
864 | - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(slotWatchFinished(QDBusPendingCallWatcher*))); |
865 | -} |
866 | - |
867 | -void IndicatorServiceManager::slotWatchFinished(QDBusPendingCallWatcher* watcher) |
868 | -{ |
869 | - QDBusMessage message = watcher->reply(); |
870 | - delete watcher; |
871 | - UQ_RETURN_IF_FAIL(message.type() == QDBusMessage::ReplyMessage); |
872 | - QVariantList args = message.arguments(); |
873 | - UQ_RETURN_IF_FAIL(args.count() == 2); |
874 | - |
875 | - uint apiVersion = args.at(0).toUInt(); |
876 | - uint serviceVersion = args.at(1).toUInt(); |
877 | - |
878 | - if (apiVersion != INDICATOR_SERVICE_VERSION) { |
879 | - UQ_WARNING << "Expected api version=" << INDICATOR_SERVICE_VERSION << "got" << apiVersion << "instead"; |
880 | - unwatchService(); |
881 | - return; |
882 | - } |
883 | - if (serviceVersion != m_serviceVersion) { |
884 | - UQ_WARNING << "Expected service version=" << m_serviceVersion << "got" << serviceVersion << "instead"; |
885 | - unwatchService(); |
886 | - } |
887 | -} |
888 | - |
889 | -void IndicatorServiceManager::unwatchService() |
890 | -{ |
891 | - QDBusInterface iface(m_serviceName, INDICATOR_SERVICE_OBJECT, INDICATOR_SERVICE_INTERFACE); |
892 | - iface.asyncCall("Unwatch"); |
893 | -} |
894 | - |
895 | -void IndicatorServiceManager::slotServiceOwnerChanged(const QString& /*name*/, const QString& /*oldOwner*/, const QString& newOwner) |
896 | -{ |
897 | - if (newOwner.isNull()) { |
898 | - // FIXME: Respawn |
899 | - } else { |
900 | - watchService(); |
901 | - } |
902 | -} |
903 | - |
904 | -#include "indicatorservicemanager.moc" |
905 | |
906 | === removed file 'panel/applets/indicator/indicatorservicemanager.h' |
907 | --- panel/applets/indicator/indicatorservicemanager.h 2011-01-15 01:41:03 +0000 |
908 | +++ panel/applets/indicator/indicatorservicemanager.h 1970-01-01 00:00:00 +0000 |
909 | @@ -1,54 +0,0 @@ |
910 | -/* |
911 | - * This file is part of unity-2d |
912 | - * |
913 | - * Copyright 2010 Canonical Ltd. |
914 | - * |
915 | - * Authors: |
916 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
917 | - * |
918 | - * This program is free software; you can redistribute it and/or modify |
919 | - * it under the terms of the GNU General Public License as published by |
920 | - * the Free Software Foundation; version 3. |
921 | - * |
922 | - * This program is distributed in the hope that it will be useful, |
923 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
924 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
925 | - * GNU General Public License for more details. |
926 | - * |
927 | - * You should have received a copy of the GNU General Public License |
928 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
929 | - */ |
930 | - |
931 | -#ifndef INDICATORSERVICEMANAGER_H |
932 | -#define INDICATORSERVICEMANAGER_H |
933 | - |
934 | -// Local |
935 | - |
936 | -// Qt |
937 | -#include <QObject> |
938 | - |
939 | -class QAction; |
940 | -class QDBusPendingCallWatcher; |
941 | - |
942 | -class IndicatorServiceManager : public QObject |
943 | -{ |
944 | - Q_OBJECT |
945 | -public: |
946 | - IndicatorServiceManager(const char* name, uint version, QObject* parent=0); |
947 | - ~IndicatorServiceManager(); |
948 | - |
949 | -private Q_SLOTS: |
950 | - void slotServiceOwnerChanged(const QString& name, const QString& oldOwner, const QString& newOwner); |
951 | - void slotWatchFinished(QDBusPendingCallWatcher*); |
952 | - |
953 | -private: |
954 | - Q_DISABLE_COPY(IndicatorServiceManager) |
955 | - QString m_serviceName; |
956 | - uint m_serviceVersion; |
957 | - |
958 | - void connectToService(); |
959 | - void watchService(); |
960 | - void unwatchService(); |
961 | -}; |
962 | - |
963 | -#endif /* INDICATORSERVICEMANAGER_H */ |
This MR contains changes that are completely compatible with Natty. For example the changes in the following files (creation of earlySetup):
spread/ app/spread. cpp app/CMakeLists. txt app/places. cpp app/CMakeLists. txt app/launcher. cpp
spread/
places/
places/
launcher/
Please extract as much as possible as to minimize the delta.