diff options
40 files changed, 685 insertions, 569 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0ee5cf9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,103 @@ +project (indicator-datetime C CXX) +cmake_minimum_required (VERSION 2.8.9) + +list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + +set (PROJECT_VERSION "14.04.0") +set (PACKAGE ${CMAKE_PROJECT_NAME}) +set (GETTEXT_PACKAGE "indicator-datetime") +add_definitions (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}" + -DGNOMELOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}") + +option (enable_tests "Build the package's automatic tests." ON) +option (enable_lcov "Generate lcov code coverage reports." ON) + +## +## GNU standard installation directories +## + +include (GNUInstallDirs) +if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian + set (CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}") + set (CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBDIR}") +endif () +set (CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}") +set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}") + +## +## Check for prerequisites +## + +find_package (PkgConfig REQUIRED) +include (FindPkgConfig) + +pkg_check_modules (SERVICE_DEPS REQUIRED + 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) +include_directories (${SERVICE_INCLUDE_DIRS}) + +pkg_check_modules (PANEL_DEPS + glib-2.0>=2.36 + gio-unix-2.0>=2.36 + gtk+-3.0>=3.1.4 + timezonemap + libgnome-control-center + polkit-gobject-1) +if (PANEL_DEPS_FOUND) + set (BUILD_PANEL 1) +endif () + +## +## custom targets +## + +set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}) +add_custom_target (dist + COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + +add_custom_target (clean-coverage + COMMAND find ${CMAKE_BINARY_DIR} -name '*.gcda' | xargs rm -f) + +add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2 --inline-suppr + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/tests) + +## +## Actual building +## + +set (CC_WARNING_ARGS " -Wall -Wshadow -Wextra -Wunused -Wformat=2 -Wno-missing-field-initializers") + +include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src) +include_directories (${CMAKE_CURRENT_BINARY_DIR}/src) + +# testing & coverage +if (${enable_tests}) + set (GTEST_SOURCE_DIR /usr/src/gtest/src) + set (GTEST_INCLUDE_DIR ${GTEST_SOURCE_DIR}/..) + set (GTEST_LIBS -lpthread) + enable_testing () + if (${enable_lcov}) + include(GCov) + endif () +endif () + +# actually build things +add_subdirectory (src) +if (BUILD_PANEL) + add_subdirectory (panel) +endif () +add_subdirectory (data) +add_subdirectory (po) +if (${enable_tests}) + add_subdirectory (tests) +endif () + @@ -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 <http://www.gnu.org/licenses/>. +# + +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/Makefile.am b/Makefile.am deleted file mode 100644 index 133a0da..0000000 --- a/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} - -SUBDIRS = po data src - -if BUILD_TESTS -SUBDIRS += tests -# build src first -tests: src -endif - -EXTRA_DIST = autogen.sh - -dist-hook: - @if test -d "$(top_srcdir)/.bzr"; \ - then \ - echo Creating ChangeLog && \ - ( cd "$(top_srcdir)" && \ - echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/build-aux/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ - && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ - || (rm -f ChangeLog.tmp; \ - echo Failed to generate ChangeLog >&2 ); \ - else \ - echo Failed to generate ChangeLog: not a branch >&2; \ - fi - @if test -d "$(top_srcdir)/.bzr"; \ - then \ - echo Creating AUTHORS && \ - ( cd "$(top_srcdir)" && \ - echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/build-aux/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ - && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \ - || (rm -f AUTHORS.tmp; \ - echo Failed to generate AUTHORS >&2 ); \ - else \ - echo Failed to generate AUTHORS: not a branch >&2; \ - fi - -include $(top_srcdir)/Makefile.am.coverage diff --git a/Makefile.am.coverage b/Makefile.am.coverage deleted file mode 100644 index fb97747..0000000 --- a/Makefile.am.coverage +++ /dev/null @@ -1,48 +0,0 @@ - -# Coverage targets - -.PHONY: clean-gcno clean-gcda \ - coverage-html generate-coverage-html clean-coverage-html \ - coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr - -clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr - -if HAVE_GCOV - -clean-gcno: - @echo Removing old coverage instrumentation - -find -name '*.gcno' -print | xargs -r rm - -clean-gcda: - @echo Removing old coverage results - -find -name '*.gcda' -print | xargs -r rm - -coverage-html: clean-gcda - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html - -generate-coverage-html: - @echo Collecting coverage data - $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool - LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info - -clean-coverage-html: clean-gcda - -$(LCOV) --directory $(top_builddir) -z - -rm -rf coverage.info coveragereport - -if HAVE_GCOVR - -coverage-gcovr: clean-gcda - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr - -generate-coverage-gcovr: - @echo Generating coverage GCOVR report - $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml - -clean-coverage-gcovr: clean-gcda - -rm -rf $(top_builddir)/coverage.xml - -endif # HAVE_GCOVR - -endif # HAVE_GCOV diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 3d255d3..0000000 --- a/autogen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -PKG_NAME="indicator-datetime" - -which gnome-autogen.sh || { - echo "You need gnome-common from GNOME Git" - exit 1 -} - -USE_GNOME2_MACROS=1 \ -. gnome-autogen.sh $@ diff --git a/cmake/FindIntltool.cmake b/cmake/FindIntltool.cmake new file mode 100644 index 0000000..45318c4 --- /dev/null +++ b/cmake/FindIntltool.cmake @@ -0,0 +1,23 @@ +# FindIntltool.cmake +# +# Jim Nelson <jim@yorba.org> +# Copyright 2012 Yorba Foundation + +find_program (INTLTOOL_MERGE_EXECUTABLE intltool-merge) + +if (INTLTOOL_MERGE_EXECUTABLE) + set (INTLTOOL_MERGE_FOUND TRUE) +else (INTLTOOL_MERGE_EXECUTABLE) + set (INTLTOOL_MERGE_FOUND FALSE) +endif (INTLTOOL_MERGE_EXECUTABLE) + +if (INTLTOOL_MERGE_FOUND) + macro (INTLTOOL_MERGE_DESKTOP desktop_id po_dir) + add_custom_target (geary.desktop ALL + ${INTLTOOL_MERGE_EXECUTABLE} --desktop-style ${CMAKE_SOURCE_DIR}/${po_dir} + ${CMAKE_CURRENT_SOURCE_DIR}/${desktop_id}.desktop.in ${desktop_id}.desktop + ) + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/geary.desktop DESTINATION /usr/share/applications) + endmacro (INTLTOOL_MERGE_DESKTOP desktop_id po_dir) +endif (INTLTOOL_MERGE_FOUND) + diff --git a/cmake/GCov.cmake b/cmake/GCov.cmake new file mode 100644 index 0000000..8df10ee --- /dev/null +++ b/cmake/GCov.cmake @@ -0,0 +1,50 @@ +if (CMAKE_BUILD_TYPE MATCHES coverage) + set(GCOV_FLAGS "${GCOV_FLAGS} --coverage") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCOV_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCOV_FLAGS}") + set(GCOV_LIBS ${GCOV_LIBS} gcov) + + find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin") + if (NOT GCOVR_EXECUTABLE) + message(STATUS "Gcovr binary was not found, can not generate XML coverage info.") + else () + message(STATUS "Gcovr found, can generate XML coverage info.") + add_custom_target (coverage-xml + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" -x -r "${CMAKE_SOURCE_DIR}" + --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml) + endif() + + find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin") + find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT}) + if (NOT LCOV_EXECUTABLE) + message(STATUS "Lcov binary was not found, can not generate HTML coverage info.") + else () + if(NOT GENHTML_EXECUTABLE) + message(STATUS "Genthml binary not found, can not generate HTML coverage info.") + else() + message(STATUS "Lcov and genhtml found, can generate HTML coverage info.") + add_custom_target (coverage-html + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose + COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture | ${CMAKE_SOURCE_DIR}/trim-lcov.py > dconf-lcov.info + COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details dconf-lcov.info + COMMAND ${CMAKE_COMMAND} -E echo "" + COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html" + COMMAND ${CMAKE_COMMAND} -E echo "") + #COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture --output-file coverage.info --no-checksum + #COMMAND "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info + #COMMAND ${CMAKE_COMMAND} -E echo "\\#define foo \\\"bar\\\"" + #) + endif() + endif() +endif() + + + #$(MAKE) $(AM_MAKEFLAGS) check + #lcov --directory $(top_builddir) --capture --test-name dconf | $(top_srcdir)/trim-lcov.py > dconf-lcov.info + #LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info + #@echo + #@echo " file://$(abs_top_builddir)/lcov-html/index.html" + #@echo diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake new file mode 100644 index 0000000..ddb2995 --- /dev/null +++ b/cmake/GdbusCodegen.cmake @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 2.6) +if(POLICY CMP0011) + cmake_policy(SET CMP0011 NEW) +endif(POLICY CMP0011) + +find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable") +if(NOT GDBUS_CODEGEN) + message(FATAL_ERROR "Excutable gdbus-codegen not found") +endif() + +macro(add_gdbus_codegen outfiles name prefix service_xml) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" + COMMAND "${GDBUS_CODEGEN}" + --interface-prefix "${prefix}" + --generate-c-code "${name}" + "${service_xml}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ARGN} "${service_xml}" + ) + list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c") +endmacro(add_gdbus_codegen) + +macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" + COMMAND "${GDBUS_CODEGEN}" + --interface-prefix "${prefix}" + --generate-c-code "${name}" + --c-namespace "${namespace}" + "${service_xml}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ARGN} "${service_xml}" + ) + list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c") +endmacro(add_gdbus_codegen_with_namespace) diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake new file mode 100644 index 0000000..d41f04e --- /dev/null +++ b/cmake/Translations.cmake @@ -0,0 +1,41 @@ +# Translations.cmake, CMake macros written for Marlin, feel free to re-use them + +macro(add_translations_directory NLS_PACKAGE) + add_custom_target (i18n ALL) + find_program (MSGFMT_EXECUTABLE msgfmt) + file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po) + foreach (PO_INPUT ${PO_FILES}) + get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE) + set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo) + add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT}) + + install (FILES ${MO_OUTPUT} DESTINATION + ${CMAKE_INSTALL_LOCALEDIR}/${PO_INPUT_BASE}/LC_MESSAGES + RENAME ${NLS_PACKAGE}.mo) + endforeach (PO_INPUT ${PO_FILES}) +endmacro(add_translations_directory) + + +macro(add_translations_catalog NLS_PACKAGE) + add_custom_target (pot COMMENT “Building translation catalog.”) + find_program (XGETTEXT_EXECUTABLE xgettext) + + + set(C_SOURCE "") + + foreach(FILES_INPUT ${ARGN}) + file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c) + foreach(C_FILE ${SOURCE_FILES}) + set(C_SOURCE ${C_SOURCE} ${C_FILE}) + endforeach() + file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala) + foreach(C_FILE ${SOURCE_FILES}) + set(C_SOURCE ${C_SOURCE} ${C_FILE}) + endforeach() + endforeach() + + add_custom_command (TARGET pot COMMAND + ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot + ${VALA_SOURCE} ${C_SOURCE} --keyword="_" --keyword="N_" --from-code=UTF-8 + ) +endmacro() diff --git a/cmake/UseGSettings.cmake b/cmake/UseGSettings.cmake new file mode 100644 index 0000000..3b61523 --- /dev/null +++ b/cmake/UseGSettings.cmake @@ -0,0 +1,23 @@ +# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them. + +macro(add_schema SCHEMA_NAME) + + set(PKG_CONFIG_EXECUTABLE pkg-config) + set(GSETTINGS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/glib-2.0/schemas") + + # Run the validator and error if it fails + execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_compile_schemas OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${_glib_compile_schemas} --dry-run --schema-file=${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE) + + if (_schemas_invalid) + message (SEND_ERROR "Schema validation error: ${_schemas_invalid}") + endif (_schemas_invalid) + + # Actually install and recomple schemas + message (STATUS "${GSETTINGS_DIR} is the GSettings install dir") + install (FILES ${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL) + + install (CODE "message (STATUS \"Compiling GSettings schemas\")") + install (CODE "execute_process (COMMAND ${_glib_compile_schemas} ${GSETTINGS_DIR})") +endmacro() + diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 040f222..0000000 --- a/configure.ac +++ /dev/null @@ -1,192 +0,0 @@ -AC_INIT([indicator-datetime], - [13.10.0], - [http://bugs.launchpad.net/indicator-datetime], - [indicator-datetime], - [http://launchpad.net/indicator-datetime]) -AC_COPYRIGHT([Copyright 2009-2011 Canonical]) - -AC_PREREQ([2.64]) - -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_SRCDIR([configure.ac]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_AUX_DIR([build-aux]) - -AM_INIT_AUTOMAKE([check-news 1.11 -Wall]) -AM_MAINTAINER_MODE([enable]) - -AM_SILENT_RULES([yes]) - -# Check for programs -AC_PROG_CC -AM_PROG_CC_C_O -AC_PROG_CXX -AC_HEADER_STDC -AM_PROG_AR - -# Initialize libtool -LT_PREREQ([2.2]) -LT_INIT([disable-static]) - -AC_CHECK_LIB([m],[pow]) - -AC_ARG_ENABLE([deprecations], - [AS_HELP_STRING([--enable-deprecations], - [allow deprecated API usage @<:@default=yes@:>@])], - [], - [enable_deprecations=yes]) -AS_IF([test "x$enable_deprecations" = xno], - [CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGTK_DISABLE_SINGLE_INCLUDES"] -) - -PKG_PROG_PKG_CONFIG - -########################### -# Dependencies -########################### - -GLIB_REQUIRED_VERSION=2.35.4 -GIO_REQUIRED_VERSION=2.25.11 -GEOCLUE_REQUIRED_VERSION=0.12.0 -ICAL_REQUIRED_VERSION=0.48 -ECAL_REQUIRED_VERSION=3.5 -EDS_REQUIRED_VERSION=3.5 -LIBNOTIFY_REQUIRED_VERSION=0.7.6 -URL_DISPATCHER_1_REQUIRED_VERSION=1 -JSON_GLIB_REQUIRED_VERSION=0.16.2 - -GTK3_REQUIRED_VERSION=3.1.4 - -PKG_CHECK_MODULES(SERVICE, [glib-2.0 >= $GLIB_REQUIRED_VERSION - gio-2.0 >= $GIO_REQUIRED_VERSION - geoclue >= $GEOCLUE_REQUIRED_VERSION - libical >= $ICAL_REQUIRED_VERSION - libecal-1.2 >= $ECAL_REQUIRED_VERSION - libedataserver-1.2 >= $EDS_REQUIRED_VERSION - libnotify >= $LIBNOTIFY_REQUIRED_VERSION - url-dispatcher-1 >= $URL_DISPATCHER_1_REQUIRED_VERSION - json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION]) - -########################### -# Control Center panel -########################### - -AC_ARG_WITH([ccpanel], - AS_HELP_STRING([--with-ccpanel], [enable Control Center panel]),, - with_ccpanel=auto) - -if test x"$with_ccpanel" != x"no" ; then - PKG_CHECK_MODULES([PREF], - [gio-2.0 >= $GIO_REQUIRED_VERSION - gtk+-3.0 >= $GTK3_REQUIRED_VERSION - timezonemap - libgnome-control-center - polkit-gobject-1], - [have_ccpanel=yes], - [have_ccpanel=no]) - if test x${have_ccpanel} = xyes; then - AC_DEFINE(HAVE_CCPANEL, 1, [Define to 1 to enable Control Center panel]) - PKG_CHECK_MODULES(LIBMAP, gio-2.0 >= $GIO_REQUIRED_VERSION - gtk+-3.0 >= $GTK3_REQUIRED_VERSION) - fi - if test x${with_ccpanel} = xyes && test x${have_ccpanel} = xno; then - AC_MSG_ERROR([Control Center panel configured but not found]) - fi -else - have_ccpanel=no -fi -AM_CONDITIONAL(BUILD_CCPANEL, test x${have_ccpanel} = xyes) - -########################### -# Grab the GSettings Macros -########################### - -GLIB_GSETTINGS - -########################### -# gcov coverage reporting -########################### - -m4_include([m4/gcov.m4]) -AC_TDD_GCOV -AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) -AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) -AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) -AC_SUBST(COVERAGE_CFLAGS) -AC_SUBST(COVERAGE_LDFLAGS) - -########################### -# Google Test framework -########################### - -AC_ARG_ENABLE([tests], - [AS_HELP_STRING([--disable-tests], [Disable test scripts and tools (default=auto)])], - [enable_tests=${enableval}], - [enable_tests=auto]) -if test "x$enable_tests" != "xno"; then - m4_include([m4/gtest.m4]) - CHECK_GTEST - CHECK_XORG_GTEST - if test "x$enable_tests" = "xauto"; then - enable_tests=${have_gtest} - elif test "x$enable_tests" = "xyes" && test "x$have_gtest" != "xyes"; then - AC_MSG_ERROR([tests were requested but gtest is not installed.]) - fi -fi -AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"]) - -############################## -# Custom Junk -############################## - -AC_DEFUN([AC_DEFINE_PATH], [ - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_path=`eval echo [$]$2` - ac_define_path=`eval echo [$]ac_define_path` - $1="$ac_define_path" - AC_SUBST($1) - ifelse($3, , - AC_DEFINE_UNQUOTED($1, "$ac_define_path"), - AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) -]) - -########################### -# Internationalization -########################### -IT_PROG_INTLTOOL([0.41.0]) - -GETTEXT_PACKAGE=indicator-datetime -AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default get text domain]) -AC_DEFINE_PATH(GNOMELOCALEDIR, "${datadir}/locale", [locale directory]) - -AM_GLIB_GNU_GETTEXT - -########################### -# Files -########################### - -AC_CONFIG_FILES([ -Makefile -src/Makefile -data/Makefile -tests/Makefile -po/Makefile.in -]) -AC_OUTPUT - -########################### -# Results -########################### - -AC_MSG_NOTICE([ - -Date and Time Indicator Configuration: - - Prefix: $prefix - CC Panel: $have_ccpanel - CC Panel Dir: $CCPANELDIR - Unit Tests: $enable_tests - gcov: $use_gcov -]) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..1bd74d6 --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,86 @@ +## +## 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}) + + +## +## Upstart Job File +## + +# where to install +set (UPSTART_JOB_DIR "${CMAKE_INSTALL_FULL_DATADIR}/upstart/sessions") +message (STATUS "${UPSTART_JOB_DIR} is the Upstart Job File install dir") + +set (UPSTART_JOB_NAME "${CMAKE_PROJECT_NAME}.conf") +set (UPSTART_JOB_FILE "${CMAKE_CURRENT_BINARY_DIR}/${UPSTART_JOB_NAME}") +set (UPSTART_JOB_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${UPSTART_JOB_NAME}.in") + +# build it +set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}") +configure_file ("${UPSTART_JOB_FILE_IN}" "${UPSTART_JOB_FILE}") + +# install it +install (FILES "${UPSTART_JOB_FILE}" + DESTINATION "${UPSTART_JOB_DIR}") + +## +## XDG Autostart File +## + +# where to install +set (XDG_AUTOSTART_DIR "${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/services") +message (STATUS "${XDG_AUTOSTART_DIR} is the DBus Service File install dir") + +set (XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.desktop") +set (XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${XDG_AUTOSTART_NAME}") +set (XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${XDG_AUTOSTART_NAME}.in") + +# build it +set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}") +configure_file ("${XDG_AUTOSTART_FILE_IN}" "${XDG_AUTOSTART_FILE}") + +# install it +install (FILES "${XDG_AUTOSTART_FILE}" + DESTINATION "${XDG_AUTOSTART_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}") + + +## +## 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}") + + # 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") + 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/Makefile.am b/data/Makefile.am deleted file mode 100644 index daaac51..0000000 --- a/data/Makefile.am +++ /dev/null @@ -1,58 +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 upstart job file -# - -upstart_jobsdir = $(datadir)/upstart/sessions -upstart_jobs_DATA = indicator-datetime.conf -upstart_jobs_in = $(upstart_jobs_DATA:.conf=.conf.in) -$(upstart_jobs_DATA): $(upstart_jobs_in) - $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ -BUILT_SOURCES += $(upstart_jobs_DATA) -CLEANFILES += $(upstart_jobs_DATA) -EXTRA_DIST += $(upstart_jobs_in) - -# -# the xdg autostart job file -# - -xdg_autostartdir = /etc/xdg/autostart -xdg_autostart_DATA = indicator-datetime.desktop -xdg_autostart_in = $(xdg_autostart_DATA:.desktop=.desktop.in) -$(xdg_autostart_DATA): $(xdg_autostart_in) - $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ -BUILT_SOURCES += $(xdg_autostart_DATA) -CLEANFILES += $(xdg_autostart_DATA) -EXTRA_DIST += $(xdg_autostart_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) 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. </description> </key> + <key name="show-year" type="b"> + <default>false</default> + <summary>Show the year in the indicator</summary> + <description> + 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. + </description> + </key> <key name="show-calendar" type="b"> <default>true</default> <summary>Show the monthly calendar in the indicator</summary> 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 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="showDateTimeCheck"> + <object class="GtkCheckButton" id="showDateAndMonthCheck"> <property name="label" translatable="yes">_Date and month</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -546,6 +546,45 @@ </packing> </child> <child> + <object class="GtkAlignment" id="showYearAlignment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="yscale">0</property> + <property name="left_padding">24</property> + <child> + <object class="GtkVBox" id="showYearVbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="showYearCheck"> + <property name="label" translatable="yes">_Year</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkVBox" id="vbox5"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -589,7 +628,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -606,7 +645,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> </object> diff --git a/data/indicator-datetime.conf.in b/data/indicator-datetime.conf.in index e53fc1c..ab9cfd6 100644 --- a/data/indicator-datetime.conf.in +++ b/data/indicator-datetime.conf.in @@ -5,4 +5,4 @@ stop on desktop-end or indicator-services-end respawn -exec @libexecdir@/indicator-datetime-service +exec @pkglibexecdir@/indicator-datetime-service diff --git a/data/indicator-datetime.desktop.in b/data/indicator-datetime.desktop.in index 90ea7f0..5362af9 100644 --- a/data/indicator-datetime.desktop.in +++ b/data/indicator-datetime.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application Name=Indicator Date & Time -Exec=@libexecdir@/indicator-datetime-service +Exec=@pkglibexecdir@/indicator-datetime-service NotShowIn=Unity; NoDisplay=true StartupNotify=false diff --git a/debian/changelog b/debian/changelog index fc74793..8868dae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +indicator-datetime (13.10.0+13.10.20131023.2-0ubuntu1) saucy-proposed; urgency=low + + [ Marcus Tomlinson ] + * Fixed datetime title text to read "Date and Time" rather than the + day of the week (as per spec). (LP: #1236400) + + [ Lars Uebernickel ] + * Work around glib's type initialization deadlock. + https://bugzilla.gnome.org/show_bug.cgi?id=674885. (LP: #1239710) + + [ Ubuntu daily release ] + * Automatic snapshot from revision 279 + + -- Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com> Mon, 28 Oct 2013 14:59:27 -0400 + indicator-datetime (13.10.0+13.10.20131016.2-0ubuntu1) saucy; urgency=low [ Charles Kerr ] diff --git a/debian/control b/debian/control index 548f7b0..357b099 100644 --- a/debian/control +++ b/debian/control @@ -2,9 +2,10 @@ Source: indicator-datetime Section: misc Priority: optional Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com> -Build-Depends: debhelper (>= 9), - quilt, - dh-autoreconf, +Build-Depends: cmake, + dbus, + debhelper (>= 9), + dh-translations, intltool (>= 0.35.0), gnome-common, libxorg-gtest-dev, diff --git a/debian/indicator-datetime.install b/debian/indicator-datetime.install index a3076ee..1085d5f 100644 --- a/debian/indicator-datetime.install +++ b/debian/indicator-datetime.install @@ -1,6 +1,6 @@ usr/share/glib-2.0/schemas/* usr/share/upstart/sessions/* usr/share/unity/indicators/* -usr/lib/*/indicator-datetime-service +usr/lib/*/indicator-datetime/indicator-datetime-service usr/share/locale/* etc/xdg/autostart/* diff --git a/debian/rules b/debian/rules index 25854b8..0e7a91f 100755 --- a/debian/rules +++ b/debian/rules @@ -3,17 +3,11 @@ LDFLAGS += -Wl,-z,defs -Wl,--as-needed %: - dh $@ --with quilt,autoreconf - -override_dh_autoreconf: - NOCONFIGURE=1 dh_autoreconf ./autogen.sh - -override_dh_auto_configure: - dh_auto_configure -- --disable-static --disable-silent-rules + dh $@ --with translations override_dh_install: cd po; intltool-update --pot --verbose - dh_install -X.la --fail-missing + dh_install --fail-missing # Language packs for d in $$(find debian/indicator-datetime -type f \( -name "*.desktop" -o -name "*.directory" \) ); do \ sed -ri '/^(Name|GenericName|Comment|X-GNOME-FullName)\[/d' $$d; \ diff --git a/panel/CMakeLists.txt b/panel/CMakeLists.txt new file mode 100644 index 0000000..b3fcc7b --- /dev/null +++ b/panel/CMakeLists.txt @@ -0,0 +1,25 @@ +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/src/datetime-prefs-locations.c b/panel/datetime-prefs-locations.c index f953ec7..54ab8f4 100644 --- a/src/datetime-prefs-locations.c +++ b/panel/datetime-prefs-locations.c @@ -109,7 +109,9 @@ time_location_array_new_from_model (GtkTreeModel * model) } static void -handle_sort(GtkWidget * button, GtkTreeView * tree_view, GCompareFunc compare) +handle_sort(GtkWidget * button G_GNUC_UNUSED, + GtkTreeView * tree_view, + GCompareFunc compare) { GtkTreeModel * model = gtk_tree_view_get_model (tree_view); GSList * l; @@ -180,7 +182,7 @@ location_model_test_sorted (GtkTreeModel * model, gboolean * is_sorted_by_name, ***/ static void -handle_add (GtkWidget * button, GtkTreeView * tree) +handle_add (GtkWidget * button G_GNUC_UNUSED, GtkTreeView * tree) { GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (tree)); @@ -193,7 +195,7 @@ handle_add (GtkWidget * button, GtkTreeView * tree) } static void -handle_remove (GtkWidget * button, GtkTreeView * tree) +handle_remove (GtkWidget * button G_GNUC_UNUSED, GtkTreeView * tree) { GtkListStore * store = GTK_LIST_STORE (gtk_tree_view_get_model (tree)); GtkTreeSelection * selection = gtk_tree_view_get_selection (tree); @@ -290,7 +292,9 @@ handle_remove (GtkWidget * button, GtkTreeView * tree) } static void -handle_edit (GtkCellRendererText * renderer, gchar * path, gchar * new_text, +handle_edit (GtkCellRendererText * renderer G_GNUC_UNUSED, + gchar * path, + gchar * new_text, GtkListStore * store) { GtkTreeIter iter; @@ -388,8 +392,10 @@ query_tooltip (GtkTreeView * tree, gint x, gint y, gboolean keyboard_mode, } static void -handle_edit_started (GtkCellRendererText * renderer, GtkCellEditable * editable, - gchar * path, CcTimezoneCompletion * completion) +handle_edit_started (GtkCellRendererText * renderer G_GNUC_UNUSED, + GtkCellEditable * editable, + gchar * path, + CcTimezoneCompletion * completion) { if (GTK_IS_ENTRY (editable)) { GtkEntry *entry = GTK_ENTRY (editable); @@ -548,7 +554,7 @@ save_when_idle (GtkWidget *dlg) } static void -dialog_closed (GtkWidget * dlg, GObject * store) +dialog_closed (GtkWidget * dlg, GObject * store G_GNUC_UNUSED) { /* Cleanup a tad */ guint time_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dlg), "time-id")); diff --git a/src/datetime-prefs-locations.h b/panel/datetime-prefs-locations.h index 45d3b23..45d3b23 100644 --- a/src/datetime-prefs-locations.h +++ b/panel/datetime-prefs-locations.h diff --git a/src/datetime-prefs.c b/panel/datetime-prefs.c index 9b48ca9..55456ac 100644 --- a/src/datetime-prefs.c +++ b/panel/datetime-prefs.c @@ -83,7 +83,9 @@ G_DEFINE_DYNAMIC_TYPE (IndicatorDatetimePanel, indicator_datetime_panel, CC_TYPE /* Turns the boolean property into a string gsettings */ static GVariant * -bind_hours_set (const GValue * value, const GVariantType * type, gpointer user_data) +bind_hours_set (const GValue * value, + const GVariantType * type G_GNUC_UNUSED, + gpointer user_data) { const gchar * output = NULL; gboolean is_12hour_button = (gboolean)GPOINTER_TO_INT(user_data); @@ -121,7 +123,7 @@ bind_hours_get (GValue * value, GVariant * variant, gpointer user_data) } static void -widget_dependency_cb (GtkWidget * parent, GParamSpec *pspec, GtkWidget * dependent) +widget_dependency_cb (GtkWidget * parent, GParamSpec *pspec G_GNUC_UNUSED, GtkWidget * dependent) { gboolean active, sensitive; g_object_get (G_OBJECT (parent), @@ -141,7 +143,7 @@ add_widget_dependency (GtkWidget * parent, GtkWidget * dependent) } static void -polkit_dependency_cb (GPermission * permission, GParamSpec *pspec, GtkWidget * dependent) +polkit_dependency_cb (GPermission * permission, GParamSpec *pspec G_GNUC_UNUSED, GtkWidget * dependent) { gboolean allowed = FALSE; @@ -152,7 +154,7 @@ polkit_dependency_cb (GPermission * permission, GParamSpec *pspec, GtkWidget * d } static void -add_polkit_dependency_helper (GtkWidget * parent, GParamSpec *pspec, GtkWidget * dependent) +add_polkit_dependency_helper (GtkWidget * parent, GParamSpec *pspec G_GNUC_UNUSED, GtkWidget * dependent) { GtkLockButton * button = GTK_LOCK_BUTTON (parent); GPermission * permission = gtk_lock_button_get_permission (button); @@ -171,7 +173,7 @@ add_polkit_dependency (GtkWidget * parent, GtkWidget * dependent) } static void -polkit_perm_ready (GObject *source_object, GAsyncResult *res, gpointer user_data) +polkit_perm_ready (GObject *source_object G_GNUC_UNUSED, GAsyncResult *res, gpointer user_data) { GError * error = NULL; GPermission * permission = polkit_permission_new_finish (res, &error); @@ -204,7 +206,7 @@ dbus_set_answered (GObject *object, GAsyncResult *res, gpointer command) } static void -toggle_ntp (GtkWidget * radio, GParamSpec * pspec, IndicatorDatetimePanel * self) +toggle_ntp (GtkWidget * radio, GParamSpec * pspec G_GNUC_UNUSED, IndicatorDatetimePanel * self) { gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); @@ -224,7 +226,9 @@ sync_entry (IndicatorDatetimePanel * self, const gchar * location) } static void -tz_changed (CcTimezoneMap * map, CcTimezoneLocation * location, IndicatorDatetimePanel * self) +tz_changed (CcTimezoneMap * map G_GNUC_UNUSED, + CcTimezoneLocation * location, + IndicatorDatetimePanel * self) { if (location == NULL) return; @@ -241,7 +245,9 @@ tz_changed (CcTimezoneMap * map, CcTimezoneLocation * location, IndicatorDatetim } static void -proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) +proxy_ready (GObject *object G_GNUC_UNUSED, + GAsyncResult *res, + IndicatorDatetimePanel * self) { GError * error = NULL; IndicatorDatetimePanelPrivate * priv = self->priv; @@ -459,7 +465,7 @@ input_time_text (GtkWidget * spinner, gdouble * value, IndicatorDatetimePanel * } static gboolean -format_time_text (GtkWidget * spinner, gpointer user_data) +format_time_text (GtkWidget * spinner, gpointer user_data G_GNUC_UNUSED) { gboolean is_time = (gboolean)GPOINTER_TO_INT (g_object_get_data (G_OBJECT (spinner), "is-time")); @@ -570,8 +576,10 @@ show_locations (IndicatorDatetimePanel * self) } static gboolean -timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, - GtkTreeIter * iter, IndicatorDatetimePanel * self) +timezone_selected (GtkEntryCompletion * widget G_GNUC_UNUSED, + GtkTreeModel * model, + GtkTreeIter * iter, + IndicatorDatetimePanel * self) { const gchar * name, * zone; @@ -610,7 +618,9 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, } static gboolean -entry_focus_out (GtkEntry * entry, GdkEventFocus * event, IndicatorDatetimePanel * self) +entry_focus_out (GtkEntry * entry, + GdkEventFocus * event G_GNUC_UNUSED, + IndicatorDatetimePanel * self) { // If the name left in the entry doesn't match the current timezone name, // show an error icon. It's always an error for the user to manually type in @@ -689,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); @@ -715,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")); @@ -809,12 +822,12 @@ indicator_datetime_panel_dispose (GObject * object) } static void -indicator_datetime_panel_class_finalize (IndicatorDatetimePanelClass *klass) +indicator_datetime_panel_class_finalize (IndicatorDatetimePanelClass *klass G_GNUC_UNUSED) { } static const char * -indicator_datetime_panel_get_help_uri (CcPanel *panel) +indicator_datetime_panel_get_help_uri (CcPanel *panel G_GNUC_UNUSED) { return "help:ubuntu-help/clock"; } @@ -845,6 +858,6 @@ g_io_module_load (GIOModule *module) } void -g_io_module_unload (GIOModule *module) +g_io_module_unload (GIOModule *module G_GNUC_UNUSED) { } diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..37a0a05 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,3 @@ +include (Translations) +add_translations_directory ("${GETTEXT_PACKAGE}") +add_translations_catalog ("${GETTEXT_PACKAGE}" ../src/ ../panel) diff --git a/po/POTFILES.in b/po/POTFILES.in index d9b2f98..516cdc5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,7 +1,7 @@ -src/datetime-prefs.c -src/datetime-prefs-locations.c src/service.c src/settings-shared.h src/utils.c +panel/datetime-prefs.c +panel/datetime-prefs-locations.c [type: gettext/glade]data/datetime-dialog.ui data/gnome-indicator-datetime-panel.desktop.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..2d51385 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,45 @@ +set (SERVICE_LIB "libindicatordatetimeservice") +set (SERVICE_EXEC "indicator-datetime-service") + +add_definitions (-DTIMEZONE_FILE="/etc/timezone" + -DG_LOG_DOMAIN="Indicator-Datetime") + +# let service know how to launch gnome-control-center on the desktop +if (BUILD_PANEL) + add_definitions (-DHAVE_CCPANEL) +endif () + +add_library (${SERVICE_LIB} STATIC + clock.c + clock.h + clock-live.c + clock-live.h + planner.c + planner.h + planner-eds.c + planner-eds.h + service.c + service.h + timezone.c + timezone.h + timezone-file.c + timezone-file.h + timezone-geoclue.c + timezone-geoclue.h + utils.c + utils.h + dbus-shared.h + settings-shared.h) +include_directories (${SERVICE_DEPS_INCLUDE_DIRS}) +link_directories (${SERVICE_DEPS_LIBRARY_DIRS}) + +add_executable (${SERVICE_EXEC} main.c) +target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${GCOV_LIBS}) +install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}) + +# common properties +set_property (TARGET ${SERVICE_LIB} ${SERVICE_EXEC} + APPEND_STRING PROPERTY COMPILE_FLAGS + " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}") + + diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index be7eb4d..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,88 +0,0 @@ - -SHARED_CFLAGS = \ - -Wall \ - -Wextra -Wno-missing-field-initializers \ - -Werror \ - $(SERVICE_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - -DTIMEZONE_FILE="\"/etc/timezone\"" \ - -DG_LOG_DOMAIN=\"Indicator-Datetime\" - -### -### -### - -noinst_LIBRARIES = libindicator-datetime-service.a - -libindicator_datetime_service_a_CFLAGS = \ - $(SHARED_CFLAGS) - -libindicator_datetime_service_a_SOURCES = \ - clock.c \ - clock.h \ - clock-live.c \ - clock-live.h \ - planner.c \ - planner.h \ - planner-eds.c \ - planner-eds.h \ - service.c \ - service.h \ - timezone.c \ - timezone.h \ - timezone-file.c \ - timezone-file.h \ - timezone-geoclue.c \ - timezone-geoclue.h \ - utils.c \ - utils.h \ - dbus-shared.h \ - settings-shared.h - -### -### -### - -libexec_PROGRAMS = indicator-datetime-service - -indicator_datetime_service_SOURCES = \ - main.c - -indicator_datetime_service_CFLAGS = \ - $(SHARED_CFLAGS) - -indicator_datetime_service_LDADD = \ - libindicator-datetime-service.a \ - $(SERVICE_LIBS) - -indicator_datetime_service_LDFLAGS = \ - $(COVERAGE_LDFLAGS) - -### -### -### - -if BUILD_CCPANEL -ccpaneldir = $(libdir)/control-center-1/panels/ -ccpanel_LTLIBRARIES = libindicator-datetime.la - -libindicator_datetime_la_SOURCES =\ - datetime-prefs.c \ - datetime-prefs-locations.c \ - datetime-prefs-locations.h \ - utils.c \ - utils.h \ - settings-shared.h -libindicator_datetime_la_CFLAGS = \ - -Wall \ - -Werror \ - $(PREF_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - -DTIMEZONE_FILE="\"/etc/timezone\"" \ - -DPKGDATADIR="\"$(pkgdatadir)\"" -libindicator_datetime_la_LIBADD = \ - $(PREF_LIBS) -libindicator_datetime_la_LDFLAGS = \ - $(COVERAGE_LDFLAGS) \ - -module -avoid-version -endif diff --git a/src/clock-live.c b/src/clock-live.c index 4153747..f2859e6 100644 --- a/src/clock-live.c +++ b/src/clock-live.c @@ -20,8 +20,6 @@ #include <glib.h> #include <gio/gio.h> -#include "config.h" - #include "clock-live.h" #include "settings-shared.h" #include "timezone-file.h" @@ -54,7 +52,7 @@ G_DEFINE_TYPE_WITH_CODE ( indicator_datetime_clock_live, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (INDICATOR_TYPE_DATETIME_CLOCK, - indicator_datetime_clock_interface_init)); + indicator_datetime_clock_interface_init)) /*** **** Timezones @@ -17,8 +17,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <locale.h> #include <stdlib.h> /* exit() */ diff --git a/src/planner-eds.c b/src/planner-eds.c index 876fdfc..cc2b8c5 100644 --- a/src/planner-eds.c +++ b/src/planner-eds.c @@ -17,8 +17,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <libical/ical.h> #include <libical/icaltime.h> #include <libecal/libecal.h> diff --git a/src/service.c b/src/service.c index 5fffc11..4edcd1c 100644 --- a/src/service.c +++ b/src/service.c @@ -18,8 +18,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <string.h> /* strstr() */ #include <glib/gi18n.h> @@ -668,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; @@ -1531,7 +1530,7 @@ on_activate_appointment (GSimpleAction * a G_GNUC_UNUSED, } /* if that appointment's an alarm, dispatch its url */ - g_debug ("%s: uri '%s'; matching appt is %p", G_STRFUNC, uid, appt); + g_debug ("%s: uri '%s'; matching appt is %p", G_STRFUNC, uid, (void*)appt); if (appt && appointment_has_alarm_url (appt)) dispatch_alarm_url (appt); } @@ -2184,6 +2183,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/timezone-file.c b/src/timezone-file.c index 698ce3e..ddc4256 100644 --- a/src/timezone-file.c +++ b/src/timezone-file.c @@ -17,8 +17,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <gio/gio.h> /* GFile, GFileMonitor */ #include "timezone-file.h" diff --git a/src/timezone-geoclue.c b/src/timezone-geoclue.c index c89558d..ac23b93 100644 --- a/src/timezone-geoclue.c +++ b/src/timezone-geoclue.c @@ -17,8 +17,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <geoclue/geoclue-master.h> #include <geoclue/geoclue-master-client.h> @@ -72,7 +70,7 @@ on_address_changed_sig (GeoclueAddress * address G_GNUC_UNUSED, GeoclueAccuracy * accuracy G_GNUC_UNUSED, gpointer gself) { - return on_address_changed(address, timestamp, addy_data, accuracy, NULL, gself); + on_address_changed(address, timestamp, addy_data, accuracy, NULL, gself); } static void diff --git a/src/utils.c b/src/utils.c index 60fd393..5539c5c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -20,10 +20,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <glib/gi18n-lib.h> #include <gio/gio.h> #include <locale.h> @@ -104,9 +100,9 @@ get_current_zone_name (const gchar * location, GSettings * settings) split_settings_location (tz_name, &old_zone, &old_name); g_free (tz_name); - // new_name is always just a sanitized version of a timezone. - // old_name is potentially a saved "pretty" version of a timezone name from - // geonames. So we prefer to use it if available and the zones match. + /* new_name is always just a sanitized version of a timezone. + old_name is potentially a saved "pretty" version of a timezone name from + geonames. So we prefer to use it if available and the zones match. */ if (g_strcmp0 (old_zone, new_zone) == 0) { rv = old_name; @@ -333,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; @@ -404,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); } @@ -440,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, diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..682896b --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,23 @@ +# build the necessary schemas +set_directory_properties (PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled) +set_source_files_properties (gschemas.compiled GENERATED) + +# GSettings: +# compile the indicator-datetime schema into a gschemas.compiled file in this directory, +# and help the tests to find that file by setting -DSCHEMA_DIR +set (SCHEMA_DIR ${CMAKE_CURRENT_BINARY_DIR}) +add_definitions(-DSCHEMA_DIR="${SCHEMA_DIR}") +execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas + 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 + 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... +include_directories (${CMAKE_SOURCE_DIR}/src) +include_directories (${CMAKE_CURRENT_BINARY_DIR} ${SERVICE_INCLUDE_DIRS}) + + diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index e204378..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -TESTS = -CLEANFILES = -BUILT_SOURCES = -check_PROGRAMS = - -### -### -### - -# stock UMB tests on user-visible strings -include $(srcdir)/Makefile.am.strings - -check_LIBRARIES = libgtest.a -nodist_libgtest_a_SOURCES = \ - $(GTEST_SOURCE)/gtest-all.cc \ - $(GTEST_SOURCE)/gtest_main.cc - -AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I${top_srcdir}/src -Wall -Werror -AM_CXXFLAGS = $(GTEST_CXXFLAGS) - -### -### -### - -TEST_LIBS = \ - libgtest.a \ - $(SERVICE_LIBS) \ - $(COVERAGE_LDFLAGS) \ - $(XORG_GTEST_LDFLAGS) - -TEST_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(SERVICE_CFLAGS) - -BUILT_SOURCES += gschemas.compiled -CLEANFILES += gschemas.compiled -gschemas.compiled: Makefile - @glib-compile-schemas --targetdir=$(abs_builddir) $(top_builddir)/data - -### -### -### - -TESTS += test-indicator -check_PROGRAMS += test-indicator -test_indicator_SOURCES = test-indicator.cc -test_indicator_LDADD = $(TEST_LIBS) -test_indicator_CPPFLAGS = $(TEST_CPPFLAGS) -DSCHEMA_DIR="\"$(top_builddir)/tests/\"" - -### -### -### - -TESTS += test-utils -check_PROGRAMS += test-utils -test_utils_SOURCES = test-utils.cc -test_utils_LDADD = $(top_builddir)/src/libindicator-datetime-service.a $(TEST_LIBS) -test_utils_CPPFLAGS = $(TEST_CPPFLAGS) -DSCHEMA_DIR="\"$(top_builddir)/tests/\"" |