From 282993043650b14736443d9a100311c1fdd1f7d4 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Fri, 10 Jan 2014 14:45:41 +1300 Subject: Support both gnome-control-center and unity-control-center --- CMakeLists.txt | 16 +++++++++++++++- data/CMakeLists.txt | 23 ++++++++++++++++++++++- data/unity-datetime-panel.desktop.in | 13 +++++++++++++ debian/control | 15 ++++++++++++++- debian/gnome-control-center-datetime.install | 4 ++-- debian/unity-control-center-datetime.install | 3 +++ panel-gnome/CMakeLists.txt | 26 ++++++++++++++++++++++++++ panel-unity/CMakeLists.txt | 26 ++++++++++++++++++++++++++ panel/CMakeLists.txt | 25 ------------------------- panel/datetime-prefs.c | 10 +++++++++- po/POTFILES.in | 1 + 11 files changed, 131 insertions(+), 31 deletions(-) create mode 100644 data/unity-datetime-panel.desktop.in create mode 100644 debian/unity-control-center-datetime.install create mode 100644 panel-gnome/CMakeLists.txt create mode 100644 panel-unity/CMakeLists.txt delete mode 100644 panel/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee5cf9..fc8a639 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,17 @@ if (PANEL_DEPS_FOUND) set (BUILD_PANEL 1) endif () +pkg_check_modules (UNITY_PANEL_DEPS + glib-2.0>=2.36 + gio-unix-2.0>=2.36 + gtk+-3.0>=3.1.4 + timezonemap + libunity-control-center + polkit-gobject-1) +if (UNITY_PANEL_DEPS_FOUND) + set (BUILD_UNITY_PANEL 1) +endif () + ## ## custom targets ## @@ -93,7 +104,10 @@ endif () # actually build things add_subdirectory (src) if (BUILD_PANEL) - add_subdirectory (panel) + add_subdirectory (panel-gnome) +endif () +if (BUILD_UNITY_PANEL) + add_subdirectory (panel-unity) endif () add_subdirectory (data) add_subdirectory (po) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index ab393a7..a3360cb 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -72,7 +72,7 @@ if (BUILD_PANEL) # the .ui file install (FILES "datetime-dialog.ui" - DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") + DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/gnome-control-center") # the .desktop file set (DESKTOP_NAME "gnome-indicator-datetime-panel.desktop") @@ -84,3 +84,24 @@ if (BUILD_PANEL) DESTINATION "${CMAKE_INSTALL_DATADIR}/applications") endif () + +## +## unity-control-center panel: .ui and .desktop files +## + +if (BUILD_UNITY_PANEL) + + # the .ui file + install (FILES "datetime-dialog.ui" + DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/unity-control-center") + + # the .desktop file + set (DESKTOP_NAME "unity-datetime-panel.desktop") + set (DESKTOP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_NAME}") + set (DESKTOP_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${DESKTOP_NAME}.in") + set (ENV{LC_ALL} "C") + execute_process (COMMAND intltool-merge -quiet --desktop-style --utf8 "${CMAKE_SOURCE_DIR}/po" "${DESKTOP_FILE_IN}" "${DESKTOP_FILE}") + install (FILES ${DESKTOP_FILE} + DESTINATION "${CMAKE_INSTALL_DATADIR}/applications") + +endif () diff --git a/data/unity-datetime-panel.desktop.in b/data/unity-datetime-panel.desktop.in new file mode 100644 index 0000000..6e7b252 --- /dev/null +++ b/data/unity-datetime-panel.desktop.in @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +_Name=Time & Date +_Comment=Change your clock and date settings +Icon=preferences-system-time +TryExec=unity-control-center +Exec=unity-control-center indicator-datetime +StartupNotify=true +Type=Application +Categories=GNOME;GTK;Utility;DesktopSettings;Settings;X-GNOME-SystemSettings;X-Unity-Settings-Panel; +X-Unity-Settings-Panel=indicator-datetime +OnlyShowIn=Unity; +X-Ubuntu-Gettext-Domain=indicator-datetime diff --git a/debian/control b/debian/control index d9d4f56..3bd1fef 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Build-Depends: cmake, libedataserver1.2-dev (>= 3.5), libgconf2-dev (>= 2.31), libgnome-control-center-dev, + libunity-control-center-dev, libtimezonemap1-dev, liburl-dispatcher1-dev, locales, @@ -45,7 +46,7 @@ Depends: ${shlibs:Depends}, systemd-shim, Recommends: indicator-applet | indicator-renderer, evolution-data-server, - gnome-control-center-datetime | ubuntu-system-settings, + gnome-control-center-datetime | unity-control-center-datetime | ubuntu-system-settings, Suggests: click, Conflicts: indicator-datetime (<< 13.10.0) Replaces: indicator-datetime (<< 13.10.0) @@ -64,3 +65,15 @@ Description: Clock settings in the GNOME Control Center A module to get date time and clock settings in the GNOME control center. +Package: unity-control-center-datetime +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + indicator-datetime (=${binary:Version}), + unity-control-center, +Conflicts: indicator-datetime (<< 13.10.0) +Replaces: indicator-datetime (<< 13.10.0) +Description: Clock settings in the Unity Control Center + A module to get date time and clock settings in the Unity control + center. + diff --git a/debian/gnome-control-center-datetime.install b/debian/gnome-control-center-datetime.install index 52a8c70..1551ef9 100644 --- a/debian/gnome-control-center-datetime.install +++ b/debian/gnome-control-center-datetime.install @@ -1,3 +1,3 @@ usr/lib/*/control-center-1/panels/* -usr/share/indicator-datetime/* -usr/share/applications/* +usr/share/indicator-datetime/gnome-control-center/* +usr/share/applications/gnome-indicator-datetime-panel.desktop diff --git a/debian/unity-control-center-datetime.install b/debian/unity-control-center-datetime.install new file mode 100644 index 0000000..d363e00 --- /dev/null +++ b/debian/unity-control-center-datetime.install @@ -0,0 +1,3 @@ +usr/lib/*/unity-control-center-1/panels/* +usr/share/indicator-datetime/unity-control-center/* +usr/share/applications/unity-datetime-panel.desktop diff --git a/panel-gnome/CMakeLists.txt b/panel-gnome/CMakeLists.txt new file mode 100644 index 0000000..9be4cf5 --- /dev/null +++ b/panel-gnome/CMakeLists.txt @@ -0,0 +1,26 @@ +set (PANEL_LIB "gnome-indicator-datetime") + +add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") + +add_library (${PANEL_LIB} SHARED + ${CMAKE_SOURCE_DIR}/panel/datetime-prefs.c + ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.c + ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.h + ${CMAKE_SOURCE_DIR}/src/utils.c + ${CMAKE_SOURCE_DIR}/src/utils.h + ${CMAKE_SOURCE_DIR}/src/settings-shared.h) +set_property (TARGET ${PANEL_LIB} PROPERTY OUTPUT_NAME indicator-datetime) + +include_directories (${PANEL_DEPS_INCLUDE_DIRS}) + +link_directories (${PANEL_DEPS_LIBRARY_DIRS}) + +set_property (TARGET ${PANEL_LIB} + APPEND_STRING PROPERTY COMPILE_FLAGS + " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}") + +target_link_libraries (${PANEL_LIB} ${PANEL_DEPS_LIBRARIES} ${GCOV_LIBS}) + +install (TARGETS ${PANEL_LIB} + DESTINATION ${CMAKE_INSTALL_LIBDIR}/control-center-1/panels) + diff --git a/panel-unity/CMakeLists.txt b/panel-unity/CMakeLists.txt new file mode 100644 index 0000000..f710006 --- /dev/null +++ b/panel-unity/CMakeLists.txt @@ -0,0 +1,26 @@ +set (PANEL_LIB "unity-indicator-datetime") + +add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") + +add_library (${PANEL_LIB} SHARED + ${CMAKE_SOURCE_DIR}/panel/datetime-prefs.c + ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.c + ${CMAKE_SOURCE_DIR}/panel/datetime-prefs-locations.h + ${CMAKE_SOURCE_DIR}/src/utils.c + ${CMAKE_SOURCE_DIR}/src/utils.h + ${CMAKE_SOURCE_DIR}/src/settings-shared.h) +set_property (TARGET ${PANEL_LIB} PROPERTY OUTPUT_NAME indicator-datetime) + +include_directories (${UNITY_PANEL_DEPS_INCLUDE_DIRS}) + +link_directories (${UNITY_PANEL_DEPS_LIBRARY_DIRS}) + +set_property (TARGET ${PANEL_LIB} + APPEND_STRING PROPERTY COMPILE_FLAGS + " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS} -DUSE_UNITY") + +target_link_libraries (${PANEL_LIB} ${UNITY_PANEL_DEPS_LIBRARIES} ${GCOV_LIBS}) + +install (TARGETS ${PANEL_LIB} + DESTINATION ${CMAKE_INSTALL_LIBDIR}/unity-control-center-1/panels) + diff --git a/panel/CMakeLists.txt b/panel/CMakeLists.txt deleted file mode 100644 index b3fcc7b..0000000 --- a/panel/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -set (PANEL_LIB "indicator-datetime") - -add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") - -add_library (${PANEL_LIB} SHARED - datetime-prefs.c - datetime-prefs-locations.c - datetime-prefs-locations.h - ${CMAKE_SOURCE_DIR}/src/utils.c - ${CMAKE_SOURCE_DIR}/src/utils.h - ${CMAKE_SOURCE_DIR}/src/settings-shared.h) - -include_directories (${PANEL_DEPS_INCLUDE_DIRS}) - -link_directories (${PANEL_DEPS_LIBRARY_DIRS}) - -set_property (TARGET ${PANEL_LIB} - APPEND_STRING PROPERTY COMPILE_FLAGS - " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}") - -target_link_libraries (${PANEL_LIB} ${PANEL_DEPS_LIBRARIES} ${GCOV_LIBS}) - -install (TARGETS ${PANEL_LIB} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/control-center-1/panels) - diff --git a/panel/datetime-prefs.c b/panel/datetime-prefs.c index 55456ac..c1e70b1 100644 --- a/panel/datetime-prefs.c +++ b/panel/datetime-prefs.c @@ -33,7 +33,11 @@ with this program. If not, see . #include #include #include +#if USE_UNITY +#include +#else #include +#endif #include #include @@ -42,7 +46,11 @@ with this program. If not, see . #include "utils.h" #include "datetime-prefs-locations.h" -#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui" +#if USE_UNITY +#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/unity-control-center/datetime-dialog.ui" +#else +#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/gnome-control-center/datetime-dialog.ui" +#endif #define INDICATOR_DATETIME_TYPE_PANEL indicator_datetime_panel_get_type() diff --git a/po/POTFILES.in b/po/POTFILES.in index 516cdc5..acc8916 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -5,3 +5,4 @@ panel/datetime-prefs.c panel/datetime-prefs-locations.c [type: gettext/glade]data/datetime-dialog.ui data/gnome-indicator-datetime-panel.desktop.in +data/unity-datetime-panel.desktop.in -- cgit v1.2.3