From c47d5e9746be3d1ea7642afd43bf527e1c3007fb Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 2 Jul 2008 17:56:57 +0200 Subject: [PATCH] Include .service.in file for activation, and adapt the project infrastructure to hold it properly. --- Makefile.am | 2 +- acinclude.m4 | 35 ++++++++++++++++++++++++++++++++++ configure.ac | 7 +++++++ data/Makefile.am | 8 ++++++++ data/org.gnome.MediaManager.service.in | 3 +++ test/clients/test-applications.c | 8 ++++---- 6 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 acinclude.m4 create mode 100644 data/Makefile.am create mode 100644 data/org.gnome.MediaManager.service.in diff --git a/Makefile.am b/Makefile.am index 3b9c7fe..d844c1d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in ## Created by Anjuta -SUBDIRS = src po test +SUBDIRS = src po test data mmediamanagerdocdir = ${prefix}/doc/mmediamanager mmediamanagerdoc_DATA = \ diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..3f8ce8f --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,35 @@ +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) +dnl +dnl example +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local +AC_DEFUN([AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var"="x$full_var"; then break; fi + full_var=$new_full_var + done + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) + diff --git a/configure.ac b/configure.ac index c5e20d2..842d166 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,12 @@ if test "$DBUS_BINDING_TOOL" = "no"; then AC_MSG_ERROR([dbus-binding-tool not found]) fi +AS_AC_EXPAND(DATADIR, $datadir) +DBUS_SERVICES_DIR="$DATADIR/dbus-1/services" +AC_SUBST(DBUS_SERVICES_DIR) +AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where +services dir for DBUS is]) + dnl *************************************************************************** dnl Internationalization dnl *************************************************************************** @@ -102,6 +108,7 @@ AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) AC_OUTPUT([ Makefile +data/Makefile src/libmmanager.pc src/Makefile test/Makefile diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..08f837b --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,8 @@ +# Dbus service file +servicedir = $(DBUS_SERVICES_DIR) +service_in_files = org.gnome.MediaManager.service.in +service_DATA = $(service_in_files:.service.in=.service) + +# Rule to make the service file with bindir expanded +$(service_DATA): $(service_in_files) Makefile + @sed -e "s|@bindir@|$(bindir)|" $<> $@ diff --git a/data/org.gnome.MediaManager.service.in b/data/org.gnome.MediaManager.service.in new file mode 100644 index 0000000..b0314ab --- /dev/null +++ b/data/org.gnome.MediaManager.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.gnome.MediaManager +Exec=@bindir@/mm-dbus-manager diff --git a/test/clients/test-applications.c b/test/clients/test-applications.c index 7b10bd3..535ff56 100644 --- a/test/clients/test-applications.c +++ b/test/clients/test-applications.c @@ -3,7 +3,6 @@ #include "config.h" #include "mm.h" #include -#include #include #include @@ -40,8 +39,9 @@ print_all_categories (MMApplication *app) MMFilterParam *fp; MMAttribute *a; GValue *val; + GError *error = NULL; - cats = mm_application_get_categories (app); + cats = mm_application_get_categories (app, &error); f = g_object_new (MM_TYPE_FILTER, NULL); a = mm_attribute_manager_lookup_attribute (mm_attribute_base_manager_get (), MM_ATTRIBUTE_BASE_URI); val = mm_create_gvalue_for_attribute (a); @@ -52,7 +52,7 @@ print_all_categories (MMApplication *app) g_free (val); for (l = cats; l; l = l->next) { g_print ("category name %s\n", mm_category_get_name (l->data)); - print_all_hits (mm_category_get_hits (l->data, f)); + print_all_hits (mm_category_get_hits (l->data, f, &error)); } } @@ -60,7 +60,7 @@ int main (int argc, char **argv) { MMManager *manager; GList *applications, *l; - GDesktopAppInfo *info; + GAppInfo *info; MMApplication *app; g_type_init (); -- 2.11.4.GIT