← Back to team overview

deja-dup-team team mailing list archive

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

 

Robert Ancell has proposed merging lp:~robert-ancell/deja-dup/unity-control-center2 into lp:deja-dup.

Requested reviews:
  Déjà Dup Developers (deja-dup-hackers)

For more details, see:
https://code.launchpad.net/~robert-ancell/deja-dup/unity-control-center2/+merge/200950

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
-- 
https://code.launchpad.net/~robert-ancell/deja-dup/unity-control-center2/+merge/200950
Your team Déjà Dup Developers is requested to review the proposed merge of lp:~robert-ancell/deja-dup/unity-control-center2 into lp:deja-dup.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2013-12-11 19:23:26 +0000
+++ CMakeLists.txt	2014-01-09 04:47:24 +0000
@@ -26,6 +26,7 @@
 deja_option(ENABLE_CCPANEL "Build gnome-control-center panel" CHECK)
 deja_option(ENABLE_NAUTILUS "Build nautilus plugin" CHECK)
 deja_option(ENABLE_UNITY "Integrate with Unity" CHECK)
+deja_option(ENABLE_UNITY_CCPANEL "Build unity-control-center panel" CHECK)
 
 find_package(PkgConfig 0.24 REQUIRED)
 find_package(Vala 0.20 REQUIRED)
@@ -55,6 +56,14 @@
 
 deja_enable_option(UNITY unity>=3.4.2)
 
+deja_enable_option(UNITY_CCPANEL libunity-control-center)
+if(ENABLE_UNITY_CCPANEL)
+  execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=extensiondir libunity-control-center
+                  OUTPUT_VARIABLE UNITY_CCPANEL_EXTENSIONDIR
+                  OUTPUT_STRIP_TRAILING_WHITESPACE
+                  ERROR_QUIET)
+endif()
+
 # Set up some common configuration values; Vala sees these via config.vapi.
 include(GNUInstallDirs)
 set(PACKAGE "deja-dup")

=== modified file 'debian/control'
--- debian/control	2013-11-07 02:42:47 +0000
+++ debian/control	2014-01-09 04:47:24 +0000
@@ -17,6 +17,7 @@
                libpeas-dev,
                libsecret-1-dev,
                libunity-dev (>= 5.0.0),
+               libunity-control-center-dev,
                libxml2-utils,
                pkg-config,
                python3,

=== modified file 'debian/rules'
--- debian/rules	2013-12-11 19:23:26 +0000
+++ debian/rules	2014-01-09 04:47:24 +0000
@@ -12,6 +12,7 @@
 	dh_auto_configure -- -DENABLE_CCPANEL=ON \
 	                     -DENABLE_NAUTILUS=ON \
 	                     -DENABLE_UNITY=ON \
+	                     -DENABLE_UNITY_CCPANEL=ON \
 	                     -DCMAKE_INSTALL_LIBEXECDIR="/usr/lib/${DEB_HOST_MULTIARCH}" \
 	                     -DCMAKE_INSTALL_SYSCONFDIR="/etc"
 

=== modified file 'deja-dup/preferences/CMakeLists.txt'
--- deja-dup/preferences/CMakeLists.txt	2013-10-14 22:22:07 +0000
+++ deja-dup/preferences/CMakeLists.txt	2014-01-09 04:47:24 +0000
@@ -16,8 +16,12 @@
 # You should have received a copy of the GNU General Public License
 # along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
 
+# Hide preferences if have control center panel
 if(ENABLE_CCPANEL)
