aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-30 23:49:58 +0000
committerTarmac <Unknown>2013-10-30 23:49:58 +0000
commitbbc781d9e2afe500d9a5d09335f0954f25269be6 (patch)
tree87ad870ab7d39777686e4f9661bcaa4ba41b5e1d
parent19ba64b479fd14d5192f0ec3dcc37fe33bde238b (diff)
parent13cc891202d3721fc157c827ed1141ee6221ccbd (diff)
downloadayatana-indicator-datetime-bbc781d9e2afe500d9a5d09335f0954f25269be6.tar.gz
ayatana-indicator-datetime-bbc781d9e2afe500d9a5d09335f0954f25269be6.tar.bz2
ayatana-indicator-datetime-bbc781d9e2afe500d9a5d09335f0954f25269be6.zip
Switch the build system to cmake. Fixes: https://bugs.launchpad.net/bugs/1237509.
Approved by Ted Gould, PS Jenkins bot.
-rw-r--r--CMakeLists.txt103
-rw-r--r--INSTALL75
-rw-r--r--Makefile.am39
-rw-r--r--Makefile.am.coverage48
-rwxr-xr-xautogen.sh11
-rw-r--r--cmake/FindIntltool.cmake23
-rw-r--r--cmake/GCov.cmake50
-rw-r--r--cmake/GdbusCodegen.cmake36
-rw-r--r--cmake/Translations.cmake41
-rw-r--r--cmake/UseGSettings.cmake23
-rw-r--r--configure.ac192
-rw-r--r--data/CMakeLists.txt66
-rw-r--r--data/Makefile.am45
-rw-r--r--data/indicator-datetime.service.in2
-rw-r--r--debian/control7
-rw-r--r--debian/indicator-datetime.install2
-rwxr-xr-xdebian/rules10
-rw-r--r--panel/CMakeLists.txt25
-rw-r--r--panel/datetime-prefs-locations.c (renamed from src/datetime-prefs-locations.c)20
-rw-r--r--panel/datetime-prefs-locations.h (renamed from src/datetime-prefs-locations.h)0
-rw-r--r--panel/datetime-prefs.c (renamed from src/datetime-prefs.c)40
-rw-r--r--po/CMakeLists.txt3
-rw-r--r--po/POTFILES.in4
-rw-r--r--src/CMakeLists.txt45
-rw-r--r--src/Makefile.am88
-rw-r--r--src/clock-live.c4
-rw-r--r--src/main.c2
-rw-r--r--src/planner-eds.c2
-rw-r--r--src/service.c4
-rw-r--r--src/timezone-file.c2
-rw-r--r--src/timezone-geoclue.c4
-rw-r--r--src/utils.c10
-rw-r--r--tests/CMakeLists.txt23
-rw-r--r--tests/Makefile.am58
34 files changed, 567 insertions, 540 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 ()
+
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 <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..197c5c6
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,66 @@
+##
+## 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}")
+
+
+##
+## 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 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)
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
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 13d21f2..b855558 100644
--- a/debian/indicator-datetime.install
+++ b/debian/indicator-datetime.install
@@ -1,5 +1,5 @@
usr/share/glib-2.0/schemas/*
usr/share/dbus-1/services/*
usr/share/unity/indicators/*
-usr/lib/*/indicator-datetime-service
+usr/lib/*/indicator-datetime/indicator-datetime-service
usr/share/locale/*
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..8e5ee35 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
@@ -809,12 +819,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 +855,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
diff --git a/src/main.c b/src/main.c
index 022df00..868d41b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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..6fb2ded 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>
@@ -1531,7 +1529,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);
}
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..d1e1fbf 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;
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/\""