aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/music-player-bridge.vala2
-rw-r--r--src/sound-service-dbus.c34
-rw-r--r--src/sound-service.c18
-rw-r--r--src/sound-service.xml9
4 files changed, 55 insertions, 8 deletions
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index b5932fa..2a85dd3 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -27,7 +27,7 @@ public class MusicPlayerBridge : GLib.Object
private SettingsManager settings_manager;
private Dbusmenu.Menuitem root_menu;
- private HashMap<string, PlayerController> registered_clients;
+ private HashMap<string, PlayerController> registered_clients;
private Mpris2Watcher watcher;
public MusicPlayerBridge()
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index d0fd765..f99716a 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -58,6 +58,14 @@ struct _SoundServiceDbusPrivate {
Device* device;
};
+enum {
+ TRACK_SPECIFIC_ITEM,
+ PLAYER_SPECIFIC_ITEM,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
static GDBusNodeInfo * node_info = NULL;
static GDBusInterfaceInfo * interface_info = NULL;
@@ -110,6 +118,20 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass)
g_error("Unable to find interface '" INDICATOR_SOUND_DBUS_INTERFACE "'");
}
}
+ signals[TRACK_SPECIFIC_ITEM] = g_signal_new("track-specific-item-requested",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+ signals[PLAYER_SPECIFIC_ITEM] = g_signal_new("player-specific-item-requested",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
}
static void
@@ -185,7 +207,7 @@ sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
DBUSMENU_MENUITEM_PROP_LABEL,
_("Sound Preferences..."));
dbusmenu_menuitem_child_append(priv->root_menuitem, settings_mi);
- g_object_unref (settings_mi);
+ g_object_unref (settings_mi);
g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
G_CALLBACK(show_sound_settings_dialog), NULL);
}
@@ -297,6 +319,16 @@ bus_method_call (GDBusConnection * connection,
player_name);
retval = g_variant_new ("(b)", result);
}
+ else if (g_strcmp0(method, "EnableTrackSpecificItems") == 0) {
+ gchar* player_name;
+ g_variant_get (params, "(s)", &player_name);
+ g_debug ("EnableTrackSpecificItems - name %s", player_name);
+ g_signal_emit (service,
+ signals[TRACK_SPECIFIC_ITEM],
+ 0,
+ player_name);
+
+ }
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 1324537..0a15921 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -21,15 +21,13 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "pulseaudio-mgr.h"
#include "sound-service-dbus.h"
#include "music-player-bridge.h"
-
#include <locale.h>
static GMainLoop *mainloop = NULL;
-
+static MusicPlayerBridge* server;
/**********************************************************************************************************************/
// Init and exit functions
/**********************************************************************************************************************/
-
/**
service_shutdown:
When the service interface starts to shutdown, we
@@ -47,13 +45,20 @@ service_shutdown (IndicatorService *service, gpointer user_data)
return;
}
+void
+on_track_specific_item_requested (SoundServiceDbus* sound_service,
+ const gchar* desktop_id,
+ gpointer userdata)
+{
+ g_debug ("ON TRACK SPECIFIC ITEM REQUESTED %s", desktop_id);
+}
+
/**
main:
**/
int
main (int argc, char ** argv)
{
-
g_type_init();
textdomain (GETTEXT_PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -66,9 +71,12 @@ main (int argc, char ** argv)
G_CALLBACK(service_shutdown), NULL);
SoundServiceDbus* sound_service = g_object_new(SOUND_SERVICE_DBUS_TYPE, NULL);
+ g_signal_connect(G_OBJECT(sound_service),
+ "track-specific-item-requested",
+ G_CALLBACK(on_track_specific_item_requested), NULL);
DbusmenuMenuitem* root_menuitem = sound_service_dbus_create_root_item(sound_service);
- MusicPlayerBridge* server = music_player_bridge_new();
+ server = music_player_bridge_new();
music_player_bridge_set_root_menu_item(server, root_menuitem);
// Run the loop
diff --git a/src/sound-service.xml b/src/sound-service.xml
index 517088e..aa9f229 100644
--- a/src/sound-service.xml
+++ b/src/sound-service.xml
@@ -12,11 +12,18 @@
<arg type='s' name='player_desktop_name' direction="in"/>
<arg type='b' name='result' direction="out"/>
</method>
-
<method name = "GetSoundState">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg type='i' name='current_state' direction="out"/>
</method>
+ <method name = "EnableTrackSpecificItems">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type='s' name='player_desktop_name' direction="in"/>
+ </method>
+ <method name = "EnablePlayerSpecificItems">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type='s' name='player_desktop_name' direction="in"/>
+ </method>
<signal name="SoundStateUpdate">
<arg name="new_state" type="i" direction="out"/>
</signal>