Merge lp:~fboucault/unity-2d/dconf_migration_super_key into lp:unity-2d/3.0

Proposed by Florian Boucault
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: 634
Merged at revision: 634
Proposed branch: lp:~fboucault/unity-2d/dconf_migration_super_key
Merge into: lp:unity-2d/3.0
Diff against target: 304 lines (+78/-20)
13 files modified
.bzrignore (+1/-0)
CMakeLists.txt (+26/-0)
data/com.canonical.Unity2d.gschema.xml (+9/-0)
data/unity-2d.convert (+2/-0)
debian/20_unity-2d-gconf-default (+0/-1)
debian/changelog (+10/-1)
debian/control (+1/-0)
debian/gconf/schemas/unity-2d.schemas (+0/-12)
debian/unity-2d.install (+2/-0)
launcher/app/CMakeLists.txt (+3/-0)
launcher/app/launcherview.cpp (+12/-3)
launcher/app/launcherview.h (+4/-3)
libunity-2d-private/src/unity2dapplication.cpp (+8/-0)
To merge this branch: bzr merge lp:~fboucault/unity-2d/dconf_migration_super_key
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+67971@code.launchpad.net

Description of the change

[launcher] Migrated GConf key /desktop/unity-2d/launcher/super_key_enable to dconf

Added a GSettings schemas file and a GConf-to-GSettings conversion file.

Packaging changes:
* debian/unity-2d.install:
  - install GSettings schemas into usr/share/glib-2.0/schemas
  - install GConf to GSettings conversion into usr/share/GConf/gsettings
* debian/gconf/schemas/unity-2d.schemas:
  - remove GConf schema for /desktop/unity-2d/launcher/super_key_enable
* debian/control:
  - add dependency on libdconf-qt-dev

To post a comment you must log in.
632. By Florian Boucault

* debian/20_unity-2d-gconf-default:
  - remove default value for /desktop/unity-2d/launcher/super_key_enable

633. By Florian Boucault

Merged lp:unity-2d

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

compile and works well.

However, we try now to enforce sane dconf values, and not only for desrt ;)
so, can you please use as a gsettings path some /com/canonical/ one? instead of /desktop/unity-2d (it should match the id com.canonical.* for non relocatable schemas)

Maybe a stupid question, but shouldn't updateSuperKeyMonitoring() SLOT take the bool parameter rather than asking dconf again about which value for this property?

Apart from that, all looks good, it works and changing the value in dconf-editor has indeed some effect. Nice work :)

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

> compile and works well.
>
> However, we try now to enforce sane dconf values, and not only for desrt ;)
> so, can you please use as a gsettings path some /com/canonical/ one? instead
> of /desktop/unity-2d (it should match the id com.canonical.* for non
> relocatable schemas)
>

I was not sure so I followed what Unity was doing. Should I definitely do what you suggest?

>
> Maybe a stupid question, but shouldn't updateSuperKeyMonitoring() SLOT take
> the bool parameter rather than asking dconf again about which value for this
> property?
>

Not a stupid question. I wanted the change to be minimal and strictly about migrating to dconf so I kept it as is.

> Apart from that, all looks good, it works and changing the value in dconf-
> editor has indeed some effect. Nice work :)

Thanks for the testing!

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

> > compile and works well.
> >
> > However, we try now to enforce sane dconf values, and not only for desrt ;)
> > so, can you please use as a gsettings path some /com/canonical/ one? instead
> > of /desktop/unity-2d (it should match the id com.canonical.* for non
> > relocatable schemas)
> >
>
> I was not sure so I followed what Unity was doing. Should I definitely do what
> you suggest?
Yeah, Unity will change that in the coming release

>
> >
> > Maybe a stupid question, but shouldn't updateSuperKeyMonitoring() SLOT take
> > the bool parameter rather than asking dconf again about which value for this
> > property?
> >
>
> Not a stupid question. I wanted the change to be minimal and strictly about
> migrating to dconf so I kept it as is.

