Merge lp:~osomon/unity-2d/natty-panel-backport-oneiric-changes into lp:unity-2d/3.0

Proposed by Olivier Tilloy on 2011-09-06
Status: Merged
Approved by: Florian Boucault on 2011-09-14
Approved revision: 690
Merged at revision: 689
Proposed branch: lp:~osomon/unity-2d/natty-panel-backport-oneiric-changes
Merge into: lp:unity-2d/3.0
Diff against target: 476 lines (+77/-42)
30 files modified
libunity-2d-private/src/panelapplet.cpp (+21/-3)
libunity-2d-private/src/panelapplet.h (+9/-1)
libunity-2d-private/src/panelappletproviderinterface.h (+1/-1)
panel/app/panelmanager.cpp (+2/-2)
panel/app/panelmanager.h (+2/-0)
panel/applets/appindicator/appindicatorapplet.cpp (+2/-1)
panel/applets/appindicator/appindicatorapplet.h (+1/-1)
panel/applets/appindicator/plugin.cpp (+2/-2)
panel/applets/appindicator/plugin.h (+1/-1)
panel/applets/appname/appnameapplet.cpp (+3/-2)
panel/applets/appname/appnameapplet.h (+1/-1)
panel/applets/appname/plugin.cpp (+2/-2)
panel/applets/appname/plugin.h (+1/-1)
panel/applets/homebutton/homebuttonapplet.cpp (+3/-2)
panel/applets/homebutton/homebuttonapplet.h (+1/-1)
panel/applets/homebutton/plugin.cpp (+2/-2)
panel/applets/homebutton/plugin.h (+1/-1)
panel/applets/indicator/indicatorapplet.cpp (+2/-1)
panel/applets/indicator/indicatorapplet.h (+1/-1)
panel/applets/indicator/plugin.cpp (+2/-2)
panel/applets/indicator/plugin.h (+1/-1)
panel/applets/legacytray/legacytrayapplet.cpp (+3/-2)
panel/applets/legacytray/legacytrayapplet.h (+1/-1)
panel/applets/legacytray/plugin.cpp (+2/-2)
panel/applets/legacytray/plugin.h (+1/-1)
panel/applets/separator/plugin.cpp (+2/-2)
panel/applets/separator/plugin.h (+1/-1)
panel/applets/separator/separatorapplet.cpp (+3/-2)
panel/applets/separator/separatorapplet.h (+1/-1)
panel/tests/homebuttonapplettest.cpp (+2/-1)
To merge this branch: bzr merge lp:~osomon/unity-2d/natty-panel-backport-oneiric-changes
Reviewer Review Type Date Requested Status
unity-2d-team 2011-09-06 Pending
Review via email: mp+74223@code.launchpad.net

Commit message

[panel] Backport an interface change from the oneiric branch (4.0): pass the panel as a parameter to the constructors of the applets.

To post a comment you must log in.
Alberto Mardegan (mardy) wrote :

Thanks for this contribution!

The merge of code from the Oneiric branch is obviously fine.

About the ready() signal, while reviewing your code I started thinking about the emission of the signal from the panelManager; I was thinking of having it emitted by the panel subclass after loading the plugins (maybe with QMetaObject::invokeMethod() with a queued connection). And this led me to wonder, do we really need this signal at all? Why can't the plugins themselves call their lengthy methods with a queued connection?

Olivier Tilloy (osomon) wrote :

You are right, on second thought this ready() signal is probably not really useful, especially since its implementation is a tad clumsy.

Do we still want to merge the first revision of this branch (the backport from the oneiric branch)? Is there a way to have tarmac merge a selected revision only, or should I undo my last revision, or resubmit another merge request, or even merge it manually?

Florian Boucault (fboucault) wrote :

> You are right, on second thought this ready() signal is probably not really
> useful, especially since its implementation is a tad clumsy.
>
> Do we still want to merge the first revision of this branch (the backport from
> the oneiric branch)? Is there a way to have tarmac merge a selected revision
> only, or should I undo my last revision, or resubmit another merge request, or
> even merge it manually?

Just undoing your last revision is easiest.

690. By Olivier Tilloy on 2011-09-09

