aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-03-12 18:07:48 +0000
committerConor Curran <conor.curran@canonical.com>2010-03-12 18:07:48 +0000
commit5dc32749af6b8281efcf94970fcb9f4863d93163 (patch)
tree45b1895d9cce2ac019bb0692a0793ba958c09c70
parent9a406f66da19e50b576f7a9614093af5e5873550 (diff)
downloadayatana-indicator-sound-5dc32749af6b8281efcf94970fcb9f4863d93163.tar.gz
ayatana-indicator-sound-5dc32749af6b8281efcf94970fcb9f4863d93163.tar.bz2
ayatana-indicator-sound-5dc32749af6b8281efcf94970fcb9f4863d93163.zip
this race condition is tricky one
-rw-r--r--src/dbus-menu-manager.c5
-rw-r--r--src/indicator-sound.c37
-rw-r--r--src/pulse-manager.c4
3 files changed, 18 insertions, 28 deletions
diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c
index 64f7108..38ed727 100644
--- a/src/dbus-menu-manager.c
+++ b/src/dbus-menu-manager.c
@@ -154,11 +154,6 @@ static void refresh_menu()
DBUSMENU_MENUITEM_PROP_ENABLED,
TRUE);
}
-/* if(b_all_muted == TRUE){*/
-/* dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), */
-/* DBUSMENU_MENUITEM_PROP_ENABLED,*/
-/* FALSE); */
-/* }*/
}
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index d59d300..aa87410 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -117,9 +117,9 @@ static gint current_state = 0;
static gint previous_state = 0;
static gdouble initial_volume_percent = 0;
-static gboolean initial_mute = FALSE;
-static gboolean device_available = TRUE;
-static gboolean slider_in_direct_use = FALSE;
+static gboolean initial_mute ;
+static gboolean device_available;
+static gboolean slider_in_direct_use;
static GtkIconSize design_team_size;
static gint animation_id;
@@ -151,10 +151,14 @@ static void indicator_sound_init (IndicatorSound *self)
{
self->service = NULL;
self->service = indicator_service_manager_new_version(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_VERSION);
- g_signal_connect(G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self);
prepare_state_machine();
prepare_blocked_animation();
animation_id = 0;
+ initial_mute = FALSE;
+ device_available = TRUE;
+ slider_in_direct_use = FALSE;
+
+ g_signal_connect(G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self);
return;
}
@@ -195,7 +199,7 @@ static GtkImage *
get_icon (IndicatorObject * io)
{
gchar* current_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state));
- //g_debug("At start-up attempting to set the image to %s", current_name);
+ g_debug("At start-up attempting to set the image to %s", current_name);
speaker_image = indicator_image_helper(current_name);
gtk_widget_show(GTK_WIDGET(speaker_image));
return speaker_image;
@@ -221,6 +225,8 @@ slider_parent_changed (GtkWidget *widget,
gpointer user_data)
{
gtk_widget_set_size_request (widget, 200, -1);
+ g_debug("slider parent changed");
+ //fetch_volume_percent_from_dbus();
}
/**
@@ -437,6 +443,9 @@ static void fetch_sink_availability_from_dbus()
device_available = *available_input;
if (device_available == FALSE)
update_state(STATE_SINKS_NONE);
+ g_debug("NO DEVICE AVAILABLE");
+
+ gtk_widget_set_sensitive(volume_slider, device_available);
g_free(available_input);
g_debug("IndicatorSound::fetch_sink_availability_from_dbus -> AVAILABILTY returned from dbus method is %i", device_available);
@@ -511,7 +520,7 @@ static gboolean fade_back_to_mute_image()
static void catch_signal_sink_volume_update(DBusGProxy *proxy, gdouble volume_percent, gpointer userdata)
{
- if (slider_in_direct_use != TRUE){
+ if (slider_in_direct_use == FALSE){
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider);
GtkRange *range = (GtkRange*)slider;
@@ -527,7 +536,7 @@ static void catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value
{
//We can be sure the service won't send a mute signal unless it has changed !
//UNMUTE's force a volume update therefore icon is updated appropriately => no need for unmute handling here.
- if(mute_value == TRUE && device_available != FALSE)
+ if(mute_value == TRUE && device_available == TRUE)
{
update_state(STATE_MUTED);
}
@@ -585,20 +594,6 @@ static void slider_released (GtkWidget *widget, gpointer user_data)
}
-/**
-slider_size_allocate:
-Callback on the size-allocate event on the slider item.
-**/
-/*static void slider_size_allocate(GtkWidget *widget,*/
-/* GtkAllocation *allocation, */
-/* gpointer user_data)*/
-/*{*/
-/* g_print("Size allocate on slider (%dx%d)\n", allocation->width, allocation->height);*/
-/* if(allocation->width < 200){*/
-/* g_print("Attempting to resize the slider");*/
-/* gtk_widget_set_size_request(widget, 200, -1); */
-/* }*/
-/*}*/
/**
key_press_cb:
diff --git a/src/pulse-manager.c b/src/pulse-manager.c
index 40add4e..e1634a9 100644
--- a/src/pulse-manager.c
+++ b/src/pulse-manager.c
@@ -67,8 +67,8 @@ void establish_pulse_activities(SoundServiceDbus *service)
// Establish event callback registration
pa_context_set_state_callback(pulse_context, context_state_callback, NULL);
- // BUILD MENU ANYWHO - it will be updated
- dbus_menu_manager_update_pa_state(FALSE, FALSE, FALSE, 0);
+ // Broadcast init state (assume we have a device - if not the signals will handle it)
+ dbus_menu_manager_update_pa_state(FALSE, TRUE, FALSE, 0);
pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL);
}