From a6dee99edd1a3870c4dc4557f605578c52a4f0dc Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 21 Jun 2011 18:26:10 +0200 Subject: custom marshaller in place to handle the string string signature on our item specific dbus methods --- configure.ac | 3 +++ src/Makefile.am | 10 ++++++++++ src/sound-service-dbus.c | 31 ++++++++++++++++++++----------- src/sound-service.c | 3 ++- src/sound-service.xml | 4 ++-- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index ab02d4e..b7525d7 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,8 @@ AC_CONFIG_MACRO_DIR([m4]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) + ########################### # Dependencies ########################### @@ -96,6 +98,7 @@ AC_SUBST(INDICATORICONSDIR) ########################### GLIB_GSETTINGS +GLIB_GENMARSHAL ########################### # DBus Service Info diff --git a/src/Makefile.am b/src/Makefile.am index fde333a..fedf5de 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,6 +30,7 @@ libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -DG_LOG_DOMAIN=\"Indicat libsoundmenu_la_LIBADD = $(APPLET_LIBS) libsoundmenu_la_LDFLAGS = -module -avoid-version + checkxml: $(srcdir)/sound-service.xml @xmllint -valid -noout $< @echo $< checks out ok @@ -39,6 +40,9 @@ checkxml: $(srcdir)/sound-service.xml # Sound Service #################################################################### +glib_marshal_list = sound-service-marshal.list +glib_marshal_prefix = _sound_service_marshal + ##################### # Sound service vala @@ -106,6 +110,8 @@ indicator_sound_service_SOURCES = \ mute-menu-item.c \ gen-sound-service.xml.h \ gen-sound-service.xml.c \ + sound-service-marshal.c \ + sound-service-marshal.h \ $(music_bridge_VALASOURCES:.vala=.c) indicator_sound_service_CFLAGS = $(PULSEAUDIO_CFLAGS) $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall @@ -146,3 +152,7 @@ BUILT_SOURCES = \ CLEANFILES = \ $(BUILT_SOURCES) + +DISTCLEANFILES = + +include $(top_srcdir)/Makefile.am.marshal diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 5d7c4cd..d546ceb 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -32,6 +32,7 @@ #include "device.h" #include "gen-sound-service.xml.h" #include "dbus-shared-names.h" +#include "sound-service-marshal.h" // DBUS methods static void bus_method_call (GDBusConnection * connection, @@ -123,7 +124,7 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__STRING, + _sound_service_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals[PLAYER_SPECIFIC_ITEM] = g_signal_new("player-specific-item-requested", @@ -131,7 +132,7 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__STRING, + _sound_service_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); } @@ -321,23 +322,31 @@ bus_method_call (GDBusConnection * connection, retval = g_variant_new ("(b)", result); } else if (g_strcmp0(method, "EnableTrackSpecificItems") == 0) { - gchar** player_object_path_and_id; - g_variant_get (params, "(ss)", &player_object_path_and_id); - /*g_debug ("EnableTrackSpecificItems - name %s", player_object_path); + gchar* player_object_path; + gchar* player_id; + g_variant_get (params, "(os)", &player_object_path, &player_id); + //g_debug ("object path = %s and id = %s", player_object_path, player_id); g_signal_emit (service, signals[TRACK_SPECIFIC_ITEM], 0, - player_object_path);*/ + player_object_path, + player_id); + g_free (player_object_path); + g_free (player_id); } else if (g_strcmp0(method, "EnablePlayerSpecificItems") == 0) { - /*gchar* player_object_path; - g_variant_get (params, "(s)", &player_object_path); - g_debug ("EnableTrackSpecificItems - name %s", player_object_path); + gchar* player_object_path; + gchar* player_id; + g_variant_get (params, "(os)", &player_object_path, &player_id); + //g_debug ("object path = %s and id = %s", player_object_path, player_id); g_signal_emit (service, - signals[TRACK_SPECIFIC_ITEM], + signals[PLAYER_SPECIFIC_ITEM], 0, - player_object_path);*/ + player_object_path, + player_id); + g_free (player_object_path); + g_free (player_id); } else { g_warning("Calling method '%s' on the sound service but it's unknown", method); diff --git a/src/sound-service.c b/src/sound-service.c index dd957a0..9e22485 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -17,11 +17,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include + #include "sound-service.h" #include "pulseaudio-mgr.h" #include "sound-service-dbus.h" #include "music-player-bridge.h" -#include static GMainLoop *mainloop = NULL; static MusicPlayerBridge* player_bridge; diff --git a/src/sound-service.xml b/src/sound-service.xml index af0f136..796fa22 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -18,13 +18,13 @@ - + + - -- cgit v1.2.3