aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-02-07 12:53:45 +0000
committerConor Curran <conor.curran@canonical.com>2011-02-07 12:53:45 +0000
commit89ea8fc69cd0b3253d6b5f4ba2d205b41e431a5d (patch)
treec6d4359d2c5f4c79d0be05dede4ccce0e7ed7980
parent373460533ffcd4217b96ed1e95672f7e73141824 (diff)
downloadayatana-indicator-sound-89ea8fc69cd0b3253d6b5f4ba2d205b41e431a5d.tar.gz
ayatana-indicator-sound-89ea8fc69cd0b3253d6b5f4ba2d205b41e431a5d.tar.bz2
ayatana-indicator-sound-89ea8fc69cd0b3253d6b5f4ba2d205b41e431a5d.zip
tidy up
-rw-r--r--src/active-sink.c11
-rw-r--r--src/mute-menu-item.c6
2 files changed, 14 insertions, 3 deletions
diff --git a/src/active-sink.c b/src/active-sink.c
index 762511d..b7954be 100644
--- a/src/active-sink.c
+++ b/src/active-sink.c
@@ -80,6 +80,8 @@ active_sink_init (ActiveSink *self)
// Init our menu items.
priv->mute_menuitem = g_object_new (MUTE_MENU_ITEM_TYPE, NULL);
priv->volume_slider_menuitem = slider_menu_item_new (self);
+ mute_menu_item_enable (priv->mute_menuitem, FALSE);
+ slider_menu_item_enable (priv->volume_slider_menuitem, FALSE);
}
static void
@@ -102,8 +104,7 @@ active_sink_populate (ActiveSink* sink,
priv->name = g_strdup (update->name);
priv->index = update->index;
- // Why the double negative !?
- active_sink_mute_update (sink, !!update->mute);
+ active_sink_mute_update (sink, update->mute);
priv->volume = active_sink_construct_mono_volume (&update->volume);
priv->base_volume = update->base_volume;
priv->channel_map = update->channel_map;
@@ -112,7 +113,9 @@ active_sink_populate (ActiveSink* sink,
gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;
active_sink_volume_update (sink, volume_percent);
- active_sink_mute_update (sink, !!update->mute);
+ active_sink_mute_update (sink, update->mute);
+ mute_menu_item_enable (priv->mute_menuitem, TRUE);
+ slider_menu_item_enable (priv->volume_slider_menuitem, TRUE);
g_debug ("Active sink has been populated - volume %f", volume_percent);
}
@@ -262,6 +265,8 @@ active_sink_deactivate (ActiveSink* self)
priv->current_sound_state = UNAVAILABLE;
sound_service_dbus_update_sound_state (priv->service,
priv->current_sound_state);
+ mute_menu_item_enable (priv->mute_menuitem, FALSE);
+ slider_menu_item_enable (priv->volume_slider_menuitem, FALSE);
priv->index = -1;
g_free(priv->name);
priv->name = NULL;
diff --git a/src/mute-menu-item.c b/src/mute-menu-item.c
index df98d5d..4740ecf 100644
--- a/src/mute-menu-item.c
+++ b/src/mute-menu-item.c
@@ -62,6 +62,9 @@ mute_menu_item_init (MuteMenuItem *self)
g_debug("Building new Mute Menu Item");
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE(self);
priv->button = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set_bool (priv->button,
+ DBUSMENU_MENUITEM_PROP_VISIBLE,
+ TRUE);
g_signal_connect (G_OBJECT (priv->button),
DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
@@ -111,6 +114,9 @@ void
mute_menu_item_enable (MuteMenuItem* item, gboolean active)
{
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE (item);
+ dbusmenu_menuitem_property_set_bool (priv->button,
+ DBUSMENU_MENUITEM_PROP_VISIBLE,
+ TRUE);
dbusmenu_menuitem_property_set_bool (priv->button,
DBUSMENU_MENUITEM_PROP_ENABLED,