-  set(CCPANEL_SHOWIN "GNOME;Unity;") # for replacing @CCPANEL_SHOWIN@ in desktop files
+  set(PREFERENCES_NOTSHOWIN "GNOME;")
+endif()
+if(ENABLE_UNITY_CCPANEL)
+  set(PREFERENCES_NOTSHOWIN "${PREFERENCES_NOTSHOWIN}Unity;")
 endif()
 
 vala_precompile(VALA_C preferences-main.vala
@@ -36,14 +40,5 @@
 
 deja_merge_po(desktop deja-dup-preferences.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
 
-if(ENABLE_CCPANEL)
-add_library(deja-dup-ccpanel MODULE Preferences.c PreferencesPanel.c)
-target_link_libraries(deja-dup-ccpanel deja widgets ${CCPANEL_LDFLAGS} ${GTK_LDFLAGS} ${PEAS_LDFLAGS} ${SECRET_LDFLAGS})
-set_target_properties(deja-dup-ccpanel PROPERTIES
-                      OUTPUT_NAME deja-dup
-                      INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/libdeja;${CMAKE_BINARY_DIR}/deja-dup/widgets"
-                      COMPILE_FLAGS "${CCPANEL_CFLAGS} ${GTK_CFLAGS} ${PEAS_CFLAGS} ${SECRET_CFLAGS} ${COMMON_CFLAGS}")
-install(TARGETS deja-dup-ccpanel DESTINATION "${CCPANEL_EXTENSIONDIR}")
-
-deja_merge_po(desktop gnome-deja-dup-panel.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
-endif()
+add_subdirectory(gnome-control-center)
+add_subdirectory(unity-control-center)

=== modified file 'deja-dup/preferences/PreferencesPanel.c'
--- deja-dup/preferences/PreferencesPanel.c	2013-10-14 22:22:07 +0000
+++ deja-dup/preferences/PreferencesPanel.c	2014-01-09 04:47:24 +0000
@@ -22,7 +22,11 @@
 */
 
 #include <gtk/gtk.h>
+#ifdef USE_UNITY
+#include <libunity-control-center/cc-panel.h>
+#else
 #include <libgnome-control-center/cc-panel.h>
+#endif
 #include "widgets.h"
 
 extern void* deja_dup_preferences_new (gboolean show_auto_switch);

=== modified file 'deja-dup/preferences/deja-dup-preferences.desktop.in'
--- deja-dup/preferences/deja-dup-preferences.desktop.in	2013-10-14 17:14:15 +0000
+++ deja-dup/preferences/deja-dup-preferences.desktop.in	2014-01-09 04:47:24 +0000
@@ -13,7 +13,7 @@
 Type=Application
 Categories=Settings;Utility;Archiving;GNOME;GTK;X-GNOME-SystemSettings;
 
-NotShowIn=@CCPANEL_SHOWIN@
+NotShowIn=@PREFERENCES_NOTSHOWIN@
 
 # Translators: Add whatever keywords you want in your language, separated by semicolons
 # These keywords are used when searching for applications in dashes, etc.

=== added directory 'deja-dup/preferences/gnome-control-center'
=== added file 'deja-dup/preferences/gnome-control-center/CMakeLists.txt'
--- deja-dup/preferences/gnome-control-center/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ deja-dup/preferences/gnome-control-center/CMakeLists.txt	2014-01-09 04:47:24 +0000
@@ -0,0 +1,36 @@
+# -*- Mode: CMake; indent-tabs-mode: nil; tab-width: 2 -*-
+#
+# This file is part of Déjà Dup.
+# For copyright information, see AUTHORS.
+#
+# Déjà Dup is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Déjà Dup is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
+
+if(ENABLE_CCPANEL)
+vala_precompile(VALA_C ../Preferences.vala
+                PACKAGES gtk+-3.0 libpeas-1.0 libsecret-1
+                CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/libdeja/deja.vapi
+                             ${CMAKE_BINARY_DIR}/deja-dup/widgets/widgets.vapi
+                             ${CMAKE_SOURCE_DIR}/vapi/config.vapi
+                OPTIONS ${COMMON_VFLAGS})
+
+add_library(deja-dup-ccpanel MODULE ${VALA_C} ../PreferencesPanel.c)
+target_link_libraries(deja-dup-ccpanel deja widgets ${CCPANEL_LDFLAGS} ${GTK_LDFLAGS} ${PEAS_LDFLAGS} ${SECRET_LDFLAGS})
+set_target_properties(deja-dup-ccpanel PROPERTIES
+                      OUTPUT_NAME deja-dup
+                      INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/libdeja;${CMAKE_BINARY_DIR}/deja-dup/widgets"
+                      COMPILE_FLAGS "${CCPANEL_CFLAGS} ${GTK_CFLAGS} ${PEAS_CFLAGS} ${SECRET_CFLAGS} ${COMMON_CFLAGS}")
+install(TARGETS deja-dup-ccpanel DESTINATION "${CCPANEL_EXTENSIONDIR}")
+
+deja_merge_po(desktop gnome-deja-dup-panel.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
+endif()

=== renamed file 'deja-dup/preferences/gnome-deja-dup-panel.desktop.in' => 'deja-dup/preferences/gnome-control-center/gnome-deja-dup-panel.desktop.in'
--- deja-dup/preferences/gnome-deja-dup-panel.desktop.in	2013-10-14 17:14:15 +0000
+++ deja-dup/preferences/gnome-control-center/gnome-deja-dup-panel.desktop.in	2014-01-09 04:47:24 +0000
@@ -14,7 +14,7 @@
 Categories=Settings;Utility;Archiving;GNOME;GTK;X-GNOME-SystemSettings;X-GNOME-Settings-Panel;
 X-GNOME-Settings-Panel=deja-dup
 
-OnlyShowIn=@CCPANEL_SHOWIN@
+OnlyShowIn=GNOME;
 
 # Translators: Add whatever keywords you want in your language, separated by semicolons
 # These keywords are used when searching for applications in dashes, etc.

=== added directory 'deja-dup/preferences/unity-control-center'
=== added file 'deja-dup/preferences/unity-control-center/CMakeLists.txt'
--- deja-dup/preferences/unity-control-center/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ deja-dup/preferences/unity-control-center/CMakeLists.txt	2014-01-09 04:47:24 +0000
@@ -0,0 +1,36 @@
+# -*- Mode: CMake; indent-tabs-mode: nil; tab-width: 2 -*-
+#
+# This file is part of Déjà Dup.
+# For copyright information, see AUTHORS.
+#
+# Déjà Dup is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Déjà Dup is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
+
+if(ENABLE_UNITY_CCPANEL)
+vala_precompile(VALA_C ../Preferences.vala
+                PACKAGES gtk+-3.0 libpeas-1.0 libsecret-1
+                CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/libdeja/deja.vapi
+                             ${CMAKE_BINARY_DIR}/deja-dup/widgets/widgets.vapi
+                             ${CMAKE_SOURCE_DIR}/vapi/config.vapi
+                OPTIONS ${COMMON_VFLAGS})
+
+add_library(deja-dup-unity-ccpanel MODULE ${VALA_C} ../PreferencesPanel.c)
+target_link_libraries(deja-dup-unity-ccpanel deja widgets ${UNITY_CCPANEL_LDFLAGS} ${GTK_LDFLAGS} ${PEAS_LDFLAGS} ${SECRET_LDFLAGS})
+set_target_properties(deja-dup-unity-ccpanel PROPERTIES
+                      OUTPUT_NAME deja-dup
+                      INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/libdeja;${CMAKE_BINARY_DIR}/deja-dup/widgets"
+                      COMPILE_FLAGS "-DUSE_UNITY ${UNITY_CCPANEL_CFLAGS} ${GTK_CFLAGS} ${PEAS_CFLAGS} ${SECRET_CFLAGS} ${COMMON_CFLAGS}")
+install(TARGETS deja-dup-unity-ccpanel DESTINATION "${UNITY_CCPANEL_EXTENSIONDIR}")
+
+deja_merge_po(desktop unity-deja-dup-panel.desktop "${CMAKE_INSTALL_FULL_DATADIR}/applications")
+endif()

=== added file 'deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in'
--- deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in	1970-01-01 00:00:00 +0000
+++ deja-dup/preferences/unity-control-center/unity-deja-dup-panel.desktop.in	2014-01-09 04:47:24 +0000
@@ -0,0 +1,29 @@
+[Desktop Entry]
+Version=1.0
+
+_Name=Backups
+_Comment=Change your backup settings
+
+Icon=deja-dup
+TryExec=unity-control-center
+Exec=unity-control-center deja-dup
+
+StartupNotify=true
+
+Type=Application
+Categories=Settings;Utility;Archiving;GNOME;GTK;X-GNOME-SystemSettings;X-Unity-Settings-Panel;
+X-Unity-Settings-Panel=deja-dup
+
+OnlyShowIn=Unity;
+
+# Translators: Add whatever keywords you want in your language, separated by semicolons
+# These keywords are used when searching for applications in dashes, etc.
+_Keywords=déjà;deja;dup;
+
+X-AppInstall-Ignore=true
+
+Actions=BackUpNow;
+
+[Desktop Action BackUpNow]
+_Name=Back Up
+Exec=deja-dup --backup

=== modified file 'deja-dup/tests/CMakeLists.txt'
--- deja-dup/tests/CMakeLists.txt	2013-11-08 07:24:00 +0000
+++ deja-dup/tests/CMakeLists.txt	2014-01-09 04:47:24 +0000
@@ -21,11 +21,16 @@
 else()
   set(HAS_CCPANEL "0")
 endif()
+if(ENABLE_UNITY_CCPANEL)
+  set(HAS_UNITY_CCPANEL "1")
+else()
+  set(HAS_UNITY_CCPANEL "0")
+endif()
 
 add_custom_target(autopilot-deja-dup
-                  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)
+                  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)
 add_dependencies(autopilot autopilot-deja-dup)
 
 add_custom_target(autopilot-system-deja-dup
-                  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)
+                  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)
 add_dependencies(autopilot-system autopilot-system-deja-dup)

=== modified file 'deja-dup/tests/deja_dup_autopilot/test_ccpanel.py'
--- deja-dup/tests/deja_dup_autopilot/test_ccpanel.py	2013-10-10 05:55:33 +0000
+++ deja-dup/tests/deja_dup_autopilot/test_ccpanel.py	2014-01-09 04:47:24 +0000
@@ -51,3 +51,33 @@
         button = window.select_single("GtkButton", label="_All Settings")
         self.pointer.click_object(button)
         self.assertThat(window.title, Eventually(NotEquals("Backups")))
+
+class CCUnityPanelTests(DejaDupTestCase):
+
+    @system_only
+    def setUp(self):
+        super(CCPanelTests, self).setUp()
+        if os.environ.get("HAS_UNITY_CCPANEL") != "1":
+            self.skip("Skipping disabled Unity ccpanel test")
+
+    def test_clean_exit(self):
+        """Launch and close the panel a couple times.  If we don't properly
+           clean up after ourselves when we are disposed, this may cause a
+           crash."""
+        app = self.launch_test_application('unity-control-center', 'deja-dup')
+        window = app.select_single("GtkApplicationWindow")
+        self.assertThat(window.title, Eventually(Equals("Backups")))
+        self.close_backup_panel(window)
+        self.open_backup_panel(window)
+        self.close_backup_panel(window)
+
+    def open_backup_panel(self, window):
+        # This is dumb, but GtkIconView doesn't seem to list its contents to
+        # autopilot.  TODO: make this actually click on Backup icon in window
+        os.system('unity-control-center deja-dup')
+        self.assertThat(window.title, Eventually(Equals("Backups")))
+
+    def close_backup_panel(self, window):
+        button = window.select_single("GtkButton", label="_All Settings")
+        self.pointer.click_object(button)
+        self.assertThat(window.title, Eventually(NotEquals("Backups")))


Follow ups