diff options
-rw-r--r-- | src/indicator-sound.c | 6 | ||||
-rw-r--r-- | src/pulse-manager.c | 10 | ||||
-rw-r--r-- | src/slider-menu-item.c | 9 | ||||
-rw-r--r-- | src/sound-service.c | 1 |
4 files changed, 11 insertions, 15 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 0837811..abebb19 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -82,7 +82,7 @@ static gdouble input_value_from_across_the_dbus = 0.0; static GtkImage *speaker_image = NULL; static gboolean new_slider_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); -static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value); +static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkWidget *widget); static gboolean slider_value_changed_event_cb(GtkRange *range, GtkScrollType scroll, double value, gpointer user_data); static void change_speaker_image(gdouble volume_percent); @@ -230,7 +230,7 @@ static gboolean new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * p GtkMenuItem *menu_volume_slider = GTK_MENU_ITEM(volume_slider); dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_volume_slider, parent); - g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(slider_prop_change_cb), NULL); + g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(slider_prop_change_cb), volume_slider); GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); GtkRange* range = (GtkRange*)slider; @@ -240,7 +240,7 @@ static gboolean new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * p /* Whenever we have a property change on a DbusmenuMenuitem we need to be responsive to that. */ -static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value) +static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkWidget *widget) { g_debug("slider_prop_change_cb "); g_debug("about to set the slider to %f", g_value_get_double(value)); diff --git a/src/pulse-manager.c b/src/pulse-manager.c index e563aca..ce63b0d 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -108,15 +108,13 @@ static gboolean sink_available() { if (g_hash_table_size(sink_hash) < 1) return FALSE; - sink_info *s = g_hash_table_lookup(sink_hash, GINT_TO_POINTER(0)); + sink_info *s = g_hash_table_lookup(sink_hash, GINT_TO_POINTER(DEFAULT_SINK_INDEX)); // TODO more testing is required for the case of having no available sink // This will need to iterate through the sinks to find an available // one as opposed to just picking the first return ((g_strcasecmp(s->name, " auto_null ") != 0) && s->active_port == TRUE); } -//TODO do not ship with this method like this - LOGIC far too convoluted " -// Would like to use default parameter values ? (C Question) static gboolean default_sink_is_muted() { if(DEFAULT_SINK_INDEX < 0) @@ -205,6 +203,7 @@ static void pulse_sink_info_callback(pa_context *c, const pa_sink_info *sink, in } else{ + g_debug("About to add an item to our hash"); sink_info *value; value = g_new0(sink_info, 1); value->index = value->device_index = sink->index; @@ -217,6 +216,7 @@ static void pulse_sink_info_callback(pa_context *c, const pa_sink_info *sink, in value->base_volume = sink->base_volume; value->channel_map = sink->channel_map; g_hash_table_insert(sink_hash, GINT_TO_POINTER(sink->index), value); + g_debug("After adding an item to our hash"); } } @@ -296,6 +296,10 @@ static void subscribed_events_callback(pa_context *c, enum pa_subscription_event // If a playback client is paused and then resumed this will NOT trigger this event. pa_operation_unref(pa_context_get_sink_input_info(c, index, pulse_sink_input_info_callback, userdata)); break; + case PA_SUBSCRIPTION_EVENT_SERVER: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_SINK ) { + g_debug("server change of some sink type ???"); + } } } diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index b26a90f..02a5605 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -56,13 +56,6 @@ static void slider_menu_item_class_init (SliderMenuItemClass *klass) DbusmenuMenuitemClass * mclass = DBUSMENU_MENUITEM_CLASS(klass); mclass->handle_event = handle_event; -/* signals[VOLUME_CHANGED] = g_signal_new(SLIDER_MENU_ITEM_SIGNAL_VOLUME_CHANGED,*/ -/* G_TYPE_FROM_CLASS(klass),*/ -/* G_SIGNAL_RUN_LAST,*/ -/* G_STRUCT_OFFSET (SliderMenuItemClass, volume_changed),*/ -/* NULL, NULL,*/ -/* g_cclosure_marshal_VOID__DOUBLE,*/ -/* G_TYPE_NONE, 1, G_TYPE_DOUBLE);*/ return; } @@ -102,7 +95,7 @@ SliderMenuItem* slider_menu_item_new(gboolean sinks_available, gdouble start_vol dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_SLIDER_MENUITEM_TYPE); //TODO: If no valid sinks are found grey out the item(s) dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_SENSITIVE, sinks_available); - g_debug("Sending the initial value of the slider over dbus = %f", start_volume * 100); + //g_debug("Sending the initial value of the slider over dbus = %f", start_volume * 100); return self; } diff --git a/src/sound-service.c b/src/sound-service.c index e7341bd..5fe074c 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -117,7 +117,6 @@ void update_pa_state(gboolean pa_state, gboolean sink_available, gboolean sink_m g_value_init(&value, G_TYPE_DOUBLE); g_value_set_double(&value, volume_percent * 100); dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(volume_slider_menuitem), DBUSMENU_SLIDER_MENUITEM_PROP_VOLUME, &value); - } |