Merge lp:~robert-ancell/deja-dup/unity-control-center2 into lp:deja-dup/30

Proposed by Robert Ancell
Status: Merged
Merge reported by: Michael Terry
Merged at revision: not available
Proposed branch: lp:~robert-ancell/deja-dup/unity-control-center2
Merge into: lp:deja-dup/30
Diff against target: 306 lines (+162/-16)
12 files modified
CMakeLists.txt (+9/-0)
debian/control (+1/-0)
debian/rules (+1/-0)
deja-dup/preferences/CMakeLists.txt (+7/-12)
deja-dup/preferences/PreferencesPanel.c (+4/-0)
deja-dup/preferences/deja-dup-preferences.desktop.in (+1/-1)
deja-dup/preferences/gnome-control-center/CMakeLists.txt (+36/-0)
deja-dup/preferences/gnome-control-center/gnome-deja-dup-panel.desktop.in (+1/-1)
deja-dup/preferences/unity-control-center/CMakeLists.txt (+36/-0)
deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in (+29/-0)
deja-dup/tests/CMakeLists.txt (+7/-2)
deja-dup/tests/deja_dup_autopilot/test_ccpanel.py (+30/-0)
To merge this branch: bzr merge lp:~robert-ancell/deja-dup/unity-control-center2
Reviewer Review Type Date Requested Status
Michael Terry Approve
Review via email: mp+200950@code.launchpad.net

Description of the change

Compile a Unity Control Center panel.

Things to note:
- unity-control-center is now in Universe, with a MIR in process
- This relies on both control center APIs staying the same, but I don't know of any reason why that would change in the future
- I originally just switched to building against u-c-c since g-c-c doesn't support external panels upstream but the Ubuntu GNOME people said they still wanted to keep using this panel in newer GNOME
- deja-dup/preferences/Preferences.vala is converted into C twice since I couldn't work out how both panels could use it without copying. Doesn't seem to be a problem in practise since the conversion is identical

To post a comment you must log in.
1519. By Robert Ancell

Show GNOME deja-dup panel in Unity so it's still there during migration

1520. By Robert Ancell

Tag with bug number

Revision history for this message
Michael Terry (mterry) wrote :

