aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common-defs.h3
-rw-r--r--src/slider-menu-item.c12
-rw-r--r--src/sound-service.c2
-rw-r--r--src/voip-input-widget.c2
-rw-r--r--src/volume-widget.c30
5 files changed, 43 insertions, 6 deletions
diff --git a/src/common-defs.h b/src/common-defs.h
index da504de..21aab60 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -45,12 +45,13 @@ typedef enum {
TRANSPORT_STATE_PAUSED
}TransportState;
-#define NOT_ACTIVE -1
+#define NOT_ACTIVE -1
#define DBUSMENU_PROPERTY_EMPTY -1
/* DBUS Custom Items */
#define DBUSMENU_VOLUME_MENUITEM_TYPE "x-canonical-ido-volume-type"
#define DBUSMENU_VOLUME_MENUITEM_LEVEL "x-canonical-ido-volume-level"
+#define DBUSMENU_VOLUME_MENUITEM_MUTE "x-canonical-ido-volume-mute"
#define DBUSMENU_VOIP_INPUT_MENUITEM_TYPE "x-canonical-ido-voip-input-type"
#define DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL "x-canonical-ido-voip-input-level"
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index fb66563..9551b4b 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -28,9 +28,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
typedef struct _SliderMenuItemPrivate SliderMenuItemPrivate;
struct _SliderMenuItemPrivate {
- Device* a_sink;
+ Device* a_sink;
gint index;
gchar* name;
+ gboolean mute;
pa_cvolume volume;
pa_channel_map channel_map;
pa_volume_t base_volume;
@@ -127,6 +128,7 @@ slider_menu_item_populate (SliderMenuItem* self, const pa_sink_info* update)
priv->volume = slider_menu_item_construct_mono_volume (&update->volume);
priv->base_volume = update->base_volume;
priv->channel_map = update->channel_map;
+ priv->mute = update->mute;
pa_volume_t vol = pa_cvolume_max (&update->volume);
gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;
@@ -170,6 +172,14 @@ slider_menu_item_update (SliderMenuItem* self, const pa_sink_info* update)
dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),
DBUSMENU_VOLUME_MENUITEM_LEVEL,
new_volume);
+ if (priv->mute != update->mute){
+ priv->mute = update->mute;
+ g_debug ("volume menu item - update - mute = %i", update->mute);
+ GVariant* new_mute_update = g_variant_new_int32 (update->mute);
+ dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),
+ DBUSMENU_VOLUME_MENUITEM_MUTE,
+ new_mute_update);
+ }
}
/*
diff --git a/src/sound-service.c b/src/sound-service.c
index cfc0b7e..9f44624 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -39,8 +39,10 @@ service_shutdown (IndicatorService *service, gpointer user_data)
{
if (mainloop != NULL) {
g_debug("Service shutdown !");
+/*
close_pulse_activites();
g_main_loop_quit(mainloop);
+*/
}
return;
}
diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c
index fc295ce..aec0c96 100644
--- a/src/voip-input-widget.c
+++ b/src/voip-input-widget.c
@@ -95,7 +95,7 @@ voip_input_widget_init (VoipInputWidget *self)
g_signal_connect(priv->ido_voip_input_slider, "slider-released", G_CALLBACK(voip_input_widget_slider_released), self);
GtkWidget* primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)priv->ido_voip_input_slider);
- GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-none-panel");
+ GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-zero-panel");
gtk_image_set_from_gicon(GTK_IMAGE(primary_image), primary_gicon, GTK_ICON_SIZE_MENU);
g_object_unref(primary_gicon);
diff --git a/src/volume-widget.c b/src/volume-widget.c
index 5c842dc..c947669 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -128,11 +128,11 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
GVariant* value, gpointer userdata)
{
g_return_if_fail (IS_VOLUME_WIDGET (userdata));
- g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
VolumeWidget* mitem = VOLUME_WIDGET(userdata);
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- //g_debug("scrub-widget::property_update for prop %s", property);
+
if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){
+ g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
if(priv->grabbed == FALSE){
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
@@ -141,6 +141,27 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
update_accessible_desc(priv->indicator);
}
}
+ if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_MUTE, property) == 0){
+ g_debug ("volume widget - mute update ");
+ if(priv->grabbed == FALSE){
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+ GtkRange *range = (GtkRange*)slider;
+ gint update = g_variant_get_int32 (value);
+ gdouble level;
+
+ g_debug ("volume widget - mute update %i", update);
+
+ if (update == 1){
+ level = 0;
+ }
+ else{
+ level = g_variant_get_double (dbusmenu_menuitem_property_get_variant (priv->twin_item,
+ DBUSMENU_VOLUME_MENUITEM_LEVEL));
+ }
+ gtk_range_set_value(range, level);
+ g_debug ("volume-widget - update mute with value %i", update);
+ }
+ }
}
static void
@@ -188,7 +209,10 @@ volume_widget_value_changed_cb (GtkRange *range, gpointer user_data)
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100);
//g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider)));
- if(current_value == 0 || current_value == 100){
+ gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item,
+ DBUSMENU_VOLUME_MENUITEM_MUTE));
+
+ if((current_value == 0 && mute != 1) || current_value == 100){
volume_widget_update(mitem, current_value);
}