aboutsummaryrefslogtreecommitdiff
path: root/src/slider-menu-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/slider-menu-item.c')
-rw-r--r--src/slider-menu-item.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index 6fd4dbc..31d4774 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -25,10 +25,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "pulse-manager.h"
#include "common-defs.h"
-
typedef struct _SliderMenuItemPrivate SliderMenuItemPrivate;
struct _SliderMenuItemPrivate {
+ ActiveSink* a_sink;
};
#define SLIDER_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SLIDER_MENU_ITEM_TYPE, SliderMenuItemPrivate))
@@ -43,7 +43,8 @@ static void handle_event (DbusmenuMenuitem * mi, const gchar * name,
G_DEFINE_TYPE (SliderMenuItem, slider_menu_item, DBUSMENU_TYPE_MENUITEM);
-static void slider_menu_item_class_init (SliderMenuItemClass *klass)
+static void
+slider_menu_item_class_init (SliderMenuItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -57,7 +58,8 @@ static void slider_menu_item_class_init (SliderMenuItemClass *klass)
return;
}
-static void slider_menu_item_init (SliderMenuItem *self)
+static void
+slider_menu_item_init (SliderMenuItem *self)
{
g_debug("Building new Slider Menu Item");
dbusmenu_menuitem_property_set( DBUSMENU_MENUITEM(self),
@@ -66,7 +68,8 @@ static void slider_menu_item_init (SliderMenuItem *self)
return;
}
-static void slider_menu_item_dispose (GObject *object)
+static void
+slider_menu_item_dispose (GObject *object)
{
G_OBJECT_CLASS (slider_menu_item_parent_class)->dispose (object);
return;
@@ -92,6 +95,12 @@ handle_event (DbusmenuMenuitem * mi,
gboolean volume_input = g_variant_get_double(input);
if (value != NULL){
+ if (IS_SLIDER_MENU_ITEM (mi)) {
+ SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi));
+ active_sink_update_volume (priv->a_sink, volume_input);
+ }
+
+ //active_sink_update_volume (
// TODO - when the ACTIVESINK instance exists this will be handled nicely
// PA MANAGER will be refactored first.
@@ -102,7 +111,8 @@ handle_event (DbusmenuMenuitem * mi,
}
}
-void slider_menu_item_update (SliderMenuItem* item,
+void
+slider_menu_item_update (SliderMenuItem* item,
gdouble update)
{
GVariant* new_volume = g_variant_new_double(update);
@@ -111,7 +121,8 @@ void slider_menu_item_update (SliderMenuItem* item,
new_volume);
}
-void slider_menu_item_enable (SliderMenuItem* item,
+void
+slider_menu_item_enable (SliderMenuItem* item,
gboolean active)
{
dbusmenu_menuitem_property_set_bool( DBUSMENU_MENUITEM(item),
@@ -119,12 +130,11 @@ void slider_menu_item_enable (SliderMenuItem* item,
active );
}
-SliderMenuItem* slider_menu_item_new (gboolean sinks_available,
- gdouble start_volume)
+SliderMenuItem*
+slider_menu_item_new (ActiveSink* sink)
{
SliderMenuItem *self = g_object_new(SLIDER_MENU_ITEM_TYPE, NULL);
- slider_menu_item_update (self, start_volume);
- slider_menu_item_enable (self, sinks_available);
-
+ SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (self);
+ priv->a_sink = sink;
return self;
} \ No newline at end of file