aboutsummaryrefslogtreecommitdiff
path: root/src/slider-menu-item.c
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2011-01-27 16:42:03 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2011-01-27 16:42:03 +0100
commit74888f5ce08b9f89ac0d62c8664a26628f098765 (patch)
treecd39c3c2752166e210666ec88e7cc85668d4e000 /src/slider-menu-item.c
parentb0babf1fab9b3e74f32de4635dd9eed78cccfc62 (diff)
parent1529af0e1224f04616054095742b698d8814cec4 (diff)
downloadayatana-indicator-sound-74888f5ce08b9f89ac0d62c8664a26628f098765.tar.gz
ayatana-indicator-sound-74888f5ce08b9f89ac0d62c8664a26628f098765.tar.bz2
ayatana-indicator-sound-74888f5ce08b9f89ac0d62c8664a26628f098765.zip
Merge against new HEAD
Diffstat (limited to 'src/slider-menu-item.c')
-rw-r--r--src/slider-menu-item.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index 0f2f07b..64db277 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -29,7 +29,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
typedef struct _SliderMenuItemPrivate SliderMenuItemPrivate;
struct _SliderMenuItemPrivate {
- gdouble slider_value;
};
#define SLIDER_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SLIDER_MENU_ITEM_TYPE, SliderMenuItemPrivate))
@@ -76,45 +75,56 @@ slider_menu_item_finalize (GObject *object)
G_OBJECT_CLASS (slider_menu_item_parent_class)->finalize (object);
}
-
static void
handle_event (DbusmenuMenuitem * mi,
const gchar * name,
GVariant * value,
guint timestamp)
{
- gdouble volume_input = 0;
/*g_debug ( "handle-event in the slider at the backend, input is of type %s",
g_variant_get_type_string(value));*/
GVariant* input = NULL;
input = value;
- g_variant_ref (input);
-
// Please note: Subject to change in future DBusmenu revisions
if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT) == TRUE) {
input = g_variant_get_variant(value);
}
- volume_input = g_variant_get_double(input);
+ gboolean volume_input = g_variant_get_double(input);
if (value != NULL){
set_sink_volume(volume_input);
}
- g_variant_unref (input);
}
+void slider_menu_item_update (SliderMenuItem* item,
+ gdouble update)
+{
+ // TODO
+ // Check if that variant below will leak !!!
+ GVariant* new_volume = g_variant_new_double(update);
+ dbusmenu_menuitem_property_set_variant(DBUSMENU_MENUITEM(item),
+ DBUSMENU_VOLUME_MENUITEM_LEVEL,
+ new_volume);
+}
+void slider_menu_item_enable (SliderMenuItem* item,
+ gboolean active)
+{
+ dbusmenu_menuitem_property_set_bool( DBUSMENU_MENUITEM(item),
+ DBUSMENU_MENUITEM_PROP_ENABLED,
+ active );
+}
-SliderMenuItem* slider_menu_item_new(gboolean sinks_available, gdouble start_volume)
+SliderMenuItem* slider_menu_item_new (gboolean sinks_available,
+ gdouble start_volume)
{
SliderMenuItem *self = g_object_new(SLIDER_MENU_ITEM_TYPE, NULL);
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_VOLUME_MENUITEM_TYPE);
+ dbusmenu_menuitem_property_set( DBUSMENU_MENUITEM(self),
+ DBUSMENU_MENUITEM_PROP_TYPE,
+ DBUSMENU_VOLUME_MENUITEM_TYPE );
+ slider_menu_item_update (self, start_volume);
+ slider_menu_item_enable (self, sinks_available);
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ENABLED, sinks_available);
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, sinks_available);
return self;
-}
-
-
-
-
+} \ No newline at end of file