Merge lp:~aacid/unity-2d/unity-2d-shell_no_dbus_to_ourselves into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Albert Astals Cid on 2012-01-19
Status: Merged
Approved by: Michał Sawicz on 2012-01-24
Approved revision: 923
Merged at revision: 927
Proposed branch: lp:~aacid/unity-2d/unity-2d-shell_no_dbus_to_ourselves
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell
Diff against target: 179 lines (+50/-22)
4 files modified
libunity-2d-private/src/bfb.cpp (+39/-14)
libunity-2d-private/src/bfb.h (+9/-1)
shell/app/shelldeclarativeview.cpp (+1/-7)
shell/launcher/Launcher.qml (+1/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d-shell_no_dbus_to_ourselves
Reviewer Review Type Date Requested Status
Michał Sawicz 2012-01-19 Needs Fixing on 2012-01-23
Ugo Riboni 2012-01-23 Pending
Review via email: mp+89247@code.launchpad.net

Description of the Change

[shell] Do not use dbus calls when we can just use in-process calls

To post a comment you must log in.
Michał Sawicz (saviq) wrote :

Do we really have to go through C++ for the BFB? Couldn't we do everything on the QML side of things?

review: Needs Information
922. By Albert Astals Cid on 2012-01-23

merge

Albert Astals Cid (aacid) wrote :

Without changing quite a lot of code, yes, in the current implementation BfbItem is a LauncherItem that means BfbItem needs the implementation in C++ of the activate() function since it is pure virtual in LauncherItem

923. By Albert Astals Cid on 2012-01-23

merge

Michał Sawicz (saviq) wrote :

We need tests to ensure no regression, please add tests for any interactions that were touched.

review: Needs Fixing
Albert Astals Cid (aacid) wrote :

Added check for both clicking the bfb (BfbItem::activate) and for pressing Alt+F2 (ShellDeclarativeView::showCommandsLens) in https://code.launchpad.net/~aacid/unity-2d/unity-2d_test_alt_f2_pops_dash/+merge/89873

You'll need to adapt the test a bit since they are against unity-2d and not unity-2d-shell

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/bfb.cpp'
2--- libunity-2d-private/src/bfb.cpp 2011-12-09 13:46:10 +0000
3+++ libunity-2d-private/src/bfb.cpp 2012-01-23 15:11:23 +0000
4@@ -21,17 +21,14 @@
5 #include "bfb.h"
6
7 // libunity-2d
8-#include <dashclient.h>
9 #include <debug_p.h>
10 #include <unity2dtr.h>
11
12 // Qt
13
14 BfbItem::BfbItem()
15-: m_active(false)
16+: m_active(false), m_view(NULL)
17 {
18- connect(DashClient::instance(), SIGNAL(activePageChanged(const QString&)),
19- SLOT(slotActivePageChanged(const QString&)));
20 }
21
22 BfbItem::~BfbItem()
23@@ -43,15 +40,6 @@
24 return m_active;
25 }
26
27-void BfbItem::slotActivePageChanged(const QString& page)
28-{
29- bool active = !page.isEmpty();
30- if (m_active != active) {
31- m_active = active;
32- activeChanged(m_active);
33- }
34-}
35-
36 bool BfbItem::running() const
37 {
38 return false;
39@@ -82,15 +70,42 @@
40 return false;
41 }
42
43+QObject* BfbItem::dashView() const
44+{
45+ return m_view;
46+}
47+
48+void BfbItem::setDashView(QObject* view)
49+{
50+ if (m_view != NULL) {
51+ disconnect(view);
52+ }
53+ m_view = view;
54+ if (m_view != NULL) {
55+ connect(view, SIGNAL(dashActiveChanged(bool)), this, SLOT(slotDashActiveChanged(bool)));
56+ }
57+}
58+
59 void BfbItem::activate()
60 {
61- DashClient::instance()->setActivePage(m_active ? "" : "home");
62+ Q_ASSERT(m_view != NULL);
63+ if (m_view != NULL) {
64+ QMetaObject::invokeMethod(m_view, "toggleDash");
65+ }
66 }
67
68 void BfbItem::createMenuActions()
69 {
70 }
71
72+void BfbItem::slotDashActiveChanged(bool active)
73+{
74+ if (m_active != active) {
75+ m_active = active;
76+ Q_EMIT activeChanged(m_active);
77+ }
78+}
79+
80 ////////////////////////////////////////////////////////////
81 BfbModel::BfbModel(QObject* parent)
82 : QAbstractListModel(parent)
83@@ -117,4 +132,14 @@
84 return QVariant::fromValue(m_bfbItem);
85 }
86
87+QObject* BfbModel::dashView() const
88+{
89+ return m_bfbItem->dashView();
90+}
91+
92+void BfbModel::setDashView(QObject* view)
93+{
94+ m_bfbItem->setDashView(view);
95+}
96+
97 #include <bfb.moc>
98
99=== modified file 'libunity-2d-private/src/bfb.h'
100--- libunity-2d-private/src/bfb.h 2011-08-11 09:25:35 +0000
101+++ libunity-2d-private/src/bfb.h 2012-01-23 15:11:23 +0000
102@@ -42,16 +42,20 @@
103 virtual QString icon() const;
104 virtual bool launching() const;
105
106+ QObject* dashView() const;
107+ void setDashView(QObject* view);
108+
109 /* methods */
110 Q_INVOKABLE virtual void activate();
111 Q_INVOKABLE virtual void createMenuActions();
112
113 private Q_SLOTS:
114- void slotActivePageChanged(const QString&);
115+ void slotDashActiveChanged(bool active);
116
117 private:
118 Q_DISABLE_COPY(BfbItem)
119 bool m_active;
120+ QObject* m_view;
121 };
122
123 Q_DECLARE_METATYPE(BfbItem*)
124@@ -60,6 +64,7 @@
125 class BfbModel : public QAbstractListModel
126 {
127 Q_OBJECT
128+ Q_PROPERTY(QObject* dashView READ dashView WRITE setDashView)
129 public:
130 BfbModel(QObject* parent = 0);
131 ~BfbModel();
132@@ -67,6 +72,9 @@
133 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
134 int rowCount(const QModelIndex& parent = QModelIndex()) const;
135
136+ QObject* dashView() const;
137+ void setDashView(QObject* view);
138+
139 private:
140 Q_DISABLE_COPY(BfbModel)
141 BfbItem* m_bfbItem;
142
143=== modified file 'shell/app/shelldeclarativeview.cpp'
144--- shell/app/shelldeclarativeview.cpp 2012-01-19 14:40:22 +0000
145+++ shell/app/shelldeclarativeview.cpp 2012-01-23 15:11:23 +0000
146@@ -47,10 +47,6 @@
147
148 static const int KEY_HOLD_THRESHOLD = 250;
149
150-static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash";
151-static const char* DASH_DBUS_PATH = "/Dash";
152-static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash";
153-
154 static const char* SPREAD_DBUS_SERVICE = "com.canonical.Unity2d.Spread";
155 static const char* SPREAD_DBUS_PATH = "/Spread";
156 static const char* SPREAD_DBUS_INTERFACE = "com.canonical.Unity2d.Spread";
157@@ -266,9 +262,7 @@
158 void
159 ShellDeclarativeView::showCommandsLens()
160 {
161- // TODO: do this directly, instead of over dbus
162- QDBusInterface dashInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
163- dashInterface.asyncCall("activateLens", COMMANDS_LENS_ID);
164+ Q_EMIT activateLens(COMMANDS_LENS_ID);
165 }
166
167 void
168
169=== modified file 'shell/launcher/Launcher.qml'
170--- shell/launcher/Launcher.qml 2012-01-17 11:25:08 +0000
171+++ shell/launcher/Launcher.qml 2012-01-23 15:11:23 +0000
172@@ -181,6 +181,7 @@
173
174 BfbModel {
175 id: bfbModel
176+ dashView: declarativeView
177 }
178
179 LauncherApplicationsList {

Subscribers

People subscribed via source and target branches