From cf9b03167ed12086acbd74b97404b082f8e018a8 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 31 Jan 2011 13:14:47 -0600 Subject: players in menu now dynamically controllable from new dbus api --- src/sound-service-dbus.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index a532c0e..0fc2f50 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -85,6 +85,10 @@ static void sound_service_dbus_determine_state (SoundServiceDbus* self, gboolean availability, gboolean mute, gdouble volume); +static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, + gchar* player_name, + gboolean blacklist); + G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT); @@ -400,12 +404,93 @@ bus_method_call (GDBusConnection * connection, g_debug("Get state - %i", priv->current_sound_state ); retval = g_variant_new ( "(i)", priv->current_sound_state); } + else if (g_strcmp0(method, "BlacklistMediaPlayer") == 0) { + gboolean blacklist; + gchar* player_name; + g_variant_get (params, "(sb)", &player_name, &blacklist); + + g_debug ("BlacklistMediaPlayer - bool %i", blacklist); + g_debug ("BlacklistMediaPlayer - name %s", player_name); + gboolean result = sound_service_dbus_blacklist_player (service, + player_name, + blacklist); + retval = g_variant_new ("(b)", result); + } else { g_warning("Calling method '%s' on the sound service but it's unknown", method); } g_dbus_method_invocation_return_value (invocation, retval); } +static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, + gchar* player_name, + gboolean blacklist) +{ + gboolean result = FALSE; + GSettings* our_settings = g_settings_new ("com.canonical.indicators.sound"); + GVariant* the_black_list = g_settings_get_value (our_settings, + "blacklisted-media-players"); + + GVariantIter *iter; + gchar *str; + // Firstly prep new array which will be set on the key. + GVariantBuilder *builder; + g_variant_get (the_black_list, "as", &iter); + builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + + while (g_variant_iter_loop (iter, "s", &str)){ + g_variant_builder_add (builder, "s", str); + } + + g_variant_get (the_black_list, "as", &iter); + + if (blacklist == TRUE){ + while (g_variant_iter_loop (iter, "s", &str)){ + g_print ("first pass to check if %s is present\n", str); + if (g_strcmp0 (player_name, str) == 0){ + // Return if its already there + g_debug ("we have this already blacklisted"); + return result; + } + } + // Otherwise blacklist it ! + g_debug ("about to blacklist %s", player_name); + g_variant_builder_add (builder, "s", player_name); + } + else{ + //g_variant_builder_clear (builder); + gboolean present = FALSE; + g_variant_get (the_black_list, "as", &iter); + + while (g_variant_iter_loop (iter, "s", &str)){ + if (g_strcmp0 (player_name, str) == 0){ + present = TRUE; + } + } + // It was not there anyway, return false + if (present == FALSE) + return result; + + // Otherwise free the builder and reconstruct ensuring no duplicates. + g_variant_builder_unref (builder); + builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + + g_variant_get (the_black_list, "as", &iter); + while (g_variant_iter_loop (iter, "s", &str)){ + if (g_strcmp0 (player_name, str) != 0){ + g_variant_builder_add (builder, "s", str); + } + } + } + GVariant* value = g_variant_new ("as", builder); + g_variant_builder_unref (builder); + g_variant_iter_free (iter); + result = g_settings_set_value (our_settings, + "blacklisted-media-players", + value); + g_variant_unref (value); + return result; +} -- cgit v1.2.3 From 6da3712d5eda504073689da98eccba020d57a5cd Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 31 Jan 2011 15:26:06 -0600 Subject: blacklist / interested players work done --- src/sound-service-dbus.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 0fc2f50..f29fab4 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -458,7 +458,6 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, g_variant_builder_add (builder, "s", player_name); } else{ - //g_variant_builder_clear (builder); gboolean present = FALSE; g_variant_get (the_black_list, "as", &iter); -- cgit v1.2.3 From 43b7e22a13692edbba02c987975747a069881814 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 31 Jan 2011 19:33:46 -0600 Subject: moved builder and iter to the stack in blacklist method --- src/sound-service-dbus.c | 61 +++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index f29fab4..9ae0fd7 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -427,68 +427,77 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, gboolean blacklist) { gboolean result = FALSE; - GSettings* our_settings = g_settings_new ("com.canonical.indicators.sound"); + GSettings* our_settings = NULL; + our_settings = g_settings_new ("com.canonical.indicators.sound"); GVariant* the_black_list = g_settings_get_value (our_settings, "blacklisted-media-players"); - - GVariantIter *iter; + GVariantIter iter; gchar *str; // Firstly prep new array which will be set on the key. - GVariantBuilder *builder; - g_variant_get (the_black_list, "as", &iter); - builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + GVariantBuilder builder; + + g_variant_iter_init (&iter, the_black_list); + g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY); - while (g_variant_iter_loop (iter, "s", &str)){ - g_variant_builder_add (builder, "s", str); + while (g_variant_iter_loop (&iter, "s", &str)){ + g_variant_builder_add (&builder, "s", str); } - - g_variant_get (the_black_list, "as", &iter); + g_variant_iter_init (&iter, the_black_list); if (blacklist == TRUE){ - while (g_variant_iter_loop (iter, "s", &str)){ + while (g_variant_iter_loop (&iter, "s", &str)){ g_print ("first pass to check if %s is present\n", str); if (g_strcmp0 (player_name, str) == 0){ // Return if its already there - g_debug ("we have this already blacklisted"); + g_debug ("we have this already blacklisted, no need to do anything"); + g_variant_builder_end (&builder); + g_object_unref (our_settings); return result; } } // Otherwise blacklist it ! g_debug ("about to blacklist %s", player_name); - g_variant_builder_add (builder, "s", player_name); + g_variant_builder_add (&builder, "s", player_name); } else{ gboolean present = FALSE; - g_variant_get (the_black_list, "as", &iter); - - while (g_variant_iter_loop (iter, "s", &str)){ + g_variant_iter_init (&iter, the_black_list); + g_debug ("attempting to UN-blacklist %s", player_name); + + while (g_variant_iter_loop (&iter, "s", &str)){ if (g_strcmp0 (player_name, str) == 0){ present = TRUE; } } // It was not there anyway, return false - if (present == FALSE) + if (present == FALSE){ + g_debug ("it was not blacklisted ?, no need to do anything"); + g_variant_builder_end (&builder); + g_object_unref (our_settings); return result; - + } + // Otherwise free the builder and reconstruct ensuring no duplicates. - g_variant_builder_unref (builder); - builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + g_variant_builder_end (&builder); + g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY); - g_variant_get (the_black_list, "as", &iter); + g_variant_iter_init (&iter, the_black_list); - while (g_variant_iter_loop (iter, "s", &str)){ + while (g_variant_iter_loop (&iter, "s", &str)){ if (g_strcmp0 (player_name, str) != 0){ - g_variant_builder_add (builder, "s", str); + g_variant_builder_add (&builder, "s", str); } } } - GVariant* value = g_variant_new ("as", builder); - g_variant_builder_unref (builder); - g_variant_iter_free (iter); + GVariant* value = g_variant_builder_end (&builder); + g_variant_ref (value); result = g_settings_set_value (our_settings, "blacklisted-media-players", value); + g_variant_unref (value); + g_object_unref (our_settings); + return result; } -- cgit v1.2.3 From 2ea739c1cc14bbfdafbebec79aeae78cbf440145 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 1 Feb 2011 09:50:29 -0600 Subject: fixes applied --- src/sound-service-dbus.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 9ae0fd7..7f5afdc 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -450,8 +450,9 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, if (g_strcmp0 (player_name, str) == 0){ // Return if its already there g_debug ("we have this already blacklisted, no need to do anything"); - g_variant_builder_end (&builder); + g_variant_builder_clear (&builder); g_object_unref (our_settings); + g_object_unref (the_black_list); return result; } } @@ -472,17 +473,18 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, // It was not there anyway, return false if (present == FALSE){ g_debug ("it was not blacklisted ?, no need to do anything"); - g_variant_builder_end (&builder); + g_variant_builder_clear (&builder); g_object_unref (our_settings); + g_object_unref (the_black_list); return result; } // Otherwise free the builder and reconstruct ensuring no duplicates. - g_variant_builder_end (&builder); + g_variant_builder_clear (&builder); g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY); g_variant_iter_init (&iter, the_black_list); - + while (g_variant_iter_loop (&iter, "s", &str)){ if (g_strcmp0 (player_name, str) != 0){ g_variant_builder_add (&builder, "s", str); @@ -490,13 +492,12 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, } } GVariant* value = g_variant_builder_end (&builder); - g_variant_ref (value); result = g_settings_set_value (our_settings, "blacklisted-media-players", value); - g_variant_unref (value); g_object_unref (our_settings); + g_object_unref (the_black_list); return result; } -- cgit v1.2.3 From 2b6453d1a988eb4a82df18401b3ba9b3867a2f40 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 1 Feb 2011 14:40:51 -0600 Subject: fixes for the last two merge requests --- src/sound-service-dbus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 7f5afdc..637bee4 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -452,7 +452,7 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, g_debug ("we have this already blacklisted, no need to do anything"); g_variant_builder_clear (&builder); g_object_unref (our_settings); - g_object_unref (the_black_list); + g_variant_unref (the_black_list); return result; } } @@ -475,7 +475,7 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, g_debug ("it was not blacklisted ?, no need to do anything"); g_variant_builder_clear (&builder); g_object_unref (our_settings); - g_object_unref (the_black_list); + g_variant_unref (the_black_list); return result; } @@ -497,7 +497,7 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, value); g_object_unref (our_settings); - g_object_unref (the_black_list); + g_variant_unref (the_black_list); return result; } -- cgit v1.2.3 From 7ba3797b9006f0a7e048787ee6de91fd05e60d2b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Feb 2011 14:08:09 +0000 Subject: on the last hurdle --- src/sound-service-dbus.c | 150 ++++++----------------------------------------- 1 file changed, 19 insertions(+), 131 deletions(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 637bee4..9009869 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -32,10 +32,6 @@ #include "gen-sound-service.xml.h" #include "dbus-shared-names.h" -#include "pulse-manager.h" -#include "slider-menu-item.h" -#include "mute-menu-item.h" -#include "pulse-manager.h" // DBUS methods static void bus_method_call (GDBusConnection * connection, @@ -57,16 +53,15 @@ static GDBusInterfaceVTable interface_table = { typedef struct _SoundServiceDbusPrivate SoundServiceDbusPrivate; struct _SoundServiceDbusPrivate { - GDBusConnection* connection; - DbusmenuMenuitem* root_menuitem; - SliderMenuItem* volume_slider_menuitem; - MuteMenuItem* mute_menuitem; - SoundState current_sound_state; + GDBusConnection* connection; + DbusmenuMenuitem* root_menuitem; + ActiveSink* active_sink; }; static GDBusNodeInfo * node_info = NULL; static GDBusInterfaceInfo * interface_info = NULL; static gboolean b_startup = TRUE; + #define SOUND_SERVICE_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUND_SERVICE_DBUS_TYPE, SoundServiceDbusPrivate)) static void sound_service_dbus_class_init (SoundServiceDbusClass *klass); @@ -133,8 +128,6 @@ sound_service_dbus_init (SoundServiceDbus *self) priv->connection = NULL; - priv->current_sound_state = UNAVAILABLE; - /* Fetch the session bus */ priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); @@ -167,32 +160,26 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self) DbusmenuServer *server = dbusmenu_server_new(INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH); dbusmenu_server_set_root (server, priv->root_menuitem); g_object_unref (priv->root_menuitem); - establish_pulse_activities (self); + priv->active_sink = active_sink_new (self); + //establish_pulse_activities (self); return priv->root_menuitem; } -static void +void sound_service_dbus_build_sound_menu ( SoundServiceDbus* self, - gboolean mute_update, - gboolean availability, - gdouble volume ) + DbusmenuMenuitem* mute_item, + DbusmenuMenuitem* slider_item) { SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); // Mute button - priv->mute_menuitem = mute_menu_item_new ( mute_update, availability); - dbusmenu_menuitem_child_append (priv->root_menuitem, - mute_menu_item_get_button (priv->mute_menuitem)); - - // Slider - priv->volume_slider_menuitem = slider_menu_item_new ( availability, volume ); - dbusmenu_menuitem_child_append (priv->root_menuitem, DBUSMENU_MENUITEM ( priv->volume_slider_menuitem )); + dbusmenu_menuitem_child_append (priv->root_menuitem, mute_item)); + dbusmenu_menuitem_child_append (priv->root_menuitem, slider_item )); // Separator - DbusmenuMenuitem* separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set( separator, + dbusmenu_menuitem_property_set (separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); dbusmenu_menuitem_child_append(priv->root_menuitem, separator); @@ -207,9 +194,7 @@ sound_service_dbus_build_sound_menu ( SoundServiceDbus* self, dbusmenu_menuitem_child_append(priv->root_menuitem, 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); - - sound_service_dbus_determine_state (self, availability, mute_update, volume); + G_CALLBACK(show_sound_settings_dialog), NULL); } /** @@ -229,41 +214,11 @@ show_sound_settings_dialog (DbusmenuMenuitem *mi, } } -void -sound_service_dbus_update_pa_state ( SoundServiceDbus* self, - gboolean availability, - gboolean mute_update, - gdouble volume ) -{ - g_debug("update pa state with availability of %i, mute value of %i and a volume percent is %f", availability, mute_update, volume); - SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); - - if (b_startup == TRUE) { - sound_service_dbus_build_sound_menu ( self, - mute_update, - availability, - volume ); - b_startup = FALSE; - return; - } - - mute_menu_item_update ( priv->mute_menuitem, - mute_update ); - slider_menu_item_update ( priv->volume_slider_menuitem, - volume ); - - mute_menu_item_enable ( priv->mute_menuitem, availability); - slider_menu_item_enable ( priv->volume_slider_menuitem, - availability ); - sound_service_dbus_determine_state (self, availability, mute_update, volume); - -} - - static void sound_service_dbus_dispose (GObject *object) { G_OBJECT_CLASS (sound_service_dbus_parent_class)->dispose (object); + //TODO dispose of the active sink instance ! return; } @@ -274,76 +229,6 @@ sound_service_dbus_finalize (GObject *object) return; } -// UNTIL PA-MANAGER IS REFACTORED AND THE ACTIVESINK CLASS IS CREATED LEAVE -// THE UI ELEMENTS SEPARATELY HANDLED LIKE THIS. -void -sound_service_dbus_update_volume (SoundServiceDbus* self, - gdouble volume) -{ - SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); - slider_menu_item_update (priv->volume_slider_menuitem, volume); - sound_service_dbus_update_sound_state (self, - sound_service_dbus_get_state_from_volume (self)); -} - -void -sound_service_dbus_update_sink_mute (SoundServiceDbus* self, - gboolean mute_update) -{ - SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); - mute_menu_item_update (priv->mute_menuitem, mute_update); - SoundState state = sound_service_dbus_get_state_from_volume (self); - if (mute_update == TRUE){ - state = MUTED; - } - sound_service_dbus_update_sound_state (self, state); -} - -/*------- State calculators ------------------*/ -static SoundState -sound_service_dbus_get_state_from_volume (SoundServiceDbus* self) -{ - SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); - GVariant* v = dbusmenu_menuitem_property_get_variant (DBUSMENU_MENUITEM(priv->volume_slider_menuitem), - DBUSMENU_VOLUME_MENUITEM_LEVEL); - gdouble volume_percent = g_variant_get_double (v); - - SoundState state = LOW_LEVEL; - - if (volume_percent < 30.0 && volume_percent > 0) { - state = LOW_LEVEL; - } - else if (volume_percent < 70.0 && volume_percent >= 30.0) { - state = MEDIUM_LEVEL; - } - else if (volume_percent >= 70.0) { - state = HIGH_LEVEL; - } - else if (volume_percent == 0.0) { - state = ZERO_LEVEL; - } - return state; -} - -static void -sound_service_dbus_determine_state (SoundServiceDbus* self, - gboolean availability, - gboolean mute, - gdouble volume) -{ - SoundState update; - if (availability == FALSE) { - update = UNAVAILABLE; - } - else if (mute == TRUE) { - update = MUTED; - } - else{ - update = sound_service_dbus_get_state_from_volume (self); - } - sound_service_dbus_update_sound_state (self, update); -} - // EMIT STATE SIGNAL @@ -401,8 +286,8 @@ bus_method_call (GDBusConnection * connection, SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (service); if (g_strcmp0(method, "GetSoundState") == 0) { - g_debug("Get state - %i", priv->current_sound_state ); - retval = g_variant_new ( "(i)", priv->current_sound_state); + g_debug("Get state - %i", active_sink_get_state (priv->active_sink); + retval = g_variant_new ( "(i)", active_sink_get_state (priv->active_sink)); } else if (g_strcmp0(method, "BlacklistMediaPlayer") == 0) { gboolean blacklist; @@ -422,6 +307,9 @@ bus_method_call (GDBusConnection * connection, g_dbus_method_invocation_return_value (invocation, retval); } +/** + TODO - Works nicely but refactor into at least two different methods +**/ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, gchar* player_name, gboolean blacklist) -- cgit v1.2.3 From 025fb0a3df226ab127ee435c341882addfafcbba Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Feb 2011 16:17:31 +0000 Subject: almost in place --- src/sound-service-dbus.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 9009869..1617a47 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -29,7 +29,7 @@ #include #include "sound-service-dbus.h" - +#include "active-sink.h" #include "gen-sound-service.xml.h" #include "dbus-shared-names.h" @@ -60,7 +60,6 @@ struct _SoundServiceDbusPrivate { static GDBusNodeInfo * node_info = NULL; static GDBusInterfaceInfo * interface_info = NULL; -static gboolean b_startup = TRUE; #define SOUND_SERVICE_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUND_SERVICE_DBUS_TYPE, SoundServiceDbusPrivate)) @@ -69,17 +68,8 @@ static void sound_service_dbus_init (SoundServiceDbus *self); static void sound_service_dbus_dispose (GObject *object); static void sound_service_dbus_finalize (GObject *object); -static void sound_service_dbus_build_sound_menu ( SoundServiceDbus* root, - gboolean mute_update, - gboolean availability, - gdouble volume ); static void show_sound_settings_dialog (DbusmenuMenuitem *mi, gpointer user_data); -static SoundState sound_service_dbus_get_state_from_volume (SoundServiceDbus* self); -static void sound_service_dbus_determine_state (SoundServiceDbus* self, - gboolean availability, - gboolean mute, - gdouble volume); static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, gchar* player_name, gboolean blacklist); @@ -173,8 +163,8 @@ sound_service_dbus_build_sound_menu ( SoundServiceDbus* self, SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); // Mute button - dbusmenu_menuitem_child_append (priv->root_menuitem, mute_item)); - dbusmenu_menuitem_child_append (priv->root_menuitem, slider_item )); + dbusmenu_menuitem_child_append (priv->root_menuitem, mute_item); + dbusmenu_menuitem_child_append (priv->root_menuitem, slider_item); // Separator DbusmenuMenuitem* separator = dbusmenu_menuitem_new(); @@ -239,21 +229,12 @@ sound_service_dbus_update_sound_state (SoundServiceDbus* self, SoundState new_state) { SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); - SoundState update = new_state; - // Ensure that after it has become available update the state with the current volume level - if (new_state == AVAILABLE && - mute_menu_item_is_muted (priv->mute_menuitem) == FALSE){ - update = sound_service_dbus_get_state_from_volume (self); - } - if (update != BLOCKED){ - priv->current_sound_state = update; - } - GVariant* v_output = g_variant_new("(i)", (int)update); + GVariant* v_output = g_variant_new("(i)", (int)new_state); GError * error = NULL; - g_debug ("emitting signal with value %i", (int)update); + g_debug ("emitting state signal with value %i", (int)new_state); g_dbus_connection_emit_signal( priv->connection, NULL, INDICATOR_SOUND_SERVICE_DBUS_OBJECT_PATH, @@ -286,7 +267,7 @@ bus_method_call (GDBusConnection * connection, SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (service); if (g_strcmp0(method, "GetSoundState") == 0) { - g_debug("Get state - %i", active_sink_get_state (priv->active_sink); + g_debug("Get state - %i", active_sink_get_state (priv->active_sink)); retval = g_variant_new ( "(i)", active_sink_get_state (priv->active_sink)); } else if (g_strcmp0(method, "BlacklistMediaPlayer") == 0) { -- cgit v1.2.3 From 39430b4d1797d16b2152fddb864a38c26f8fb97f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Feb 2011 17:31:16 +0000 Subject: putting in back together --- src/sound-service-dbus.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 1617a47..f9428cc 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -164,6 +164,7 @@ sound_service_dbus_build_sound_menu ( SoundServiceDbus* self, // Mute button dbusmenu_menuitem_child_append (priv->root_menuitem, mute_item); + g_debug ("just about to add the slider %i", DBUSMENU_IS_MENUITEM(slider_item)); dbusmenu_menuitem_child_append (priv->root_menuitem, slider_item); // Separator -- cgit v1.2.3 From 6bfc46de9234f0ef39d90b934fb406eebec4c59c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Feb 2011 18:25:54 +0000 Subject: tidy ups --- src/sound-service-dbus.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/sound-service-dbus.c') diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index f9428cc..58367f4 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -151,7 +151,6 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self) dbusmenu_server_set_root (server, priv->root_menuitem); g_object_unref (priv->root_menuitem); priv->active_sink = active_sink_new (self); - //establish_pulse_activities (self); return priv->root_menuitem; } @@ -222,9 +221,6 @@ sound_service_dbus_finalize (GObject *object) // EMIT STATE SIGNAL - -// TODO: this will be a bit messy until the pa_manager is sorted. -// And we figure out all of the edge cases. void sound_service_dbus_update_sound_state (SoundServiceDbus* self, SoundState new_state) @@ -251,7 +247,6 @@ sound_service_dbus_update_sound_state (SoundServiceDbus* self, } //HANDLE DBUS METHOD CALLS -// TODO we will need to implement the black_list method. static void bus_method_call (GDBusConnection * connection, const gchar * sender, -- cgit v1.2.3