From 62d01fc8749606d8fc4614d897044462a6d703fc Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 18 Oct 2013 14:22:54 -0500 Subject: replace autotools with cmake --- data/CMakeLists.txt | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ data/Makefile.am | 45 -------------------------------- 2 files changed, 74 insertions(+), 45 deletions(-) create mode 100644 data/CMakeLists.txt delete mode 100644 data/Makefile.am (limited to 'data') diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..f0738b3 --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,74 @@ +## +## GSettings schema +## + +include (UseGSettings) +set (SCHEMA_NAME "com.canonical.indicator.datetime.gschema.xml") +set (SCHEMA_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME}") +add_schema (${SCHEMA_FILE}) + + +## +## DBus Service File +## + +# where to install +set (DBUS_SERVICE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/services") +message (STATUS "${DBUS_SERVICE_DIR} is the DBus Service File install dir") + +set (SERVICE_NAME "${CMAKE_PROJECT_NAME}.service") +set (SERVICE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SERVICE_NAME}") +set (SERVICE_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SERVICE_NAME}.in") + +# build it +set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}") +configure_file ("${SERVICE_FILE_IN}" "${SERVICE_FILE}") + +# install it +install (FILES "${SERVICE_FILE}" + DESTINATION "${DBUS_SERVICE_DIR}") + + +## +## Unity Indicator File +## + +# where to install +set (UNITY_INDICATOR_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/unity/indicators") +message (STATUS "${UNITY_INDICATOR_DIR} is the Unity Indicator install dir") + +set (UNITY_INDICATOR_NAME "com.canonical.indicator.datetime") +set (UNITY_INDICATOR_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_INDICATOR_NAME}") + +install (FILES "${UNITY_INDICATOR_FILE}" + DESTINATION "${UNITY_INDICATOR_DIR}") + + +## +## FIXME: gnome-control-center panel +## + +if (BUILD_PANEL) + + install (FILES "datetime-dialog.ui" + DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") + + # generate the desktop file using intltool + set (DESKTOP_NAME "gnome-indicator-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 --xml-style --utf8 --no-translations "${DESKTOP_FILE_IN}" "${DESKTOP_FILE}") + install (FILES ${DESKTOP_FILE} + DESTINATION "${CMAKE_INSTALL_DATADIR}/applications") + +endif () + +#if BUILD_CCPANEL +# @INTLTOOL_DESKTOP_RULE@ +# desktopdir = $(datadir)/applications +# desktop_DATA = gnome-indicator-datetime-panel.desktop +# EXTRA_DIST += $(desktop_DATA) +# CLEANFILES += $(desktop_DATA) +#endif +#EXTRA_DIST += datetime-dialog.ui $(desktop_DATA:.desktop=.desktop.in) diff --git a/data/Makefile.am b/data/Makefile.am deleted file mode 100644 index 9bcac72..0000000 --- a/data/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -BUILT_SOURCES= -CLEANFILES= -EXTRA_DIST= - -# -# the indicator bus file -# - -indicatorsdir = $(prefix)/share/unity/indicators -dist_indicators_DATA = com.canonical.indicator.datetime - -# -# the gsettings -# - -gsettings_SCHEMAS = com.canonical.indicator.datetime.gschema.xml -@GSETTINGS_RULES@ -EXTRA_DIST += $(gsettings_SCHEMAS) - -# -# the dbus service file -# - -dbus_servicesdir = $(datadir)/dbus-1/services -dbus_services_DATA = indicator-datetime.service -dbus_services_in = $(dbus_services_DATA:.service=.service.in) -$(dbus_services_DATA): $(dbus_services_in) - $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ -BUILT_SOURCES += $(dbus_services_DATA) -CLEANFILES += $(dbus_services_DATA) -EXTRA_DIST += $(dbus_services_in) - -# -# the gnome-control-center panel -# - -if BUILD_CCPANEL - pkgdata_DATA = datetime-dialog.ui - @INTLTOOL_DESKTOP_RULE@ - desktopdir = $(datadir)/applications - desktop_DATA = gnome-indicator-datetime-panel.desktop - EXTRA_DIST += $(desktop_DATA) - CLEANFILES += $(desktop_DATA) -endif -EXTRA_DIST += datetime-dialog.ui $(desktop_DATA:.desktop=.desktop.in) -- cgit v1.2.3 From ad4f98ea56af0ce143b369abf55e35c22f29e3b5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 18 Oct 2013 14:46:46 -0500 Subject: fix .desktop file generation in CMake --- data/CMakeLists.txt | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'data') diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index f0738b3..76a348e 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -58,17 +58,8 @@ if (BUILD_PANEL) 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 --xml-style --utf8 --no-translations "${DESKTOP_FILE_IN}" "${DESKTOP_FILE}") + 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 () - -#if BUILD_CCPANEL -# @INTLTOOL_DESKTOP_RULE@ -# desktopdir = $(datadir)/applications -# desktop_DATA = gnome-indicator-datetime-panel.desktop -# EXTRA_DIST += $(desktop_DATA) -# CLEANFILES += $(desktop_DATA) -#endif -#EXTRA_DIST += datetime-dialog.ui $(desktop_DATA:.desktop=.desktop.in) -- cgit v1.2.3 From 02e2a8f982de341fbfa3f17fa0feee485339e6c5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 29 Oct 2013 09:50:36 -0700 Subject: remove the panel FIXME comments in data/CMakeLists.txt b/c the .ui and .desktop files are being installed now --- INSTALL | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ data/CMakeLists.txt | 5 ++-- 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 INSTALL (limited to 'data') diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..6db8c1c --- /dev/null +++ b/INSTALL @@ -0,0 +1,75 @@ +# +# Copyright (C) 2013 Canonical Ltd +# +# 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 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 this program. If not, see . +# + +BUILD DEPENDENCIES +================== + +build dependencies for indicator-datetime-service + * glib-2.0 >= 2.36 + * gio-unix-2.0 >= 2.36 + * geoclue >= 0.12 + * libical >= 0.48 + * libecal-1.2 >= 3.5 + * libedataserver-1.2 >= 3.5 + * libnotify >= 0.7.6 + * url-dispatcher-1 >= 1 + * json-glib-1.0 >= 0.16.2 + + +Additional build dependencies for the gnome-control-center panel: + * gtk+-3.0>=3.1.4 + * timezonemap + * libgnome-control-center + * polkit-gobject-1 + +Build dependencies for testing / code coverage: + * gcovr (gcovr, 2.4 or later) + * lcov (lcov, 1.9 or later) + * google test (libgtest-dev, 1.6.0 or later) + * cppcheck (cppcheck) + + +Building the code +----------------- + 1. $ cd indicator-datetime-X.Y.Z + 2. $ mkdir build + 3. $ cd build + 4. $ cmake .. + or + $ cmake -DCMAKE_INSTALL_PREFIX=/your/install/prefix/here .. + or + $ cmake -GNinja .. + 5. $ make + +Running the tests +----------------- + 1. $ cd indicator-datetime-X.Y.Z + 2. $ mkdir build + 3. $ cd build + 4. $ cmake .. + 5. $ make + 6. $ make test + 7. $ make cppcheck + +Generating Test Coverage Reports +-------------------------------- + 1. $ cd indicator-datetime-X.Y.Z + 2. $ mkdir build-coverage + 3. $ cd build-coverage + 4. $ cmake -DCMAKE_BUILD_TYPE=coverage .. + 5. $ make + 6. $ make coverage-html + diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 76a348e..197c5c6 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -45,15 +45,16 @@ install (FILES "${UNITY_INDICATOR_FILE}" ## -## FIXME: gnome-control-center panel +## gnome-control-center panel: .ui and .desktop files ## if (BUILD_PANEL) + # the .ui file install (FILES "datetime-dialog.ui" DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") - # generate the desktop file using intltool + # the .desktop file set (DESKTOP_NAME "gnome-indicator-datetime-panel.desktop") set (DESKTOP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_NAME}") set (DESKTOP_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${DESKTOP_NAME}.in") -- cgit v1.2.3 From e2bc82355ac369bc2f22bf0b9f679130e0299204 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 29 Oct 2013 11:19:44 -0700 Subject: point the dbus service file at pkglibexecdir --- data/indicator-datetime.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data') diff --git a/data/indicator-datetime.service.in b/data/indicator-datetime.service.in index e7735ce..a9100b8 100644 --- a/data/indicator-datetime.service.in +++ b/data/indicator-datetime.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=com.canonical.indicator.datetime -Exec=@libexecdir@/indicator-datetime-service +Exec=@pkglibexecdir@/indicator-datetime-service -- cgit v1.2.3 From 19663dd8958f833385470c6d67f1d80923f33fd0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 30 Oct 2013 15:29:43 -0700 Subject: Add support for showing the year in indicator-datetime --- data/com.canonical.indicator.datetime.gschema.xml | 9 +++++ data/datetime-dialog.ui | 45 +++++++++++++++++++++-- panel/datetime-prefs.c | 5 ++- src/service.c | 5 ++- src/settings-shared.h | 1 + src/utils.c | 32 +++++++++++----- src/utils.h | 1 + 7 files changed, 83 insertions(+), 15 deletions(-) (limited to 'data') diff --git a/data/com.canonical.indicator.datetime.gschema.xml b/data/com.canonical.indicator.datetime.gschema.xml index 4f831d5..1a5922c 100644 --- a/data/com.canonical.indicator.datetime.gschema.xml +++ b/data/com.canonical.indicator.datetime.gschema.xml @@ -64,6 +64,15 @@ time-format value is set to custom. + + false + Show the year in the indicator + + Puts the year in the panel along with the month and the date. + This setting will be ignored if either the time-format value is set to custom + or if show-date is set to false. + + true Show the monthly calendar in the indicator diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui index 430f77f..6f74cd0 100644 --- a/data/datetime-dialog.ui +++ b/data/datetime-dialog.ui @@ -529,7 +529,7 @@ - + _Date and month True True @@ -545,6 +545,45 @@ 2 + + + True + False + 0 + 0 + 0 + 24 + + + True + False + 6 + + + _Year + True + True + False + False + True + 0 + True + + + True + True + 0 + + + + + + + False + True + 3 + + True @@ -589,7 +628,7 @@ False True - 3 + 4 @@ -606,7 +645,7 @@ False True - 4 + 5 diff --git a/panel/datetime-prefs.c b/panel/datetime-prefs.c index 8e5ee35..55456ac 100644 --- a/panel/datetime-prefs.c +++ b/panel/datetime-prefs.c @@ -699,7 +699,9 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self) "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (conf, SETTINGS_SHOW_DAY_S, WIG ("showWeekdayCheck"), "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateTimeCheck"), + g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateAndMonthCheck"), + "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (conf, SETTINGS_SHOW_YEAR_S, WIG ("showYearCheck"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (conf, SETTINGS_SHOW_SECONDS_S, WIG ("showSecondsCheck"), "active", G_SETTINGS_BIND_DEFAULT); @@ -725,6 +727,7 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self) "active", G_SETTINGS_BIND_DEFAULT); /* Set up sensitivities */ + add_widget_dependency (WIG ("showDateAndMonthCheck"), WIG ("showYearCheck")); add_widget_dependency (WIG ("showCalendarCheck"), WIG ("calendarOptions")); add_widget_dependency (WIG ("showClockCheck"), WIG ("clockOptions")); add_widget_dependency (WIG ("showLocationsCheck"), WIG ("locationsButton")); diff --git a/src/service.c b/src/service.c index 6fb2ded..0ed7d02 100644 --- a/src/service.c +++ b/src/service.c @@ -666,7 +666,8 @@ get_header_label_format_string (IndicatorDatetimeService * self) { gboolean show_day = g_settings_get_boolean (s, SETTINGS_SHOW_DAY_S); gboolean show_date = g_settings_get_boolean (s, SETTINGS_SHOW_DATE_S); - fmt = generate_full_format_string (show_day, show_date, s); + gboolean show_year = show_date && g_settings_get_boolean (s, SETTINGS_SHOW_YEAR_S); + fmt = generate_full_format_string (show_day, show_date, show_year, s); } p->header_label_format_string = fmt; @@ -1495,6 +1496,7 @@ on_desktop_settings_activated (GSimpleAction * a G_GNUC_UNUSED, #ifdef HAVE_CCPANEL execute_command ("gnome-control-center indicator-datetime"); #else +#error blah execute_command ("gnome-control-center datetime"); #endif } @@ -2182,6 +2184,7 @@ my_constructed (GObject * gself) SETTINGS_SHOW_SECONDS_S, SETTINGS_SHOW_DAY_S, SETTINGS_SHOW_DATE_S, + SETTINGS_SHOW_YEAR_S, SETTINGS_CUSTOM_TIME_FORMAT_S }; const char * const calendar_settings[] = { diff --git a/src/settings-shared.h b/src/settings-shared.h index afcccb6..4615fe8 100644 --- a/src/settings-shared.h +++ b/src/settings-shared.h @@ -37,6 +37,7 @@ TimeFormatMode; #define SETTINGS_SHOW_SECONDS_S "show-seconds" #define SETTINGS_SHOW_DAY_S "show-day" #define SETTINGS_SHOW_DATE_S "show-date" +#define SETTINGS_SHOW_YEAR_S "show-year" #define SETTINGS_CUSTOM_TIME_FORMAT_S "custom-time-format" #define SETTINGS_SHOW_CALENDAR_S "show-calendar" #define SETTINGS_SHOW_WEEK_NUMBERS_S "show-week-numbers" diff --git a/src/utils.c b/src/utils.c index d1e1fbf..5539c5c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -329,19 +329,31 @@ generate_terse_format_string_at_time (GDateTime * now, GDateTime * time) ***/ static const gchar * -get_full_date_format_string (gboolean show_day, gboolean show_date) +get_full_date_format_string (gboolean show_day, gboolean show_date, gboolean show_year) { - const gchar * fmt; + const char * fmt; - if (show_date && show_day) - /* TRANSLATORS: a strftime(3) format showing the date and weekday */ + if (show_day && show_date && show_year) + /* TRANSLATORS: a strftime(3) format showing the weekday, date, and year */ + fmt = T_("%a %b %e %Y"); + else if (show_day && show_date) + /* TRANSLATORS: a strftime(3) format showing the weekday and date */ fmt = T_("%a %b %e"); + else if (show_day && show_year) + /* TRANSLATORS: a strftime(3) format showing the weekday and year. */ + fmt = T_("%a %Y"); + else if (show_day) + /* TRANSLATORS: a strftime(3) format showing the weekday. */ + fmt = T_("%a"); + else if (show_date && show_year) + /* TRANSLATORS: a strftime(3) format showing the date and year */ + fmt = T_("%b %e %Y"); else if (show_date) /* TRANSLATORS: a strftime(3) format showing the date */ fmt = T_("%b %e"); - else if (show_day) - /* TRANSLATORS: a strftime(3) format showing the weekday */ - fmt = T_("%a"); + else if (show_year) + /* TRANSLATORS: a strftime(3) format showing the year */ + fmt = T_("%Y"); else fmt = NULL; @@ -400,9 +412,9 @@ get_full_time_format_string (GSettings * settings) } gchar * -generate_full_format_string (gboolean show_day, gboolean show_date, GSettings * settings) +generate_full_format_string (gboolean show_day, gboolean show_date, gboolean show_year, GSettings * settings) { - const gchar * date_fmt = get_full_date_format_string (show_day, show_date); + const gchar * date_fmt = get_full_date_format_string (show_day, show_date, show_year); const gchar * time_fmt = get_full_time_format_string (settings); return join_date_and_time_format_strings (date_fmt, time_fmt); } @@ -436,6 +448,6 @@ generate_full_format_string_at_time (GDateTime * now, GDateTime * time, GSetting break; } - return generate_full_format_string (show_day, show_date, settings); + return generate_full_format_string (show_day, show_date, FALSE, settings); } diff --git a/src/utils.h b/src/utils.h index 24eddb6..5eacce5 100644 --- a/src/utils.h +++ b/src/utils.h @@ -54,6 +54,7 @@ gchar * generate_terse_format_string_at_time (GDateTime * now, gchar * generate_full_format_string (gboolean show_day, gboolean show_date, + gboolean show_year, GSettings * settings); gchar * generate_full_format_string_at_time (GDateTime * now, -- cgit v1.2.3