Merged with some minor changes:
- Typo in new autopilot test (had to change right super() class)
- Dropped the two new directories. I understand why you did that, but I just specified a LIBRARY_OUTPUT_DIRECTORY to stuff the two libdeja-dup.so files in different places.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-12-11 19:23:26 +0000
3+++ CMakeLists.txt 2014-01-10 01:44:47 +0000
4@@ -26,6 +26,7 @@
5 deja_option(ENABLE_CCPANEL "Build gnome-control-center panel" CHECK)
6 deja_option(ENABLE_NAUTILUS "Build nautilus plugin" CHECK)
7 deja_option(ENABLE_UNITY "Integrate with Unity" CHECK)
8+deja_option(ENABLE_UNITY_CCPANEL "Build unity-control-center panel" CHECK)
9
10 find_package(PkgConfig 0.24 REQUIRED)
11 find_package(Vala 0.20 REQUIRED)
12@@ -55,6 +56,14 @@
13
14 deja_enable_option(UNITY unity>=3.4.2)
15
16+deja_enable_option(UNITY_CCPANEL libunity-control-center)
17+if(ENABLE_UNITY_CCPANEL)
18+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=extensiondir libunity-control-center
19+ OUTPUT_VARIABLE UNITY_CCPANEL_EXTENSIONDIR
20+ OUTPUT_STRIP_TRAILING_WHITESPACE
21+ ERROR_QUIET)
22+endif()
23+
24 # Set up some common configuration values; Vala sees these via config.vapi.
25 include(GNUInstallDirs)
26 set(PACKAGE "deja-dup")
27
28=== modified file 'debian/control'
29--- debian/control 2013-11-07 02:42:47 +0000
30+++ debian/control 2014-01-10 01:44:47 +0000
31@@ -17,6 +17,7 @@
32 libpeas-dev,
33 libsecret-1-dev,
34 libunity-dev (>= 5.0.0),
35+ libunity-control-center-dev,
36 libxml2-utils,
37 pkg-config,
38 python3,
39
40=== modified file 'debian/rules'
41--- debian/rules 2013-12-11 19:23:26 +0000
42+++ debian/rules 2014-01-10 01:44:47 +0000
43@@ -12,6 +12,7 @@
44 dh_auto_configure -- -DENABLE_CCPANEL=ON \
45 -DENABLE_NAUTILUS=ON \
46 -DENABLE_UNITY=ON \
47+ -DENABLE_UNITY_CCPANEL=ON \
48 -DCMAKE_INSTALL_LIBEXECDIR="/usr/lib/${DEB_HOST_MULTIARCH}" \
49 -DCMAKE_INSTALL_SYSCONFDIR="/etc"
50
51
52=== modified file 'deja-dup/preferences/CMakeLists.txt'
53--- deja-dup/preferences/CMakeLists.txt 2013-10-14 22:22:07 +0000
54+++ deja-dup/preferences/CMakeLists.txt 2014-01-10 01:44:47 +0000
55@@ -16,8 +16,12 @@
56 # You should have received a copy of the GNU General Public License
57 # along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
58
59+# Hide preferences if have control center panel
60 if(ENABLE_CCPANEL)
61- set(CCPANEL_SHOWIN "GNOME;Unity;") # for replacing @CCPANEL_SHOWIN@ in desktop files
62+ set(PREFERENCES_NOTSHOWIN "GNOME;")
63+endif()
64+if(ENABLE_UNITY_CCPANEL)
65+ set(PREFERENCES_NOTSHOWIN "${PREFERENCES_NOTSHOWIN}Unity;")
66 endif()
67
68 vala_precompile(VALA_C preferences-main.vala
69@@ -36,14 +40,5 @@
70
71 deja_merge_po(desktop deja-dup-preferences.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
72
73-if(ENABLE_CCPANEL)
74-add_library(deja-dup-ccpanel MODULE Preferences.c PreferencesPanel.c)
75-target_link_libraries(deja-dup-ccpanel deja widgets ${CCPANEL_LDFLAGS} ${GTK_LDFLAGS} ${PEAS_LDFLAGS} ${SECRET_LDFLAGS})
76-set_target_properties(deja-dup-ccpanel PROPERTIES
77- OUTPUT_NAME deja-dup
78- INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/libdeja;${CMAKE_BINARY_DIR}/deja-dup/widgets"
79- COMPILE_FLAGS "${CCPANEL_CFLAGS} ${GTK_CFLAGS} ${PEAS_CFLAGS} ${SECRET_CFLAGS} ${COMMON_CFLAGS}")
80-install(TARGETS deja-dup-ccpanel DESTINATION "${CCPANEL_EXTENSIONDIR}")
81-
82-deja_merge_po(desktop gnome-deja-dup-panel.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
83-endif()
84+add_subdirectory(gnome-control-center)
85+add_subdirectory(unity-control-center)
86
87=== modified file 'deja-dup/preferences/PreferencesPanel.c'
88--- deja-dup/preferences/PreferencesPanel.c 2013-10-14 22:22:07 +0000
89+++ deja-dup/preferences/PreferencesPanel.c 2014-01-10 01:44:47 +0000
90@@ -22,7 +22,11 @@
91 */
92
93 #include <gtk/gtk.h>
94+#ifdef USE_UNITY
95+#include <libunity-control-center/cc-panel.h>
96+#else
97 #include <libgnome-control-center/cc-panel.h>
98+#endif
99 #include "widgets.h"
100
101 extern void* deja_dup_preferences_new (gboolean show_auto_switch);
102
103=== modified file 'deja-dup/preferences/deja-dup-preferences.desktop.in'
104--- deja-dup/preferences/deja-dup-preferences.desktop.in 2013-10-14 17:14:15 +0000
105+++ deja-dup/preferences/deja-dup-preferences.desktop.in 2014-01-10 01:44:47 +0000
106@@ -13,7 +13,7 @@
107 Type=Application
108 Categories=Settings;Utility;Archiving;GNOME;GTK;X-GNOME-SystemSettings;
109
110-NotShowIn=@CCPANEL_SHOWIN@
111+NotShowIn=@PREFERENCES_NOTSHOWIN@
112
113 # Translators: Add whatever keywords you want in your language, separated by semicolons
114 # These keywords are used when searching for applications in dashes, etc.
115
116=== added directory 'deja-dup/preferences/gnome-control-center'
117=== added file 'deja-dup/preferences/gnome-control-center/CMakeLists.txt'
118--- deja-dup/preferences/gnome-control-center/CMakeLists.txt 1970-01-01 00:00:00 +0000
119+++ deja-dup/preferences/gnome-control-center/CMakeLists.txt 2014-01-10 01:44:47 +0000
120@@ -0,0 +1,36 @@
121+# -*- Mode: CMake; indent-tabs-mode: nil; tab-width: 2 -*-
122+#
123+# This file is part of Déjà Dup.
124+# For copyright information, see AUTHORS.
125+#
126+# Déjà Dup is free software; you can redistribute it and/or modify
127+# it under the terms of the GNU General Public License as published by
128+# the Free Software Foundation; either version 3 of the License, or
129+# (at your option) any later version.
130+#
131+# Déjà Dup is distributed in the hope that it will be useful, but
132+# WITHOUT ANY WARRANTY; without even the implied warranty of
133+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
134+# General Public License for more details.
135+#
136+# You should have received a copy of the GNU General Public License
137+# along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
138+
139+if(ENABLE_CCPANEL)
140+vala_precompile(VALA_C ../Preferences.vala
141+ PACKAGES gtk+-3.0 libpeas-1.0 libsecret-1
142+ CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/libdeja/deja.vapi
143+ ${CMAKE_BINARY_DIR}/deja-dup/widgets/widgets.vapi
144+ ${CMAKE_SOURCE_DIR}/vapi/config.vapi
145+ OPTIONS ${COMMON_VFLAGS})
146+
147+add_library(deja-dup-ccpanel MODULE ${VALA_C} ../PreferencesPanel.c)
148+target_link_libraries(deja-dup-ccpanel deja widgets ${CCPANEL_LDFLAGS} ${GTK_LDFLAGS} ${PEAS_LDFLAGS} ${SECRET_LDFLAGS})
149+set_target_properties(deja-dup-ccpanel PROPERTIES
150+ OUTPUT_NAME deja-dup
151+ INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/libdeja;${CMAKE_BINARY_DIR}/deja-dup/widgets"
152+ COMPILE_FLAGS "${CCPANEL_CFLAGS} ${GTK_CFLAGS} ${PEAS_CFLAGS} ${SECRET_CFLAGS} ${COMMON_CFLAGS}")
153+install(TARGETS deja-dup-ccpanel DESTINATION "${CCPANEL_EXTENSIONDIR}")
154+
155+deja_merge_po(desktop gnome-deja-dup-panel.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
156+endif()
157
158=== renamed file 'deja-dup/preferences/gnome-deja-dup-panel.desktop.in' => 'deja-dup/preferences/gnome-control-center/gnome-deja-dup-panel.desktop.in'
159--- deja-dup/preferences/gnome-deja-dup-panel.desktop.in 2013-10-14 17:14:15 +0000
160+++ deja-dup/preferences/gnome-control-center/gnome-deja-dup-panel.desktop.in 2014-01-10 01:44:47 +0000
161@@ -14,7 +14,7 @@
162 Categories=Settings;Utility;Archiving;GNOME;GTK;X-GNOME-SystemSettings;X-GNOME-Settings-Panel;
163 X-GNOME-Settings-Panel=deja-dup
164
165-OnlyShowIn=@CCPANEL_SHOWIN@
166+OnlyShowIn=GNOME;Unity;
167
168 # Translators: Add whatever keywords you want in your language, separated by semicolons
169 # These keywords are used when searching for applications in dashes, etc.
170
171=== added directory 'deja-dup/preferences/unity-control-center'
172=== added file 'deja-dup/preferences/unity-control-center/CMakeLists.txt'
173--- deja-dup/preferences/unity-control-center/CMakeLists.txt 1970-01-01 00:00:00 +0000
174+++ deja-dup/preferences/unity-control-center/CMakeLists.txt 2014-01-10 01:44:47 +0000
175@@ -0,0 +1,36 @@
176+# -*- Mode: CMake; indent-tabs-mode: nil; tab-width: 2 -*-
177+#
178+# This file is part of Déjà Dup.
179+# For copyright information, see AUTHORS.
180+#
181+# Déjà Dup is free software; you can redistribute it and/or modify
182+# it under the terms of the GNU General Public License as published by
183+# the Free Software Foundation; either version 3 of the License, or
184+# (at your option) any later version.
185+#
186+# Déjà Dup is distributed in the hope that it will be useful, but
187+# WITHOUT ANY WARRANTY; without even the implied warranty of
188+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
189+# General Public License for more details.
190+#
191+# You should have received a copy of the GNU General Public License
192+# along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
193+
194+if(ENABLE_UNITY_CCPANEL)
195+vala_precompile(VALA_C ../Preferences.vala
196+ PACKAGES gtk+-3.0 libpeas-1.0 libsecret-1
197+ CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/libdeja/deja.vapi
198+ ${CMAKE_BINARY_DIR}/deja-dup/widgets/widgets.vapi
199+ ${CMAKE_SOURCE_DIR}/vapi/config.vapi
200+ OPTIONS ${COMMON_VFLAGS})
201+
202+add_library(deja-dup-unity-ccpanel MODULE ${VALA_C} ../PreferencesPanel.c)
203+target_link_libraries(deja-dup-unity-ccpanel deja widgets ${UNITY_CCPANEL_LDFLAGS} ${GTK_LDFLAGS} ${PEAS_LDFLAGS} ${SECRET_LDFLAGS})
204+set_target_properties(deja-dup-unity-ccpanel PROPERTIES
205+ OUTPUT_NAME deja-dup
206+ INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/libdeja;${CMAKE_BINARY_DIR}/deja-dup/widgets"
207+ COMPILE_FLAGS "-DUSE_UNITY ${UNITY_CCPANEL_CFLAGS} ${GTK_CFLAGS} ${PEAS_CFLAGS} ${SECRET_CFLAGS} ${COMMON_CFLAGS}")
208+install(TARGETS deja-dup-unity-ccpanel DESTINATION "${UNITY_CCPANEL_EXTENSIONDIR}")
209+
210+deja_merge_po(desktop unity-deja-dup-panel.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
211+endif()
212
213=== added file 'deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in'
214--- deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in 1970-01-01 00:00:00 +0000
215+++ deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in 2014-01-10 01:44:47 +0000
216@@ -0,0 +1,29 @@
217+[Desktop Entry]
218+Version=1.0
219+
220+_Name=Backups
221+_Comment=Change your backup settings
222+
223+Icon=deja-dup
224+TryExec=unity-control-center
225+Exec=unity-control-center deja-dup
226+
227+StartupNotify=true
228+
229+Type=Application
230+Categories=Settings;Utility;Archiving;GNOME;GTK;X-GNOME-SystemSettings;X-Unity-Settings-Panel;
231+X-Unity-Settings-Panel=deja-dup
232+
233+OnlyShowIn=Unity;
234+
235+# Translators: Add whatever keywords you want in your language, separated by semicolons
236+# These keywords are used when searching for applications in dashes, etc.
237+_Keywords=déjà;deja;dup;
238+
239+X-AppInstall-Ignore=true
240+
241+Actions=BackUpNow;
242+
243+[Desktop Action BackUpNow]
244+_Name=Back Up
245+Exec=deja-dup --backup
246
247=== modified file 'deja-dup/tests/CMakeLists.txt'
248--- deja-dup/tests/CMakeLists.txt 2013-11-08 07:24:00 +0000
249+++ deja-dup/tests/CMakeLists.txt 2014-01-10 01:44:47 +0000
250@@ -21,11 +21,16 @@
251 else()
252 set(HAS_CCPANEL "0")
253 endif()
254+if(ENABLE_UNITY_CCPANEL)
255+ set(HAS_UNITY_CCPANEL "1")
256+else()
257+ set(HAS_UNITY_CCPANEL "0")
258+endif()
259
260 add_custom_target(autopilot-deja-dup
261- COMMAND env HAS_CCPANEL=${HAS_CCPANEL} LANG=C DEJA_DUP_TESTING=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH="${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/shell" autopilot-py3 run deja_dup_autopilot)
262+ COMMAND env HAS_CCPANEL=${HAS_CCPANEL} HAS_UNITY_CCPANEL=${HAS_UNITY_CCPANEL} LANG=C DEJA_DUP_TESTING=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH="${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/shell" autopilot-py3 run deja_dup_autopilot)
263 add_dependencies(autopilot autopilot-deja-dup)
264
265 add_custom_target(autopilot-system-deja-dup
266- COMMAND env HAS_CCPANEL=${HAS_CCPANEL} LANG=C DEJA_DUP_TESTING=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH="${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/shell-system" autopilot-py3 run deja_dup_autopilot)
267+ COMMAND env HAS_CCPANEL=${HAS_CCPANEL} HAS_UNITY_CCPANEL=${HAS_UNITY_CCPANEL} LANG=C DEJA_DUP_TESTING=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH="${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/shell-system" autopilot-py3 run deja_dup_autopilot)
268 add_dependencies(autopilot-system autopilot-system-deja-dup)
269
270=== modified file 'deja-dup/tests/deja_dup_autopilot/test_ccpanel.py'
271--- deja-dup/tests/deja_dup_autopilot/test_ccpanel.py 2013-10-10 05:55:33 +0000
272+++ deja-dup/tests/deja_dup_autopilot/test_ccpanel.py 2014-01-10 01:44:47 +0000
273@@ -51,3 +51,33 @@
274 button = window.select_single("GtkButton", label="_All Settings")
275 self.pointer.click_object(button)
276 self.assertThat(window.title, Eventually(NotEquals("Backups")))
277+
278+class CCUnityPanelTests(DejaDupTestCase):
279+
280+ @system_only
281+ def setUp(self):
282+ super(CCPanelTests, self).setUp()
283+ if os.environ.get("HAS_UNITY_CCPANEL") != "1":
284+ self.skip("Skipping disabled Unity ccpanel test")
285+
286+ def test_clean_exit(self):
287+ """Launch and close the panel a couple times. If we don't properly
288+ clean up after ourselves when we are disposed, this may cause a
289+ crash."""
290+ app = self.launch_test_application('unity-control-center', 'deja-dup')
291+ window = app.select_single("GtkApplicationWindow")
292+ self.assertThat(window.title, Eventually(Equals("Backups")))
293+ self.close_backup_panel(window)
294+ self.open_backup_panel(window)
295+ self.close_backup_panel(window)
296+
297+ def open_backup_panel(self, window):
298+ # This is dumb, but GtkIconView doesn't seem to list its contents to
299+ # autopilot. TODO: make this actually click on Backup icon in window
300+ os.system('unity-control-center deja-dup')
301+ self.assertThat(window.title, Eventually(Equals("Backups")))
302+
303+ def close_backup_panel(self, window):
304+ button = window.select_single("GtkButton", label="_All Settings")
305+ self.pointer.click_object(button)
306+ self.assertThat(window.title, Eventually(NotEquals("Backups")))

Subscribers

People subscribed via source and target branches