aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indicator-sound.c')
-rw-r--r--src/indicator-sound.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index f9e98ed..9c73df4 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -82,6 +82,7 @@ static GtkMenu * get_menu (IndicatorObject * io);
static GtkWidget *volume_slider = NULL;
static gboolean new_slider_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkWidget *widget);
+// Alternative callback mechanism, may use this again once ido is updated.
/*static gboolean user_change_value_event_cb(GtkRange *range, GtkScrollType scroll_type, gdouble input_value, gpointer user_data);*/
static gboolean value_changed_event_cb(GtkRange *range, gpointer user_data);
static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
@@ -99,7 +100,6 @@ static void fetch_mute_value_from_dbus();
static void prepare_state_machine();
static void determine_state_from_volume(gdouble volume_percent);
static void update_state(const gint state);
-/*static void revert_state();*/
static const gint STATE_MUTED = 0;
static const gint STATE_ZERO = 1;
static const gint STATE_LOW = 2;
@@ -265,9 +265,10 @@ static void catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value
//UNMUTE's force a volume update therefore icon is updated appropriately => no need for unmute handling here.
if(mute_value == TRUE)
{
- g_debug("signal caught - sink mute update - MUTE");
update_state(STATE_MUTED);
}
+ g_debug("signal caught - sink mute update with mute value: %i", mute_value);
+ gtk_widget_set_sensitive(volume_slider, !mute_value);
}
@@ -377,8 +378,9 @@ static gboolean new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * p
// register slider changes listening on the range
GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider);
-/* g_signal_connect(slider, "change-value", G_CALLBACK(user_change_value_event_cb), newitem); */
g_signal_connect(slider, "value-changed", G_CALLBACK(value_changed_event_cb), newitem);
+ // alternative callback mechanism which i could use again at some point.
+/* g_signal_connect(slider, "change-value", G_CALLBACK(user_change_value_event_cb), newitem); */
// Set images on the ido
primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)volume_slider);
@@ -430,8 +432,6 @@ key_press_cb:
static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
{
-/* if(event->length > 0)*/
-/* g_debug("The key event's string is '%s'\n", event->string);*/
GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider);
GtkRange* range = (GtkRange*)slider;
gdouble current_value = gtk_range_get_value(range);
@@ -443,41 +443,33 @@ static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer dat
case GDK_Right:
if(event->state & GDK_CONTROL_MASK)
{
-/* g_debug("right key was pressed with ctrl- volume set to 100"); */
new_value = 100;
}
else
{
-/* g_debug("right key was pressed - normal 5 percent increase"); */
new_value = current_value + five_percent;
}
break;
case GDK_Left:
if(event->state & GDK_CONTROL_MASK)
{
-/* g_debug("left key was pressed with ctrl- volume set to 0"); */
new_value = 0;
}
else
{
-/* g_debug("left key was pressed - normal 5 percent decrease"); */
new_value = current_value - five_percent;
}
break;
case GDK_plus:
-/* g_debug("Plus key was pressed");*/
new_value = current_value + five_percent;
break;
case GDK_minus:
-/* g_debug("minus key was pressed");*/
new_value = current_value - five_percent;
break;
default:
break;
}
-/* g_debug("new range value without being clamped = %f", new_value); */
-
new_value = CLAMP(new_value, 0, 100);
if(new_value != current_value)
{