aboutsummaryrefslogtreecommitdiff
path: root/src/volume-widget.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-01-11 12:12:30 -0600
committerConor Curran <conor.curran@canonical.com>2011-01-11 12:12:30 -0600
commitd8da7cdced255ac430caa78b9e6d24d9476e76d8 (patch)
tree376066b4c491b77c72f3073918eec7cca8be8e65 /src/volume-widget.c
parent714c7c49776e8a341254a3e4297b465d181206cd (diff)
parent259057b02fe5c6b777a438331defa2dda628dfd2 (diff)
downloadayatana-indicator-sound-d8da7cdced255ac430caa78b9e6d24d9476e76d8.tar.gz
ayatana-indicator-sound-d8da7cdced255ac430caa78b9e6d24d9476e76d8.tar.bz2
ayatana-indicator-sound-d8da7cdced255ac430caa78b9e6d24d9476e76d8.zip
merged the dreaded gdbus port
Diffstat (limited to 'src/volume-widget.c')
-rw-r--r--src/volume-widget.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/volume-widget.c b/src/volume-widget.c
index c37f9c7..38dc9bb 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "volume-widget.h"
#include "common-defs.h"
#include <libido/idoscalemenuitem.h>
+#include "indicator-sound.h"
typedef struct _VolumeWidgetPrivate VolumeWidgetPrivate;
@@ -48,7 +49,7 @@ static void volume_widget_finalize (GObject *object);
static void volume_widget_set_twin_item( VolumeWidget* self,
DbusmenuMenuitem* twin_item);
static void volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
- GValue* value, gpointer userdata);
+ GVariant* value, gpointer userdata );
static gboolean volume_widget_change_value_cb (GtkRange *range,
GtkScrollType scroll,
@@ -122,8 +123,8 @@ volume_widget_finalize (GObject *object)
}
static void
-volume_widget_property_update(DbusmenuMenuitem* item, gchar* property,
- GValue* value, gpointer userdata)
+volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
+ GVariant* value, gpointer userdata)
{
g_return_if_fail (IS_VOLUME_WIDGET (userdata));
VolumeWidget* mitem = VOLUME_WIDGET(userdata);
@@ -133,10 +134,10 @@ volume_widget_property_update(DbusmenuMenuitem* item, gchar* property,
if(priv->grabbed == FALSE){
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
- gdouble update = g_value_get_double (value);
+ gdouble update = g_variant_get_double (value);
//g_debug("volume-widget - update level with value %f", update);
gtk_range_set_value(range, update);
- determine_state_from_volume(update);
+ determine_state_from_volume(update);
}
}
}
@@ -150,8 +151,8 @@ volume_widget_set_twin_item(VolumeWidget* self,
g_object_ref(priv->twin_item);
g_signal_connect(G_OBJECT(twin_item), "property-changed",
G_CALLBACK(volume_widget_property_update), self);
- gdouble initial_level = g_value_get_double (dbusmenu_menuitem_property_get_value(twin_item,
- DBUSMENU_VOLUME_MENUITEM_LEVEL));
+ gdouble initial_level = g_variant_get_double (dbusmenu_menuitem_property_get_variant(twin_item,
+ DBUSMENU_VOLUME_MENUITEM_LEVEL));
//g_debug("volume_widget_set_twin_item initial level = %f", initial_level);
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
@@ -195,11 +196,9 @@ void
volume_widget_update(VolumeWidget* self, gdouble update)
{
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
- GValue value = {0};
- g_value_init(&value, G_TYPE_DOUBLE);
gdouble clamped = CLAMP(update, 0, 100);
- g_value_set_double(&value, clamped);
- dbusmenu_menuitem_handle_event (priv->twin_item, "update", &value, 0);
+ GVariant* new_volume = g_variant_new_double(clamped);
+ dbusmenu_menuitem_handle_event (priv->twin_item, "update", new_volume, 0);
}
GtkWidget*
@@ -246,8 +245,8 @@ volume_widget_get_current_volume ( GtkWidget *widget )
{
VolumeWidget* mitem = VOLUME_WIDGET(widget);
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- gdouble vol = g_value_get_double ( dbusmenu_menuitem_property_get_value( priv->twin_item,
- DBUSMENU_VOLUME_MENUITEM_LEVEL));
+ gdouble vol = g_variant_get_double( dbusmenu_menuitem_property_get_variant( priv->twin_item,
+ DBUSMENU_VOLUME_MENUITEM_LEVEL));
return vol;
}