aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt16
-rw-r--r--data/CMakeLists.txt23
-rw-r--r--data/unity-datetime-panel.desktop.in13
-rw-r--r--debian/changelog12
-rw-r--r--debian/control18
-rw-r--r--debian/gnome-control-center-datetime.install4
-rw-r--r--debian/unity-control-center-datetime.install3
-rw-r--r--panel-gnome/CMakeLists.txt (renamed from panel/CMakeLists.txt)12
-rw-r--r--panel-unity/CMakeLists.txt28
-rw-r--r--panel/datetime-prefs.c13
-rw-r--r--po/POTFILES.in1
-rw-r--r--tests/test-formatter.cc98
12 files changed, 229 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf34ebb..53a3f7e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,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
##
@@ -97,7 +108,10 @@ endif ()
add_subdirectory(include)
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/changelog b/debian/changelog
index e1509fd..5ceaecf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+indicator-datetime (13.10.0+14.04.20131217-0ubuntu1) trusty; urgency=low
+
+ [ Charles Kerr ]
+ * Make the phone profile's header format sensitive to whether the
+ phone is running in a 12h or 24h locale, and use a 12h or 24h
+ notation accordingly. (LP: #1256061)
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 291
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 17 Dec 2013 09:49:56 +0000
+
indicator-datetime (13.10.0+14.04.20131125-0ubuntu1) trusty; urgency=low
[ Charles Kerr ]
diff --git a/debian/control b/debian/control
index 3dc61c6..1788381 100644
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,14 @@ Source: indicator-datetime
Section: misc
Priority: optional
Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
+# language-pack-en-base is for the unit tests s.t. we can test in 12h and 24h locales
Build-Depends: cmake,
dbus,
debhelper (>= 9),
dh-translations,
intltool (>= 0.35.0),
gnome-common,
+ language-pack-en-base,
libxorg-gtest-dev,
libgtest-dev,
libglib2.0-dev (>= 2.35.4),
@@ -23,9 +25,11 @@ 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,
libproperties-cpp-dev,
+ locales,
Standards-Version: 3.9.3
Homepage: https://launchpad.net/indicator-datetime
# If you aren't a member of ~indicator-applet-developers but need to upload
@@ -43,7 +47,7 @@ Depends: ${shlibs:Depends},
systemd-shim,
Recommends: indicator-applet | indicator-renderer,
evolution-data-server,
- gnome-control-center-datetime | ubuntu-system-settings,
+ unity-control-center-datetime | gnome-control-center-datetime | ubuntu-system-settings,
Suggests: click,
Conflicts: indicator-datetime (<< 13.10.0)
Replaces: indicator-datetime (<< 13.10.0)
@@ -62,3 +66,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/CMakeLists.txt b/panel-gnome/CMakeLists.txt
index c165326..1135cd4 100644
--- a/panel/CMakeLists.txt
+++ b/panel-gnome/CMakeLists.txt
@@ -1,18 +1,20 @@
-set (PANEL_LIB "indicator-datetime")
+set (PANEL_LIB "gnome-indicator-datetime")
add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}")
+
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS}")
add_library (${PANEL_LIB} SHARED
- datetime-prefs.c
- datetime-prefs-locations.c
- datetime-prefs-locations.h
+ ${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.cpp
${CMAKE_SOURCE_DIR}/include/datetime/utils.h
${CMAKE_SOURCE_DIR}/include/datetime/settings-shared.h)
+set_property (TARGET ${PANEL_LIB} PROPERTY OUTPUT_NAME indicator-datetime)
-include_directories (${PANEL_DEPS_INCLUDE_DIRS})
+include_directories (SYSTEM ${PANEL_DEPS_INCLUDE_DIRS})
link_directories (${PANEL_DEPS_LIBRARY_DIRS})
diff --git a/panel-unity/CMakeLists.txt b/panel-unity/CMakeLists.txt
new file mode 100644
index 0000000..150034c
--- /dev/null
+++ b/panel-unity/CMakeLists.txt
@@ -0,0 +1,28 @@
+set (PANEL_LIB "unity-indicator-datetime")
+
+add_definitions (-DPKGDATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}")
+
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS}")
+
+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.cpp
+ ${CMAKE_SOURCE_DIR}/include/datetime/utils.h
+ ${CMAKE_SOURCE_DIR}/include/datetime/settings-shared.h)
+set_property (TARGET ${PANEL_LIB} PROPERTY OUTPUT_NAME indicator-datetime)
+
+include_directories (SYSTEM ${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/datetime-prefs.c b/panel/datetime-prefs.c
index 3e7fc3c..02536c7 100644
--- a/panel/datetime-prefs.c
+++ b/panel/datetime-prefs.c
@@ -32,7 +32,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <datetime/utils.h>
#include <polkit/polkit.h>
-#include <libgnome-control-center/cc-panel.h>
#include <timezonemap/cc-timezone-map.h>
#include <timezonemap/timezone-completion.h>
@@ -40,12 +39,22 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#ifdef USE_UNITY
+ #include <libunity-control-center/cc-panel.h>
+#else
+ #include <libgnome-control-center/cc-panel.h>
+#endif
+
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#include <langinfo.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
diff --git a/tests/test-formatter.cc b/tests/test-formatter.cc
new file mode 100644
index 0000000..6a408ab
--- /dev/null
+++ b/tests/test-formatter.cc
@@ -0,0 +1,98 @@
+
+/*
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Authors:
+ * Charles Kerr <charles.kerr@canonical.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <langinfo.h>
+#include <locale.h>
+
+#include <glib/gi18n.h>
+
+#include "utils.h"
+
+#include "glib-fixture.h"
+
+/***
+****
+***/
+
+class FormatterFixture: public GlibFixture
+{
+ private:
+
+ typedef GlibFixture super;
+ gchar * original_locale = nullptr;
+
+ protected:
+
+ virtual void SetUp ()
+ {
+ super::SetUp ();
+
+ original_locale = g_strdup (setlocale (LC_TIME, NULL));
+ }
+
+ virtual void TearDown ()
+ {
+ setlocale (LC_TIME, original_locale);
+ g_clear_pointer (&original_locale, g_free);
+
+ super::TearDown ();
+ }
+
+ bool SetLocale (const char * expected_locale, const char * name)
+ {
+ setlocale (LC_TIME, expected_locale);
+ const char * actual_locale = setlocale (LC_TIME, NULL);
+ if (!g_strcmp0 (expected_locale, actual_locale))
+ {
+ return true;
+ }
+ else
+ {
+ g_warning ("Unable to set locale to %s; skipping %s locale tests.", expected_locale, name);
+ return false;
+ }
+ }
+
+ inline bool Set24hLocale () { return SetLocale ("C", "24h"); }
+ inline bool Set12hLocale () { return SetLocale ("en_US.utf8", "12h"); }
+};
+
+
+/**
+ * Test the phone header format
+ */
+TEST_F (FormatterFixture, TestPhoneHeader)
+{
+ // test the default value in a 24h locale
+ if (Set24hLocale ())
+ {
+ const gchar * format = get_terse_header_time_format_string ();
+ ASSERT_NE (nullptr, format);
+ ASSERT_STREQ ("%H:%M", format);
+ }
+
+ // test the default value in a 12h locale
+ if (Set12hLocale ())
+ {
+ const gchar * format = get_terse_header_time_format_string ();
+ ASSERT_NE (nullptr, format);
+ ASSERT_STREQ ("%l:%M %p", format);
+ }
+}