Ok, nice enhancement target for the future then?
>
> > Apart from that, all looks good, it works and changing the value in dconf-
> > editor has indeed some effect. Nice work :)
>
> Thanks for the testing!

So, approved with once the change #1 is done :)

review: Approve
Revision history for this message
Florian Boucault (fboucault) wrote :

> > > compile and works well.
> > >
> > > However, we try now to enforce sane dconf values, and not only for desrt
> ;)
> > > so, can you please use as a gsettings path some /com/canonical/ one?
> instead
> > > of /desktop/unity-2d (it should match the id com.canonical.* for non
> > > relocatable schemas)
> > >
> >
> > I was not sure so I followed what Unity was doing. Should I definitely do
> what
> > you suggest?
> Yeah, Unity will change that in the coming release
>

Done.

> >
> > >
> > > Maybe a stupid question, but shouldn't updateSuperKeyMonitoring() SLOT
> take
> > > the bool parameter rather than asking dconf again about which value for
> this
> > > property?
> > >
> >
> > Not a stupid question. I wanted the change to be minimal and strictly about
> > migrating to dconf so I kept it as is.
>
> Ok, nice enhancement target for the future then?

Yes

> >
> > > Apart from that, all looks good, it works and changing the value in dconf-
> > > editor has indeed some effect. Nice work :)
> >
> > Thanks for the testing!
>
> So, approved with once the change #1 is done :)

634. By Florian Boucault

