aboutsummaryrefslogtreecommitdiff
path: root/src/volume-widget.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-01-14 11:09:26 -0600
committerKen VanDine <ken.vandine@canonical.com>2011-01-14 11:09:26 -0600
commit603ecf78d1f2e897ac60ecf585569c8758fe5d1e (patch)
tree9167ca38ac270c15ebf7be5d51ed56d714c1fdc6 /src/volume-widget.c
parentf4f168553cc7fc9ed09f76c805694abfcad70870 (diff)
parent500000a82b6785e2bf7732ee87f36c6a44d2767c (diff)
downloadayatana-indicator-sound-603ecf78d1f2e897ac60ecf585569c8758fe5d1e.tar.gz
ayatana-indicator-sound-603ecf78d1f2e897ac60ecf585569c8758fe5d1e.tar.bz2
ayatana-indicator-sound-603ecf78d1f2e897ac60ecf585569c8758fe5d1e.zip
releasing version 0.5.6-0ubuntu1
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;
}