aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-01-26 16:40:38 -0600
committerConor Curran <conor.curran@canonical.com>2011-01-26 16:40:38 -0600
commit46cbdc7d1607b20c1bba67df4471f8e5d1243c3d (patch)
tree575a210f1061dd0c1de3028ef19bc5a7f46e50c5
parent8bbf7ea5805ed69a2d7450065a558398a623525f (diff)
downloadayatana-indicator-sound-46cbdc7d1607b20c1bba67df4471f8e5d1243c3d.tar.gz
ayatana-indicator-sound-46cbdc7d1607b20c1bba67df4471f8e5d1243c3d.tar.bz2
ayatana-indicator-sound-46cbdc7d1607b20c1bba67df4471f8e5d1243c3d.zip
last minute tidy up
-rw-r--r--src/indicator-sound.c12
-rw-r--r--src/mute-menu-item.c5
-rw-r--r--src/sound-service.c4
-rw-r--r--src/sound-state-manager.c16
-rw-r--r--src/sound-state-manager.h6
5 files changed, 30 insertions, 13 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index b47290c..3c65a90 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -129,7 +129,6 @@ indicator_sound_init (IndicatorSound *self)
priv->dbus_proxy = NULL;
GList* t_list = NULL;
priv->transport_widgets_list = t_list;
- // create our state manager which will handle all icon changing etc.
priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);
g_signal_connect ( G_OBJECT(self->service),
@@ -209,7 +208,7 @@ connection_changed (IndicatorServiceManager * sm,
GError *error = NULL;
if (connected == FALSE){
- //update_state (STATE_SINKS_NONE);
+ sound_state_manager_deal_with_disconnect (priv->state_manager);
return;
//TODO: Gracefully handle disconnection
// do a timeout to wait for reconnection
@@ -220,7 +219,14 @@ connection_changed (IndicatorServiceManager * sm,
// we don't need to anything, gdbus takes care of the rest - bless.
// just fetch the state.
if (priv->dbus_proxy != NULL){
- //fetch_state (indicator);
+ g_dbus_proxy_call ( priv->dbus_proxy,
+ "GetSoundState",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ (GAsyncReadyCallback)sound_state_manager_get_state_cb,
+ priv->state_manager);
return;
}
diff --git a/src/mute-menu-item.c b/src/mute-menu-item.c
index 344c17e..2f40177 100644
--- a/src/mute-menu-item.c
+++ b/src/mute-menu-item.c
@@ -39,10 +39,7 @@ static void mute_menu_item_class_init (MuteMenuItemClass *klass);
static void mute_menu_item_init (MuteMenuItem *self);
static void mute_menu_item_dispose (GObject *object);
static void mute_menu_item_finalize (GObject *object);
-static void handle_event (DbusmenuMenuitem * mi, const gchar * name,
- GVariant * value, guint timestamp);
-static void
-mute_menu_item_set_global_mute_from_ui (gpointer user_data);
+static void mute_menu_item_set_global_mute_from_ui (gpointer user_data);
G_DEFINE_TYPE (MuteMenuItem, mute_menu_item, G_TYPE_OBJECT);
diff --git a/src/sound-service.c b/src/sound-service.c
index 9a5c6fe..2cb33d3 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -18,8 +18,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sound-service.h"
-//#include "dbus-menu-manager.h"
-//#include "pulse-manager.h"
+
+#include "pulse-manager.h"
#include "sound-service-dbus.h"
#include "music-player-bridge.h"
diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c
index 4a8dbe2..2ea9b1a 100644
--- a/src/sound-state-manager.c
+++ b/src/sound-state-manager.c
@@ -52,9 +52,6 @@ static void sound_state_signal_cb ( GDBusProxy* proxy,
gchar* signal_name,
GVariant* parameters,
gpointer user_data );
-static void sound_state_manager_get_state_cb (GObject *object,
- GAsyncResult *res,
- gpointer user_data);
static gboolean sound_state_manager_can_proceed_with_blocking_animation (SoundStateManager* self);
static void
@@ -210,7 +207,7 @@ sound_state_manager_connect_to_dbus (SoundStateManager* self, GDBusProxy* proxy)
self);
}
-static void
+void
sound_state_manager_get_state_cb (GObject *object,
GAsyncResult *res,
gpointer user_data)
@@ -242,6 +239,17 @@ sound_state_manager_get_state_cb (GObject *object,
g_variant_unref(result);
}
+void
+sound_state_manager_deal_with_disconnect (SoundStateManager* self)
+{
+ SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self);
+ priv->current_state = UNAVAILABLE;
+
+ gchar* image_name = g_hash_table_lookup (priv->volume_states,
+ GINT_TO_POINTER(priv->current_state) );
+ indicator_image_helper_update (priv->speaker_image, image_name);
+}
+
static void
sound_state_signal_cb ( GDBusProxy* proxy,
gchar* sender_name,
diff --git a/src/sound-state-manager.h b/src/sound-state-manager.h
index 76264e2..d73d5d9 100644
--- a/src/sound-state-manager.h
+++ b/src/sound-state-manager.h
@@ -54,6 +54,12 @@ GtkImage* sound_state_manager_get_current_icon (SoundStateManager* self);
SoundState sound_state_manager_get_current_state (SoundStateManager* self);
void sound_state_manager_connect_to_dbus (SoundStateManager* self,
GDBusProxy* proxy);
+void sound_state_manager_deal_with_disconnect (SoundStateManager* self);
+void sound_state_manager_get_state_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data);
+
+
G_END_DECLS