aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-10-21 22:27:03 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-10-21 22:27:03 +0200
commitb2beaa3431ac84614ae45f58f2771fb6b97f6201 (patch)
tree61b44606d995290f8fcd062f15176a8adc8fceb1
parent9ad235af84652bc64c1d28a6b2c68eb55e1b401c (diff)
parent421e9dcda36265642403c42b687e80769506b5b1 (diff)
downloadayatana-indicator-messages-b2beaa3431ac84614ae45f58f2771fb6b97f6201.tar.gz
ayatana-indicator-messages-b2beaa3431ac84614ae45f58f2771fb6b97f6201.tar.bz2
ayatana-indicator-messages-b2beaa3431ac84614ae45f58f2771fb6b97f6201.zip
Merge branch 'tari01-pr/move-to-cmake'
Attributes GH PR #19: https://github.com/AyatanaIndicators/ayatana-indicator-messages/pull/19
-rw-r--r--CMakeLists.txt97
-rw-r--r--Makefile.am21
-rw-r--r--Makefile.am.coverage48
-rwxr-xr-xautogen.sh10
-rw-r--r--cmake/FindGObjectIntrospection.cmake61
-rw-r--r--cmake/FindVala.cmake57
-rw-r--r--cmake/GdbusCodegen.cmake36
-rw-r--r--common/Makefile.am31
-rw-r--r--configure.ac210
-rw-r--r--data/CMakeLists.txt38
-rw-r--r--data/Makefile.am35
-rw-r--r--data/ayatana-indicator-messages.desktop.in2
-rw-r--r--data/ayatana-indicator-messages.service.in2
-rw-r--r--data/icons/16x16/Makefile.am1
-rw-r--r--data/icons/16x16/categories/Makefile.am10
-rw-r--r--data/icons/16x16/status/Makefile.am10
-rw-r--r--data/icons/22x22/Makefile.am1
-rw-r--r--data/icons/22x22/categories/Makefile.am8
-rw-r--r--data/icons/22x22/status/Makefile.am9
-rw-r--r--data/icons/24x24/Makefile.am1
-rw-r--r--data/icons/24x24/status/Makefile.am10
-rw-r--r--data/icons/32x32/Makefile.am1
-rw-r--r--data/icons/32x32/categories/Makefile.am9
-rw-r--r--data/icons/32x32/status/Makefile.am10
-rw-r--r--data/icons/48x48/Makefile.am1
-rw-r--r--data/icons/48x48/status/Makefile.am10
-rw-r--r--data/icons/Makefile.am15
-rw-r--r--data/icons/scalable/Makefile.am1
-rw-r--r--data/icons/scalable/categories/Makefile.am9
-rw-r--r--data/icons/scalable/status/Makefile.am10
-rw-r--r--debian/ayatana-indicator-messages.install2
-rw-r--r--debian/compat2
-rw-r--r--debian/control7
-rw-r--r--debian/copyright56
-rw-r--r--debian/libmessaging-menu0.symbols67
-rwxr-xr-xdebian/rules28
-rw-r--r--doc/CMakeLists.txt1
-rw-r--r--doc/Makefile.am1
-rw-r--r--doc/reference/CMakeLists.txt205
-rw-r--r--doc/reference/Makefile.am19
-rw-r--r--doc/reference/messaging-menu-docs.xml.in2
-rw-r--r--libmessaging-menu/CMakeLists.txt101
-rw-r--r--libmessaging-menu/Makefile.am76
-rw-r--r--libmessaging-menu/messaging-menu.pc.in10
-rw-r--r--m4/ax_python_module.m449
-rw-r--r--m4/gcov.m486
-rw-r--r--m4/gtest.m474
-rw-r--r--po/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt49
-rw-r--r--src/Makefile.am44
-rw-r--r--src/im-accounts-service.c226
-rw-r--r--src/indicator-desktop-shortcuts.c1046
-rw-r--r--src/messages-service.c357
-rw-r--r--tests/CMakeLists.txt78
-rw-r--r--tests/Makefile.am122
-rw-r--r--tests/indicator-test.cpp8
56 files changed, 1658 insertions, 1824 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..1e73a3b
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,97 @@
+project(ayatana-indicator-messages C CXX)
+cmake_minimum_required(VERSION 3.13)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+
+# Globals
+
+set(PROJECT_VERSION "0.9.0")
+set(PACKAGE ${CMAKE_PROJECT_NAME})
+set(GETTEXT_PACKAGE ${CMAKE_PROJECT_NAME})
+
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
+endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Weverything")
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-c++98-compat -Wno-padded")
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-documentation")
+else()
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall")
+endif()
+
+# Options
+
+option(ENABLE_TESTS "Enable all tests and checks" OFF)
+option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF)
+option(ENABLE_WERROR "Treat all build warnings as errors" OFF)
+
+if(ENABLE_COVERAGE)
+ set(ENABLE_TESTS ON)
+ set(CMAKE_BUILD_TYPE "Coverage")
+else()
+ set(CMAKE_BUILD_TYPE "Release")
+endif()
+
+if(ENABLE_WERROR)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+endif()
+
+# Check for prerequisites
+
+include (GNUInstallDirs)
+find_package(PkgConfig REQUIRED)
+include(FindPkgConfig)
+
+pkg_check_modules(
+ PROJECT_DEPS
+ REQUIRED
+ glib-2.0>=2.36
+ gio-unix-2.0>=2.36
+ accountsservice
+)
+
+# Cppcheck
+
+add_custom_target(
+ cppcheck
+ COMMAND
+ cppcheck
+ --enable=all
+ -q
+ --error-exitcode=2
+ --inline-suppr
+ ${CMAKE_SOURCE_DIR}/src
+ ${CMAKE_SOURCE_DIR}/tests
+)
+
+# Build
+
+add_subdirectory(src)
+add_subdirectory(libmessaging-menu)
+add_subdirectory(data)
+add_subdirectory(po)
+add_subdirectory(doc)
+
+# Testing and coverage
+
+if (ENABLE_TESTS)
+ include(CTest)
+ enable_testing()
+ add_subdirectory(tests)
+ if (ENABLE_COVERAGE)
+ find_package(CoverageReport)
+ ENABLE_COVERAGE_REPORT(
+ TARGETS "messaging-menu" "indicator-messages-service"
+ TESTS ${COVERAGE_TEST_TARGETS}
+ FILTER /usr/include ${CMAKE_BINARY_DIR}/*
+ )
+ endif ()
+endif ()
+
+# Display config info
+
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Unit tests: ${ENABLE_TESTS}")
+message(STATUS "Build with -Werror: ${ENABLE_WERROR}")
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 16a9a77..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-SUBDIRS = \
- common \
- src \
- libmessaging-menu \
- data \
- po
-
-if ENABLE_GTK_DOC
-SUBDIRS += doc
-endif
-
-if BUILD_TESTS
-SUBDIRS += \
- tests
-
-# build src first
-tests: src libayatana-messaging-menu
-
-endif
-
-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 e3035d8..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-PKG_NAME="ayatana-indicator-messages"
-
-which mate-autogen || {
- echo "You need mate-common from the MATE Desktop Environment"
- exit 1
-}
-
-. mate-autogen
diff --git a/cmake/FindGObjectIntrospection.cmake b/cmake/FindGObjectIntrospection.cmake
new file mode 100644
index 0000000..2073c3c
--- /dev/null
+++ b/cmake/FindGObjectIntrospection.cmake
@@ -0,0 +1,61 @@
+# - try to find gobject-introspection
+#
+# Once done this will define
+#
+# INTROSPECTION_FOUND - system has gobject-introspection
+# INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
+# INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
+# INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
+# INTROSPECTION_GIRDIR
+# INTROSPECTION_TYPELIBDIR
+# INTROSPECTION_CFLAGS
+# INTROSPECTION_LIBS
+#
+# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname)
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0
+ OUTPUT_VARIABLE _result
+ RESULT_VARIABLE _null
+ )
+
+ if (_null)
+ else()
+ string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+ string(REGEX REPLACE " +$" "" _result "${_result}")
+ separate_arguments(_result)
+ set(${_outvar} ${_result} CACHE INTERNAL "")
+ endif()
+endmacro(_GIR_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ if(PACKAGE_FIND_VERSION_COUNT GREATER 0)
+ set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
+ endif()
+ pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
+ if(_pc_gir_FOUND)
+ set(INTROSPECTION_FOUND TRUE)
+ _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner")
+ _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler")
+ _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate")
+ _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir")
+ _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir")
+ set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
+ set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
+ endif()
+endif()
+
+mark_as_advanced(
+ INTROSPECTION_SCANNER
+ INTROSPECTION_COMPILER
+ INTROSPECTION_GENERATE
+ INTROSPECTION_GIRDIR
+ INTROSPECTION_TYPELIBDIR
+ INTROSPECTION_CFLAGS
+ INTROSPECTION_LIBS
+)
diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake
new file mode 100644
index 0000000..a638735
--- /dev/null
+++ b/cmake/FindVala.cmake
@@ -0,0 +1,57 @@
+# - Find Vala
+# This module looks for valac.
+# This module defines the following values:
+# VALA_FOUND
+# VALA_COMPILER
+# VALA_VERSION
+# VAPI_GEN
+# VAPI_GEN_VERSION
+
+#=============================================================================
+# Copyright Přemysl Janouch 2011
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+# OF SUCH DAMAGE.
+#=============================================================================
+
+find_program (VALA_COMPILER "valac")
+
+if (VALA_COMPILER)
+ execute_process (COMMAND ${VALA_COMPILER} --version
+ OUTPUT_VARIABLE VALA_VERSION)
+ string (REGEX MATCH "[.0-9]+" VALA_VERSION "${VALA_VERSION}")
+endif (VALA_COMPILER)
+
+find_program (VAPI_GEN "vapigen")
+
+if (VAPI_GEN)
+ execute_process (COMMAND ${VAPI_GEN} --version
+ OUTPUT_VARIABLE VAPI_GEN_VERSION)
+ string (REGEX MATCH "[.0-9]+" VAPI_GEN_VERSION "${VAPI_GEN_VERSION}")
+endif (VAPI_GEN)
+
+include (FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (Vala
+ REQUIRED_VARS VALA_COMPILER
+ VERSION_VAR VALA_VERSION)
+
+mark_as_advanced (VALA_COMPILER VALA_VERSION VAPI_GEN)
+
diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake
new file mode 100644
index 0000000..5261ba8
--- /dev/null
+++ b/cmake/GdbusCodegen.cmake
@@ -0,0 +1,36 @@
+cmake_minimum_required(VERSION 3.13)
+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/common/Makefile.am b/common/Makefile.am
deleted file mode 100644
index d1be198..0000000
--- a/common/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-noinst_LTLIBRARIES = libmessaging-common.la
-
-indicator-messages-service.c: org.ayatana.indicator.messages.service.xml
- $(AM_V_GEN) gdbus-codegen \
- --interface-prefix org.ayatana.indicator.messages. \
- --generate-c-code indicator-messages-service \
- --c-namespace IndicatorMessages \
- $^
-indicator-messages-service.h: indicator-messages-service.c
-
-indicator-messages-application.c: org.ayatana.indicator.messages.application.xml
- $(AM_V_GEN) gdbus-codegen \
- --interface-prefix org.ayatana.indicator.messages. \
- --generate-c-code indicator-messages-application \
- --c-namespace IndicatorMessages \
- $^
-indicator-messages-application.h: indicator-messages-application.c
-
-BUILT_SOURCES = \
- indicator-messages-service.c \
- indicator-messages-service.h \
- indicator-messages-application.c \
- indicator-messages-application.h
-
-libmessaging_common_la_SOURCES = \
- $(BUILT_SOURCES)
-
-libmessaging_common_la_CFLAGS = $(GIO_CFLAGS)
-libmessaging_common_la_LIBADD = $(GIO_LIBS)
-
-CLEANFILES = $(BUILT_SOURCES)
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index ae54f4c..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,210 +0,0 @@
-AC_INIT(ayatana-indicator-messages, 0.8.2)
-
-AC_PREREQ(2.62)
-
-AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE()
-
-AM_MAINTAINER_MODE
-
-IT_PROG_INTLTOOL([0.35.0])
-
-AC_ISC_POSIX
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_STDC_HEADERS
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-
-AC_SUBST(VERSION)
-AC_CONFIG_MACRO_DIR([m4])
-
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
-
-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"]
-)
-
-# the Google Test targets are cpp
-AC_PROG_CXX
-
-###########################
-# Dependencies
-###########################
-
-GIO_UNIX_REQUIRED_VERSION=2.33.10
-GLIB_REQUIRED_VERSION=2.35.4
-INTROSPECTION_REQUIRED_VERSION=1.32.0
-
-PKG_CHECK_MODULES(APPLET, gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
- glib-2.0 >= $GLIB_REQUIRED_VERSION
- accountsservice)
-
-PKG_CHECK_MODULES(GIO, gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION)
-
-AC_SUBST(APPLET_CFLAGS)
-AC_SUBST(APPLET_LIBS)
-
-GLIB_GSETTINGS
-
-GTK_DOC_CHECK([1.18], [--flavour no-tmpl])
-
-GOBJECT_INTROSPECTION_CHECK([$INTROSPECTION_REQUIRED_VERSION])
-
-AC_ARG_WITH([indicator-dir],
- [AS_HELP_STRING([--with-indicator-dir=DIR], [Ayatana Indicator directory [default=$datadir/ayatana/indicators]])],
- [],
- [with_indicator_dir=$datadir/ayatana/indicators])
-AC_SUBST([INDICATOR_DIR], [$with_indicator_dir])
-
-#########################
-# Check for systemd
-#########################
-PKG_CHECK_MODULES(SYSTEMD, systemd,
- [has_systemd=yes],
- []
-)
-if test "x$has_systemd" = "xyes"; then
- SYSTEMD_USERDIR=`$PKG_CONFIG --variable=systemduserunitdir systemd`
- AC_SUBST(SYSTEMD_USERDIR)
- AC_DEFINE(HAVE_SYSTEMD, 1, [create ayatana-indicator-application.service for systemd])
-fi
-
-###########################
-# 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_CXXFLAGS)
-AC_SUBST(COVERAGE_LDFLAGS)
-
-###########################
-# Tests
-###########################
-
-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
- PKG_CHECK_MODULES(DBUSTEST, dbustest-1)
- m4_include([m4/gtest.m4])
- CHECK_GTEST
- AM_PATH_PYTHON(3.0,, [:])
- AC_PYTHON_MODULE(dbusmock)
- if test "x$have_gtest" = "xyes" -a "x$HAVE_PYMOD_DBUSMOCK" = "xyes"; then
- enable_tests="yes"
- else
- if test "x$enable_tests" = "xyes"; then
- AC_MSG_ERROR([tests were requested but gtest or dbusmock are not installed.])
- else
- enable_tests="no"
- fi
- fi
-fi
-AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"])
-
-###########################
-# Vala API Generation
-###########################
-
-AC_ARG_ENABLE([vala],
- AC_HELP_STRING([--disable-vala], [Disable vala]),
- [enable_vala=$enableval], [enable_vala=yes])
-
-AS_IF([test "x$enable_vala" != "xno"],[
- AM_COND_IF([HAVE_INTROSPECTION],,[
- AC_MSG_ERROR([Vala bindings require introspection support, please --enable-introspection])
- ])
-AC_PATH_PROG([VALA_API_GEN], [vapigen])
-])
-AM_CONDITIONAL([HAVE_VALA], [test -n "$VALA_API_GEN"])
-
-##############################
-# 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
-###########################
-
-GETTEXT_PACKAGE=ayatana-indicator-messages
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default get text domain])
-AC_DEFINE_PATH(LOCALEDIR, "${datadir}/locale", [locale directory])
-
-AM_GLIB_GNU_GETTEXT
-
-###########################
-# Files
-###########################
-
-AC_OUTPUT([
-Makefile
-src/Makefile
-common/Makefile
-data/Makefile
-data/icons/Makefile
-data/icons/16x16/Makefile
-data/icons/16x16/status/Makefile
-data/icons/16x16/categories/Makefile
-data/icons/22x22/Makefile
-data/icons/22x22/status/Makefile
-data/icons/22x22/categories/Makefile
-data/icons/24x24/Makefile
-data/icons/24x24/status/Makefile
-data/icons/32x32/Makefile
-data/icons/32x32/status/Makefile
-data/icons/32x32/categories/Makefile
-data/icons/48x48/Makefile
-data/icons/48x48/status/Makefile
-data/icons/scalable/Makefile
-data/icons/scalable/status/Makefile
-data/icons/scalable/categories/Makefile
-po/Makefile.in
-tests/Makefile
-libmessaging-menu/Makefile
-libmessaging-menu/messaging-menu.pc
-doc/Makefile
-doc/reference/Makefile
-doc/reference/messaging-menu-docs.xml
-])
-
-###########################
-# Results
-###########################
-
-AC_MSG_NOTICE([
-
-Messaging Indicator Configuration:
-
- Prefix: $prefix
- Indicator Dir: $INDICATORDIR
- tests: $enable_tests
- gcov: $use_gcov
- introspecion: $enable_introspection
- Vala bindings: $enable_vala
- documentation: $enable_gtk_doc
-])
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..76bed98
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,38 @@
+# org.ayatana.indicator.session.gschema.xml
+
+find_package(GSettings)
+set(GSETTINGS_COMPILE ON)
+add_schema("org.ayatana.indicator.messages.gschema.xml")
+
+# ayatana-indicator-messages.service
+
+pkg_check_modules(SYSTEMD systemd)
+
+if (${SYSTEMD_FOUND})
+ pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-messages.service.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-messages.service" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-messages.service" DESTINATION "${SYSTEMD_USER_DIR}")
+endif()
+
+# ayatana-indicator-messages.desktop
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-messages.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-messages.desktop" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-messages.desktop" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/xdg/autostart")
+
+# org.ayatana.indicator.messages
+
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/org.ayatana.indicator.messages" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/ayatana/indicators")
+
+# icons/*
+
+install(
+ DIRECTORY
+ icons/16x16
+ icons/22x22
+ icons/24x24
+ icons/32x32
+ icons/48x48
+ icons/scalable
+ DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor"
+ FILES_MATCHING PATTERN "*.png" PATTERN "*.svg"
+)
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index b88aee5..0000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-NULL =
-
-SUBDIRS = icons
-
-xdg_autostartdir = /etc/xdg/autostart
-xdg_autostart_DATA = ayatana-indicator-messages.desktop
-
-%.desktop: %.desktop.in
- $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
-
-gsettings_SCHEMAS = org.ayatana.indicator.messages.gschema.xml
-@GSETTINGS_RULES@
-
-#if defined(HAVE_SYSTEMD)
-systemdservice_file = ayatana-indicator-messages.service
-$(systemdservice_file): $(systemdservice_file).in
- $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
-
-systemddir = $(SYSTEMD_USERDIR)
-systemd_DATA = $(systemdservice_file)
-#endif
-
-indicatordir = $(INDICATOR_DIR)
-dist_indicator_DATA = org.ayatana.indicator.messages
-
-EXTRA_DIST = \
- ayatana-indicator-messages.desktop.in \
- $(gsettings_SCHEMAS) \
- $(systemdservice_file).in \
- $(NULL)
-
-CLEANFILES = \
- $(xdg_autostart_DATA) \
- $(systemdservice_file) \
- $(NULL)
diff --git a/data/ayatana-indicator-messages.desktop.in b/data/ayatana-indicator-messages.desktop.in
index 5fdb313..a2f5036 100644
--- a/data/ayatana-indicator-messages.desktop.in
+++ b/data/ayatana-indicator-messages.desktop.in
@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Name=Ayatana Indicator Messages
-Exec=@pkglibexecdir@/ayatana-indicator-messages-service
+Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-messages/ayatana-indicator-messages-service
NoDisplay=true
StartupNotify=false
Terminal=false
diff --git a/data/ayatana-indicator-messages.service.in b/data/ayatana-indicator-messages.service.in
index a0a3ba0..d6976dd 100644
--- a/data/ayatana-indicator-messages.service.in
+++ b/data/ayatana-indicator-messages.service.in
@@ -4,7 +4,7 @@ PartOf=graphical-session.target
PartOf=ayatana-indicators.target
[Service]
-ExecStart=@pkglibexecdir@/ayatana-indicator-messages-service
+ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-messages/ayatana-indicator-messages-service
Restart=on-failure
[Install]
diff --git a/data/icons/16x16/Makefile.am b/data/icons/16x16/Makefile.am
deleted file mode 100644
index 4b46952..0000000
--- a/data/icons/16x16/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = status categories
diff --git a/data/icons/16x16/categories/Makefile.am b/data/icons/16x16/categories/Makefile.am
deleted file mode 100644
index 2ddfa63..0000000
--- a/data/icons/16x16/categories/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/16x16/categories
-
-icons_DATA = \
- applications-email-panel.png \
- applications-chat-panel.png \
- applications-microblogging-panel.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/16x16/status/Makefile.am b/data/icons/16x16/status/Makefile.am
deleted file mode 100644
index adafb8c..0000000
--- a/data/icons/16x16/status/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/16x16/status
-
-icons_DATA = \
- application-running.png \
- indicator-messages.png \
- indicator-messages-new.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/22x22/Makefile.am b/data/icons/22x22/Makefile.am
deleted file mode 100644
index 4b46952..0000000
--- a/data/icons/22x22/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = status categories
diff --git a/data/icons/22x22/categories/Makefile.am b/data/icons/22x22/categories/Makefile.am
deleted file mode 100644
index b1ea14c..0000000
--- a/data/icons/22x22/categories/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/22x22/categories
-
-icons_DATA = \
- applications-email-panel.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/22x22/status/Makefile.am b/data/icons/22x22/status/Makefile.am
deleted file mode 100644
index 470c817..0000000
--- a/data/icons/22x22/status/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/22x22/status
-
-icons_DATA = \
- indicator-messages.png \
- indicator-messages-new.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/24x24/Makefile.am b/data/icons/24x24/Makefile.am
deleted file mode 100644
index d52da2b..0000000
--- a/data/icons/24x24/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = status
diff --git a/data/icons/24x24/status/Makefile.am b/data/icons/24x24/status/Makefile.am
deleted file mode 100644
index 086c404..0000000
--- a/data/icons/24x24/status/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/24x24/status
-
-icons_DATA = \
- application-running.png \
- indicator-messages.png \
- indicator-messages-new.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am
deleted file mode 100644
index 4b46952..0000000
--- a/data/icons/32x32/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = status categories
diff --git a/data/icons/32x32/categories/Makefile.am b/data/icons/32x32/categories/Makefile.am
deleted file mode 100644
index 6fcfb7b..0000000
--- a/data/icons/32x32/categories/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/32x32/categories
-
-icons_DATA = \
- applications-email-panel.png \
- applications-chat-panel.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/32x32/status/Makefile.am b/data/icons/32x32/status/Makefile.am
deleted file mode 100644
index 00f9d53..0000000
--- a/data/icons/32x32/status/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/32x32/status
-
-icons_DATA = \
- application-running.png \
- indicator-messages.png \
- indicator-messages-new.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/48x48/Makefile.am b/data/icons/48x48/Makefile.am
deleted file mode 100644
index d52da2b..0000000
--- a/data/icons/48x48/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = status
diff --git a/data/icons/48x48/status/Makefile.am b/data/icons/48x48/status/Makefile.am
deleted file mode 100644
index 9c560b5..0000000
--- a/data/icons/48x48/status/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/48x48/status
-
-icons_DATA = \
- application-running.png \
- indicator-messages.png \
- indicator-messages-new.png
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
deleted file mode 100644
index 44cd81b..0000000
--- a/data/icons/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-SUBDIRS = scalable 16x16 22x22 24x24 32x32 48x48
-
-gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
-
-install-data-hook: update-icon-cache
-uninstall-hook: update-icon-cache
-update-icon-cache:
- @-if test -z "$(DESTDIR)"; then \
- echo "Updating Gtk icon cache."; \
- $(gtk_update_icon_cache); \
- else \
- echo "*** Icon cache not updated. After (un)install, run this:"; \
- echo "*** $(gtk_update_icon_cache)"; \
- fi
-
diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am
deleted file mode 100644
index 4b46952..0000000
--- a/data/icons/scalable/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = status categories
diff --git a/data/icons/scalable/categories/Makefile.am b/data/icons/scalable/categories/Makefile.am
deleted file mode 100644
index 0fdbbd7..0000000
--- a/data/icons/scalable/categories/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/scalable/categories
-
-icons_DATA = \
- applications-email-panel.svg \
- applications-chat-panel.svg
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/data/icons/scalable/status/Makefile.am b/data/icons/scalable/status/Makefile.am
deleted file mode 100644
index 59f0256..0000000
--- a/data/icons/scalable/status/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-iconsdir = $(datadir)/icons/hicolor/scalable/status
-
-icons_DATA = \
- application-running.svg \
- indicator-messages.svg \
- indicator-messages-new.svg
-
-EXTRA_DIST = $(icons_DATA)
-
diff --git a/debian/ayatana-indicator-messages.install b/debian/ayatana-indicator-messages.install
index 47c562c..782060b 100644
--- a/debian/ayatana-indicator-messages.install
+++ b/debian/ayatana-indicator-messages.install
@@ -1,4 +1,4 @@
-usr/lib/*/ayatana-indicator-messages/ayatana-indicator-messages-service
+usr/libexec/ayatana-indicator-messages/ayatana-indicator-messages-service
usr/lib/systemd
usr/share/ayatana/indicators
usr/share/glib-2.0
diff --git a/debian/compat b/debian/compat
index ec63514..f599e28 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-9
+10
diff --git a/debian/control b/debian/control
index 648990d..e2b3d2c 100644
--- a/debian/control
+++ b/debian/control
@@ -2,9 +2,9 @@ Source: ayatana-indicator-messages
Section: gnome
Priority: optional
Maintainer: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
-Build-Depends: debhelper (>= 9),
- dh-autoreconf | debhelper (>= 9.20160403~),
- dh-systemd | debhelper (>= 10.2~),
+Build-Depends: cmake,
+ cmake-extras,
+ debhelper (>= 10),
gobject-introspection (>= 0.9.12-4~),
gtk-doc-tools,
intltool,
@@ -12,7 +12,6 @@ Build-Depends: debhelper (>= 9),
libdbustest1-dev,
libgirepository1.0-dev (>= 0.9.12),
libgtest-dev,
- mate-common,
python3-dbusmock,
valac,
systemd [linux-any],
diff --git a/debian/copyright b/debian/copyright
index c432785..afadfe6 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -9,35 +9,26 @@ Copyright: 2017, THE PACKAGE'S COPYRIGHT HOLDER
YEAR, THE PACKAGE'S COPYRIGHT HOLDER
License: GPL-3
+Files: cmake/FindGObjectIntrospection.cmake
+ cmake/UseGObjectIntrospection.cmake
+Copyright: 2010, Pino Toscano, <pino@kde.org>
+License: BSD-3-clause
+
+Files:cmake/FindVala.cmake
+ cmake/UseVala.cmake
+Copyright: 2011, Přemysl Janouch
+License: BSD-2-clause
+
Files: AUTHORS
ChangeLog
- Makefile.am
- Makefile.am.coverage
README
NEWS
NEWS.Canonical
- autogen.sh
- common/Makefile.am
+ cmake/GdbusCodegen.cmake
common/org.ayatana.indicator.messages.application.xml
common/org.ayatana.indicator.messages.service.xml
- configure.ac
- data/Makefile.am
data/ayatana-indicator-messages.conf.in
data/ayatana-indicator-messages.desktop.in
- data/icons/16x16/Makefile.am
- data/icons/16x16/categories/Makefile.am
- data/icons/16x16/status/Makefile.am
- data/icons/22x22/Makefile.am
- data/icons/22x22/categories/Makefile.am
- data/icons/22x22/status/Makefile.am
- data/icons/24x24/Makefile.am
- data/icons/24x24/status/Makefile.am
- data/icons/32x32/Makefile.am
- data/icons/32x32/categories/Makefile.am
- data/icons/32x32/status/Makefile.am
- data/icons/48x48/Makefile.am
- data/icons/48x48/status/Makefile.am
- data/icons/Makefile.am
data/icons/16x16/categories/applications-chat-panel.png
data/icons/16x16/categories/applications-email-panel.png
data/icons/16x16/categories/applications-microblogging-panel.png
@@ -58,31 +49,21 @@ Files: AUTHORS
data/icons/48x48/status/application-running.png
data/icons/48x48/status/indicator-messages-new.png
data/icons/48x48/status/indicator-messages.png
- data/icons/scalable/Makefile.am
- data/icons/scalable/categories/Makefile.am
data/icons/scalable/categories/applications-chat-panel.svg
data/icons/scalable/categories/applications-email-panel.svg
- data/icons/scalable/status/Makefile.am
data/icons/scalable/status/application-running.svg
data/icons/scalable/status/indicator-messages-new.svg
data/icons/scalable/status/indicator-messages.svg
data/org.ayatana.indicator.messages
data/org.ayatana.indicator.messages.gschema.xml
- doc/Makefile.am
- doc/reference/Makefile.am
doc/reference/messaging-menu-docs.xml.in
doc/reference/messaging-menu-overrides.txt
doc/reference/messaging-menu-sections.txt
doc/reference/messaging-menu.types
- libmessaging-menu/Makefile.am
libmessaging-menu/client-example.py
libmessaging-menu/messaging-menu.pc.in
- m4/gcov.m4
- m4/gtest.m4
po/LINGUAS
po/POTFILES.in
- src/Makefile.am
- tests/Makefile.am
tests/applications/test.desktop
tests/applications/test2.desktop
tests/indicator-messages-service-activate.build.sh
@@ -130,15 +111,20 @@ Copyright: 2009, Canonical Ltd.
2015, Canonical Ltd.
License: GPL-3
-Files: update-po.sh
+Files: CMakeLists.txt
+ data/CMakeLists.txt
+ doc/CMakeLists.txt
+ doc/reference/CMakeLists.txt
+ libmessaging-menu/CMakeLists.txt
+ po/CMakeLists.txt
+ src/CMakeLists.txt
+ tests/CMakeLists.txt
+ update-po.sh
update-pot.sh
Copyright: 2017, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ Copyright: 2021, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
License: GPL-3
-Files: m4/ax_python_module.m4
-Copyright: 2008, Andrew Collier <colliera@ukzn.ac.za>
-License: FSF~All-Permissive
-
Files: debian/*
Copyright: 2009-2010, Evgeni Golov <evgeni@debian.org>
2009-2010, Ted Gould <ted@canonical.com>, Canonical Ltd.
diff --git a/debian/libmessaging-menu0.symbols b/debian/libmessaging-menu0.symbols
index 567e0a8..63f983e 100644
--- a/debian/libmessaging-menu0.symbols
+++ b/debian/libmessaging-menu0.symbols
@@ -1,4 +1,71 @@
libmessaging-menu.so.0 libmessaging-menu0 #MINVER#
+ _messaging_menu_message_to_variant@Base 0.8.2-0
+ indicator_messages_application_call_activate_message@Base 0.8.2-0
+ indicator_messages_application_call_activate_message_finish@Base 0.8.2-0
+ indicator_messages_application_call_activate_message_sync@Base 0.8.2-0
+ indicator_messages_application_call_activate_source@Base 0.8.2-0
+ indicator_messages_application_call_activate_source_finish@Base 0.8.2-0
+ indicator_messages_application_call_activate_source_sync@Base 0.8.2-0
+ indicator_messages_application_call_dismiss@Base 0.8.2-0
+ indicator_messages_application_call_dismiss_finish@Base 0.8.2-0
+ indicator_messages_application_call_dismiss_sync@Base 0.8.2-0
+ indicator_messages_application_call_list_messages@Base 0.8.2-0
+ indicator_messages_application_call_list_messages_finish@Base 0.8.2-0
+ indicator_messages_application_call_list_messages_sync@Base 0.8.2-0
+ indicator_messages_application_call_list_sources@Base 0.8.2-0
+ indicator_messages_application_call_list_sources_finish@Base 0.8.2-0
+ indicator_messages_application_call_list_sources_sync@Base 0.8.2-0
+ indicator_messages_application_complete_activate_message@Base 0.8.2-0
+ indicator_messages_application_complete_activate_source@Base 0.8.2-0
+ indicator_messages_application_complete_dismiss@Base 0.8.2-0
+ indicator_messages_application_complete_list_messages@Base 0.8.2-0
+ indicator_messages_application_complete_list_sources@Base 0.8.2-0
+ indicator_messages_application_emit_message_added@Base 0.8.2-0
+ indicator_messages_application_emit_message_removed@Base 0.8.2-0
+ indicator_messages_application_emit_source_added@Base 0.8.2-0
+ indicator_messages_application_emit_source_changed@Base 0.8.2-0
+ indicator_messages_application_emit_source_removed@Base 0.8.2-0
+ indicator_messages_application_get_type@Base 0.8.2-0
+ indicator_messages_application_interface_info@Base 0.8.2-0
+ indicator_messages_application_override_properties@Base 0.8.2-0
+ indicator_messages_application_proxy_get_type@Base 0.8.2-0
+ indicator_messages_application_proxy_new@Base 0.8.2-0
+ indicator_messages_application_proxy_new_finish@Base 0.8.2-0
+ indicator_messages_application_proxy_new_for_bus@Base 0.8.2-0
+ indicator_messages_application_proxy_new_for_bus_finish@Base 0.8.2-0
+ indicator_messages_application_proxy_new_for_bus_sync@Base 0.8.2-0
+ indicator_messages_application_proxy_new_sync@Base 0.8.2-0
+ indicator_messages_application_skeleton_get_type@Base 0.8.2-0
+ indicator_messages_application_skeleton_new@Base 0.8.2-0
+ indicator_messages_service_call_application_stopped_running@Base 0.8.2-0
+ indicator_messages_service_call_application_stopped_running_finish@Base 0.8.2-0
+ indicator_messages_service_call_application_stopped_running_sync@Base 0.8.2-0
+ indicator_messages_service_call_register_application@Base 0.8.2-0
+ indicator_messages_service_call_register_application_finish@Base 0.8.2-0
+ indicator_messages_service_call_register_application_sync@Base 0.8.2-0
+ indicator_messages_service_call_set_status@Base 0.8.2-0
+ indicator_messages_service_call_set_status_finish@Base 0.8.2-0
+ indicator_messages_service_call_set_status_sync@Base 0.8.2-0
+ indicator_messages_service_call_unregister_application@Base 0.8.2-0
+ indicator_messages_service_call_unregister_application_finish@Base 0.8.2-0
+ indicator_messages_service_call_unregister_application_sync@Base 0.8.2-0
+ indicator_messages_service_complete_application_stopped_running@Base 0.8.2-0
+ indicator_messages_service_complete_register_application@Base 0.8.2-0
+ indicator_messages_service_complete_set_status@Base 0.8.2-0
+ indicator_messages_service_complete_unregister_application@Base 0.8.2-0
+ indicator_messages_service_emit_status_changed@Base 0.8.2-0
+ indicator_messages_service_get_type@Base 0.8.2-0
+ indicator_messages_service_interface_info@Base 0.8.2-0
+ indicator_messages_service_override_properties@Base 0.8.2-0
+ indicator_messages_service_proxy_get_type@Base 0.8.2-0
+ indicator_messages_service_proxy_new@Base 0.8.2-0
+ indicator_messages_service_proxy_new_finish@Base 0.8.2-0
+ indicator_messages_service_proxy_new_for_bus@Base 0.8.2-0
+ indicator_messages_service_proxy_new_for_bus_finish@Base 0.8.2-0
+ indicator_messages_service_proxy_new_for_bus_sync@Base 0.8.2-0
+ indicator_messages_service_proxy_new_sync@Base 0.8.2-0
+ indicator_messages_service_skeleton_get_type@Base 0.8.2-0
+ indicator_messages_service_skeleton_new@Base 0.8.2-0
messaging_menu_app_append_message@Base 0.6.0
messaging_menu_app_append_source@Base 0.6.0
messaging_menu_app_append_source_with_count@Base 0.6.0
diff --git a/debian/rules b/debian/rules
index e97abfe..db23614 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,27 +6,27 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
-%:
- dh $@ --with autoreconf,gir,systemd
+DEB_CMAKE_EXTRA_FLAGS = \
+ -DENABLE_TESTS=ON \
+ -DENABLE_COVERAGE=OFF \
+ $(NULL)
-override_dh_autoreconf:
- if [ ! -e po/ayatana-indicator-messages.pot.bak ]; then \
- cp po/ayatana-indicator-messages.pot po/ayatana-indicator-messages.pot.bak; \
- fi
- NOCONFIGURE=1 dh_autoreconf ./autogen.sh
+%:
+ dh $@ --with gir,systemd
override_dh_auto_configure:
- dh_auto_configure -- --enable-gtk-doc
+ dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)
override_dh_install:
find debian/tmp/usr/lib -name *.la -delete
- dh_install --fail-missing
+ dh_install
+
+override_dh_missing:
+ dh_missing --fail-missing
-override_dh_auto_clean:
- dh_auto_clean
- if [ -e po/ayatana-indicator-messages.pot.bak ]; then \
- mv -f po/ayatana-indicator-messages.pot.bak po/ayatana-indicator-messages.pot; \
- fi
+# Hack as it seems it's not possible to easy run that under dbus-test-runner
+override_dh_auto_test:
+ env -u LD_PRELOAD dh_auto_test
get-orig-source:
uscan --noconf --force-download --rename --download-current-version --destdir=..
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 0000000..90bb2b5
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(reference)
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index f3ddc22..0000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = reference
diff --git a/doc/reference/CMakeLists.txt b/doc/reference/CMakeLists.txt
new file mode 100644
index 0000000..ed949c2
--- /dev/null
+++ b/doc/reference/CMakeLists.txt
@@ -0,0 +1,205 @@
+# messaging-menu-docs.xml
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu-docs.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-docs.xml" @ONLY)
+
+# messaging-menu-decl.txt
+# messaging-menu-decl-list.txt
+# messaging-menu-overrides.txt
+# messaging-menu-sections.txt
+# messaging-menu.types
+
+find_program(GTKDOC_SCAN gtkdoc-scan)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-decl.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-decl-list.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-overrides.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-sections.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.types"
+ DEPENDS "messaging-menu"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${GTKDOC_SCAN}
+ --module=messaging-menu
+ --source-dir="${CMAKE_SOURCE_DIR}/libmessaging-menu"
+)
+
+# scangobj.sh
+
+list(JOIN PROJECT_DEPS_INCLUDE_DIRS " -I" GTKDOC_SCANGOBJ_INCLUDE_DIRS)
+list(JOIN PROJECT_DEPS_LIBRARIES " -l" GTKDOC_SCANGOBJ_LIBRARIES)
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/scangobj.sh" GENERATED)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/scangobj.sh" "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/libmessaging-menu\" CFLAGS=\"-I${GTKDOC_SCANGOBJ_INCLUDE_DIRS}\" LDFLAGS=\"-l${GTKDOC_SCANGOBJ_LIBRARIES} -L${CMAKE_BINARY_DIR}/libmessaging-menu -lmessaging-menu\" gtkdoc-scangobj --module=messaging-menu")
+
+# messaging-menu.actions"
+# messaging-menu.args"
+# messaging-menu.hierarchy"
+# messaging-menu.interfaces"
+# messaging-menu.prerequisites"
+# messaging-menu.signals"
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.actions"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.args"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.hierarchy"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.interfaces"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.prerequisites"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.signals"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-decl.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-decl-list.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-overrides.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-sections.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.types"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scangobj.sh"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND sh scangobj.sh
+)
+
+# messaging-menu-undeclared.txt
+# messaging-menu-undocumented.txt
+# messaging-menu-unused.txt
+# sgml.stamp
+# xml/annotation-glossary.xml
+# xml/api-index-deprecated.xml
+# xml/api-index-full.xml
+# xml/messaging-menu-app.xml
+# xml/messaging-menu-doc.bottom
+# xml/messaging-menu-doc.top
+# xml/messaging-menu-message.xml
+# xml/object_index.sgml
+# xml/tree_index.sgml
+
+find_program(GTKDOC_MKDB gtkdoc-mkdb)
+list(JOIN PROJECT_DEPS_INCLUDE_DIRS ";-I" GTKDOC_SCANGOBJ_INCLUDE_DIRS)
+list(JOIN PROJECT_DEPS_LIBRARIES ";-l" GTKDOC_SCANGOBJ_LIBRARIES)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-undeclared.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-undocumented.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-unused.txt"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/annotation-glossary.xml"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/api-index-deprecated.xml"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/api-index-full.xml"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/messaging-menu-app.xml"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/messaging-menu-doc.bottom"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/messaging-menu-doc.top"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/xml/messaging-menu-message.xml"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/object_index.sgml"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/xml/tree_index.sgml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.actions"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.args"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.hierarchy"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.interfaces"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.prerequisites"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.signals"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${GTKDOC_MKDB}
+ --module=messaging-menu
+ --output-format=xml
+ --expand-content-files=""
+ --main-sgml-file=messaging-menu-docs.xml
+ --source-dir="${CMAKE_SOURCE_DIR}/libmessaging-menu"
+ --xml-mode
+)
+
+# html
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html")
+
+# html/annotation-glossary.html
+# html/api-index-full.html
+# html/ch01.html
+# html/home.png
+# html/index.html
+# html/left.png
+# html/left-insensitive.png
+# html/messaging-menu.devhelp2
+# html/MessagingMenuApp.html
+# html/MessagingMenuMessage.html
+# html/object-tree.html
+# html/right.png
+# html/right-insensitive.png
+# html/style.css
+# html/up.png
+# html/up-insensitive.png
+
+find_program(GTKDOC_MKHTML gtkdoc-mkhtml)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/annotation-glossary.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/api-index-full.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/ch01.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/home.png"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/left.png"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/left-insensitive.png"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/messaging-menu.devhelp2"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/MessagingMenuApp.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/MessagingMenuMessage.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/object-tree.html"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/right.png"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/right-insensitive.png"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/style.css"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/up.png"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/up-insensitive.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-undeclared.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-undocumented.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu-unused.txt"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/annotation-glossary.xml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/api-index-deprecated.xml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/api-index-full.xml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/messaging-menu-app.xml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/messaging-menu-doc.bottom"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/messaging-menu-doc.top"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/xml/messaging-menu-message.xml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/object_index.sgml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xml/tree_index.sgml"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html"
+ COMMAND
+ ${GTKDOC_MKHTML}
+ --path=${CMAKE_CURRENT_BINARY_DIR}
+ messaging-menu
+ messaging-menu-docs.xml
+)
+
+# html/annotation-glossary.html
+# html/api-index-deprecated.html
+# html/api-index-full.html
+# html/ch01.html
+# html/index.html
+# html/object-tree.html
+# html/style.css
+
+find_program(GTKDOC_FIXXREF gtkdoc-fixxref)
+
+add_custom_command(
+ OUTPUT "fixxref"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/annotation-glossary.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/api-index-full.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/ch01.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/home.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/left.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/left-insensitive.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/messaging-menu.devhelp2"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/MessagingMenuApp.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/MessagingMenuMessage.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/object-tree.html"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/right.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/right-insensitive.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/style.css"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/up.png"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/up-insensitive.png"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${GTKDOC_FIXXREF}
+ --module=messaging-menu
+ --module-dir=html
+ --html-dir="${CMAKE_INSTALL_FULL_DATADIR}/gtk-doc/html"
+)
+
+set_source_files_properties("fixxref" PROPERTIES SYMBOLIC TRUE)
+install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gtk-doc/html/messaging-menu")
+
+add_custom_target("docs-references" ALL DEPENDS "fixxref")
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
deleted file mode 100644
index 1dfac8a..0000000
--- a/doc/reference/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-DOC_MODULE = messaging-menu
-
-DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
-
-DOC_SOURCE_DIR = $(top_srcdir)/libmessaging-menu
-
-MKDB_OPTIONS=--xml-mode --output-format=xml
-
-# Used for dependencies. The docs will be rebuilt if any of these change.
-HFILE_GLOB = $(top_srcdir)/libmessaging-menu/*.h
-CFILE_GLOB = $(top_srcdir)/libmessaging-menu/*.c
-
-IGNORE_HFILES= \
- indicator-messages-service.h
-
-AM_CPPFLAGS=-I$(top_srcdir)/libmessaging-menu $(GIO_CFLAGS)
-GTKDOC_LIBS=$(top_builddir)/libmessaging-menu/libmessaging-menu.la
-
-include $(top_srcdir)/gtk-doc.make
diff --git a/doc/reference/messaging-menu-docs.xml.in b/doc/reference/messaging-menu-docs.xml.in
index 9319875..caa499c 100644
--- a/doc/reference/messaging-menu-docs.xml.in
+++ b/doc/reference/messaging-menu-docs.xml.in
@@ -2,7 +2,7 @@
<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
-<!ENTITY version "@PACKAGE_VERSION@">
+<!ENTITY version "@PROJECT_VERSION@">
]>
<book lang="en" id="messaging-menu" xmlns:xi="http://www.w3.org/2003/XInclude">
<title>Messaging Menu Reference Manual</title>
diff --git a/libmessaging-menu/CMakeLists.txt b/libmessaging-menu/CMakeLists.txt
new file mode 100644
index 0000000..2d3d6ac
--- /dev/null
+++ b/libmessaging-menu/CMakeLists.txt
@@ -0,0 +1,101 @@
+# messaging-menu.pc
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.pc" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
+
+# messaging-menu-app.h
+# messaging-menu-message.h
+# messaging-menu.h
+
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu-app.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/messaging-menu")
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu-message.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/messaging-menu")
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/messaging-menu")
+
+# libmessaging-menu.so
+
+set(
+ SOURCES
+ messaging-menu-app.c
+ messaging-menu-message.c
+)
+
+set(
+ SOURCES_GEN
+ ${CMAKE_BINARY_DIR}/src/indicator-messages-service.c
+ ${CMAKE_BINARY_DIR}/src/indicator-messages-application.c
+)
+
+set_source_files_properties(${SOURCES_GEN} PROPERTIES GENERATED TRUE)
+set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_library("messaging-menu" SHARED ${SOURCES} ${SOURCES_GEN})
+set_target_properties("messaging-menu" PROPERTIES VERSION 0.0.0 SOVERSION 0)
+target_include_directories("messaging-menu" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} "${CMAKE_BINARY_DIR}/src")
+target_link_libraries("messaging-menu" ${PROJECT_DEPS_LIBRARIES})
+add_dependencies("messaging-menu" "ayatana-indicator-messages-service")
+install(TARGETS "messaging-menu" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")
+
+# MessagingMenu-1.0.gir
+
+find_package(GObjectIntrospection REQUIRED)
+
+set(
+ HEADERS
+ messaging-menu-app.h
+ messaging-menu-message.h
+)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir"
+ DEPENDS "messaging-menu"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${INTROSPECTION_SCANNER}
+ ${HEADERS} ${SOURCES}
+ --namespace=MessagingMenu
+ --nsversion=1.0
+ --quiet
+ --warn-all
+ --include=GObject-2.0
+ --include=Gio-2.0
+ --pkg-export=messaging-menu
+ --library="messaging-menu"
+ --c-include="messaging-menu.h"
+ --library-path=${CMAKE_CURRENT_BINARY_DIR}
+ --output "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir"
+)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
+
+# MessagingMenu-1.0.typelib
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${INTROSPECTION_COMPILER}
+ --includedir=${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir
+ -o "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib"
+)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0")
+
+# MessagingMenu-1.0.vapi
+
+find_package(Vala REQUIRED)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.vapi"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${VAPI_GEN}
+ --library=MessagingMenu-1.0
+ --pkg gio-2.0
+ MessagingMenu-1.0.gir
+)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")
+
+add_custom_target("libmessaging-menu" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.vapi")
diff --git a/libmessaging-menu/Makefile.am b/libmessaging-menu/Makefile.am
deleted file mode 100644
index 2f178b5..0000000
--- a/libmessaging-menu/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-lib_LTLIBRARIES = libmessaging-menu.la
-
-libmessaging_menu_ladir = $(includedir)/messaging-menu
-
-libmessaging_menu_la_SOURCES = \
- messaging-menu-app.c \
- messaging-menu-message.c
-
-libmessaging_menu_la_HEADERS = \
- messaging-menu-app.h \
- messaging-menu.h \
- messaging-menu-message.h
-
-libmessaging_menu_la_LIBADD = \
- $(GIO_LIBS) \
- $(top_builddir)/common/libmessaging-common.la
-
-libmessaging_menu_la_CFLAGS = \
- -I$(top_builddir)/common \
- $(GIO_CFLAGS) \
- -Wall
-
-libmessaging_menu_la_LDFLAGS = -export-symbols-regex "^messaging_menu_.*"
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = messaging-menu.pc
-
-
--include $(INTROSPECTION_MAKEFILE)
-
-INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
-
-if HAVE_INTROSPECTION
-
-MessagingMenu-1.0.gir: libmessaging-menu.la
-MessagingMenu_1_0_gir_NAMESPACE = MessagingMenu
-MessagingMenu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
-MessagingMenu_1_0_gir_CFLAGS = $(INCLUDES) $(GIO_CFLAGS)
-MessagingMenu_1_0_gir_SCANNERFLAGS = --c-include="messaging-menu.h"
-MessagingMenu_1_0_gir_LIBS = libmessaging-menu.la
-MessagingMenu_1_0_gir_FILES = \
- messaging-menu-app.c \
- messaging-menu-app.h \
- messaging-menu-message.c \
- messaging-menu-message.h
-MessagingMenu_1_0_gir_EXPORT_PACKAGES = messaging-menu
-INTROSPECTION_GIRS += MessagingMenu-1.0.gir
-
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(INTROSPECTION_GIRS)
-
-typelibdir = $(libdir)/girepository-1.0
-typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
-
-CLEANFILES = $(gir_DATA) $(typelib_DATA)
-
-
-#########################
-# VAPI Files
-#########################
-
-if HAVE_VALA
-
-vapidir = $(datadir)/vala/vapi
-vapi_DATA = MessagingMenu-1.0.vapi
-
-MessagingMenu-1.0.vapi: MessagingMenu-1.0.gir
- $(VALA_API_GEN) --pkg gio-2.0 --library=MessagingMenu-1.0 $<
-
-CLEANFILES += $(vapi_DATA)
-
-endif
-
-endif
diff --git a/libmessaging-menu/messaging-menu.pc.in b/libmessaging-menu/messaging-menu.pc.in
index 24ac4bc..d241276 100644
--- a/libmessaging-menu/messaging-menu.pc.in
+++ b/libmessaging-menu/messaging-menu.pc.in
@@ -1,11 +1,11 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/messaging-menu
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/messaging-menu
Name: Ayatana Messaging Menu Library
Description: Ayatana Messaging Menu client library
-Version: @VERSION@
+Version: @PROJECT_VERSION@
Requires: gio-unix-2.0
Libs: -L${libdir} -lmessaging-menu
Cflags: -I${includedir}
diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4
deleted file mode 100644
index bd70a06..0000000
--- a/m4/ax_python_module.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_python_module.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_PYTHON_MODULE(modname[, fatal])
-#
-# DESCRIPTION
-#
-# Checks for Python module.
-#
-# If fatal is non-empty then absence of a module will trigger an error.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 5
-
-AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
-AC_DEFUN([AX_PYTHON_MODULE],[
- if test -z $PYTHON;
- then
- PYTHON="python"
- fi
- PYTHON_NAME=`basename $PYTHON`
- AC_MSG_CHECKING($PYTHON_NAME module: $1)
- $PYTHON -c "import $1" 2>/dev/null
- if test $? -eq 0;
- then
- AC_MSG_RESULT(yes)
- eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
- else
- AC_MSG_RESULT(no)
- eval AS_TR_CPP(HAVE_PYMOD_$1)=no
- #
- if test -n "$2"
- then
- AC_MSG_ERROR(failed to find required module $1)
- exit 1
- fi
- fi
-])
diff --git a/m4/gcov.m4 b/m4/gcov.m4
deleted file mode 100644
index bd96386..0000000
--- a/m4/gcov.m4
+++ /dev/null
@@ -1,86 +0,0 @@
-# Checks for existence of coverage tools:
-# * gcov
-# * lcov
-# * genhtml
-# * gcovr
-#
-# Sets ac_cv_check_gcov to yes if tooling is present
-# and reports the executables to the variables LCOV, GCOVR and GENHTML.
-AC_DEFUN([AC_TDD_GCOV],
-[
- AC_ARG_ENABLE(gcov,
- AS_HELP_STRING([--enable-gcov],
- [enable coverage testing with gcov]),
- [use_gcov=$enableval], [use_gcov=no])
-
- if test "x$use_gcov" = "xyes"; then
- # we need gcc:
- if test "$GCC" != "yes"; then
- AC_MSG_ERROR([GCC is required for --enable-gcov])
- fi
-
- # Check if ccache is being used
- AC_CHECK_PROG(SHTOOL, shtool, shtool)
- case `$SHTOOL path $CC` in
- *ccache*[)] gcc_ccache=yes;;
- *[)] gcc_ccache=no;;
- esac
-
- if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
- AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
- fi
-
- lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11"
- AC_CHECK_PROG(LCOV, lcov, lcov)
- AC_CHECK_PROG(GENHTML, genhtml, genhtml)
-
- if test "$LCOV"; then
- AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
- glib_cv_lcov_version=invalid
- lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
- for lcov_check_version in $lcov_version_list; do
- if test "$lcov_version" = "$lcov_check_version"; then
- glib_cv_lcov_version="$lcov_check_version (ok)"
- fi
- done
- ])
- else
- lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
- AC_MSG_ERROR([$lcov_msg])
- fi
-
- case $glib_cv_lcov_version in
- ""|invalid[)]
- lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
- AC_MSG_ERROR([$lcov_msg])
- LCOV="exit 0;"
- ;;
- esac
-
- if test -z "$GENHTML"; then
- AC_MSG_ERROR([Could not find genhtml from the lcov package])
- fi
-
- ac_cv_check_gcov=yes
- ac_cv_check_lcov=yes
-
- # Remove all optimization flags from CFLAGS
- changequote({,})
- CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
- changequote([,])
-
- # Add the special gcc flags
- COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
- COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
- COVERAGE_LDFLAGS="-lgcov"
-
- # Check availability of gcovr
- AC_CHECK_PROG(GCOVR, gcovr, gcovr)
- if test -z "$GCOVR"; then
- ac_cv_check_gcovr=no
- else
- ac_cv_check_gcovr=yes
- fi
-
-fi
-]) # AC_TDD_GCOV
diff --git a/m4/gtest.m4 b/m4/gtest.m4
deleted file mode 100644
index 6598ba7..0000000
--- a/m4/gtest.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-dnl GTEST_LIB_CHECK([minimum version [,
-dnl action if found [,action if not found]]])
-dnl
-dnl Check for the presence of the Google Test library, optionally at a minimum
-dnl version, and indicate a viable version with the HAVE_GTEST flag. It defines
-dnl standard variables for substitution including GTEST_CPPFLAGS,
-dnl GTEST_CXXFLAGS, GTEST_LDFLAGS, and GTEST_LIBS. It also defines
-dnl GTEST_VERSION as the version of Google Test found. Finally, it provides
-dnl optional custom action slots in the event GTEST is found or not.
-AC_DEFUN([GTEST_LIB_CHECK],
-[
-dnl Provide a flag to enable or disable Google Test usage.
-AC_ARG_ENABLE([gtest],
- [AS_HELP_STRING([--enable-gtest],
- [Enable tests using the Google C++ Testing Framework.
- (Default is enabled.)])],
- [],
- [enable_gtest=])
-AC_ARG_VAR([GTEST_CONFIG],
- [The exact path of Google Test's 'gtest-config' script.])
-AC_ARG_VAR([GTEST_CPPFLAGS],
- [C-like preprocessor flags for Google Test.])
-AC_ARG_VAR([GTEST_CXXFLAGS],
- [C++ compile flags for Google Test.])
-AC_ARG_VAR([GTEST_LDFLAGS],
- [Linker path and option flags for Google Test.])
-AC_ARG_VAR([GTEST_LIBS],
- [Library linking flags for Google Test.])
-AC_ARG_VAR([GTEST_VERSION],
- [The version of Google Test available.])
-HAVE_GTEST="no"
-AS_IF([test "x${enable_gtest}" != "xno"],
- [AC_MSG_CHECKING([for 'gtest-config'])
- AS_IF([test "x${enable_gtest}" != "xyes"],
- [AS_IF([test -x "${enable_gtest}/scripts/gtest-config"],
- [GTEST_CONFIG="${enable_gtest}/scripts/gtest-config"],
- [GTEST_CONFIG="${enable_gtest}/bin/gtest-config"])
- AS_IF([test -x "${GTEST_CONFIG}"], [],
- [AC_MSG_RESULT([no])
- AC_MSG_ERROR([dnl
-Unable to locate either a built or installed Google Test.
-The specific location '${enable_gtest}' was provided for a built or installed
-Google Test, but no 'gtest-config' script could be found at this location.])
- ])],
- [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])
- AS_IF([test -x "${GTEST_CONFIG}"],
- [AC_MSG_RESULT([${GTEST_CONFIG}])
- m4_ifval([$1],
- [_gtest_min_version="--min-version=$1"
- AC_MSG_CHECKING([for Google Test at least version >= $1])],
- [_gtest_min_version="--min-version=0"
- AC_MSG_CHECKING([for Google Test])])
- AS_IF([${GTEST_CONFIG} ${_gtest_min_version}],
- [AC_MSG_RESULT([yes])
- HAVE_GTEST='yes'],
- [AC_MSG_RESULT([no])])],
- [AC_MSG_RESULT([no])])
- AS_IF([test "x${HAVE_GTEST}" = "xyes"],
- [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`
- GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`
- GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
- GTEST_LIBS=`${GTEST_CONFIG} --libs`
- GTEST_VERSION=`${GTEST_CONFIG} --version`
- AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])],
- [AS_IF([test "x${enable_gtest}" = "xyes"],
- [AC_MSG_ERROR([dnl
-Google Test was enabled, but no viable version could be found.])
- ])])])
-AC_SUBST([HAVE_GTEST])
-AM_CONDITIONAL([HAVE_GTEST],[test "x$HAVE_GTEST" = "xyes"])
-AS_IF([test "x$HAVE_GTEST" = "xyes"],
- [m4_ifval([$2], [$2])],
- [m4_ifval([$3], [$3])])
-])
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 0000000..8435188
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,2 @@
+find_package(Intltool REQUIRED)
+intltool_install_translations(ALL GETTEXT_PACKAGE ${GETTEXT_PACKAGE})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..4c8ace8
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,49 @@
+include(GdbusCodegen)
+set(SOURCES_GEN)
+
+# indicator-messages-service.h
+# indicator-messages-service.c
+
+add_gdbus_codegen_with_namespace(
+ SOURCES_GEN indicator-messages-service
+ org.ayatana.indicator.messages
+ IndicatorMessages
+ ${CMAKE_SOURCE_DIR}/common/org.ayatana.indicator.messages.service.xml
+)
+
+# indicator-messages-application.h
+# indicator-messages-application.c
+
+add_gdbus_codegen_with_namespace(
+ SOURCES_GEN indicator-messages-application
+ org.ayatana.indicator.messages
+ IndicatorMessages
+ ${CMAKE_SOURCE_DIR}/common/org.ayatana.indicator.messages.application.xml
+)
+
+# ayatana-indicator-messages-service
+
+set(
+ SOURCES
+ gactionmuxer.c
+ gsettingsstrv.c
+ im-accounts-service.c
+ im-application-list.c
+ im-desktop-menu.c
+ im-menu.c
+ im-phone-menu.c
+ indicator-desktop-shortcuts.c
+ messages-service.c
+)
+
+set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_executable("ayatana-indicator-messages-service" ${SOURCES} ${SOURCES_GEN})
+target_compile_definitions(
+ "ayatana-indicator-messages-service" PUBLIC
+ G_LOG_DOMAIN="Ayatana-Indicator-Messages"
+ GETTEXT_PACKAGE="${GETTEXT_PACKAGE}"
+ LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
+)
+target_include_directories("ayatana-indicator-messages-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries("ayatana-indicator-messages-service" ${PROJECT_DEPS_LIBRARIES})
+install(TARGETS "ayatana-indicator-messages-service" RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ayatana-indicator-messages")
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index bc6205f..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-EXTRA_DIST =
-
-pkglibexec_PROGRAMS = ayatana-indicator-messages-service
-
-ayatana_indicator_messages_service_SOURCES = \
- messages-service.c \
- dbus-data.h \
- gactionmuxer.c \
- gactionmuxer.h \
- gsettingsstrv.c \
- gsettingsstrv.h \
- im-accounts-service.c \
- im-accounts-service.h \
- im-menu.c \
- im-menu.h \
- im-phone-menu.c \
- im-phone-menu.h \
- im-desktop-menu.c \
- im-desktop-menu.h \
- im-application-list.c \
- im-application-list.h \
- indicator-desktop-shortcuts.c \
- indicator-desktop-shortcuts.h
-
-ayatana_indicator_messages_service_CFLAGS = \
- $(APPLET_CFLAGS) \
- $(COVERAGE_CFLAGS) \
- -I$(top_builddir)/common \
- -Wall \
- -Wl,-Bsymbolic-functions \
- -Wl,-z,defs \
- -Wl,--as-needed \
- -Wno-error=deprecated-declarations \
- -DG_LOG_DOMAIN=\"Ayatana-Indicator-Messages\"
-
-ayatana_indicator_messages_service_LDADD = \
- $(top_builddir)/common/libmessaging-common.la \
- $(APPLET_LIBS)
-
-ayatana_indicator_messages_service_LDFLAGS = \
- $(COVERAGE_LDFLAGS)
-
-EXTRA_DIST += \
- ayatana-messages-service.xml
diff --git a/src/im-accounts-service.c b/src/im-accounts-service.c
index fa2d469..8507cae 100644
--- a/src/im-accounts-service.c
+++ b/src/im-accounts-service.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2014 Canonical Ltd.
+ * Copyright © 2021 Robert Tari
*
* 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
@@ -15,20 +16,17 @@
*
* Authors:
* Ted Gould <ted@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <act/act.h>
#include "im-accounts-service.h"
typedef struct {
- ActUserManager * user_manager;
- GDBusProxy * touch_settings;
- GCancellable * cancel;
+ ActUserManager * user_manager;
+ GDBusProxy * touch_settings;
+ GCancellable * cancel;
} ImAccountsServicePrivate;
static void im_accounts_service_class_init (ImAccountsServiceClass *klass);
@@ -44,97 +42,97 @@ G_DEFINE_TYPE_WITH_PRIVATE (ImAccountsService, im_accounts_service, G_TYPE_OBJEC
static void
im_accounts_service_class_init (ImAccountsServiceClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = im_accounts_service_dispose;
- object_class->finalize = im_accounts_service_finalize;
+ object_class->dispose = im_accounts_service_dispose;
+ object_class->finalize = im_accounts_service_finalize;
}
static void
im_accounts_service_init (ImAccountsService *self)
{
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
- priv->cancel = g_cancellable_new();
+ priv->cancel = g_cancellable_new();
- priv->user_manager = act_user_manager_get_default();
- g_signal_connect(priv->user_manager, "user-changed", G_CALLBACK(user_changed), self);
- g_signal_connect(priv->user_manager, "notify::is-loaded", G_CALLBACK(on_user_manager_loaded), self);
+ priv->user_manager = act_user_manager_get_default();
+ g_signal_connect(priv->user_manager, "user-changed", G_CALLBACK(user_changed), self);
+ g_signal_connect(priv->user_manager, "notify::is-loaded", G_CALLBACK(on_user_manager_loaded), self);
- gboolean isLoaded = FALSE;
- g_object_get(G_OBJECT(priv->user_manager), "is-loaded", &isLoaded, NULL);
- if (isLoaded) {
- on_user_manager_loaded(priv->user_manager, NULL, NULL);
- }
+ gboolean isLoaded = FALSE;
+ g_object_get(G_OBJECT(priv->user_manager), "is-loaded", &isLoaded, NULL);
+ if (isLoaded) {
+ on_user_manager_loaded(priv->user_manager, NULL, NULL);
+ }
}
static void
im_accounts_service_dispose (GObject *object)
{
- ImAccountsService * self = IM_ACCOUNTS_SERVICE(object);
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(object);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+
+ if (priv->cancel != NULL) {
+ g_cancellable_cancel(priv->cancel);
+ g_clear_object(&priv->cancel);
+ }
- if (priv->cancel != NULL) {
- g_cancellable_cancel(priv->cancel);
- g_clear_object(&priv->cancel);
- }
+ g_clear_object(&priv->user_manager);
- g_clear_object(&priv->user_manager);
-
- G_OBJECT_CLASS (im_accounts_service_parent_class)->dispose (object);
+ G_OBJECT_CLASS (im_accounts_service_parent_class)->dispose (object);
}
static void
im_accounts_service_finalize (GObject *object)
{
- G_OBJECT_CLASS (im_accounts_service_parent_class)->finalize (object);
+ G_OBJECT_CLASS (im_accounts_service_parent_class)->finalize (object);
}
/* Handles a User getting updated */
static void
user_changed (ActUserManager * manager, ActUser * user, gpointer user_data)
{
- if (g_strcmp0(act_user_get_user_name(user), g_get_user_name()) != 0) {
- return;
- }
-
- ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
- g_debug("User Updated");
-
- /* Clear old proxies */
- g_clear_object(&priv->touch_settings);
-
- /* Start getting a new proxy */
- g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.Accounts",
- act_user_get_object_path(user),
- "com.ubuntu.touch.AccountsService.SecurityPrivacy",
- priv->cancel,
- security_privacy_ready,
- user_data);
+ if (g_strcmp0(act_user_get_user_name(user), g_get_user_name()) != 0) {
+ return;
+ }
+
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+ g_debug("User Updated");
+
+ /* Clear old proxies */
+ g_clear_object(&priv->touch_settings);
+
+ /* Start getting a new proxy */
+ g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.Accounts",
+ act_user_get_object_path(user),
+ "com.ubuntu.touch.AccountsService.SecurityPrivacy",
+ priv->cancel,
+ security_privacy_ready,
+ user_data);
}
/* Respond to the async of setting up the proxy. Mostly we get it or we error. */
static void
security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data)
{
- GError * error = NULL;
- GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
-
- if (error != NULL) {
- g_warning("Unable to get a proxy on accounts service for touch settings: %s", error->message);
- g_error_free(error);
- return;
- }
-
- ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
- /* Ensure we didn't get a proxy while we weren't looking */
- g_clear_object(&priv->touch_settings);
- priv->touch_settings = proxy;
+ GError * error = NULL;
+ GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
+
+ if (error != NULL) {
+ g_warning("Unable to get a proxy on accounts service for touch settings: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+ /* Ensure we didn't get a proxy while we weren't looking */
+ g_clear_object(&priv->touch_settings);
+ priv->touch_settings = proxy;
}
/* When the user manager is loaded see if we have a user already loaded
@@ -142,17 +140,17 @@ security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data)
static void
on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data)
{
- ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
- ActUser * user = NULL;
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(user_data);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+ ActUser * user = NULL;
- g_debug("Accounts Manager Loaded");
+ g_debug("Accounts Manager Loaded");
- user = act_user_manager_get_user(priv->user_manager, g_get_user_name());
- if (user != NULL) {
- user_changed(priv->user_manager, user, user_data);
- g_object_unref(user);
- }
+ user = act_user_manager_get_user(priv->user_manager, g_get_user_name());
+ if (user != NULL) {
+ user_changed(priv->user_manager, user, user_data);
+ g_object_unref(user);
+ }
}
/* Not the most testable way to do this but, it is a less invasive one, and we'll
@@ -161,14 +159,14 @@ on_user_manager_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer
ImAccountsService *
im_accounts_service_ref_default (void)
{
- static ImAccountsService * as = NULL;
- if (as == NULL) {
- as = IM_ACCOUNTS_SERVICE(g_object_new(IM_ACCOUNTS_SERVICE_TYPE, NULL));
- g_object_add_weak_pointer(G_OBJECT(as), (gpointer *)&as);
- return as;
- }
-
- return g_object_ref(as);
+ static ImAccountsService * as = NULL;
+ if (as == NULL) {
+ as = IM_ACCOUNTS_SERVICE(g_object_new(IM_ACCOUNTS_SERVICE_TYPE, NULL));
+ g_object_add_weak_pointer(G_OBJECT(as), (gpointer *)&as);
+ return as;
+ }
+
+ return g_object_ref(as);
}
/* The draws attention setting is very legacy right now, we've patched and not changed
@@ -176,25 +174,25 @@ im_accounts_service_ref_default (void)
void
im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean draws_attention)
{
- g_return_if_fail(IM_IS_ACCOUNTS_SERVICE(service));
- ImAccountsService * self = IM_ACCOUNTS_SERVICE(service);
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
-
- if (priv->touch_settings == NULL) {
- return;
- }
-
- g_dbus_connection_call(g_dbus_proxy_get_connection(priv->touch_settings),
- g_dbus_proxy_get_name(priv->touch_settings),
- g_dbus_proxy_get_object_path(priv->touch_settings),
- "org.freedesktop.Accounts.User",
- "SetXHasMessages",
- g_variant_new("(b)", draws_attention),
- NULL, /* reply */
- G_DBUS_CALL_FLAGS_NONE,
- -1, /* timeout */
- priv->cancel, /* cancellable */
- NULL, NULL); /* cb */
+ g_return_if_fail(IM_IS_ACCOUNTS_SERVICE(service));
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(service);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+
+ if (priv->touch_settings == NULL) {
+ return;
+ }
+
+ g_dbus_connection_call(g_dbus_proxy_get_connection(priv->touch_settings),
+ g_dbus_proxy_get_name(priv->touch_settings),
+ g_dbus_proxy_get_object_path(priv->touch_settings),
+ "org.freedesktop.Accounts.User",
+ "SetXHasMessages",
+ g_variant_new("(b)", draws_attention),
+ NULL, /* reply */
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, /* timeout */
+ priv->cancel, /* cancellable */
+ NULL, NULL); /* cb */
}
/* Looks at the property that is set by settings. We default to off in any case
@@ -202,21 +200,21 @@ im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean d
gboolean
im_accounts_service_get_show_on_greeter (ImAccountsService * service)
{
- g_return_val_if_fail(IM_IS_ACCOUNTS_SERVICE(service), FALSE);
+ g_return_val_if_fail(IM_IS_ACCOUNTS_SERVICE(service), FALSE);
- ImAccountsService * self = IM_ACCOUNTS_SERVICE(service);
- ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
+ ImAccountsService * self = IM_ACCOUNTS_SERVICE(service);
+ ImAccountsServicePrivate * priv = im_accounts_service_get_instance_private(self);
- if (priv->touch_settings == NULL) {
- return FALSE;
- }
+ if (priv->touch_settings == NULL) {
+ return FALSE;
+ }
- GVariant * val = g_dbus_proxy_get_cached_property(priv->touch_settings, "MessagesWelcomeScreen");
- if (val == NULL) {
- return FALSE;
- }
+ GVariant * val = g_dbus_proxy_get_cached_property(priv->touch_settings, "MessagesWelcomeScreen");
+ if (val == NULL) {
+ return FALSE;
+ }
- gboolean retval = g_variant_get_boolean(val);
- g_variant_unref(val);
- return retval;
+ gboolean retval = g_variant_get_boolean(val);
+ g_variant_unref(val);
+ return retval;
}
diff --git a/src/indicator-desktop-shortcuts.c b/src/indicator-desktop-shortcuts.c
index bbac612..5482657 100644
--- a/src/indicator-desktop-shortcuts.c
+++ b/src/indicator-desktop-shortcuts.c
@@ -3,9 +3,11 @@ A small file to parse through the actions that are available
in the desktop file and making those easily usable.
Copyright 2010 Canonical Ltd.
+Copyright 2021 Robert Tari
Authors:
Ted Gould <ted@canonical.com>
+ Robert Tari <robert@tari.in>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -21,10 +23,6 @@ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <gio/gdesktopappinfo.h>
#include "indicator-desktop-shortcuts.h"
@@ -40,23 +38,23 @@ License along with this library. If not, see
typedef enum _actions_t actions_t;
enum _actions_t {
- ACTIONS_NONE,
- ACTIONS_XAYATANA,
- ACTIONS_DESKTOP_SPEC
+ ACTIONS_NONE,
+ ACTIONS_XAYATANA,
+ ACTIONS_DESKTOP_SPEC
};
typedef struct {
- actions_t actions;
- GKeyFile * keyfile;
- gchar * identity;
- GArray * nicks;
- gchar * domain;
+ actions_t actions;
+ GKeyFile * keyfile;
+ gchar * identity;
+ GArray * nicks;
+ gchar * domain;
} IndicatorDesktopShortcutsPrivate;
enum {
- PROP_0,
- PROP_DESKTOP_FILE,
- PROP_IDENTITY
+ PROP_0,
+ PROP_DESKTOP_FILE,
+ PROP_IDENTITY
};
static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass);
@@ -74,176 +72,176 @@ G_DEFINE_TYPE_WITH_PRIVATE (IndicatorDesktopShortcuts, indicator_desktop_shortcu
static void
indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = indicator_desktop_shortcuts_dispose;
- object_class->finalize = indicator_desktop_shortcuts_finalize;
-
- /* Property funcs */
- object_class->set_property = set_property;
- object_class->get_property = get_property;
-
- g_object_class_install_property(object_class, PROP_DESKTOP_FILE,
- g_param_spec_string(PROP_DESKTOP_FILE_S,
- "The path of the desktop file to read",
- "A path to a desktop file that we'll look for shortcuts in.",
- NULL,
- G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(object_class, PROP_IDENTITY,
- g_param_spec_string(PROP_IDENTITY_S,
- "The string that represents the identity that we're acting as.",
- "Used to process ShowIn and NotShownIn fields of the desktop shortcust to get the proper list.",
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
-
- return;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = indicator_desktop_shortcuts_dispose;
+ object_class->finalize = indicator_desktop_shortcuts_finalize;
+
+ /* Property funcs */
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+
+ g_object_class_install_property(object_class, PROP_DESKTOP_FILE,
+ g_param_spec_string(PROP_DESKTOP_FILE_S,
+ "The path of the desktop file to read",
+ "A path to a desktop file that we'll look for shortcuts in.",
+ NULL,
+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(object_class, PROP_IDENTITY,
+ g_param_spec_string(PROP_IDENTITY_S,
+ "The string that represents the identity that we're acting as.",
+ "Used to process ShowIn and NotShownIn fields of the desktop shortcust to get the proper list.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+
+ return;
}
/* Initialize instance data */
static void
indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)
{
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
- priv->keyfile = NULL;
- priv->identity = NULL;
- priv->domain = NULL;
- priv->nicks = g_array_new(TRUE, TRUE, sizeof(gchar *));
- priv->actions = ACTIONS_NONE;
+ priv->keyfile = NULL;
+ priv->identity = NULL;
+ priv->domain = NULL;
+ priv->nicks = g_array_new(TRUE, TRUE, sizeof(gchar *));
+ priv->actions = ACTIONS_NONE;
- return;
+ return;
}
/* Clear object references */
static void
indicator_desktop_shortcuts_dispose (GObject *object)
{
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
- if (priv->keyfile) {
- g_key_file_free(priv->keyfile);
- priv->keyfile = NULL;
- }
+ if (priv->keyfile) {
+ g_key_file_free(priv->keyfile);
+ priv->keyfile = NULL;
+ }
- G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->dispose (object);
- return;
+ G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->dispose (object);
+ return;
}
/* Free all memory */
static void
indicator_desktop_shortcuts_finalize (GObject *object)
{
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
-
- if (priv->identity != NULL) {
- g_free(priv->identity);
- priv->identity = NULL;
- }
-
- if (priv->domain != NULL) {
- g_free(priv->domain);
- priv->domain = NULL;
- }
-
- if (priv->nicks != NULL) {
- gint i;
- for (i = 0; i < priv->nicks->len; i++) {
- gchar * nick = g_array_index(priv->nicks, gchar *, i);
- g_free(nick);
- }
- g_array_free(priv->nicks, TRUE);
- priv->nicks = NULL;
- }
-
- G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->finalize (object);
- return;
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+
+ if (priv->identity != NULL) {
+ g_free(priv->identity);
+ priv->identity = NULL;
+ }
+
+ if (priv->domain != NULL) {
+ g_free(priv->domain);
+ priv->domain = NULL;
+ }
+
+ if (priv->nicks != NULL) {
+ gint i;
+ for (i = 0; i < priv->nicks->len; i++) {
+ gchar * nick = g_array_index(priv->nicks, gchar *, i);
+ g_free(nick);
+ }
+ g_array_free(priv->nicks, TRUE);
+ priv->nicks = NULL;
+ }
+
+ G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->finalize (object);
+ return;
}
/* Sets one of the two properties we have, only at construction though */
static void
set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
{
- g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
-
- switch(prop_id) {
- case PROP_DESKTOP_FILE: {
- if (priv->keyfile != NULL) {
- g_key_file_free(priv->keyfile);
- priv->keyfile = NULL;
- priv->actions = ACTIONS_NONE;
- }
-
- GError * error = NULL;
- GKeyFile * keyfile = g_key_file_new();
- g_key_file_load_from_file(keyfile, g_value_get_string(value), G_KEY_FILE_NONE, &error);
-
- if (error != NULL) {
- g_warning("Unable to load keyfile from file '%s': %s", g_value_get_string(value), error->message);
- g_error_free(error);
- g_key_file_free(keyfile);
- break;
- }
-
- /* Always prefer the desktop spec if we can get it */
- if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, ACTIONS_KEY, NULL)) {
- priv->actions = ACTIONS_DESKTOP_SPEC;
- }
-
- /* But fallback if we can't */
- if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, NULL)) {
- priv->actions = ACTIONS_XAYATANA;
- g_warning("Desktop file '%s' is using a deprecated format for its actions that will be dropped soon.", g_value_get_string(value));
- }
-
- if (priv->actions == ACTIONS_NONE) {
- g_key_file_free(keyfile);
- break;
- }
-
- priv->keyfile = keyfile;
- parse_keyfile(INDICATOR_DESKTOP_SHORTCUTS(object));
- break;
- }
- case PROP_IDENTITY:
- if (priv->identity != NULL) {
- g_warning("Identity already set to '%s' and trying to set it to '%s'.", priv->identity, g_value_get_string(value));
- return;
- }
- priv->identity = g_value_dup_string(value);
- parse_keyfile(INDICATOR_DESKTOP_SHORTCUTS(object));
- break;
- /* *********************** */
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- return;
+ g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+
+ switch(prop_id) {
+ case PROP_DESKTOP_FILE: {
+ if (priv->keyfile != NULL) {
+ g_key_file_free(priv->keyfile);
+ priv->keyfile = NULL;
+ priv->actions = ACTIONS_NONE;
+ }
+
+ GError * error = NULL;
+ GKeyFile * keyfile = g_key_file_new();
+ g_key_file_load_from_file(keyfile, g_value_get_string(value), G_KEY_FILE_NONE, &error);
+
+ if (error != NULL) {
+ g_warning("Unable to load keyfile from file '%s': %s", g_value_get_string(value), error->message);
+ g_error_free(error);
+ g_key_file_free(keyfile);
+ break;
+ }
+
+ /* Always prefer the desktop spec if we can get it */
+ if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, ACTIONS_KEY, NULL)) {
+ priv->actions = ACTIONS_DESKTOP_SPEC;
+ }
+
+ /* But fallback if we can't */
+ if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, NULL)) {
+ priv->actions = ACTIONS_XAYATANA;
+ g_warning("Desktop file '%s' is using a deprecated format for its actions that will be dropped soon.", g_value_get_string(value));
+ }
+
+ if (priv->actions == ACTIONS_NONE) {
+ g_key_file_free(keyfile);
+ break;
+ }
+
+ priv->keyfile = keyfile;
+ parse_keyfile(INDICATOR_DESKTOP_SHORTCUTS(object));
+ break;
+ }
+ case PROP_IDENTITY:
+ if (priv->identity != NULL) {
+ g_warning("Identity already set to '%s' and trying to set it to '%s'.", priv->identity, g_value_get_string(value));
+ return;
+ }
+ priv->identity = g_value_dup_string(value);
+ parse_keyfile(INDICATOR_DESKTOP_SHORTCUTS(object));
+ break;
+ /* *********************** */
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+
+ return;
}
/* Gets either the desktop file our the identity. */
static void
get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
{
- g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
-
- switch(prop_id) {
- case PROP_IDENTITY:
- g_value_set_string(value, priv->identity);
- break;
- /* *********************** */
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- return;
+ g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object));
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(object);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+
+ switch(prop_id) {
+ case PROP_IDENTITY:
+ g_value_set_string(value, priv->identity);
+ break;
+ /* *********************** */
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+
+ return;
}
/* Checks to see if we can, and if we can it goes through
@@ -251,97 +249,97 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe
static void
parse_keyfile (IndicatorDesktopShortcuts * ids)
{
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
-
- if (priv->keyfile == NULL) {
- return;
- }
-
- if (priv->identity == NULL) {
- return;
- }
-
- /* Remove a previous translation domain if we had one
- from a previously parsed file. */
- if (priv->domain != NULL) {
- g_free(priv->domain);
- priv->domain = NULL;
- }
-
- /* Check to see if there is a custom translation domain that
- we should take into account. */
- if (priv->domain == NULL &&
- g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL)) {
- priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL);
- }
-
- if (priv->domain == NULL &&
- g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL)) {
- priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL);
- }
-
- /* We need to figure out what we're looking for and what we want to
- look for in the rest of the file */
- const gchar * list_name = NULL;
- const gchar * group_format = NULL;
- gboolean should_have_target = FALSE;
-
- switch (priv->actions) {
- case ACTIONS_NONE:
- /* None, let's just get outta here */
- return;
- case ACTIONS_XAYATANA:
- list_name = OLD_SHORTCUTS_KEY;
- group_format = "%s " OLD_GROUP_SUFFIX;
- should_have_target = TRUE;
- break;
- case ACTIONS_DESKTOP_SPEC:
- list_name = ACTIONS_KEY;
- group_format = ACTION_GROUP_PREFIX " %s";
- should_have_target = FALSE;
- break;
- default:
- g_assert_not_reached();
- return;
- }
-
- /* Okay, we've got everything we need. Let's get it on! */
- gint i;
- gsize num_nicks = 0;
- gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, list_name, &num_nicks, NULL);
-
- /* If there is an error from get_string_list num_nicks should still
- be zero, so this loop will drop out. */
- for (i = 0; i < num_nicks; i++) {
- /* g_debug("Looking at group nick %s", nicks[i]); */
- gchar * groupname = g_strdup_printf(group_format, nicks[i]);
- if (!g_key_file_has_group(priv->keyfile, groupname)) {
- g_warning("Unable to find group '%s'", groupname);
- g_free(groupname);
- continue;
- }
-
- if (!should_show(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, priv->identity, FALSE)) {
- g_free(groupname);
- continue;
- }
-
- if (!should_show(priv->keyfile, groupname, priv->identity, should_have_target)) {
- g_free(groupname);
- continue;
- }
-
- gchar * nickalloc = g_strdup(nicks[i]);
- g_array_append_val(priv->nicks, nickalloc);
- g_free(groupname);
- }
-
- if (nicks != NULL) {
- g_strfreev(nicks);
- }
-
- return;
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+
+ if (priv->keyfile == NULL) {
+ return;
+ }
+
+ if (priv->identity == NULL) {
+ return;
+ }
+
+ /* Remove a previous translation domain if we had one
+ from a previously parsed file. */
+ if (priv->domain != NULL) {
+ g_free(priv->domain);
+ priv->domain = NULL;
+ }
+
+ /* Check to see if there is a custom translation domain that
+ we should take into account. */
+ if (priv->domain == NULL &&
+ g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL)) {
+ priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL);
+ }
+
+ if (priv->domain == NULL &&
+ g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL)) {
+ priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL);
+ }
+
+ /* We need to figure out what we're looking for and what we want to
+ look for in the rest of the file */
+ const gchar * list_name = NULL;
+ const gchar * group_format = NULL;
+ gboolean should_have_target = FALSE;
+
+ switch (priv->actions) {
+ case ACTIONS_NONE:
+ /* None, let's just get outta here */
+ return;
+ case ACTIONS_XAYATANA:
+ list_name = OLD_SHORTCUTS_KEY;
+ group_format = "%s " OLD_GROUP_SUFFIX;
+ should_have_target = TRUE;
+ break;
+ case ACTIONS_DESKTOP_SPEC:
+ list_name = ACTIONS_KEY;
+ group_format = ACTION_GROUP_PREFIX " %s";
+ should_have_target = FALSE;
+ break;
+ default:
+ g_assert_not_reached();
+ return;
+ }
+
+ /* Okay, we've got everything we need. Let's get it on! */
+ gint i;
+ gsize num_nicks = 0;
+ gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, list_name, &num_nicks, NULL);
+
+ /* If there is an error from get_string_list num_nicks should still
+ be zero, so this loop will drop out. */
+ for (i = 0; i < num_nicks; i++) {
+ /* g_debug("Looking at group nick %s", nicks[i]); */
+ gchar * groupname = g_strdup_printf(group_format, nicks[i]);
+ if (!g_key_file_has_group(priv->keyfile, groupname)) {
+ g_warning("Unable to find group '%s'", groupname);
+ g_free(groupname);
+ continue;
+ }
+
+ if (!should_show(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, priv->identity, FALSE)) {
+ g_free(groupname);
+ continue;
+ }
+
+ if (!should_show(priv->keyfile, groupname, priv->identity, should_have_target)) {
+ g_free(groupname);
+ continue;
+ }
+
+ gchar * nickalloc = g_strdup(nicks[i]);
+ g_array_append_val(priv->nicks, nickalloc);
+ g_free(groupname);
+ }
+
+ if (nicks != NULL) {
+ g_strfreev(nicks);
+ }
+
+ return;
}
/* Checks the ONLY_SHOW_IN and NOT_SHOW_IN keys for a group to
@@ -349,74 +347,74 @@ parse_keyfile (IndicatorDesktopShortcuts * ids)
static gboolean
should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target)
{
- if (should_have_target && g_key_file_has_key(keyfile, group, OLD_ENVIRON_KEY, NULL)) {
- /* If we've got this key, we're going to return here and not
- process the deprecated keys. */
- gint j;
- gsize num_env = 0;
- gchar ** envs = g_key_file_get_string_list(keyfile, group, OLD_ENVIRON_KEY, &num_env, NULL);
-
- for (j = 0; j < num_env; j++) {
- if (g_strcmp0(envs[j], identity) == 0) {
- break;
- }
- }
-
- if (envs != NULL) {
- g_strfreev(envs);
- }
-
- if (j == num_env) {
- return FALSE;
- }
- return TRUE;
- }
-
- /* If there is a list of OnlyShowIn entries we need to check
- to see if we're in that list. If not, we drop this nick */
- if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, NULL)) {
- gint j;
- gsize num_only = 0;
- gchar ** onlies = g_key_file_get_string_list(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, &num_only, NULL);
-
- for (j = 0; j < num_only; j++) {
- if (g_strcmp0(onlies[j], identity) == 0) {
- break;
- }
- }
-
- if (onlies != NULL) {
- g_strfreev(onlies);
- }
-
- if (j == num_only) {
- return FALSE;
- }
- }
-
- /* If there is a NotShowIn entry we need to make sure that we're
- not in that list. If we are, we need to drop out. */
- if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, NULL)) {
- gint j;
- gsize num_not = 0;
- gchar ** nots = g_key_file_get_string_list(keyfile, group, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, &num_not, NULL);
-
- for (j = 0; j < num_not; j++) {
- if (g_strcmp0(nots[j], identity) == 0) {
- break;
- }
- }
-
- if (nots != NULL) {
- g_strfreev(nots);
- }
-
- if (j != num_not) {
- return FALSE;
- }
- }
-
- return TRUE;
+ if (should_have_target && g_key_file_has_key(keyfile, group, OLD_ENVIRON_KEY, NULL)) {
+ /* If we've got this key, we're going to return here and not
+ process the deprecated keys. */
+ gint j;
+ gsize num_env = 0;
+ gchar ** envs = g_key_file_get_string_list(keyfile, group, OLD_ENVIRON_KEY, &num_env, NULL);
+
+ for (j = 0; j < num_env; j++) {
+ if (g_strcmp0(envs[j], identity) == 0) {
+ break;
+ }
+ }
+
+ if (envs != NULL) {
+ g_strfreev(envs);
+ }
+
+ if (j == num_env) {
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ /* If there is a list of OnlyShowIn entries we need to check
+ to see if we're in that list. If not, we drop this nick */
+ if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, NULL)) {
+ gint j;
+ gsize num_only = 0;
+ gchar ** onlies = g_key_file_get_string_list(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, &num_only, NULL);
+
+ for (j = 0; j < num_only; j++) {
+ if (g_strcmp0(onlies[j], identity) == 0) {
+ break;
+ }
+ }
+
+ if (onlies != NULL) {
+ g_strfreev(onlies);
+ }
+
+ if (j == num_only) {
+ return FALSE;
+ }
+ }
+
+ /* If there is a NotShowIn entry we need to make sure that we're
+ not in that list. If we are, we need to drop out. */
+ if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, NULL)) {
+ gint j;
+ gsize num_not = 0;
+ gchar ** nots = g_key_file_get_string_list(keyfile, group, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, &num_not, NULL);
+
+ for (j = 0; j < num_not; j++) {
+ if (g_strcmp0(nots[j], identity) == 0) {
+ break;
+ }
+ }
+
+ if (nots != NULL) {
+ g_strfreev(nots);
+ }
+
+ if (j != num_not) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
/* Looks through the nicks to see if this one is in the list,
@@ -424,259 +422,259 @@ should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gb
static gboolean
is_valid_nick (gchar ** list, const gchar * nick)
{
- if (*list == NULL)
- return FALSE;
- /* g_debug("Checking Nick: %s", list[0]); */
- if (g_strcmp0(list[0], nick) == 0)
- return TRUE;
- return is_valid_nick(&list[1], nick);
+ if (*list == NULL)
+ return FALSE;
+ /* g_debug("Checking Nick: %s", list[0]); */
+ if (g_strcmp0(list[0], nick) == 0)
+ return TRUE;
+ return is_valid_nick(&list[1], nick);
}
/* API */
/**
- indicator_desktop_shortcuts_new:
- @file: The desktop file that would be opened to
- find the actions.
- @identity: This is a string that represents the identity
- that should be used in searching those actions. It
- relates to the ShowIn and NotShownIn properties.
-
- This function creates the basic object. It involves opening
- the file and parsing it. It could potentially block on IO. At
- the end of the day you'll have a fully functional object.
-
- Return value: A new #IndicatorDesktopShortcuts object.
+ indicator_desktop_shortcuts_new:
+ @file: The desktop file that would be opened to
+ find the actions.
+ @identity: This is a string that represents the identity
+ that should be used in searching those actions. It
+ relates to the ShowIn and NotShownIn properties.
+
+ This function creates the basic object. It involves opening
+ the file and parsing it. It could potentially block on IO. At
+ the end of the day you'll have a fully functional object.
+
+ Return value: A new #IndicatorDesktopShortcuts object.
*/
IndicatorDesktopShortcuts *
indicator_desktop_shortcuts_new (const gchar * file, const gchar * identity)
{
- GObject * obj = g_object_new(INDICATOR_TYPE_DESKTOP_SHORTCUTS,
- PROP_DESKTOP_FILE_S, file,
- PROP_IDENTITY_S, identity,
- NULL);
- return INDICATOR_DESKTOP_SHORTCUTS(obj);
+ GObject * obj = g_object_new(INDICATOR_TYPE_DESKTOP_SHORTCUTS,
+ PROP_DESKTOP_FILE_S, file,
+ PROP_IDENTITY_S, identity,
+ NULL);
+ return INDICATOR_DESKTOP_SHORTCUTS(obj);
}
/**
- indicator_desktop_shortcuts_get_nicks:
- @ids: The #IndicatorDesktopShortcuts object to look in
+ indicator_desktop_shortcuts_get_nicks:
+ @ids: The #IndicatorDesktopShortcuts object to look in
- Give you the list of commands that are available for this desktop
- file given the identity that was passed in at creation. This will
- filter out the various items in the desktop file. These nicks can
- then be used as keys for working with the desktop file.
+ Give you the list of commands that are available for this desktop
+ file given the identity that was passed in at creation. This will
+ filter out the various items in the desktop file. These nicks can
+ then be used as keys for working with the desktop file.
- Return value: A #NULL terminated list of strings. This memory
- is managed by the @ids object.
+ Return value: A #NULL terminated list of strings. This memory
+ is managed by the @ids object.
*/
const gchar **
indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids)
{
- g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
- return (const gchar **)priv->nicks->data;
+ g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+ return (const gchar **)priv->nicks->data;
}
/**
- indicator_desktop_shortcuts_nick_get_name:
- @ids: The #IndicatorDesktopShortcuts object to look in
- @nick: Which command that we're referencing.
-
- This function looks in a desktop file for a nick to find the
- user visible name for that shortcut. The @nick parameter
- should be gotten from #indicator_desktop_shortcuts_get_nicks
- though it's not required that the exact memory location
- be the same.
-
- Return value: A user visible string for the shortcut or
- #NULL on error.
+ indicator_desktop_shortcuts_nick_get_name:
+ @ids: The #IndicatorDesktopShortcuts object to look in
+ @nick: Which command that we're referencing.
+
+ This function looks in a desktop file for a nick to find the
+ user visible name for that shortcut. The @nick parameter
+ should be gotten from #indicator_desktop_shortcuts_get_nicks
+ though it's not required that the exact memory location
+ be the same.
+
+ Return value: A user visible string for the shortcut or
+ #NULL on error.
*/
gchar *
indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick)
{
- g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
-
- g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL);
- g_return_val_if_fail(priv->keyfile != NULL, NULL);
- g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), NULL);
-
- const gchar * group_format = NULL;
-
- switch (priv->actions) {
- case ACTIONS_XAYATANA:
- group_format = "%s " OLD_GROUP_SUFFIX;
- break;
- case ACTIONS_DESKTOP_SPEC:
- group_format = ACTION_GROUP_PREFIX " %s";
- break;
- default:
- g_assert_not_reached();
- return NULL;
- }
-
- gchar * groupheader = g_strdup_printf(group_format, nick);
- if (!g_key_file_has_group(priv->keyfile, groupheader)) {
- g_warning("The group for nick '%s' doesn't exist anymore.", nick);
- g_free(groupheader);
- return NULL;
- }
-
- if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL)) {
- g_warning("No name available for nick '%s'", nick);
- g_free(groupheader);
- return NULL;
- }
-
- gchar * name = NULL;
- gchar * keyvalue = g_key_file_get_string(priv->keyfile,
- groupheader,
- G_KEY_FILE_DESKTOP_KEY_NAME,
- NULL);
- gchar * localeval = g_key_file_get_locale_string(priv->keyfile,
- groupheader,
- G_KEY_FILE_DESKTOP_KEY_NAME,
- NULL,
- NULL);
- g_free(groupheader);
-
- if (priv->domain != NULL && g_strcmp0(keyvalue, localeval) == 0) {
- name = g_strdup(g_dgettext(priv->domain, keyvalue));
- g_free(localeval);
- } else {
- name = localeval;
- }
-
- g_free(keyvalue);
-
- return name;
+ g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+
+ g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL);
+ g_return_val_if_fail(priv->keyfile != NULL, NULL);
+ g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), NULL);
+
+ const gchar * group_format = NULL;
+
+ switch (priv->actions) {
+ case ACTIONS_XAYATANA:
+ group_format = "%s " OLD_GROUP_SUFFIX;
+ break;
+ case ACTIONS_DESKTOP_SPEC:
+ group_format = ACTION_GROUP_PREFIX " %s";
+ break;
+ default:
+ g_assert_not_reached();
+ return NULL;
+ }
+
+ gchar * groupheader = g_strdup_printf(group_format, nick);
+ if (!g_key_file_has_group(priv->keyfile, groupheader)) {
+ g_warning("The group for nick '%s' doesn't exist anymore.", nick);
+ g_free(groupheader);
+ return NULL;
+ }
+
+ if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL)) {
+ g_warning("No name available for nick '%s'", nick);
+ g_free(groupheader);
+ return NULL;
+ }
+
+ gchar * name = NULL;
+ gchar * keyvalue = g_key_file_get_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ NULL);
+ gchar * localeval = g_key_file_get_locale_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ NULL,
+ NULL);
+ g_free(groupheader);
+
+ if (priv->domain != NULL && g_strcmp0(keyvalue, localeval) == 0) {
+ name = g_strdup(g_dgettext(priv->domain, keyvalue));
+ g_free(localeval);
+ } else {
+ name = localeval;
+ }
+
+ g_free(keyvalue);
+
+ return name;
}
/**
- indicator_desktop_shortcuts_nick_exec_with_context:
- @ids: The #IndicatorDesktopShortcuts object to look in
- @nick: Which command that we're referencing.
- @launch_context: The #GAppLaunchContext to use for launching the shortcut
+ indicator_desktop_shortcuts_nick_exec_with_context:
+ @ids: The #IndicatorDesktopShortcuts object to look in
+ @nick: Which command that we're referencing.
+ @launch_context: The #GAppLaunchContext to use for launching the shortcut
- Here we take a @nick and try and execute the action that is
- associated with it. The @nick parameter should be gotten
- from #indicator_desktop_shortcuts_get_nicks though it's not
- required that the exact memory location be the same.
+ Here we take a @nick and try and execute the action that is
+ associated with it. The @nick parameter should be gotten
+ from #indicator_desktop_shortcuts_get_nicks though it's not
+ required that the exact memory location be the same.
- Return value: #TRUE on success or #FALSE on error.
+ Return value: #TRUE on success or #FALSE on error.
*/
gboolean
indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts * ids, const gchar * nick, GAppLaunchContext * launch_context)
{
- GError * error = NULL;
-
- g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);
- IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
- IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
-
- g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE);
- g_return_val_if_fail(priv->keyfile != NULL, FALSE);
- g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), FALSE);
-
- const gchar * group_format = NULL;
-
- switch (priv->actions) {
- case ACTIONS_XAYATANA:
- group_format = "%s " OLD_GROUP_SUFFIX;
- break;
- case ACTIONS_DESKTOP_SPEC:
- group_format = ACTION_GROUP_PREFIX " %s";
- break;
- default:
- g_assert_not_reached();
- return FALSE;
- }
-
- gchar * groupheader = g_strdup_printf(group_format, nick);
- if (!g_key_file_has_group(priv->keyfile, groupheader)) {
- g_warning("The group for nick '%s' doesn't exist anymore.", nick);
- g_free(groupheader);
- return FALSE;
- }
-
- if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL)) {
- g_warning("No name available for nick '%s'", nick);
- g_free(groupheader);
- return FALSE;
- }
-
- if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL)) {
- g_warning("No exec available for nick '%s'", nick);
- g_free(groupheader);
- return FALSE;
- }
-
- /* Grab the name and the exec entries out of our current group */
- gchar * name = g_key_file_get_locale_string(priv->keyfile,
- groupheader,
- G_KEY_FILE_DESKTOP_KEY_NAME,
- NULL,
- NULL);
-
- gchar * exec = g_key_file_get_locale_string(priv->keyfile,
- groupheader,
- G_KEY_FILE_DESKTOP_KEY_EXEC,
- NULL,
- NULL);
-
- g_free(groupheader);
-
- GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE;
-
- if (launch_context) {
- flags |= G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION;
- }
-
- GAppInfo * appinfo = g_app_info_create_from_commandline(exec, name, flags, &error);
- g_free(name); g_free(exec);
-
- if (error != NULL) {
- g_warning("Unable to build Command line App info: %s", error->message);
- g_error_free(error);
- return FALSE;
- }
-
- if (appinfo == NULL) {
- g_warning("Unable to build Command line App info (unknown)");
- return FALSE;
- }
-
- gboolean launched = g_app_info_launch(appinfo, NULL, launch_context, &error);
-
- if (error != NULL) {
- g_warning("Unable to launch file from nick '%s': %s", nick, error->message);
- g_clear_error(&error);
- }
-
- g_object_unref(appinfo);
-
- return launched;
+ GError * error = NULL;
+
+ g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);
+ IndicatorDesktopShortcuts * self = INDICATOR_DESKTOP_SHORTCUTS(ids);
+ IndicatorDesktopShortcutsPrivate * priv = indicator_desktop_shortcuts_get_instance_private(self);
+
+ g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE);
+ g_return_val_if_fail(priv->keyfile != NULL, FALSE);
+ g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), FALSE);
+
+ const gchar * group_format = NULL;
+
+ switch (priv->actions) {
+ case ACTIONS_XAYATANA:
+ group_format = "%s " OLD_GROUP_SUFFIX;
+ break;
+ case ACTIONS_DESKTOP_SPEC:
+ group_format = ACTION_GROUP_PREFIX " %s";
+ break;
+ default:
+ g_assert_not_reached();
+ return FALSE;
+ }
+
+ gchar * groupheader = g_strdup_printf(group_format, nick);
+ if (!g_key_file_has_group(priv->keyfile, groupheader)) {
+ g_warning("The group for nick '%s' doesn't exist anymore.", nick);
+ g_free(groupheader);
+ return FALSE;
+ }
+
+ if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL)) {
+ g_warning("No name available for nick '%s'", nick);
+ g_free(groupheader);
+ return FALSE;
+ }
+
+ if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL)) {
+ g_warning("No exec available for nick '%s'", nick);
+ g_free(groupheader);
+ return FALSE;
+ }
+
+ /* Grab the name and the exec entries out of our current group */
+ gchar * name = g_key_file_get_locale_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ NULL,
+ NULL);
+
+ gchar * exec = g_key_file_get_locale_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_EXEC,
+ NULL,
+ NULL);
+
+ g_free(groupheader);
+
+ GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE;
+
+ if (launch_context) {
+ flags |= G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION;
+ }
+
+ GAppInfo * appinfo = g_app_info_create_from_commandline(exec, name, flags, &error);
+ g_free(name); g_free(exec);
+
+ if (error != NULL) {
+ g_warning("Unable to build Command line App info: %s", error->message);
+ g_error_free(error);
+ return FALSE;
+ }
+
+ if (appinfo == NULL) {
+ g_warning("Unable to build Command line App info (unknown)");
+ return FALSE;
+ }
+
+ gboolean launched = g_app_info_launch(appinfo, NULL, launch_context, &error);
+
+ if (error != NULL) {
+ g_warning("Unable to launch file from nick '%s': %s", nick, error->message);
+ g_clear_error(&error);
+ }
+
+ g_object_unref(appinfo);
+
+ return launched;
}
/**
- indicator_desktop_shortcuts_nick_exec:
- @ids: The #IndicatorDesktopShortcuts object to look in
- @nick: Which command that we're referencing.
-
- Here we take a @nick and try and execute the action that is
- associated with it. The @nick parameter should be gotten
- from #indicator_desktop_shortcuts_get_nicks though it's not
- required that the exact memory location be the same.
- This function is deprecated and shouldn't be used in newly
- written code.
-
- Return value: #TRUE on success or #FALSE on error.
+ indicator_desktop_shortcuts_nick_exec:
+ @ids: The #IndicatorDesktopShortcuts object to look in
+ @nick: Which command that we're referencing.
+
+ Here we take a @nick and try and execute the action that is
+ associated with it. The @nick parameter should be gotten
+ from #indicator_desktop_shortcuts_get_nicks though it's not
+ required that the exact memory location be the same.
+ This function is deprecated and shouldn't be used in newly
+ written code.
+
+ Return value: #TRUE on success or #FALSE on error.
*/
gboolean
indicator_desktop_shortcuts_nick_exec (IndicatorDesktopShortcuts * ids, const gchar * nick)
{
- return indicator_desktop_shortcuts_nick_exec_with_context (ids, nick, NULL);
+ return indicator_desktop_shortcuts_nick_exec_with_context (ids, nick, NULL);
}
diff --git a/src/messages-service.c b/src/messages-service.c
index b123a46..1446c27 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -3,25 +3,26 @@ An indicator to show information that is in messaging applications
that the user is using.
Copyright 2012 Canonical Ltd.
+Copyright 2021 Robert Tari
Authors:
Ted Gould <ted@canonical.com>
Lars Uebernickel <lars.uebernickel@canonical.com>
+ Robert Tari <robert@tari.in>
-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
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
by the Free Software Foundation.
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranties of
-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <config.h>
#include <locale.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
@@ -44,248 +45,248 @@ static GHashTable *menus;
static GSettings *settings;
enum {
- DBUS_ERROR_BAD_DESKTOP_FILE,
+ DBUS_ERROR_BAD_DESKTOP_FILE,
};
G_DEFINE_QUARK(indicator_messages_dbus_error, dbus_error);
static gboolean
register_application (IndicatorMessagesService *service,
- GDBusMethodInvocation *invocation,
- const gchar *desktop_id,
- const gchar *menu_path,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ const gchar *desktop_id,
+ const gchar *menu_path,
+ gpointer user_data)
{
- GDBusConnection *bus;
- const gchar *sender;
+ GDBusConnection *bus;
+ const gchar *sender;
- if (!im_application_list_add (applications, desktop_id)) {
- g_dbus_method_invocation_return_error(invocation, dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "Unable to find or parse desktop file for application '%s'", desktop_id);
- return TRUE;
- }
+ if (!im_application_list_add (applications, desktop_id)) {
+ g_dbus_method_invocation_return_error(invocation, dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "Unable to find or parse desktop file for application '%s'", desktop_id);
+ return TRUE;
+ }
- bus = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (service));
- sender = g_dbus_method_invocation_get_sender (invocation);
+ bus = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (service));
+ sender = g_dbus_method_invocation_get_sender (invocation);
- im_application_list_set_remote (applications, desktop_id, bus, sender, menu_path);
- g_settings_strv_append_unique (settings, "applications", desktop_id);
+ im_application_list_set_remote (applications, desktop_id, bus, sender, menu_path);
+ g_settings_strv_append_unique (settings, "applications", desktop_id);
- indicator_messages_service_complete_register_application (service, invocation);
+ indicator_messages_service_complete_register_application (service, invocation);
- return TRUE;
+ return TRUE;
}
static gboolean
unregister_application (IndicatorMessagesService *service,
- GDBusMethodInvocation *invocation,
- const gchar *desktop_id,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ const gchar *desktop_id,
+ gpointer user_data)
{
- im_application_list_remove (applications, desktop_id);
- g_settings_strv_remove (settings, "applications", desktop_id);
+ im_application_list_remove (applications, desktop_id);
+ g_settings_strv_remove (settings, "applications", desktop_id);
- indicator_messages_service_complete_unregister_application (service, invocation);
+ indicator_messages_service_complete_unregister_application (service, invocation);
- return TRUE;
+ return TRUE;
}
static gboolean
set_status (IndicatorMessagesService *service,
- GDBusMethodInvocation *invocation,
- const gchar *desktop_id,
- const gchar *status_str,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ const gchar *desktop_id,
+ const gchar *status_str,
+ gpointer user_data)
{
- GDesktopAppInfo *appinfo;
- const gchar *id;
+ GDesktopAppInfo *appinfo;
+ const gchar *id;
- g_return_val_if_fail (g_str_equal (status_str, "available") ||
- g_str_equal (status_str, "away")||
- g_str_equal (status_str, "busy") ||
- g_str_equal (status_str, "invisible") ||
- g_str_equal (status_str, "offline"),
- FALSE);
+ g_return_val_if_fail (g_str_equal (status_str, "available") ||
+ g_str_equal (status_str, "away")||
+ g_str_equal (status_str, "busy") ||
+ g_str_equal (status_str, "invisible") ||
+ g_str_equal (status_str, "offline"),
+ FALSE);
- appinfo = g_desktop_app_info_new (desktop_id);
- if (!appinfo) {
- g_warning ("could not set status for '%s', there's no desktop file with that id", desktop_id);
- return TRUE;
- }
+ appinfo = g_desktop_app_info_new (desktop_id);
+ if (!appinfo) {
+ g_warning ("could not set status for '%s', there's no desktop file with that id", desktop_id);
+ return TRUE;
+ }
- id = g_app_info_get_id (G_APP_INFO (appinfo));
+ id = g_app_info_get_id (G_APP_INFO (appinfo));
- im_application_list_set_status(applications, id, status_str);
+ im_application_list_set_status(applications, id, status_str);
- indicator_messages_service_complete_set_status (service, invocation);
+ indicator_messages_service_complete_set_status (service, invocation);
- g_object_unref (appinfo);
+ g_object_unref (appinfo);
- return TRUE;
+ return TRUE;
}
static gboolean
app_stopped (IndicatorMessagesService *service,
- GDBusMethodInvocation *invocation,
- const gchar *desktop_id,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ const gchar *desktop_id,
+ gpointer user_data)
{
- GDesktopAppInfo *appinfo;
- const gchar *id;
+ GDesktopAppInfo *appinfo;
+ const gchar *id;
- appinfo = g_desktop_app_info_new (desktop_id);
- if (!appinfo)
- return TRUE;
+ appinfo = g_desktop_app_info_new (desktop_id);
+ if (!appinfo)
+ return TRUE;
- id = g_app_info_get_id (G_APP_INFO (appinfo));
- im_application_list_set_remote (applications, id, NULL, NULL, NULL);
- indicator_messages_service_complete_application_stopped_running (service, invocation);
+ id = g_app_info_get_id (G_APP_INFO (appinfo));
+ im_application_list_set_remote (applications, id, NULL, NULL, NULL);
+ indicator_messages_service_complete_application_stopped_running (service, invocation);
- g_object_unref (appinfo);
+ g_object_unref (appinfo);
- return TRUE;
+ return TRUE;
}
/* The status has been set by the user, let's tell the world! */
static void
status_set_by_user (ImApplicationList * list, const gchar * status, gpointer user_data)
{
- indicator_messages_service_emit_status_changed(messages_service, status);
- return;
+ indicator_messages_service_emit_status_changed(messages_service, status);
+ return;
}
static void
on_bus_acquired (GDBusConnection *bus,
- const gchar *name,
- gpointer user_data)
+ const gchar *name,
+ gpointer user_data)
{
- GError *error = NULL;
- GHashTableIter it;
- const gchar *profile;
- ImMenu *menu;
-
- /* Register some errors */
- g_dbus_error_register_error (dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "BadDesktopFile");
-
- g_dbus_connection_export_action_group (bus, INDICATOR_MESSAGES_DBUS_OBJECT,
- im_application_list_get_action_group (applications),
- &error);
- if (error) {
- g_warning ("unable to export action group on dbus: %s", error->message);
- g_error_free (error);
- return;
- }
-
- g_hash_table_iter_init (&it, menus);
- while (g_hash_table_iter_next (&it, (gpointer *) &profile, (gpointer *) &menu)) {
- gchar *object_path;
-
- object_path = g_strconcat (INDICATOR_MESSAGES_DBUS_OBJECT, "/", profile, NULL);
- if (!im_menu_export (menu, bus, object_path, &error)) {
- g_warning ("unable to export menu for profile '%s': %s", profile, error->message);
- g_clear_error (&error);
- }
-
- g_free (object_path);
- }
-
- g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (messages_service),
- bus, INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT,
- &error);
- if (error) {
- g_warning ("unable to export messages service on dbus: %s", error->message);
- g_error_free (error);
- return;
- }
+ GError *error = NULL;
+ GHashTableIter it;
+ const gchar *profile;
+ ImMenu *menu;
+
+ /* Register some errors */
+ g_dbus_error_register_error (dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "BadDesktopFile");
+
+ g_dbus_connection_export_action_group (bus, INDICATOR_MESSAGES_DBUS_OBJECT,
+ im_application_list_get_action_group (applications),
+ &error);
+ if (error) {
+ g_warning ("unable to export action group on dbus: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ g_hash_table_iter_init (&it, menus);
+ while (g_hash_table_iter_next (&it, (gpointer *) &profile, (gpointer *) &menu)) {
+ gchar *object_path;
+
+ object_path = g_strconcat (INDICATOR_MESSAGES_DBUS_OBJECT, "/", profile, NULL);
+ if (!im_menu_export (menu, bus, object_path, &error)) {
+ g_warning ("unable to export menu for profile '%s': %s", profile, error->message);
+ g_clear_error (&error);
+ }
+
+ g_free (object_path);
+ }
+
+ g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (messages_service),
+ bus, INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT,
+ &error);
+ if (error) {
+ g_warning ("unable to export messages service on dbus: %s", error->message);
+ g_error_free (error);
+ return;
+ }
}
static void
on_name_lost (GDBusConnection *bus,
- const gchar *name,
- gpointer user_data)
+ const gchar *name,
+ gpointer user_data)
{
- GMainLoop *mainloop = user_data;
+ GMainLoop *mainloop = user_data;
- g_main_loop_quit (mainloop);
+ g_main_loop_quit (mainloop);
}
static gboolean
sig_term_handler (gpointer user_data)
{
- GMainLoop *mainloop = user_data;
+ GMainLoop *mainloop = user_data;
- g_main_loop_quit (mainloop);
+ g_main_loop_quit (mainloop);
- return FALSE;
+ return FALSE;
}
int
main (int argc, char ** argv)
{
- GMainLoop * mainloop = NULL;
- GBusNameOwnerFlags flags;
+ GMainLoop * mainloop = NULL;
+ GBusNameOwnerFlags flags;
- /* Glib init */
+ /* Glib init */
#if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34
- g_type_init();
+ g_type_init();
#endif
- mainloop = g_main_loop_new (NULL, FALSE);
-
- /* Setting up i18n and gettext. Apparently, we need
- all of these. */
- setlocale (LC_ALL, "");
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- textdomain (GETTEXT_PACKAGE);
-
- /* Bring up the service DBus interface */
- messages_service = indicator_messages_service_skeleton_new ();
-
- flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
- if (argc >= 2 && g_str_equal (argv[1], "--replace"))
- flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
-
- g_bus_own_name (G_BUS_TYPE_SESSION, "org.ayatana.indicator.messages", flags,
- on_bus_acquired, NULL, on_name_lost, mainloop, NULL);
-
- g_signal_connect (messages_service, "handle-register-application",
- G_CALLBACK (register_application), NULL);
- g_signal_connect (messages_service, "handle-unregister-application",
- G_CALLBACK (unregister_application), NULL);
- g_signal_connect (messages_service, "handle-set-status",
- G_CALLBACK (set_status), NULL);
- g_signal_connect (messages_service, "handle-application-stopped-running",
- G_CALLBACK (app_stopped), NULL);
-
- applications = im_application_list_new ();
- g_signal_connect (applications, "status-set",
- G_CALLBACK (status_set_by_user), NULL);
-
- settings = g_settings_new ("org.ayatana.indicator.messages");
- {
- gchar **app_ids;
- gchar **id;
-
- app_ids = g_settings_get_strv (settings, "applications");
- for (id = app_ids; *id; id++)
- im_application_list_add (applications, *id);
-
- g_strfreev (app_ids);
- }
-
- menus = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
- g_hash_table_insert (menus, "phone", im_phone_menu_new (applications, FALSE));
- g_hash_table_insert (menus, "phone_greeter", im_phone_menu_new (applications, TRUE));
- g_hash_table_insert (menus, "desktop", im_desktop_menu_new (applications));
- g_hash_table_insert (menus, "desktop_greeter", im_desktop_menu_new (applications));
-
- g_unix_signal_add(SIGTERM, sig_term_handler, mainloop);
-
- g_main_loop_run(mainloop);
-
- /* Clean up */
- g_hash_table_unref (menus);
- g_object_unref (messages_service);
- g_object_unref (settings);
- g_object_unref (applications);
- return 0;
+ mainloop = g_main_loop_new (NULL, FALSE);
+
+ /* Setting up i18n and gettext. Apparently, we need
+ all of these. */
+ setlocale (LC_ALL, "");
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ textdomain (GETTEXT_PACKAGE);
+
+ /* Bring up the service DBus interface */
+ messages_service = indicator_messages_service_skeleton_new ();
+
+ flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
+ if (argc >= 2 && g_str_equal (argv[1], "--replace"))
+ flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
+
+ g_bus_own_name (G_BUS_TYPE_SESSION, "org.ayatana.indicator.messages", flags,
+ on_bus_acquired, NULL, on_name_lost, mainloop, NULL);
+
+ g_signal_connect (messages_service, "handle-register-application",
+ G_CALLBACK (register_application), NULL);
+ g_signal_connect (messages_service, "handle-unregister-application",
+ G_CALLBACK (unregister_application), NULL);
+ g_signal_connect (messages_service, "handle-set-status",
+ G_CALLBACK (set_status), NULL);
+ g_signal_connect (messages_service, "handle-application-stopped-running",
+ G_CALLBACK (app_stopped), NULL);
+
+ applications = im_application_list_new ();
+ g_signal_connect (applications, "status-set",
+ G_CALLBACK (status_set_by_user), NULL);
+
+ settings = g_settings_new ("org.ayatana.indicator.messages");
+ {
+ gchar **app_ids;
+ gchar **id;
+
+ app_ids = g_settings_get_strv (settings, "applications");
+ for (id = app_ids; *id; id++)
+ im_application_list_add (applications, *id);
+
+ g_strfreev (app_ids);
+ }
+
+ menus = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
+ g_hash_table_insert (menus, "phone", im_phone_menu_new (applications, FALSE));
+ g_hash_table_insert (menus, "phone_greeter", im_phone_menu_new (applications, TRUE));
+ g_hash_table_insert (menus, "desktop", im_desktop_menu_new (applications));
+ g_hash_table_insert (menus, "desktop_greeter", im_desktop_menu_new (applications));
+
+ g_unix_signal_add(SIGTERM, sig_term_handler, mainloop);
+
+ g_main_loop_run(mainloop);
+
+ /* Clean up */
+ g_hash_table_unref (menus);
+ g_object_unref (messages_service);
+ g_object_unref (settings);
+ g_object_unref (applications);
+ return 0;
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..1f0d117
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,78 @@
+# libindicator-messages-service
+
+find_package(GMock)
+
+set(
+ HEADERS
+ ${CMAKE_SOURCE_DIR}/src/gactionmuxer.h
+ ${CMAKE_SOURCE_DIR}/src/dbus-data.h
+)
+
+set(
+ SOURCES
+ ${CMAKE_SOURCE_DIR}/src/gactionmuxer.c
+)
+
+set(
+ HEADERS_GEN
+ ${CMAKE_BINARY_DIR}/src/indicator-messages-service.h
+)
+
+set(
+ SOURCES_GEN
+ ${CMAKE_BINARY_DIR}/src/indicator-messages-service.c
+)
+
+set_source_files_properties(${HEADERS_GEN} ${SOURCES_GEN} PROPERTIES GENERATED TRUE)
+set_source_files_properties(${HEADERS} ${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_library("indicator-messages-service" STATIC ${HEADERS} ${HEADERS_GEN} ${SOURCES} ${SOURCES_GEN})
+target_include_directories("indicator-messages-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
+target_compile_definitions("indicator-messages-service" PUBLIC G_LOG_DOMAIN="Ayatana-Indicator-Messages")
+target_link_libraries("indicator-messages-service")
+
+# test-gactionmuxer
+
+set_source_files_properties(gtest-menuitems.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_executable("test-gactionmuxer" test-gactionmuxer.cpp)
+target_link_options("test-gactionmuxer" PRIVATE -no-pie)
+target_include_directories("test-gactionmuxer" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} "${CMAKE_SOURCE_DIR}/src")
+target_link_libraries("test-gactionmuxer" "indicator-messages-service" ${PROJECT_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES})
+if (ENABLE_COVERAGE)
+ target_link_libraries("test-gactionmuxer" "-lgcov")
+endif()
+add_test("test-gactionmuxer" "test-gactionmuxer")
+add_dependencies("test-gactionmuxer" "indicator-messages-service")
+set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} "test-gactionmuxer" PARENT_SCOPE)
+
+# gschemas.compiled
+
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled)
+set_source_files_properties(gschemas.compiled GENERATED)
+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 COMMAND cp -f ${CMAKE_SOURCE_DIR}/data/org.ayatana.indicator.messages.gschema.xml ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR})
+add_custom_target("gschemas-compiled" ALL DEPENDS gschemas.compiled)
+
+# indicator-test
+
+pkg_check_modules(DBUSTEST REQUIRED dbustest-1)
+set_source_files_properties(indicator-test.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_executable("indicator-test" indicator-test.cpp)
+target_link_options("indicator-test" PRIVATE -no-pie)
+target_include_directories("indicator-test" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} ${DBUSTEST_INCLUDE_DIRS} "${CMAKE_SOURCE_DIR}/libmessaging-menu")
+target_link_libraries("indicator-test" "messaging-menu" ${PROJECT_DEPS_LIBRARIES} ${DBUSTEST_LIBRARIES} ${GTEST_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES})
+target_compile_definitions(
+ "indicator-test"
+ PUBLIC
+ INDICATOR_MESSAGES_SERVICE_BINARY="${CMAKE_BINARY_DIR}/src/ayatana-indicator-messages-service"
+ SCHEMA_DIR="${CMAKE_CURRENT_BINARY_DIR}"
+ XDG_DATA_DIRS="${CMAKE_CURRENT_SOURCE_DIR}"
+)
+add_test("indicator-test" "indicator-test")
+add_dependencies("indicator-test" "messaging-menu" "gschemas-compiled")
+set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} "indicator-test" PARENT_SCOPE)
+
+# test-client.sh
+
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/test-client.sh" GENERATED)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test-client.sh" "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/libmessaging-menu\"; export GI_TYPELIB_PATH=\"${CMAKE_BINARY_DIR}/libmessaging-menu\"; export XDG_DATA_DIRS=\"${CMAKE_CURRENT_SOURCE_DIR}\"; python3 \"${CMAKE_CURRENT_SOURCE_DIR}/test-client.py\"")
+add_test(NAME "test-client" COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test-client.sh")
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index c6a3db6..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,122 +0,0 @@
-CLEANFILES=
-check_LTLIBRARIES = libgtest.la
-check_PROGRAMS = test-gactionmuxer
-
-TESTS = $(check_PROGRAMS)
-
-AM_CPPFLAGS = $(GTEST_CPPFLAGS) \
- -I${top_srcdir}/src
-
-######################################
-# Google Test
-######################################
-
-nodist_libgtest_la_SOURCES = \
- $(GTEST_SOURCE)/src/gtest-all.cc \
- $(GTEST_SOURCE)/src/gtest_main.cc
-libgtest_la_CPPFLAGS = \
- $(GTEST_CPPFLAGS) -w \
- $(AM_CPPFLAGS)
-libgtest_la_CXXFLAGS = \
- $(AM_CXXFLAGS)
-
-######################################
-# GActionMixer
-######################################
-
-test_gactionmuxer_SOURCES = \
- test-gactionmuxer.cpp
-
-test_gactionmuxer_CPPFLAGS = \
- $(APPLET_CFLAGS) \
- $(AM_CPPFLAGS)
-
-test_gactionmuxer_LDADD = \
- $(APPLET_LIBS) \
- libindicator-messages-service.la \
- libgtest.la
-
-######################################
-# Indicator Test
-######################################
-
-SCHEMA_COMPILED_DIR="$(abs_builddir)/gsettings-schemas-compiled/"
-
-indicator_test_SOURCES = \
- indicator-test.cpp
-
-indicator_test_CPPFLAGS = \
- -DINDICATOR_MESSAGES_SERVICE_BINARY="\"$(abs_top_builddir)/src/ayatana-indicator-messages-service\"" \
- -DSCHEMA_DIR="\"$(SCHEMA_COMPILED_DIR)\"" \
- -DXDG_DATA_DIRS="\"$(abs_srcdir)/\"" \
- -I$(top_srcdir)/libmessaging-menu \
- -std=c++11 \
- $(APPLET_CFLAGS) \
- $(DBUSTEST_CFLAGS) \
- $(AM_CPPFLAGS)
-
-indicator_test_LDADD = \
- $(APPLET_LIBS) \
- $(DBUSTEST_LIBS) \
- $(top_builddir)/libmessaging-menu/libmessaging-menu.la \
- libgtest.la \
- -lc -lpthread
-
-indicator-test.cpp: schemas-compiled.stamp
-
-schemas-compiled.stamp: $(top_srcdir)/data/*gschema.xml
- @rm -rf $(SCHEMA_COMPILED_DIR)
- @mkdir -p $(SCHEMA_COMPILED_DIR)
- @cp -f $(top_srcdir)/data/*gschema.xml $(SCHEMA_COMPILED_DIR)
- @`pkg-config gio-2.0 --variable glib_compile_schemas` $(SCHEMA_COMPILED_DIR)
- @touch schemas-compiled.stamp
-
-CLEANFILES += schemas-compiled.stamp
-TESTS += indicator-test
-check_PROGRAMS += indicator-test
-
-######################################
-# Lib containing code under test
-######################################
-
-noinst_LTLIBRARIES = \
- libindicator-messages-service.la
-
-libindicator_messages_service_la_SOURCES = \
- $(top_builddir)/common/indicator-messages-service.c \
- $(top_builddir)/common/indicator-messages-service.h \
- $(top_srcdir)/src/gactionmuxer.c \
- $(top_srcdir)/src/gactionmuxer.h \
- $(top_srcdir)/src/dbus-data.h
-
-libindicator_messages_service_ladir = \
- $(includedir)/libayatana-indicator-messages-service/
-
-libindicator_messages_service_la_CFLAGS = \
- $(APPLET_CFLAGS) \
- $(COVERAGE_CFLAGS) \
- -I$(top_builddir)/src \
- -I$(top_builddir)/common \
- -Wall \
- -Wl,-Bsymbolic-functions \
- -Wl,-z,defs \
- -Wl,--as-needed \
- -Wno-error=deprecated-declarations \
- -DG_LOG_DOMAIN=\"Ayatana-Indicator-Messages\"
-
-libindicator_messages_service_la_LIBADD = \
- $(APPLET_LIBS)
-
-libindicator_messages_service_la_LDFLAGS = \
- $(COVERAGE_LDFLAGS)
-
-######################################
-# Test client with dbusmock
-######################################
-
-TESTS_ENVIRONMENT = \
- export LD_LIBRARY_PATH=$(top_builddir)/libmessaging-menu/.libs; \
- export GI_TYPELIB_PATH=$(top_builddir)/libmessaging-menu; \
- export XDG_DATA_DIRS=$(abs_srcdir);
-
-TESTS += test-client.py
diff --git a/tests/indicator-test.cpp b/tests/indicator-test.cpp
index 4e76eea..afca37a 100644
--- a/tests/indicator-test.cpp
+++ b/tests/indicator-test.cpp
@@ -1,5 +1,6 @@
/*
* Copyright © 2015 Canonical Ltd.
+ * Copyright © 2021 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Ted Gould <ted@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <gtest/gtest.h>
@@ -64,7 +66,7 @@ TEST_F(IndicatorTest, RootAction) {
EXPECT_EVENTUALLY_ACTION_EXISTS("messages");
EXPECT_ACTION_STATE_TYPE("messages", G_VARIANT_TYPE("a{sv}"));
- EXPECT_ACTION_STATE("messages", g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-offline', 'indicator-messages', 'indicator']>)>, 'title': <'Notifications'>, 'accessible-desc': <'Messages'>, 'visible': <false>}"));
+ EXPECT_ACTION_STATE("messages", g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-offline', 'indicator-messages', 'indicator', 'indicator-messages-offline-symbolic', 'indicator-messages-symbolic', 'indicator-symbolic']>)>, 'title': <'Notifications'>, 'accessible-desc': <'Messages'>, 'visible': <false>}"));
}
TEST_F(IndicatorTest, SingleMessage) {
@@ -146,8 +148,8 @@ TEST_F(IndicatorTest, MessageReply) {
}
TEST_F(IndicatorTest, IconNotification) {
- auto normalicon = std::shared_ptr<GVariant>(g_variant_ref_sink(g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-offline', 'indicator-messages', 'indicator']>)>, 'title': <'Notifications'>, 'accessible-desc': <'Messages'>, 'visible': <true>}")), [](GVariant *var) {if (var != nullptr) g_variant_unref(var); });
- auto blueicon = std::shared_ptr<GVariant>(g_variant_ref_sink(g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-new-offline', 'indicator-messages-new', 'indicator-messages', 'indicator']>)>, 'title': <'Notifications'>, 'accessible-desc': <'New Messages'>, 'visible': <true>}")), [](GVariant *var) {if (var != nullptr) g_variant_unref(var); });
+ auto normalicon = std::shared_ptr<GVariant>(g_variant_ref_sink(g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-offline', 'indicator-messages', 'indicator', 'indicator-messages-offline-symbolic', 'indicator-messages-symbolic', 'indicator-symbolic']>)>, 'title': <'Notifications'>, 'accessible-desc': <'Messages'>, 'visible': <true>}")), [](GVariant *var) {if (var != nullptr) g_variant_unref(var); });
+ auto blueicon = std::shared_ptr<GVariant>(g_variant_ref_sink(g_variant_new_parsed("{'icon': <('themed', <['indicator-messages-new-offline', 'indicator-messages-new', 'indicator-messages', 'indicator', 'indicator-messages-new-offline-symbolic', 'indicator-messages-new-symbolic', 'indicator-messages-symbolic', 'indicator-symbolic']>)>, 'title': <'Notifications'>, 'accessible-desc': <'New Messages'>, 'visible': <true>}")), [](GVariant *var) {if (var != nullptr) g_variant_unref(var); });
setActions("/org/ayatana/indicator/messages");