From 5ed0920a13fcd87192f2567b0046037db85c885d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 09:44:05 -0600 Subject: move the phone & desktop common elements of header time format into a private util, get_default_header_time_format(), and have the phone & desktop functions call it. --- src/utils.c | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/utils.c b/src/utils.c index 5539c5c..c90f2e7 100644 --- a/src/utils.c +++ b/src/utils.c @@ -188,6 +188,31 @@ join_date_and_time_format_strings (const char * date_string, **** ***/ +static const gchar * +get_default_header_time_format (gboolean twelvehour, gboolean show_seconds) +{ + const gchar * fmt; + + if (twelvehour && show_seconds) + /* TRANSLATORS: a strftime(3) format for 12hr time w/seconds */ + fmt = T_("%l:%M:%S %p"); + else if (twelvehour) + /* TRANSLATORS: a strftime(3) format for 12hr time */ + fmt = T_("%l:%M %p"); + else if (show_seconds) + /* TRANSLATORS: a strftime(3) format for 24hr time w/seconds */ + fmt = T_("%H:%M:%S"); + else + /* TRANSLATORS: a strftime(3) format for 24hr time */ + fmt = T_("%H:%M"); + + return fmt; +} + +/*** +**** +***/ + typedef enum { DATE_PROXIMITY_TODAY, @@ -293,8 +318,10 @@ get_terse_date_format_string (date_proximity_t proximity) const gchar* get_terse_header_time_format_string (void) { - /* a strftime(3) fmt string for a H:MM 12 hour time, eg "6:59 PM" */ - return T_("%l:%M %p"); + const gboolean twelvehour = is_locale_12h (); + const gboolean show_seconds = FALSE; + + return get_default_header_time_format (twelvehour, show_seconds); } const gchar * @@ -374,7 +401,6 @@ get_full_time_format_string (GSettings * settings) { gboolean twelvehour; gboolean show_seconds; - const gchar * fmt; g_return_val_if_fail (settings != NULL, NULL); @@ -395,20 +421,7 @@ get_full_time_format_string (GSettings * settings) break; } - if (twelvehour && show_seconds) - /* TRANSLATORS: a strftime(3) format for 12hr time w/seconds */ - fmt = T_("%l:%M:%S %p"); - else if (twelvehour) - /* TRANSLATORS: a strftime(3) format for 12hr time */ - fmt = T_("%l:%M %p"); - else if (show_seconds) - /* TRANSLATORS: a strftime(3) format for 24hr time w/seconds */ - fmt = T_("%H:%M:%S"); - else - /* TRANSLATORS: a strftime(3) format for 24hr time */ - fmt = T_("%H:%M"); - - return fmt; + return get_default_header_time_format (twelvehour, show_seconds); } gchar * -- cgit v1.2.3 From 358b551cd1ab977c0c2931eacf0d5ebf1f7f7fef Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 09:44:46 -0600 Subject: fix minor naming error in the interim library that we link the unit tests and final product service against --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d51385..15f29ea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -set (SERVICE_LIB "libindicatordatetimeservice") +set (SERVICE_LIB "indicatordatetimeservice") set (SERVICE_EXEC "indicator-datetime-service") add_definitions (-DTIMEZONE_FILE="/etc/timezone" -- cgit v1.2.3 From 5b5546a50c9a323942ca5abae81563ae2c709042 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 09:48:35 -0600 Subject: in tests/, add rules to make the Google Test library --- tests/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 682896b..e6b3e2d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,12 @@ +# build libgtest +add_library (gtest STATIC + ${GTEST_SOURCE_DIR}/gtest-all.cc + ${GTEST_SOURCE_DIR}/gtest_main.cc) +set_target_properties (gtest PROPERTIES INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${GTEST_INCLUDE_DIR}) +set_target_properties (gtest PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -w) + +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -g ${CC_WARNING_ARGS}") + # build the necessary schemas set_directory_properties (PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled) -- cgit v1.2.3 From 40f91368f6ac0bb3ebf86e349be0779e6f2746b8 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 09:49:40 -0600 Subject: in tests/, fix typo in schema generator rules --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e6b3e2d..0a3284b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,7 +21,7 @@ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compil OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_command (OUTPUT gschemas.compiled - DEPENDS ${CMAKE_SOURCE_DIR}/data/com.canonical.indicator.session.gschema.xml + DEPENDS ${CMAKE_SOURCE_DIR}/data/com.canonical.indicator.datetime.gschema.xml COMMAND cp -f ${CMAKE_SOURCE_DIR}/data/*gschema.xml ${SCHEMA_DIR} COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR}) -- cgit v1.2.3 From 75b0a871e757b1e71539bd0bd8d52065bd2a85ec Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 09:50:27 -0600 Subject: in tests/, fix the include dirs to look at the source and binary dirs so we can pick up autogenerated headers --- tests/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0a3284b..60e0507 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,8 +25,10 @@ add_custom_command (OUTPUT gschemas.compiled COMMAND cp -f ${CMAKE_SOURCE_DIR}/data/*gschema.xml ${SCHEMA_DIR} COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR}) -# look for hearder in our src dir, and also in the directories where we autogenerate files... +# look for headers in our src dir, and also in the directories where we autogenerate files... include_directories (${CMAKE_SOURCE_DIR}/src) -include_directories (${CMAKE_CURRENT_BINARY_DIR} ${SERVICE_INCLUDE_DIRS}) +include_directories (${CMAKE_CURRENT_BINARY_DIR}) +include_directories (${SERVICE_DEPS_INCLUDE_DIRS}) +include_directories (${DBUSTEST_INCLUDE_DIRS}) -- cgit v1.2.3 From 8c89aa772071eaa5f4c2b8bc37cb346d80a0ad6e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 09:51:20 -0600 Subject: Add tests to confirm the phone profile header's time format is sensitive to 12/24hr locales (bug #1256061) --- tests/CMakeLists.txt | 8 ++++ tests/glib-fixture.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/test-formatter.cc | 108 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 tests/glib-fixture.h create mode 100644 tests/test-formatter.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 60e0507..a10bcd0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,4 +31,12 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}) include_directories (${SERVICE_DEPS_INCLUDE_DIRS}) include_directories (${DBUSTEST_INCLUDE_DIRS}) +add_definitions (-DSANDBOX="${CMAKE_CURRENT_BINARY_DIR}") + +# test-formatter +set (TEST_NAME test-formatter) +add_executable (${TEST_NAME} test-formatter.cc gschemas.compiled) +add_test (${TEST_NAME} ${TEST_NAME}) +add_dependencies (${TEST_NAME} libindicatordatetimeservice) +target_link_libraries (${TEST_NAME} indicatordatetimeservice gtest ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS}) diff --git a/tests/glib-fixture.h b/tests/glib-fixture.h new file mode 100644 index 0000000..4128033 --- /dev/null +++ b/tests/glib-fixture.h @@ -0,0 +1,119 @@ +/* + * Copyright 2013 Canonical Ltd. + * + * Authors: + * Charles Kerr + * + * 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 . + */ + +#include + +#include +#include +#include + +#include + +class GlibFixture : public ::testing::Test +{ + private: + + GLogFunc realLogHandler; + + protected: + + std::map logCounts; + + void testLogCount (GLogLevelFlags log_level, int expected G_GNUC_UNUSED) + { + ASSERT_EQ (expected, logCounts[log_level]); + + logCounts.erase (log_level); + } + + private: + + static void default_log_handler (const gchar * log_domain G_GNUC_UNUSED, + GLogLevelFlags log_level, + const gchar * message G_GNUC_UNUSED, + gpointer self) + { + static_cast(self)->logCounts[log_level]++; + } + + protected: + + virtual void SetUp () + { + loop = g_main_loop_new (NULL, FALSE); + + g_log_set_default_handler (default_log_handler, this); + + // only use local, temporary settings + g_setenv ("GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, TRUE); + g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); + g_debug ("SCHEMA_DIR is %s", SCHEMA_DIR); + } + + virtual void TearDown() + { + // confirm there aren't any unexpected log messages + ASSERT_EQ (0, logCounts[G_LOG_LEVEL_ERROR]); + ASSERT_EQ (0, logCounts[G_LOG_LEVEL_CRITICAL]); + ASSERT_EQ (0, logCounts[G_LOG_LEVEL_WARNING]); + ASSERT_EQ (0, logCounts[G_LOG_LEVEL_MESSAGE]); + ASSERT_EQ (0, logCounts[G_LOG_LEVEL_INFO]); + + // revert to glib's log handler + g_log_set_default_handler (realLogHandler, this); + + g_clear_pointer (&loop, g_main_loop_unref); + } + + private: + + static gboolean + wait_for_signal__timeout (gpointer name) + { + g_error ("%s: timed out waiting for signal '%s'", G_STRLOC, (char*)name); + return G_SOURCE_REMOVE; + } + + protected: + + /* convenience func to loop while waiting for a GObject's signal */ + void wait_for_signal (gpointer o, const gchar * signal, const int timeout_seconds=5) + { + // wait for the signal or for timeout, whichever comes first + guint handler_id = g_signal_connect_swapped (o, signal, + G_CALLBACK(g_main_loop_quit), + loop); + gulong timeout_id = g_timeout_add_seconds (timeout_seconds, + wait_for_signal__timeout, + loop); + g_main_loop_run (loop); + g_source_remove (timeout_id); + g_signal_handler_disconnect (o, handler_id); + } + + /* convenience func to loop for N msec */ + void wait_msec (int msec=50) + { + guint id = g_timeout_add (msec, (GSourceFunc)g_main_loop_quit, loop); + g_main_loop_run (loop); + g_source_remove (id); + } + + GMainLoop * loop; +}; diff --git a/tests/test-formatter.cc b/tests/test-formatter.cc new file mode 100644 index 0000000..488d9e1 --- /dev/null +++ b/tests/test-formatter.cc @@ -0,0 +1,108 @@ + +/* + * Copyright 2013 Canonical Ltd. + * + * Authors: + * Charles Kerr + * + * 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 . + */ + +#include +#include + +#include +#include + +#include + +#include "utils.h" +#include "settings-shared.h" + +#include "glib-fixture.h" + +/*** +**** +***/ + +class FormatterFixture: public GlibFixture +{ + private: + + typedef GlibFixture super; + gchar * original_locale = nullptr; + + protected: + + GSettings * settings = nullptr; + + virtual void SetUp () + { + super::SetUp (); + + settings = g_settings_new (SETTINGS_INTERFACE); + + original_locale = g_strdup (setlocale (LC_TIME, NULL)); + } + + virtual void TearDown () + { + g_clear_object (&settings); + + 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); + } +} -- cgit v1.2.3 From 54cf4f28f2284ee2700e6806b2ab1cbba355dfba Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 10:01:39 -0600 Subject: in tests/, remove a couple of rules that got pulled in from the dev branch but aren't necessary here --- tests/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a10bcd0..23f96b9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,9 +29,6 @@ add_custom_command (OUTPUT gschemas.compiled include_directories (${CMAKE_SOURCE_DIR}/src) include_directories (${CMAKE_CURRENT_BINARY_DIR}) include_directories (${SERVICE_DEPS_INCLUDE_DIRS}) -include_directories (${DBUSTEST_INCLUDE_DIRS}) - -add_definitions (-DSANDBOX="${CMAKE_CURRENT_BINARY_DIR}") # test-formatter set (TEST_NAME test-formatter) -- cgit v1.2.3 From 77608001413236f5decbfabea3392137127bd1c1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 10:36:46 -0600 Subject: in test-formatter, the 12h/24h unit test doesn't need our gschema, so remove it from this MP --- tests/CMakeLists.txt | 2 +- tests/test-formatter.cc | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 23f96b9..6564a25 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -32,7 +32,7 @@ include_directories (${SERVICE_DEPS_INCLUDE_DIRS}) # test-formatter set (TEST_NAME test-formatter) -add_executable (${TEST_NAME} test-formatter.cc gschemas.compiled) +add_executable (${TEST_NAME} test-formatter.cc) add_test (${TEST_NAME} ${TEST_NAME}) add_dependencies (${TEST_NAME} libindicatordatetimeservice) target_link_libraries (${TEST_NAME} indicatordatetimeservice gtest ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS}) diff --git a/tests/test-formatter.cc b/tests/test-formatter.cc index 488d9e1..6a408ab 100644 --- a/tests/test-formatter.cc +++ b/tests/test-formatter.cc @@ -18,16 +18,12 @@ * with this program. If not, see . */ -#include -#include - #include #include #include #include "utils.h" -#include "settings-shared.h" #include "glib-fixture.h" @@ -44,21 +40,15 @@ class FormatterFixture: public GlibFixture protected: - GSettings * settings = nullptr; - virtual void SetUp () { super::SetUp (); - settings = g_settings_new (SETTINGS_INTERFACE); - original_locale = g_strdup (setlocale (LC_TIME, NULL)); } virtual void TearDown () { - g_clear_object (&settings); - setlocale (LC_TIME, original_locale); g_clear_pointer (&original_locale, g_free); -- cgit v1.2.3 From bb0c9077bbdf00adf7b737a84730959250d91200 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 10:44:37 -0600 Subject: let's see what g_warning jenkins found. --- tests/glib-fixture.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/glib-fixture.h b/tests/glib-fixture.h index 4128033..c6ecc68 100644 --- a/tests/glib-fixture.h +++ b/tests/glib-fixture.h @@ -44,11 +44,12 @@ class GlibFixture : public ::testing::Test private: - static void default_log_handler (const gchar * log_domain G_GNUC_UNUSED, + static void default_log_handler (const gchar * log_domain, GLogLevelFlags log_level, - const gchar * message G_GNUC_UNUSED, + const gchar * message, gpointer self) { + g_print ("%s - %d - %s", log_domain, (int)log_level, message); static_cast(self)->logCounts[log_level]++; } -- cgit v1.2.3 From 080af76066c8781b4b6dbfcc447c13fb0d1bb28c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 11:57:58 -0600 Subject: ensure that we have 12h and 24h locales installed at build time -- the unit tests need them --- debian/control | 1 + debian/locale-gen | 31 +++++++++++++++++++++++++++++++ debian/rules | 3 +++ 3 files changed, 35 insertions(+) create mode 100644 debian/locale-gen diff --git a/debian/control b/debian/control index 357b099..ade7f2e 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Build-Depends: cmake, libgnome-control-center-dev, libtimezonemap1-dev, liburl-dispatcher1-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 diff --git a/debian/locale-gen b/debian/locale-gen new file mode 100644 index 0000000..437dec5 --- /dev/null +++ b/debian/locale-gen @@ -0,0 +1,31 @@ +#!/bin/sh + +LOCPATH=`pwd`/locales +export LOCPATH + +[ -d $LOCPATH ] || mkdir -p $LOCPATH + +umask 022 + +echo "Generating locales..." +while read locale charset; do + case $locale in \#*) continue;; esac + [ -n "$locale" -a -n "$charset" ] || continue + echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`" + echo -n ".$charset" + echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'` + echo -n '...' + if [ -f $LOCPATH/$locale ]; then + input=$locale + else + input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'` + fi + localedef -i $input -c -f $charset $LOCPATH/$locale #-A /etc/locale.alias + echo ' done'; \ +done <> $$d; \ done; +override_dh_auto_test: + sh debian/locale-gen + LOCPATH="$(CURDIR)/locales" dh_auto_test -- cgit v1.2.3 From b91dc2ac50d421d29e22bac9c9564029ba64350d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Dec 2013 12:20:58 -0600 Subject: try adding a build-dep of language-pack-en-base instead of configuring the locales in the unit test sandbox. (h/t seb) --- debian/control | 2 ++ debian/locale-gen | 31 ------------------------------- debian/rules | 3 --- 3 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 debian/locale-gen diff --git a/debian/control b/debian/control index ade7f2e..d9d4f56 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,14 @@ Source: indicator-datetime Section: misc Priority: optional Maintainer: Ubuntu Desktop Team +# 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), diff --git a/debian/locale-gen b/debian/locale-gen deleted file mode 100644 index 437dec5..0000000 --- a/debian/locale-gen +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -LOCPATH=`pwd`/locales -export LOCPATH - -[ -d $LOCPATH ] || mkdir -p $LOCPATH - -umask 022 - -echo "Generating locales..." -while read locale charset; do - case $locale in \#*) continue;; esac - [ -n "$locale" -a -n "$charset" ] || continue - echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`" - echo -n ".$charset" - echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'` - echo -n '...' - if [ -f $LOCPATH/$locale ]; then - input=$locale - else - input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'` - fi - localedef -i $input -c -f $charset $LOCPATH/$locale #-A /etc/locale.alias - echo ' done'; \ -done <> $$d; \ done; -override_dh_auto_test: - sh debian/locale-gen - LOCPATH="$(CURDIR)/locales" dh_auto_test -- cgit v1.2.3 From 707292ed0f2d5e55c718b1ed55d274a9ad5c2121 Mon Sep 17 00:00:00 2001 From: Automatic PS uploader Date: Tue, 17 Dec 2013 09:49:56 +0000 Subject: Releasing 13.10.0+14.04.20131217-0ubuntu1, based on r291 --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 Tue, 17 Dec 2013 09:49:56 +0000 + indicator-datetime (13.10.0+14.04.20131125-0ubuntu1) trusty; urgency=low [ Charles Kerr ] -- cgit v1.2.3 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 From ad76159088202f6e4390843cfed6dd712b8e2544 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Tue, 14 Jan 2014 17:41:03 +1300 Subject: Recommend unity-control-center before gnome-control-center --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 3bd1fef..0b9d12b 100644 --- a/debian/control +++ b/debian/control @@ -46,7 +46,7 @@ Depends: ${shlibs:Depends}, systemd-shim, Recommends: indicator-applet | indicator-renderer, evolution-data-server, - gnome-control-center-datetime | unity-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) -- cgit v1.2.3