Undo the previous revision.
After discussion (see https://code.launchpad.net/~osomon/unity-2d/natty-panel-notify-loaded/+merge/74223), this has been identified as not necessary.

Olivier Tilloy (osomon) wrote :

I have reverted the last revision.
I have also updated the name of the branch and the commit message accordingly.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/panelapplet.cpp'
2--- libunity-2d-private/src/panelapplet.cpp 2011-08-17 09:21:18 +0000
3+++ libunity-2d-private/src/panelapplet.cpp 2011-09-09 06:56:54 +0000
4@@ -3,12 +3,30 @@
5 namespace Unity2d
6 {
7
8-PanelApplet::PanelApplet(QWidget* parent) :
9- QWidget(parent)
10-{
11+class PanelAppletPrivate
12+{
13+ Unity2dPanel* m_panel;
14+
15+ PanelApplet* q_ptr;
16+ Q_DECLARE_PUBLIC(PanelApplet)
17+};
18+
19+PanelApplet::PanelApplet(Unity2dPanel* panel) :
20+ QWidget(),
21+ d_ptr(new PanelAppletPrivate)
22+{
23+ Q_D(PanelApplet);
24+
25+ d->m_panel = panel;
26 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
27 }
28
29+Unity2dPanel* PanelApplet::panel() const
30+{
31+ Q_D(const PanelApplet);
32+ return d->m_panel;
33+}
34+
35 } // namespace Unity2d
36
37 #include "panelapplet.moc"
38
39=== modified file 'libunity-2d-private/src/panelapplet.h'
40--- libunity-2d-private/src/panelapplet.h 2011-08-16 12:58:45 +0000
41+++ libunity-2d-private/src/panelapplet.h 2011-09-09 06:56:54 +0000
42@@ -23,20 +23,28 @@
43 #ifndef PANELAPPLET_H
44 #define PANELAPPLET_H
45
46+// Local
47+class Unity2dPanel;
48+
49 // Qt
50 #include <QWidget>
51
52 namespace Unity2d
53 {
54
55+class PanelAppletPrivate;
56 class PanelApplet : public QWidget
57 {
58 Q_OBJECT
59 public:
60- explicit PanelApplet(QWidget* parent = 0);
61+ explicit PanelApplet(Unity2dPanel* panel);
62+
63+ Unity2dPanel* panel() const;
64
65 private:
66 Q_DISABLE_COPY(PanelApplet)
67+ PanelAppletPrivate* d_ptr;
68+ Q_DECLARE_PRIVATE(PanelApplet)
69 };
70
71 } // namespace Unity2d
72
73=== modified file 'libunity-2d-private/src/panelappletproviderinterface.h'
74--- libunity-2d-private/src/panelappletproviderinterface.h 2011-08-16 12:58:45 +0000
75+++ libunity-2d-private/src/panelappletproviderinterface.h 2011-09-09 06:56:54 +0000
76@@ -31,7 +31,7 @@
77 {
78 public:
79 virtual QString appletName() const = 0;
80- virtual PanelApplet* createApplet() const = 0;
81+ virtual PanelApplet* createApplet(Unity2dPanel* panel) const = 0;
82 };
83
84 } // namespace Unity2d
85
86=== modified file 'panel/app/panelmanager.cpp'
87--- panel/app/panelmanager.cpp 2011-08-19 10:42:32 +0000
88+++ panel/app/panelmanager.cpp 2011-09-09 06:56:54 +0000
89@@ -130,7 +130,7 @@
90 return appletsConfig.toStringList();
91 }
92
93-static Unity2dPanel* instantiatePanel(int screen)
94+Unity2dPanel* PanelManager::instantiatePanel(int screen)
95 {
96 Unity2dPanel* panel = new Unity2dPanel;
97 panel->setEdge(Unity2dPanel::TopEdge);
98@@ -156,7 +156,7 @@
99 << "installed plugin providing it.";
100 } else {
101 if (screen == leftmost || !onlyLeftmost) {
102- QWidget *applet = provider->createApplet();
103+ QWidget *applet = provider->createApplet(panel);
104 if (applet == 0) {
105 qWarning() << "The panel applet plugin for" << appletName
106 << "did not return a valid plugin.";
107
108=== modified file 'panel/app/panelmanager.h'
109--- panel/app/panelmanager.h 2011-04-04 16:41:15 +0000
110+++ panel/app/panelmanager.h 2011-09-09 06:56:54 +0000
111@@ -40,6 +40,8 @@
112 Q_DISABLE_COPY(PanelManager)
113 QList<Unity2dPanel*> m_panels;
114
115+ Unity2dPanel* instantiatePanel(int screen);
116+
117 private Q_SLOTS:
118 void onScreenCountChanged(int newCount);
119 };
120
121=== modified file 'panel/applets/appindicator/appindicatorapplet.cpp'
122--- panel/applets/appindicator/appindicatorapplet.cpp 2011-01-15 01:41:03 +0000
123+++ panel/applets/appindicator/appindicatorapplet.cpp 2011-09-09 06:56:54 +0000
124@@ -37,7 +37,8 @@
125 static const char* WATCHER_PATH = "/StatusNotifierWatcher";
126 static const char* WATCHER_IFACE = "org.kde.StatusNotifierWatcher";
127
128-AppIndicatorApplet::AppIndicatorApplet()
129+AppIndicatorApplet::AppIndicatorApplet(Unity2dPanel* panel)
130+: Unity2d::PanelApplet(panel)
131 {
132 setupDBus();
133 setupUi();
134
135=== modified file 'panel/applets/appindicator/appindicatorapplet.h'
136--- panel/applets/appindicator/appindicatorapplet.h 2011-08-16 12:58:45 +0000
137+++ panel/applets/appindicator/appindicatorapplet.h 2011-09-09 06:56:54 +0000
138@@ -33,7 +33,7 @@
139 {
140 Q_OBJECT
141 public:
142- AppIndicatorApplet();
143+ AppIndicatorApplet(Unity2dPanel* panel);
144
145 private:
146 Q_DISABLE_COPY(AppIndicatorApplet)
147
148=== modified file 'panel/applets/appindicator/plugin.cpp'
149--- panel/applets/appindicator/plugin.cpp 2011-08-16 10:44:38 +0000
150+++ panel/applets/appindicator/plugin.cpp 2011-09-09 06:56:54 +0000
151@@ -29,9 +29,9 @@
152 return QString("appindicator");
153 }
154
155-PanelApplet* AppIndicatorPlugin::createApplet() const
156+PanelApplet* AppIndicatorPlugin::createApplet(Unity2dPanel* panel) const
157 {
158- return new AppIndicatorApplet();
159+ return new AppIndicatorApplet(panel);
160 }
161
162 Q_EXPORT_PLUGIN2(panelplugin-appindicator, AppIndicatorPlugin)
163
164=== modified file 'panel/applets/appindicator/plugin.h'
165--- panel/applets/appindicator/plugin.h 2011-08-16 12:58:45 +0000
166+++ panel/applets/appindicator/plugin.h 2011-09-09 06:56:54 +0000
167@@ -34,7 +34,7 @@
168
169 public:
170 QString appletName() const;
171- PanelApplet* createApplet() const;
172+ PanelApplet* createApplet(Unity2dPanel* panel) const;
173 };
174
175 #endif // APPINDICATOR_PLUGIN_H
176
177=== modified file 'panel/applets/appname/appnameapplet.cpp'
178--- panel/applets/appname/appnameapplet.cpp 2011-08-17 09:21:18 +0000
179+++ panel/applets/appname/appnameapplet.cpp 2011-09-09 06:56:54 +0000
180@@ -212,8 +212,9 @@
181 }
182 };
183
184-AppNameApplet::AppNameApplet()
185-: d(new AppNameAppletPrivate)
186+AppNameApplet::AppNameApplet(Unity2dPanel* panel)
187+: Unity2d::PanelApplet(panel)
188+, d(new AppNameAppletPrivate)
189 {
190 d->q = this;
191 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
192
193=== modified file 'panel/applets/appname/appnameapplet.h'
194--- panel/applets/appname/appnameapplet.h 2011-08-16 12:58:45 +0000
195+++ panel/applets/appname/appnameapplet.h 2011-09-09 06:56:54 +0000
196@@ -33,7 +33,7 @@
197 {
198 Q_OBJECT
199 public:
200- AppNameApplet();
201+ AppNameApplet(Unity2dPanel* panel);
202 ~AppNameApplet();
203
204 protected:
205
206=== modified file 'panel/applets/appname/plugin.cpp'
207--- panel/applets/appname/plugin.cpp 2011-08-16 10:56:09 +0000
208+++ panel/applets/appname/plugin.cpp 2011-09-09 06:56:54 +0000
209@@ -29,9 +29,9 @@
210 return QString("appname");
211 }
212
213-PanelApplet* AppNamePlugin::createApplet() const
214+PanelApplet* AppNamePlugin::createApplet(Unity2dPanel* panel) const
215 {
216- return new AppNameApplet();
217+ return new AppNameApplet(panel);
218 }
219
220 Q_EXPORT_PLUGIN2(panelplugin-appname, AppNamePlugin)
221
222=== modified file 'panel/applets/appname/plugin.h'
223--- panel/applets/appname/plugin.h 2011-08-16 12:58:45 +0000
224+++ panel/applets/appname/plugin.h 2011-09-09 06:56:54 +0000
225@@ -34,7 +34,7 @@
226
227 public:
228 QString appletName() const;
229- PanelApplet* createApplet() const;
230+ PanelApplet* createApplet(Unity2dPanel* panel) const;
231 };
232
233 #endif // APPNAME_PLUGIN_H
234
235=== modified file 'panel/applets/homebutton/homebuttonapplet.cpp'
236--- panel/applets/homebutton/homebuttonapplet.cpp 2011-08-11 15:52:38 +0000
237+++ panel/applets/homebutton/homebuttonapplet.cpp 2011-09-09 06:56:54 +0000
238@@ -38,8 +38,9 @@
239 static const char* DBUS_PATH = "/Dash";
240 static const char* DBUS_IFACE = "com.canonical.Unity2d.Dash";
241
242-HomeButtonApplet::HomeButtonApplet()
243-: m_button(new HomeButton)
244+HomeButtonApplet::HomeButtonApplet(Unity2dPanel* panel)
245+: Unity2d::PanelApplet(panel)
246+, m_button(new HomeButton)
247 , m_dashInterface(NULL)
248 , m_launcherClient(new LauncherClient(this))
249 {
250
251=== modified file 'panel/applets/homebutton/homebuttonapplet.h'
252--- panel/applets/homebutton/homebuttonapplet.h 2011-08-16 12:58:45 +0000
253+++ panel/applets/homebutton/homebuttonapplet.h 2011-09-09 06:56:54 +0000
254@@ -35,7 +35,7 @@
255 {
256 Q_OBJECT
257 public:
258- HomeButtonApplet();
259+ HomeButtonApplet(Unity2dPanel* panel);
260
261 protected:
262 void enterEvent(QEvent*);
263
264=== modified file 'panel/applets/homebutton/plugin.cpp'
265--- panel/applets/homebutton/plugin.cpp 2011-08-16 10:44:38 +0000
266+++ panel/applets/homebutton/plugin.cpp 2011-09-09 06:56:54 +0000
267@@ -29,9 +29,9 @@
268 return QString("homebutton");
269 }
270
271-PanelApplet* HomeButtonPlugin::createApplet() const
272+PanelApplet* HomeButtonPlugin::createApplet(Unity2dPanel* panel) const
273 {
274- return new HomeButtonApplet();
275+ return new HomeButtonApplet(panel);
276 }
277
278 Q_EXPORT_PLUGIN2(panelplugin-homebutton, HomeButtonPlugin)
279
280=== modified file 'panel/applets/homebutton/plugin.h'
281--- panel/applets/homebutton/plugin.h 2011-08-16 12:58:45 +0000
282+++ panel/applets/homebutton/plugin.h 2011-09-09 06:56:54 +0000
283@@ -34,7 +34,7 @@
284
285 public:
286 QString appletName() const;
287- PanelApplet* createApplet() const;
288+ PanelApplet* createApplet(Unity2dPanel* panel) const;
289 };
290
291 #endif // HOMEBUTTON_PLUGIN_H
292
293=== modified file 'panel/applets/indicator/indicatorapplet.cpp'
294--- panel/applets/indicator/indicatorapplet.cpp 2011-06-22 14:49:34 +0000
295+++ panel/applets/indicator/indicatorapplet.cpp 2011-09-09 06:56:54 +0000
296@@ -39,7 +39,8 @@
297 #include <gdk/gdk.h>
298 #include <gtk/gtk.h>
299
300-IndicatorApplet::IndicatorApplet()
301+IndicatorApplet::IndicatorApplet(Unity2dPanel* panel)
302+: Unity2d::PanelApplet(panel)
303 {
304 setupUi();
305 loadIndicators();
306
307=== modified file 'panel/applets/indicator/indicatorapplet.h'
308--- panel/applets/indicator/indicatorapplet.h 2011-08-16 12:58:45 +0000
309+++ panel/applets/indicator/indicatorapplet.h 2011-09-09 06:56:54 +0000
310@@ -37,7 +37,7 @@
311 {
312 Q_OBJECT
313 public:
314- IndicatorApplet();
315+ IndicatorApplet(Unity2dPanel* panel);
316
317 private Q_SLOTS:
318 void loadIndicators();
319
320=== modified file 'panel/applets/indicator/plugin.cpp'
321--- panel/applets/indicator/plugin.cpp 2011-08-16 10:44:38 +0000
322+++ panel/applets/indicator/plugin.cpp 2011-09-09 06:56:54 +0000
323@@ -29,9 +29,9 @@
324 return QString("indicator");
325 }
326
327-PanelApplet* IndicatorPlugin::createApplet() const
328+PanelApplet* IndicatorPlugin::createApplet(Unity2dPanel* panel) const
329 {
330- return new IndicatorApplet();
331+ return new IndicatorApplet(panel);
332 }
333
334 Q_EXPORT_PLUGIN2(panelplugin-indicator, IndicatorPlugin)
335
336=== modified file 'panel/applets/indicator/plugin.h'
337--- panel/applets/indicator/plugin.h 2011-08-16 12:58:45 +0000
338+++ panel/applets/indicator/plugin.h 2011-09-09 06:56:54 +0000
339@@ -34,7 +34,7 @@
340
341 public:
342 QString appletName() const;
343- PanelApplet* createApplet() const;
344+ PanelApplet* createApplet(Unity2dPanel* panel) const;
345 };
346
347 #endif // INDICATOR_PLUGIN_H
348
349=== modified file 'panel/applets/legacytray/legacytrayapplet.cpp'
350--- panel/applets/legacytray/legacytrayapplet.cpp 2011-02-02 16:57:00 +0000
351+++ panel/applets/legacytray/legacytrayapplet.cpp 2011-09-09 06:56:54 +0000
352@@ -33,8 +33,9 @@
353 #include <QApplication>
354 #include <QHBoxLayout>
355
356-LegacyTrayApplet::LegacyTrayApplet()
357-: m_selectionManager(new SystemTray::FdoSelectionManager)
358+LegacyTrayApplet::LegacyTrayApplet(Unity2dPanel* panel)
359+: Unity2d::PanelApplet(panel)
360+, m_selectionManager(new SystemTray::FdoSelectionManager)
361 {
362 QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
363
364
365=== modified file 'panel/applets/legacytray/legacytrayapplet.h'
366--- panel/applets/legacytray/legacytrayapplet.h 2011-08-16 12:58:45 +0000
367+++ panel/applets/legacytray/legacytrayapplet.h 2011-09-09 06:56:54 +0000
368@@ -35,7 +35,7 @@
369 {
370 Q_OBJECT
371 public:
372- LegacyTrayApplet();
373+ LegacyTrayApplet(Unity2dPanel* panel);
374 virtual ~LegacyTrayApplet();
375
376 private Q_SLOTS:
377
378=== modified file 'panel/applets/legacytray/plugin.cpp'
379--- panel/applets/legacytray/plugin.cpp 2011-08-16 10:44:38 +0000
380+++ panel/applets/legacytray/plugin.cpp 2011-09-09 06:56:54 +0000
381@@ -29,9 +29,9 @@
382 return QString("legacytray");
383 }
384
385-PanelApplet* LegacyTrayPlugin::createApplet() const
386+PanelApplet* LegacyTrayPlugin::createApplet(Unity2dPanel* panel) const
387 {
388- return new LegacyTrayApplet();
389+ return new LegacyTrayApplet(panel);
390 }
391
392 Q_EXPORT_PLUGIN2(panelplugin-legacytray, LegacyTrayPlugin)
393
394=== modified file 'panel/applets/legacytray/plugin.h'
395--- panel/applets/legacytray/plugin.h 2011-08-16 12:58:45 +0000
396+++ panel/applets/legacytray/plugin.h 2011-09-09 06:56:54 +0000
397@@ -34,7 +34,7 @@
398
399 public:
400 QString appletName() const;
401- PanelApplet* createApplet() const;
402+ PanelApplet* createApplet(Unity2dPanel* panel) const;
403 };
404
405 #endif // LEGACYTRAY_PLUGIN_H
406
407=== modified file 'panel/applets/separator/plugin.cpp'
408--- panel/applets/separator/plugin.cpp 2011-08-16 10:44:38 +0000
409+++ panel/applets/separator/plugin.cpp 2011-09-09 06:56:54 +0000
410@@ -29,9 +29,9 @@
411 return QString("separator");
412 }
413
414-PanelApplet* SeparatorPlugin::createApplet() const
415+PanelApplet* SeparatorPlugin::createApplet(Unity2dPanel* panel) const
416 {
417- return new SeparatorApplet();
418+ return new SeparatorApplet(panel);
419 }
420
421 Q_EXPORT_PLUGIN2(panelplugin-separator, SeparatorPlugin)
422
423=== modified file 'panel/applets/separator/plugin.h'
424--- panel/applets/separator/plugin.h 2011-08-16 12:58:45 +0000
425+++ panel/applets/separator/plugin.h 2011-09-09 06:56:54 +0000
426@@ -34,7 +34,7 @@
427
428 public:
429 QString appletName() const;
430- PanelApplet* createApplet() const;
431+ PanelApplet* createApplet(Unity2dPanel* panel) const;
432 };
433
434 #endif // SEPARATOR_PLUGIN_H
435
436=== modified file 'panel/applets/separator/separatorapplet.cpp'
437--- panel/applets/separator/separatorapplet.cpp 2011-08-11 09:56:53 +0000
438+++ panel/applets/separator/separatorapplet.cpp 2011-09-09 06:56:54 +0000
439@@ -29,8 +29,9 @@
440 #include <QPixmap>
441 #include <QHBoxLayout>
442
443-SeparatorApplet::SeparatorApplet()
444- : m_separator(new QLabel())
445+SeparatorApplet::SeparatorApplet(Unity2dPanel* panel) :
446+ Unity2d::PanelApplet(panel),
447+ m_separator(new QLabel())
448 {
449 QPixmap pix(unity2dDirectory() + "/panel/artwork/divider.png");
450 m_separator->setPixmap(pix);
451
452=== modified file 'panel/applets/separator/separatorapplet.h'
453--- panel/applets/separator/separatorapplet.h 2011-08-16 12:58:45 +0000
454+++ panel/applets/separator/separatorapplet.h 2011-09-09 06:56:54 +0000
455@@ -34,7 +34,7 @@
456 {
457 Q_OBJECT
458 public:
459- SeparatorApplet();
460+ SeparatorApplet(Unity2dPanel* panel);
461
462 private:
463 Q_DISABLE_COPY(SeparatorApplet)
464
465=== modified file 'panel/tests/homebuttonapplettest.cpp'
466--- panel/tests/homebuttonapplettest.cpp 2011-08-11 15:52:38 +0000
467+++ panel/tests/homebuttonapplettest.cpp 2011-09-09 06:56:54 +0000
468@@ -32,7 +32,8 @@
469 private Q_SLOTS:
470 void testCreateButton()
471 {
472- HomeButtonApplet applet;
473+ Unity2dPanel* panel = 0;
474+ HomeButtonApplet applet(panel);
475 }
476 };
477

Subscribers

People subscribed via source and target branches