Changed schema path to match com.canonical.*

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-06-15 14:39:35 +0000
3+++ .bzrignore 2011-07-22 16:53:25 +0000
4@@ -78,3 +78,4 @@
5 debian/unity-qt-spread
6 debian/libuqpanel-dev
7 debian/libuqpanel0
8+data/gschemas.compiled
9
10=== modified file 'CMakeLists.txt'
11--- CMakeLists.txt 2011-06-27 13:40:51 +0000
12+++ CMakeLists.txt 2011-07-22 16:53:25 +0000
13@@ -4,6 +4,7 @@
14 # Dirs
15 set(UNITY_2D_DIR share/unity-2d)
16 set(UNITY_DIR /usr/share/unity/)
17+set(UNITY_2D_DATA_DIR "${CMAKE_SOURCE_DIR}/data")
18
19 configure_file(config.h.in config.h)
20
21@@ -24,6 +25,31 @@
22 find_package(X11 REQUIRED)
23 find_package(Gettext REQUIRED)
24
25+
26+# GSettings schemas
27+pkg_check_modules(GLIB REQUIRED glib-2.0)
28+set (UNITY_2D_SCHEMAS "com.canonical.Unity2d.gschema.xml")
29+set (UNITY_2D_GCONF_CONVERT "unity-2d.convert")
30+set (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
31+set (GCONF_CONVERT_DIR "${CMAKE_INSTALL_PREFIX}/share/GConf/gsettings")
32+execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE GLIB_COMPILE_SCHEMAS OUTPUT_STRIP_TRAILING_WHITESPACE)
33+
34+# Run the schemas validator and error if it fails
35+execute_process (COMMAND ${GLIB_COMPILE_SCHEMAS} ${UNITY_2D_DATA_DIR} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
36+
37+if (_schemas_invalid)
38+ message (SEND_ERROR "Schemas validation error: ${_schemas_invalid}")
39+endif (_schemas_invalid)
40+
41+# Actually install and recompile the schemas
42+message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
43+install (FILES ${UNITY_2D_DATA_DIR}/${UNITY_2D_SCHEMAS} DESTINATION ${GSETTINGS_DIR})
44+install (CODE "message (STATUS \"Compiling GSettings schemas\")")
45+install (CODE "execute_process (COMMAND ${GLIB_COMPILE_SCHEMAS} ${GSETTINGS_DIR})")
46+
47+# Install GConf to GSettings conversion file
48+install (FILES ${UNITY_2D_DATA_DIR}/${UNITY_2D_GCONF_CONVERT} DESTINATION ${GCONF_CONVERT_DIR})
49+
50 include_directories(
51 ${CMAKE_BINARY_DIR}
52 ${QT_INCLUDE_DIR}
53
54=== added directory 'data'
55=== added file 'data/com.canonical.Unity2d.gschema.xml'
56--- data/com.canonical.Unity2d.gschema.xml 1970-01-01 00:00:00 +0000
57+++ data/com.canonical.Unity2d.gschema.xml 2011-07-22 16:53:25 +0000
58@@ -0,0 +1,9 @@
59+<schemalist>
60+ <schema path="/com/canonical/unity-2d/launcher/" id="com.canonical.Unity2d.Launcher" gettext-domain="unity-2d">
61+ <key type="b" name="super-key-enable">
62+ <default>true</default>
63+ <summary>Super key activation.</summary>
64+ <description>Whether or not the super (also called windows key) key is used.</description>
65+ </key>
66+ </schema>
67+</schemalist>
68
69=== added file 'data/unity-2d.convert'
70--- data/unity-2d.convert 1970-01-01 00:00:00 +0000
71+++ data/unity-2d.convert 2011-07-22 16:53:25 +0000
72@@ -0,0 +1,2 @@
73+[com.canonical.Unity2d.Launcher]
74+super-key-enable = /desktop/unity-2d/launcher/super_key_enable
75
76=== modified file 'debian/20_unity-2d-gconf-default'
77--- debian/20_unity-2d-gconf-default 2011-06-15 13:05:38 +0000
78+++ debian/20_unity-2d-gconf-default 2011-07-22 16:53:25 +0000
79@@ -3,7 +3,6 @@
80 /desktop/unity-2d/launcher/favorites [ubiquity-gtkui.desktop,nautilus-home.desktop,firefox.desktop,libreoffice-writer.desktop,libreoffice-calc.desktop,libreoffice-impress.desktop,ubuntu-software-center.desktop,ubuntuone-control-panel-gtk.desktop]
81 /desktop/unity-2d/launcher/hide_mode 2
82 /desktop/unity-2d/launcher/use_strut false
83-/desktop/unity-2d/launcher/super_key_enable true
84 /desktop/gnome/applications/window_manager/default /usr/bin/metacity
85 /desktop/gnome/applications/window_manager/current /usr/bin/metacity
86 /apps/metacity/general/show_maximized_titlebars false
87
88=== modified file 'debian/changelog'
89--- debian/changelog 2011-07-19 07:02:13 +0000
90+++ debian/changelog 2011-07-22 16:53:25 +0000
91@@ -4,13 +4,22 @@
92 * do not run pkgbinarymangler to convert images to 8bit since this breaks
93 the launcher icon background handling. (LP: #809205)
94 (QT upstream bug: http://bugreports.qt.nokia.com/browse/QTBUG-4459)
95+ * debian/unity-2d.install:
96+ - install GSettings schemas into usr/share/glib-2.0/schemas
97+ - install GConf to GSettings conversion into usr/share/GConf/gsettings
98+ * debian/gconf/schemas/unity-2d.schemas:
99+ - remove GConf schema for /desktop/unity-2d/launcher/super_key_enable
100+ * debian/20_unity-2d-gconf-default:
101+ - remove default value for /desktop/unity-2d/launcher/super_key_enable
102+ * debian/control:
103+ - add dependency on libdconf-qt-dev
104
105 [ Didier Roche ]
106 * Fix typo in trigger (debian/unity-2d.triggers): (LP: #807358)
107 * Install the apport hook in the right directory so that it's not launched
108 unconditionally (LP: #712343)
109
110- -- Didier Roche <didrocks@ubuntu.com> Mon, 18 Jul 2011 11:02:17 +0200
111+ -- Florian Boucault <florian.boucault@canonical.com> Fri, 22 Jul 2011 16:44:37 +0200
112
113 unity-2d (3.8.10-0ubuntu1) natty; urgency=low
114
115
116=== modified file 'debian/control'
117--- debian/control 2011-06-22 21:17:49 +0000
118+++ debian/control 2011-07-22 16:53:25 +0000
119@@ -12,6 +12,7 @@
120 libglib2.0-dev,
121 libwnck-dev,
122 libqtgconf-dev,
123+ libdconf-qt-dev,
124 libqtbamf-dev,
125 libqtdee-dev,
126 libdbusmenu-qt-dev,
127
128=== modified file 'debian/gconf/schemas/unity-2d.schemas'
129--- debian/gconf/schemas/unity-2d.schemas 2011-06-15 13:10:14 +0000
130+++ debian/gconf/schemas/unity-2d.schemas 2011-07-22 16:53:25 +0000
131@@ -39,18 +39,6 @@
132 <long>Use EWMH standard to reserve an area of the desktop (struts) so that no window can use the launcher's area</long>
133 </locale>
134 </schema>
135-
136- <schema>
137- <key>/schemas/desktop/unity-2d/launcher/super_key_enable</key>
138- <applyto>/desktop/unity-2d/launcher/super_key_enable</applyto>
139- <owner>unity-2d</owner>
140- <type>bool</type>
141- <default>true</default>
142- <locale name="C">
143- <short>Super key activation</short>
144- <long>Whether or not the super (also called windows key) key is used</long>
145- </locale>
146- </schema>
147 </schemalist>
148 </gconfschemafile>
149
150
151=== modified file 'debian/unity-2d.install'
152--- debian/unity-2d.install 2011-07-19 07:02:13 +0000
153+++ debian/unity-2d.install 2011-07-22 16:53:25 +0000
154@@ -5,3 +5,5 @@
155 debian/20_unity-2d-gconf-mandatory /usr/share/gconf/unity-2d/mandatory
156 debian/20_unity-2d-gconf-default /usr/share/gconf/unity-2d/default
157 usr/share/locale/*/LC_MESSAGES/unity-2d.mo
158+usr/share/glib-2.0/schemas/com.canonical.Unity2d.gschema.xml
159+usr/share/GConf/gsettings
160
161=== modified file 'launcher/app/CMakeLists.txt'
162--- launcher/app/CMakeLists.txt 2011-06-11 11:33:52 +0000
163+++ launcher/app/CMakeLists.txt 2011-07-22 16:53:25 +0000
164@@ -3,6 +3,7 @@
165 pkg_check_modules(X11 REQUIRED x11)
166 pkg_check_modules(GEIS REQUIRED libutouch-geis)
167 pkg_check_modules(QTGCONF REQUIRED libqtgconf)
168+pkg_check_modules(DCONFQT REQUIRED dconf-qt)
169
170 # Sources
171 set(launcher_SRCS
172@@ -38,6 +39,7 @@
173 ${X11_INCLUDE_DIRS}
174 ${GEIS_INCLUDE_DIRS}
175 ${QTGCONF_INCLUDE_DIRS}
176+ ${DCONFQT_INCLUDE_DIRS}
177 ${libunity-2d-private_SOURCE_DIR}/src
178 )
179
180@@ -50,6 +52,7 @@
181 ${X11_LDFLAGS}
182 ${GEIS_LDFLAGS}
183 ${QTGCONF_LDFLAGS}
184+ ${DCONFQT_LDFLAGS}
185 unity-2d-private
186 )
187
188
189=== modified file 'launcher/app/launcherview.cpp'
190--- launcher/app/launcherview.cpp 2011-06-22 08:54:52 +0000
191+++ launcher/app/launcherview.cpp 2011-07-22 16:53:25 +0000
192@@ -36,6 +36,9 @@
193 #include <X11/Xlib.h>
194 #include <X11/Xatom.h>
195
196+// libdconf-qt
197+#include "qconf.h"
198+
199 #include <keyboardmodifiersmonitor.h>
200 #include <hotkey.h>
201 #include <hotkeymonitor.h>
202@@ -55,6 +58,7 @@
203 static const char* SPREAD_DBUS_METHOD_IS_SHOWN = "IsShown";
204 static const char* APPLICATIONS_PLACE = "/usr/share/unity/places/applications.place";
205 static const char* COMMANDS_PLACE_ENTRY = "Runner";
206+static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher";
207
208 LauncherView::LauncherView(QWidget* parent) :
209 Unity2DDeclarativeView(parent),
210@@ -67,8 +71,8 @@
211 connect(&m_superKeyHoldTimer, SIGNAL(timeout()), SLOT(updateSuperKeyHoldState()));
212 connect(this, SIGNAL(superKeyTapped()), SLOT(toggleDash()));
213
214- m_enableSuperKey.setKey("/desktop/unity-2d/launcher/super_key_enable");
215- connect(&m_enableSuperKey, SIGNAL(valueChanged()), SLOT(updateSuperKeyMonitoring()));
216+ m_dconf_launcher = new QConf(LAUNCHER_DCONF_SCHEMA);
217+ connect(m_dconf_launcher, SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring()));
218 updateSuperKeyMonitoring();
219
220 /* Alt+F1 gives the keyboard focus to the launcher. */
221@@ -86,6 +90,11 @@
222 }
223 }
224
225+LauncherView::~LauncherView()
226+{
227+ delete m_dconf_launcher;
228+}
229+
230 void
231 LauncherView::activateWindow()
232 {
233@@ -111,7 +120,7 @@
234 {
235 KeyboardModifiersMonitor *modifiersMonitor = KeyboardModifiersMonitor::instance();
236
237- QVariant value = m_enableSuperKey.getValue();
238+ QVariant value = m_dconf_launcher->property("superKeyEnable");
239 if (!value.isValid() || value.toBool() == true) {
240 QObject::connect(modifiersMonitor,
241 SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)),
242
243=== modified file 'launcher/app/launcherview.h'
244--- launcher/app/launcherview.h 2011-06-22 08:54:52 +0000
245+++ launcher/app/launcherview.h 2011-07-22 16:53:25 +0000
246@@ -24,13 +24,13 @@
247 #include <QList>
248 #include <QUrl>
249 #include <QTimer>
250-
251-#include "gconfitem-qml-wrapper.h"
252+#include <QVariant>
253
254 #include <unity2ddeclarativeview.h>
255
256 class DeclarativeDragDropEvent;
257 class LauncherDBus;
258+class QConf;
259
260 class LauncherView : public Unity2DDeclarativeView
261 {
262@@ -40,6 +40,7 @@
263
264 public:
265 explicit LauncherView(QWidget* parent = NULL);
266+ ~LauncherView();
267
268 bool superKeyHeld() const { return m_superKeyHeld; }
269
270@@ -66,7 +67,7 @@
271 void focusOutEvent(QFocusEvent* event);
272
273 private:
274- GConfItemQmlWrapper m_enableSuperKey;
275+ QConf* m_dconf_launcher;
276 bool m_superKeyPressed;
277 bool m_superKeyHeld;
278 QTimer m_superKeyHoldTimer;
279
280=== modified file 'libunity-2d-private/src/unity2dapplication.cpp'
281--- libunity-2d-private/src/unity2dapplication.cpp 2011-06-11 10:50:03 +0000
282+++ libunity-2d-private/src/unity2dapplication.cpp 2011-07-22 16:53:25 +0000
283@@ -21,6 +21,7 @@
284
285 // Self
286 #include "unity2dapplication.h"
287+#include "config.h"
288
289 // Qt
290
291@@ -35,6 +36,13 @@
292 Unity2dApplication::Unity2dApplication(int& argc, char** argv)
293 : QApplication(argc, argv)
294 {
295+ /* Allow developers to run Unity 2D uninstalled by telling dconf-qt
296+ where to look for Unity 2D's schemas.
297+ It relies on the fact that the schema is compiled when running cmake.
298+ */
299+ if (!isRunningInstalled()) {
300+ qputenv("GSETTINGS_SCHEMA_DIR", unity2dDirectory().toLocal8Bit() + "/data");
301+ }
302 }
303
304 Unity2dApplication::~Unity2dApplication()

Subscribers

People subscribed via source and target branches