diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common-defs.h | 3 | ||||
-rw-r--r-- | src/indicator-sound.c | 4 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 14 | ||||
-rw-r--r-- | src/mpris2-watcher.vala | 2 | ||||
-rw-r--r-- | src/player-controller.vala | 28 | ||||
-rw-r--r-- | src/player-item.vala | 4 | ||||
-rw-r--r-- | src/slider-menu-item.c | 38 | ||||
-rw-r--r-- | src/transport-menu-item.vala | 56 | ||||
-rw-r--r-- | src/transport-widget.c | 108 | ||||
-rw-r--r-- | src/voip-input-widget.c | 4 | ||||
-rw-r--r-- | src/volume-widget.c | 36 | ||||
-rw-r--r-- | src/volume-widget.h | 2 |
12 files changed, 234 insertions, 65 deletions
diff --git a/src/common-defs.h b/src/common-defs.h index 68cb0b8..b118d4b 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -45,7 +45,8 @@ typedef enum { typedef enum { TRANSPORT_STATE_PLAYING, - TRANSPORT_STATE_PAUSED + TRANSPORT_STATE_PAUSED, + TRANSPORT_STATE_LAUNCHING }TransportState; #define NOT_ACTIVE -1 diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 7d74a42..042bf89 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -539,7 +539,7 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) voip_input_widget_update (VOIP_INPUT_WIDGET(priv->voip_widget), new_value); } else{ - volume_widget_update (VOLUME_WIDGET(priv->volume_widget), new_value); + volume_widget_update (VOLUME_WIDGET(priv->volume_widget), new_value, "keypress-update"); } } } @@ -660,7 +660,7 @@ indicator_sound_scroll (IndicatorObject *io, gint delta, value -= adj->step_increment; } //g_debug("indicator-sound-scroll - update slider with value %f", value); - volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value); + volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value, "scroll updates"); sound_state_manager_show_notification (priv->state_manager, value); } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 6129458..94c52c0 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -127,10 +127,10 @@ public class Mpris2Controller : GLib.Object Variant? artist_v = this.player.Metadata.lookup("xesam:artist"); if(artist_v != null){ Variant? v_artists = this.player.Metadata.lookup("xesam:artist"); - debug("artists is of type %s", v_artists.get_type_string ()); + //debug("artists is of type %s", v_artists.get_type_string ()); string display_artists; if(v_artists.get_type_string() == "s"){ - debug("SPOTIFY is that you ?"); + //debug("SPOTIFY is that you ?"); display_artists = v_artists.get_string(); } else{ @@ -138,7 +138,7 @@ public class Mpris2Controller : GLib.Object display_artists = string.joinv(", ", artists); } changed_updates.replace("xesam:artist", display_artists); - debug("artist : %s", (string)changed_updates.lookup("xesam:artist")); + //debug("artist : %s", (string)changed_updates.lookup("xesam:artist")); } return changed_updates; } @@ -226,12 +226,12 @@ public class Mpris2Controller : GLib.Object false); } catch (IOError e){ - debug("Could not fetch playlists because %s", e.message); + //debug("Could not fetch playlists because %s", e.message); return; } if( current_playlists != null ){ - debug( "Size of the playlist array = %i", current_playlists.length ); + //debug( "Size of the playlist array = %i", current_playlists.length ); PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem; playlists_item.update(current_playlists); } @@ -244,7 +244,7 @@ public class Mpris2Controller : GLib.Object private bool fetch_active_playlist() { if (this.playlists.ActivePlaylist.valid == false){ - debug(" We don't have an active playlist"); + //debug(" We don't have an active playlist"); } PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem; playlists_item.active_playlist_update ( this.playlists.ActivePlaylist.details ); @@ -257,7 +257,7 @@ public class Mpris2Controller : GLib.Object this.playlists.ActivatePlaylist.begin(path); } catch(IOError e){ - debug("Could not activate playlist %s because %s", (string)path, e.message); + //debug("Could not activate playlist %s because %s", (string)path, e.message); } } } diff --git a/src/mpris2-watcher.vala b/src/mpris2-watcher.vala index 0b37506..d508959 100644 --- a/src/mpris2-watcher.vala +++ b/src/mpris2-watcher.vala @@ -168,4 +168,4 @@ public class Mpris2Watcher : GLib.Object delete xml_doc; return result; } -}
\ No newline at end of file +} diff --git a/src/player-controller.vala b/src/player-controller.vala index 3ce121e..20479d9 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -133,7 +133,8 @@ public class PlayerController : GLib.Object public void hibernate() { update_state(PlayerController.state.OFFLINE); - this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format()); + TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem; + transport.change_play_state (Transport.State.PAUSED); this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem; title.toggle_active_triangle(false); @@ -143,20 +144,25 @@ public class PlayerController : GLib.Object public void update_layout() { PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem; - if(this.current_state != state.CONNECTED){ - this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, + this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE, false); - this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, - false); - playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE, - false ); + playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, + false ); + this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, + this.app_info.get_id() == "banshee.desktop"); return; } - this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, - this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); - this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, - true); + this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE, + this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); + if (this.app_info.get_id() == "banshee.desktop"){ + TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem; + transport.handle_cached_action(); + } + else{ + this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, + true); + } playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE, this.use_playlists ); } diff --git a/src/player-item.vala b/src/player-item.vala index 9d07bf7..f71b166 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -37,7 +37,7 @@ public class PlayerItem : Dbusmenu.Menuitem public void reset(HashSet<string> attrs){ foreach(string s in attrs){ - debug("attempting to set prop %s to EMPTY", s); + //debug("attempting to set prop %s to EMPTY", s); this.property_set_int(s, EMPTY); } } @@ -50,7 +50,7 @@ public class PlayerItem : Dbusmenu.Menuitem */ public void update(HashTable<string, Variant?> data, HashSet<string> attributes) { - debug("PlayerItem::update()"); + //debug("PlayerItem::update()"); if(data == null){ warning("PlayerItem::Update -> The hashtable was null - just leave it!"); return; diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index 974749f..d7d08fb 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -69,7 +69,9 @@ slider_menu_item_class_init (SliderMenuItemClass *klass) static void slider_menu_item_init (SliderMenuItem *self) { +/* g_debug("Building new Slider Menu Item"); +*/ dbusmenu_menuitem_property_set( DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_VOLUME_MENUITEM_TYPE ); @@ -101,21 +103,18 @@ handle_event (DbusmenuMenuitem * mi, GVariant * value, guint timestamp) { - GVariant* input = NULL; - input = value; - if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT) == TRUE) { - input = g_variant_get_variant(value); - } + g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE)); + g_return_if_fail (IS_SLIDER_MENU_ITEM (mi)); - if (value != NULL){ - if (IS_SLIDER_MENU_ITEM (mi)) { - SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi)); - gdouble volume_input = g_variant_get_double(input); - //g_debug ("slider menu item about to update volume %f", volume_input); - slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input); - device_ensure_sink_is_unmuted (priv->a_sink); - } - } + SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi)); + gdouble volume_input = g_variant_get_double (value); +/* + g_debug ("slider menu item handle event with value %f on name %s", + volume_input, + name); +*/ + slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input); + device_ensure_sink_is_unmuted (priv->a_sink); } @@ -148,6 +147,10 @@ slider_menu_item_populate (SliderMenuItem* self, const pa_sink_info* update) static void slider_menu_item_update_volume (SliderMenuItem* self, gdouble percent) { +/* + g_debug ("slider menu item update volume - about to set the volume to %f", percent); +*/ + pa_cvolume new_volume; pa_cvolume_init(&new_volume); new_volume.channels = 1; @@ -174,12 +177,17 @@ slider_menu_item_update (SliderMenuItem* self, const pa_sink_info* update) gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; GVariant* new_volume = g_variant_new_double (volume_percent); +/* + g_debug ("slider menu item update - volume update to ui to %f", volume_percent); +*/ dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self), DBUSMENU_VOLUME_MENUITEM_LEVEL, new_volume); if (priv->mute != update->mute){ priv->mute = update->mute; - g_debug ("volume menu item - update - mute = %i", update->mute); +/* + g_debug ("volume menu item - update - mute on ui = %i", update->mute); +*/ GVariant* new_mute_update = g_variant_new_int32 (update->mute); dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self), DBUSMENU_VOLUME_MENUITEM_MUTE, diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 67e9562..ec41dd7 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -23,18 +23,44 @@ using DbusmenuTransport; using Transport; public class TransportMenuitem : PlayerItem -{ - +{ + private Transport.Action cached_action; + + private bool running { + get{ + return this.owner.current_state == PlayerController.state.CONNECTED; + } + } + public TransportMenuitem(PlayerController parent) { Object(item_type: MENUITEM_TYPE, owner: parent); - this.property_set_int(MENUITEM_PLAY_STATE, 1); + } + construct{ + this.property_set_int(MENUITEM_PLAY_STATE, (int)Transport.State.PAUSED); + this.cached_action = Transport.Action.NO_ACTION; + } + + /** + Please remove this timeout when the default player can handle mpris commands + immediately once it raises its dbus interface + **/ + public void handle_cached_action() + { + if (this.cached_action != Transport.Action.NO_ACTION){ + Timeout.add_seconds (1, send_cached_action); + } + } + + private bool send_cached_action() + { + this.owner.mpris_bridge.transport_update(this.cached_action); + this.cached_action = Transport.Action.NO_ACTION; + return false; } - public void change_play_state(Transport.State update) + public void change_play_state (Transport.State update) { - //debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i", - // (int)update); int temp = (int)update; this.property_set_int(MENUITEM_PLAY_STATE, temp); } @@ -43,17 +69,21 @@ public class TransportMenuitem : PlayerItem Variant input_value, uint timestamp) { - /*debug ( "Handle event in transport menu item - input variant is of type %s", - input_value.get_type_string() );*/ Variant v = input_value; - if ( input_value.is_of_type ( VariantType.VARIANT) ){ + if ( input_value.is_of_type (VariantType.VARIANT)){ v = input_value.get_variant(); } int32 input = v.get_int32(); - //debug("transport menu item -> handle_event with value %s", input.to_string()); - //debug("transport owner name = %s", this.owner.app_info.get_name()); - this.owner.mpris_bridge.transport_update((Transport.Action)input); + + if (this.running == true){ + this.owner.mpris_bridge.transport_update((Transport.Action)input); + } + else{ + this.cached_action = (Transport.Action)input; + this.owner.instantiate(); + this.property_set_int (MENUITEM_PLAY_STATE, (int)Transport.State.LAUNCHING); + } } public static HashSet<string> attributes_format() @@ -63,4 +93,4 @@ public class TransportMenuitem : PlayerItem return attrs; } -}
\ No newline at end of file +} diff --git a/src/transport-widget.c b/src/transport-widget.c index ef2916d..f05c4c1 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -85,6 +85,9 @@ struct _TransportWidgetPrivate gboolean has_focus; gint hold_timer; gint skip_frequency; + gint launching_timer; + gdouble launching_transparency; + gboolean fade_out; }; // TODO refactor the UI handlers, consolidate functionality between key press /release @@ -136,6 +139,7 @@ static TransportAction transport_widget_collision_detection (gint x, gint y); static void transport_widget_start_timing (TransportWidget* widget); static gboolean transport_widget_trigger_seek (gpointer userdata); static gboolean transport_widget_seek (gpointer userdata); +static gboolean transport_widget_fade_playbutton (gpointer userdata); /// Init functions ////////////////////////////////////////////////////////// @@ -168,6 +172,9 @@ transport_widget_init (TransportWidget *self) priv->has_focus = FALSE; priv->hold_timer = 0; priv->skip_frequency = 0; + priv->launching_timer = 0; + priv->launching_transparency = 1.0f; + priv->fade_out = TRUE; priv->command_coordinates = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, @@ -1733,6 +1740,61 @@ draw (GtkWidget* button, cairo_t *cr) FALSE); _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y); } + else if(priv->current_state == TRANSPORT_STATE_LAUNCHING) + { +/* + g_debug ("launching in draw"); +*/ + _setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6); + _mask_play (cr_surf, + PLAY_PADDING, + PLAY_PADDING, + PLAY_WIDTH - (2*PLAY_PADDING), + PLAY_HEIGHT - (2*PLAY_PADDING)); + + double BUTTON_SHADOW_LAUNCHING[] = {color_button[3].r, + color_button[3].g, + color_button[3].b, + priv->launching_transparency}; + double BUTTON_LAUNCHING_END[] = {color_button[0].r, + color_button[0].g, + color_button[0].b, + priv->launching_transparency}; + double BUTTON_LAUNCHING_START[] = {color_button[1].r, + color_button[1].g, + color_button[1].b, + priv->launching_transparency}; + _fill (cr_surf, + PLAY_PADDING, + PLAY_PADDING, + PLAY_WIDTH - (2*PLAY_PADDING), + PLAY_HEIGHT - (2*PLAY_PADDING), + BUTTON_SHADOW_LAUNCHING, + BUTTON_SHADOW_LAUNCHING, + FALSE); + _surface_blur (surf, 3); + _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y + 0.5f, 3); + + // draw play-button + _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT); + cairo_set_line_width (cr, 10.5); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); + cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND); + _mask_play (cr_surf, + PLAY_PADDING, + PLAY_PADDING, + PLAY_WIDTH - (2*PLAY_PADDING), + PLAY_HEIGHT - (2*PLAY_PADDING)); + _fill (cr_surf, + PLAY_PADDING, + PLAY_PADDING, + PLAY_WIDTH - (2*PLAY_PADDING), + PLAY_HEIGHT - (2*PLAY_PADDING), + BUTTON_LAUNCHING_START, + BUTTON_LAUNCHING_END, + FALSE); + _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y); + } } static void @@ -1750,6 +1812,30 @@ transport_widget_set_twin_item(TransportWidget* self, (TransportState)initial_state); } +static gboolean +transport_widget_fade_playbutton (gpointer userdata) +{ + TransportWidget* bar = (TransportWidget*)userdata; + g_return_val_if_fail(IS_TRANSPORT_WIDGET(bar), FALSE); +/* + g_debug ("fade in /out timeout"); +*/ + TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); + if (priv->launching_transparency == 1.0f){ + priv->fade_out = TRUE; + } + else if (priv->launching_transparency <= 0.3F){ + priv->fade_out = FALSE; + } + if (priv->fade_out == TRUE){ + priv->launching_transparency -= 0.05f; + } + else{ + priv->launching_transparency += 0.05f; + } + gtk_widget_queue_draw (GTK_WIDGET(bar)); + return TRUE; +} /** * transport_widget_update_state() * Callback for updates from the other side of dbus @@ -1761,12 +1847,28 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, //g_debug("transport_widget_update_state - with property %s", property); TransportWidget* bar = (TransportWidget*)userdata; g_return_if_fail(IS_TRANSPORT_WIDGET(bar)); + TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); if(g_ascii_strcasecmp(DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, property) == 0) { - int update_value = g_variant_get_int32(value); - //g_debug("transport_widget_update_state - with value %i", update_value); - transport_widget_toggle_play_pause(bar, (TransportState)update_value); + TransportState new_state = (TransportState)g_variant_get_int32(value); + //g_debug("transport_widget_update_state - with value %i", update_value); + if (new_state == TRANSPORT_STATE_LAUNCHING){ + priv->current_state = TRANSPORT_STATE_LAUNCHING; + priv->launching_timer = g_timeout_add (100, + transport_widget_fade_playbutton, + bar); + //g_debug("TransportWidget::toggle play state : %i", priv->current_state); + } + else{ + if (priv->launching_timer != 0){ + g_source_remove (priv->launching_timer); + priv->launching_timer = 0; + priv->fade_out = TRUE; + priv->launching_transparency = 1.0f; + } + transport_widget_toggle_play_pause(bar, new_state); + } } } diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c index 6878361..dcf858e 100644 --- a/src/voip-input-widget.c +++ b/src/voip-input-widget.c @@ -129,9 +129,9 @@ voip_input_widget_property_update (DbusmenuMenuitem* item, gchar* property, g_return_if_fail (IS_VOIP_INPUT_WIDGET (userdata)); VoipInputWidget* mitem = VOIP_INPUT_WIDGET(userdata); VoipInputWidgetPrivate * priv = VOIP_INPUT_WIDGET_GET_PRIVATE(mitem); - //g_debug("scrub-widget::property_update for prop %s", property); if(g_ascii_strcasecmp(DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL, property) == 0){ - if(priv->grabbed == FALSE){ + g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE)); + if (priv->grabbed == FALSE){ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_voip_input_slider); GtkRange *range = (GtkRange*)slider; gdouble update = g_variant_get_double (value); diff --git a/src/volume-widget.c b/src/volume-widget.c index f638bd4..a54441c 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -131,26 +131,33 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, g_return_if_fail (IS_VOLUME_WIDGET (userdata)); VolumeWidget* mitem = VOLUME_WIDGET(userdata); VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); - if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){ g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) ); if(priv->grabbed == FALSE){ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); GtkRange *range = (GtkRange*)slider; gdouble update = g_variant_get_double (value); +/* + g_debug ("volume widget volume prop update with %f", update); +*/ gtk_range_set_value(range, update); update_accessible_desc(priv->indicator); } } if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_MUTE, property) == 0){ +/* g_debug ("volume widget - mute update "); +*/ + g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32) ); if(priv->grabbed == FALSE){ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); GtkRange *range = (GtkRange*)slider; gint update = g_variant_get_int32 (value); gdouble level; +/* g_debug ("volume widget - mute update %i", update); +*/ if (update == 1){ level = 0; @@ -160,7 +167,9 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, DBUSMENU_VOLUME_MENUITEM_LEVEL)); } gtk_range_set_value(range, level); +/* g_debug ("volume-widget - update mute with value %i", update); +*/ } } } @@ -197,8 +206,10 @@ volume_widget_change_value_cb (GtkRange *range, { g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE); VolumeWidget* mitem = VOLUME_WIDGET(user_data); - //g_debug ("changed value %f", new_value); - volume_widget_update(mitem, new_value); +/* + g_debug ("changed value %f", new_value); +*/ + volume_widget_update(mitem, new_value, "change-value"); return FALSE; } @@ -215,24 +226,35 @@ volume_widget_value_changed_cb (GtkRange *range, gpointer user_data) VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100); - //g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider))); +/* + g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider))); +*/ + gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item, DBUSMENU_VOLUME_MENUITEM_MUTE)); if((current_value == 0 && mute != 1) || current_value == 100){ - volume_widget_update(mitem, current_value); +/* + g_debug ("value changed - actual set %f", current_value); +*/ + volume_widget_update(mitem, current_value, "value-changed"); } return FALSE; } void -volume_widget_update(VolumeWidget* self, gdouble update) +volume_widget_update(VolumeWidget* self, gdouble update, gchar* label) { + gchar* source = NULL; + source = label; + if (label == NULL){ + source = "v widget update"; + } VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); gdouble clamped = CLAMP(update, 0, 100); GVariant* new_volume = g_variant_new_double(clamped); - dbusmenu_menuitem_handle_event (priv->twin_item, "update", new_volume, 0); + dbusmenu_menuitem_handle_event (priv->twin_item, source, new_volume, 0); } GtkWidget* diff --git a/src/volume-widget.h b/src/volume-widget.h index 50ef377..7012473 100644 --- a/src/volume-widget.h +++ b/src/volume-widget.h @@ -47,7 +47,7 @@ struct _VolumeWidget { GType volume_widget_get_type (void) G_GNUC_CONST; GtkWidget* volume_widget_new(DbusmenuMenuitem *item, IndicatorObject* io); GtkWidget* volume_widget_get_ido_slider(VolumeWidget* self); -void volume_widget_update(VolumeWidget* self, gdouble update); +void volume_widget_update(VolumeWidget* self, gdouble update, gchar* label); void volume_widget_tidy_up (GtkWidget *widget); gdouble volume_widget_get_current_volume ( GtkWidget *widget ); |