Merge lp:~cjcurran/indicator-sound/banshee-offline-speciality into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Conor Curran
Status: Merged
Merged at revision: 227
Proposed branch: lp:~cjcurran/indicator-sound/banshee-offline-speciality
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 654 lines (+241/-70)
13 files modified
src/common-defs.h (+2/-1)
src/indicator-sound.c (+2/-2)
src/mpris2-controller.vala (+7/-7)
src/mpris2-watcher.vala (+1/-1)
src/player-controller.vala (+17/-11)
src/player-item.vala (+2/-2)
src/slider-menu-item.c (+23/-15)
src/transport-menu-item.vala (+46/-16)
src/transport-widget.c (+105/-3)
src/voip-input-widget.c (+2/-2)
src/volume-widget.c (+29/-7)
src/volume-widget.h (+1/-1)
vapi/common-defs.vapi (+4/-2)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/banshee-offline-speciality
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+54221@code.launchpad.net

This proposal supersedes a proposal from 2011-03-21.

Description of the change

Fixes bug attached. Mpt would like me to merge this feature. implementation is ideal but at least it is step in the right direction in order to deliver this user experience. I suspect the next issue will be for the clients to ensure that once their mpris interface is raised they must be able to accept mpris commands. This will ensure that the 1 second timeout which can found in this merge request can be removed

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Yeah, less that ideal. Could you put a TODO to that effect in the code so people coming after us reading it will understand why it is there, and that it should be eventually removed?

review: Approve
Revision history for this message
Conor Curran (cjcurran) wrote :

will do

230. By Conor Curran

add an important todo to remind myself of the need to get that timeout removed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/common-defs.h'
--- src/common-defs.h 2011-03-17 16:10:03 +0000
+++ src/common-defs.h 2011-03-21 15:53:27 +0000
@@ -45,7 +45,8 @@
4545
46typedef enum {46typedef enum {
47 TRANSPORT_STATE_PLAYING,47 TRANSPORT_STATE_PLAYING,
48 TRANSPORT_STATE_PAUSED48 TRANSPORT_STATE_PAUSED,
49 TRANSPORT_STATE_LAUNCHING
49}TransportState;50}TransportState;
5051
51#define NOT_ACTIVE -152#define NOT_ACTIVE -1
5253
=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c 2011-03-16 12:38:04 +0000
+++ src/indicator-sound.c 2011-03-21 15:53:27 +0000
@@ -539,7 +539,7 @@
539 voip_input_widget_update (VOIP_INPUT_WIDGET(priv->voip_widget), new_value);539 voip_input_widget_update (VOIP_INPUT_WIDGET(priv->voip_widget), new_value);
540 }540 }
541 else{541 else{
542 volume_widget_update (VOLUME_WIDGET(priv->volume_widget), new_value);542 volume_widget_update (VOLUME_WIDGET(priv->volume_widget), new_value, "keypress-update");
543 }543 }
544 }544 }
545 }545 }
@@ -660,7 +660,7 @@
660 value -= adj->step_increment;660 value -= adj->step_increment;
661 }661 }
662 //g_debug("indicator-sound-scroll - update slider with value %f", value);662 //g_debug("indicator-sound-scroll - update slider with value %f", value);
663 volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value);663 volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value, "scroll updates");
664664
665 sound_state_manager_show_notification (priv->state_manager, value);665 sound_state_manager_show_notification (priv->state_manager, value);
666}666}
667667
=== modified file 'src/mpris2-controller.vala'
--- src/mpris2-controller.vala 2011-03-09 14:17:12 +0000
+++ src/mpris2-controller.vala 2011-03-21 15:53:27 +0000
@@ -127,10 +127,10 @@
127 Variant? artist_v = this.player.Metadata.lookup("xesam:artist");127 Variant? artist_v = this.player.Metadata.lookup("xesam:artist");
128 if(artist_v != null){128 if(artist_v != null){
129 Variant? v_artists = this.player.Metadata.lookup("xesam:artist");129 Variant? v_artists = this.player.Metadata.lookup("xesam:artist");
130 debug("artists is of type %s", v_artists.get_type_string ());130 //debug("artists is of type %s", v_artists.get_type_string ());
131 string display_artists;131 string display_artists;
132 if(v_artists.get_type_string() == "s"){132 if(v_artists.get_type_string() == "s"){
133 debug("SPOTIFY is that you ?");133 //debug("SPOTIFY is that you ?");
134 display_artists = v_artists.get_string();134 display_artists = v_artists.get_string();
135 }135 }
136 else{136 else{
@@ -138,7 +138,7 @@
138 display_artists = string.joinv(", ", artists);138 display_artists = string.joinv(", ", artists);
139 }139 }
140 changed_updates.replace("xesam:artist", display_artists);140 changed_updates.replace("xesam:artist", display_artists);
141 debug("artist : %s", (string)changed_updates.lookup("xesam:artist"));141 //debug("artist : %s", (string)changed_updates.lookup("xesam:artist"));
142 }142 }
143 return changed_updates;143 return changed_updates;
144 }144 }
@@ -226,12 +226,12 @@
226 false);226 false);
227 }227 }
228 catch (IOError e){228 catch (IOError e){
229 debug("Could not fetch playlists because %s", e.message); 229 //debug("Could not fetch playlists because %s", e.message);
230 return;230 return;
231 }231 }
232 232
233 if( current_playlists != null ){233 if( current_playlists != null ){
234 debug( "Size of the playlist array = %i", current_playlists.length );234 //debug( "Size of the playlist array = %i", current_playlists.length );
235 PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;235 PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
236 playlists_item.update(current_playlists);236 playlists_item.update(current_playlists);
237 }237 }
@@ -244,7 +244,7 @@
244 private bool fetch_active_playlist()244 private bool fetch_active_playlist()
245 { 245 {
246 if (this.playlists.ActivePlaylist.valid == false){246 if (this.playlists.ActivePlaylist.valid == false){
247 debug(" We don't have an active playlist");247 //debug(" We don't have an active playlist");
248 } 248 }
249 PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;249 PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
250 playlists_item.active_playlist_update ( this.playlists.ActivePlaylist.details );250 playlists_item.active_playlist_update ( this.playlists.ActivePlaylist.details );
@@ -257,7 +257,7 @@
257 this.playlists.ActivatePlaylist.begin(path);257 this.playlists.ActivatePlaylist.begin(path);
258 }258 }
259 catch(IOError e){259 catch(IOError e){
260 debug("Could not activate playlist %s because %s", (string)path, e.message); 260 //debug("Could not activate playlist %s because %s", (string)path, e.message);
261 }261 }
262 }262 }
263}263}
264264
=== modified file 'src/mpris2-watcher.vala'
--- src/mpris2-watcher.vala 2011-01-31 19:14:47 +0000
+++ src/mpris2-watcher.vala 2011-03-21 15:53:27 +0000
@@ -168,4 +168,4 @@
168 delete xml_doc;168 delete xml_doc;
169 return result;169 return result;
170 } 170 }
171}
172\ No newline at end of file171\ No newline at end of file
172}
173173
=== modified file 'src/player-controller.vala'
--- src/player-controller.vala 2011-02-01 01:33:46 +0000
+++ src/player-controller.vala 2011-03-21 15:53:27 +0000
@@ -133,7 +133,8 @@
133 public void hibernate()133 public void hibernate()
134 {134 {
135 update_state(PlayerController.state.OFFLINE);135 update_state(PlayerController.state.OFFLINE);
136 this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format());136 TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem;
137 transport.change_play_state (Transport.State.PAUSED);
137 this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format());138 this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
138 TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;139 TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;
139 title.toggle_active_triangle(false); 140 title.toggle_active_triangle(false);
@@ -143,20 +144,25 @@
143 public void update_layout()144 public void update_layout()
144 { 145 {
145 PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem;146 PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem;
146
147 if(this.current_state != state.CONNECTED){147 if(this.current_state != state.CONNECTED){
148 this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE,148 this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE,
149 false);149 false);
150 this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE,150 playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE,
151 false);151 false );
152 playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE,152 this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE,
153 false ); 153 this.app_info.get_id() == "banshee.desktop");
154 return; 154 return;
155 }155 }
156 this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE,156 this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE,
157 this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); 157 this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));
158 this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE,158 if (this.app_info.get_id() == "banshee.desktop"){
159 true);159 TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem;
160 transport.handle_cached_action();
161 }
162 else{
163 this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE,
164 true);
165 }
160 playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE,166 playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE,
161 this.use_playlists );167 this.use_playlists );
162 }168 }
163169
=== modified file 'src/player-item.vala'
--- src/player-item.vala 2011-02-17 18:54:58 +0000
+++ src/player-item.vala 2011-03-21 15:53:27 +0000
@@ -37,7 +37,7 @@
3737
38 public void reset(HashSet<string> attrs){ 38 public void reset(HashSet<string> attrs){
39 foreach(string s in attrs){39 foreach(string s in attrs){
40 debug("attempting to set prop %s to EMPTY", s);40 //debug("attempting to set prop %s to EMPTY", s);
41 this.property_set_int(s, EMPTY);41 this.property_set_int(s, EMPTY);
42 }42 }
43 }43 }
@@ -50,7 +50,7 @@
50 */50 */
51 public void update(HashTable<string, Variant?> data, HashSet<string> attributes)51 public void update(HashTable<string, Variant?> data, HashSet<string> attributes)
52 {52 {
53 debug("PlayerItem::update()");53 //debug("PlayerItem::update()");
54 if(data == null){54 if(data == null){
55 warning("PlayerItem::Update -> The hashtable was null - just leave it!");55 warning("PlayerItem::Update -> The hashtable was null - just leave it!");
56 return;56 return;
5757
=== modified file 'src/slider-menu-item.c'
--- src/slider-menu-item.c 2011-03-15 12:46:57 +0000
+++ src/slider-menu-item.c 2011-03-21 15:53:27 +0000
@@ -69,7 +69,9 @@
69static void69static void
70slider_menu_item_init (SliderMenuItem *self)70slider_menu_item_init (SliderMenuItem *self)
71{71{
72/*
72 g_debug("Building new Slider Menu Item");73 g_debug("Building new Slider Menu Item");
74*/
73 dbusmenu_menuitem_property_set( DBUSMENU_MENUITEM(self),75 dbusmenu_menuitem_property_set( DBUSMENU_MENUITEM(self),
74 DBUSMENU_MENUITEM_PROP_TYPE,76 DBUSMENU_MENUITEM_PROP_TYPE,
75 DBUSMENU_VOLUME_MENUITEM_TYPE );77 DBUSMENU_VOLUME_MENUITEM_TYPE );
@@ -101,21 +103,18 @@
101 GVariant * value,103 GVariant * value,
102 guint timestamp)104 guint timestamp)
103{105{
104 GVariant* input = NULL;106 g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE));
105 input = value;107 g_return_if_fail (IS_SLIDER_MENU_ITEM (mi));
106 if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT) == TRUE) {
107 input = g_variant_get_variant(value);
108 }
109108
110 if (value != NULL){109 SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi));
111 if (IS_SLIDER_MENU_ITEM (mi)) {110 gdouble volume_input = g_variant_get_double (value);
112 SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi));111/*
113 gdouble volume_input = g_variant_get_double(input);112 g_debug ("slider menu item handle event with value %f on name %s",
114 //g_debug ("slider menu item about to update volume %f", volume_input);113 volume_input,
115 slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input);114 name);
116 device_ensure_sink_is_unmuted (priv->a_sink);115*/
117 } 116 slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input);
118 }117 device_ensure_sink_is_unmuted (priv->a_sink);
119}118}
120119
121120
@@ -148,6 +147,10 @@
148static void147static void
149slider_menu_item_update_volume (SliderMenuItem* self, gdouble percent)148slider_menu_item_update_volume (SliderMenuItem* self, gdouble percent)
150{149{
150/*
151 g_debug ("slider menu item update volume - about to set the volume to %f", percent);
152*/
153
151 pa_cvolume new_volume;154 pa_cvolume new_volume;
152 pa_cvolume_init(&new_volume);155 pa_cvolume_init(&new_volume);
153 new_volume.channels = 1;156 new_volume.channels = 1;
@@ -174,12 +177,17 @@
174 gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;177 gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;
175178
176 GVariant* new_volume = g_variant_new_double (volume_percent);179 GVariant* new_volume = g_variant_new_double (volume_percent);
180/*
181 g_debug ("slider menu item update - volume update to ui to %f", volume_percent);
182*/
177 dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),183 dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),
178 DBUSMENU_VOLUME_MENUITEM_LEVEL,184 DBUSMENU_VOLUME_MENUITEM_LEVEL,
179 new_volume);185 new_volume);
180 if (priv->mute != update->mute){186 if (priv->mute != update->mute){
181 priv->mute = update->mute;187 priv->mute = update->mute;
182 g_debug ("volume menu item - update - mute = %i", update->mute);188/*
189 g_debug ("volume menu item - update - mute on ui = %i", update->mute);
190*/
183 GVariant* new_mute_update = g_variant_new_int32 (update->mute);191 GVariant* new_mute_update = g_variant_new_int32 (update->mute);
184 dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),192 dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),
185 DBUSMENU_VOLUME_MENUITEM_MUTE,193 DBUSMENU_VOLUME_MENUITEM_MUTE,
186194
=== modified file 'src/transport-menu-item.vala'
--- src/transport-menu-item.vala 2011-03-09 14:17:12 +0000
+++ src/transport-menu-item.vala 2011-03-21 15:53:27 +0000
@@ -23,18 +23,44 @@
23using Transport;23using Transport;
2424
25public class TransportMenuitem : PlayerItem25public class TransportMenuitem : PlayerItem
26{26{
27 27 private Transport.Action cached_action;
28
29 private bool running {
30 get{
31 return this.owner.current_state == PlayerController.state.CONNECTED;
32 }
33 }
34
28 public TransportMenuitem(PlayerController parent)35 public TransportMenuitem(PlayerController parent)
29 {36 {
30 Object(item_type: MENUITEM_TYPE, owner: parent);37 Object(item_type: MENUITEM_TYPE, owner: parent);
31 this.property_set_int(MENUITEM_PLAY_STATE, 1);38 }
32 }39 construct{
3340 this.property_set_int(MENUITEM_PLAY_STATE, (int)Transport.State.PAUSED);
34 public void change_play_state(Transport.State update)41 this.cached_action = Transport.Action.NO_ACTION;
35 {42 }
36 //debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i",43
37 // (int)update);44 /**
45 Please remove this timeout when the default player can handle mpris commands
46 immediately once it raises its dbus interface
47 **/
48 public void handle_cached_action()
49 {
50 if (this.cached_action != Transport.Action.NO_ACTION){
51 Timeout.add_seconds (1, send_cached_action);
52 }
53 }
54
55 private bool send_cached_action()
56 {
57 this.owner.mpris_bridge.transport_update(this.cached_action);
58 this.cached_action = Transport.Action.NO_ACTION;
59 return false;
60 }
61
62 public void change_play_state (Transport.State update)
63 {
38 int temp = (int)update;64 int temp = (int)update;
39 this.property_set_int(MENUITEM_PLAY_STATE, temp); 65 this.property_set_int(MENUITEM_PLAY_STATE, temp);
40 }66 }
@@ -43,17 +69,21 @@
43 Variant input_value,69 Variant input_value,
44 uint timestamp)70 uint timestamp)
45 {71 {
46 /*debug ( "Handle event in transport menu item - input variant is of type %s",
47 input_value.get_type_string() );*/
48 Variant v = input_value;72 Variant v = input_value;
49 if ( input_value.is_of_type ( VariantType.VARIANT) ){73 if ( input_value.is_of_type (VariantType.VARIANT)){
50 v = input_value.get_variant();74 v = input_value.get_variant();
51 }75 }
52 76
53 int32 input = v.get_int32();77 int32 input = v.get_int32();
54 //debug("transport menu item -> handle_event with value %s", input.to_string());78
55 //debug("transport owner name = %s", this.owner.app_info.get_name());79 if (this.running == true){
56 this.owner.mpris_bridge.transport_update((Transport.Action)input);80 this.owner.mpris_bridge.transport_update((Transport.Action)input);
81 }
82 else{
83 this.cached_action = (Transport.Action)input;
84 this.owner.instantiate();
85 this.property_set_int (MENUITEM_PLAY_STATE, (int)Transport.State.LAUNCHING);
86 }
57 } 87 }
5888
59 public static HashSet<string> attributes_format()89 public static HashSet<string> attributes_format()
@@ -63,4 +93,4 @@
63 return attrs;93 return attrs;
64 } 94 }
6595
66}
67\ No newline at end of file96\ No newline at end of file
97}
6898
=== modified file 'src/transport-widget.c'
--- src/transport-widget.c 2011-03-11 12:49:42 +0000
+++ src/transport-widget.c 2011-03-21 15:53:27 +0000
@@ -85,6 +85,9 @@
85 gboolean has_focus;85 gboolean has_focus;
86 gint hold_timer;86 gint hold_timer;
87 gint skip_frequency;87 gint skip_frequency;
88 gint launching_timer;
89 gdouble launching_transparency;
90 gboolean fade_out;
88};91};
8992
90// TODO refactor the UI handlers, consolidate functionality between key press /release93// TODO refactor the UI handlers, consolidate functionality between key press /release
@@ -136,6 +139,7 @@
136static void transport_widget_start_timing (TransportWidget* widget);139static void transport_widget_start_timing (TransportWidget* widget);
137static gboolean transport_widget_trigger_seek (gpointer userdata);140static gboolean transport_widget_trigger_seek (gpointer userdata);
138static gboolean transport_widget_seek (gpointer userdata);141static gboolean transport_widget_seek (gpointer userdata);
142static gboolean transport_widget_fade_playbutton (gpointer userdata);
139143
140144
141/// Init functions //////////////////////////////////////////////////////////145/// Init functions //////////////////////////////////////////////////////////
@@ -168,6 +172,9 @@
168 priv->has_focus = FALSE;172 priv->has_focus = FALSE;
169 priv->hold_timer = 0;173 priv->hold_timer = 0;
170 priv->skip_frequency = 0;174 priv->skip_frequency = 0;
175 priv->launching_timer = 0;
176 priv->launching_transparency = 1.0f;
177 priv->fade_out = TRUE;
171 priv->command_coordinates = g_hash_table_new_full(g_direct_hash,178 priv->command_coordinates = g_hash_table_new_full(g_direct_hash,
172 g_direct_equal,179 g_direct_equal,
173 NULL,180 NULL,
@@ -1733,6 +1740,61 @@
1733 FALSE);1740 FALSE);
1734 _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y);1741 _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y);
1735 }1742 }
1743 else if(priv->current_state == TRANSPORT_STATE_LAUNCHING)
1744 {
1745/*
1746 g_debug ("launching in draw");
1747*/
1748 _setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6);
1749 _mask_play (cr_surf,
1750 PLAY_PADDING,
1751 PLAY_PADDING,
1752 PLAY_WIDTH - (2*PLAY_PADDING),
1753 PLAY_HEIGHT - (2*PLAY_PADDING));
1754
1755 double BUTTON_SHADOW_LAUNCHING[] = {color_button[3].r,
1756 color_button[3].g,
1757 color_button[3].b,
1758 priv->launching_transparency};
1759 double BUTTON_LAUNCHING_END[] = {color_button[0].r,
1760 color_button[0].g,
1761 color_button[0].b,
1762 priv->launching_transparency};
1763 double BUTTON_LAUNCHING_START[] = {color_button[1].r,
1764 color_button[1].g,
1765 color_button[1].b,
1766 priv->launching_transparency};
1767 _fill (cr_surf,
1768 PLAY_PADDING,
1769 PLAY_PADDING,
1770 PLAY_WIDTH - (2*PLAY_PADDING),
1771 PLAY_HEIGHT - (2*PLAY_PADDING),
1772 BUTTON_SHADOW_LAUNCHING,
1773 BUTTON_SHADOW_LAUNCHING,
1774 FALSE);
1775 _surface_blur (surf, 3);
1776 _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y + 0.5f, 3);
1777
1778 // draw play-button
1779 _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
1780 cairo_set_line_width (cr, 10.5);
1781 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
1782 cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
1783 _mask_play (cr_surf,
1784 PLAY_PADDING,
1785 PLAY_PADDING,
1786 PLAY_WIDTH - (2*PLAY_PADDING),
1787 PLAY_HEIGHT - (2*PLAY_PADDING));
1788 _fill (cr_surf,
1789 PLAY_PADDING,
1790 PLAY_PADDING,
1791 PLAY_WIDTH - (2*PLAY_PADDING),
1792 PLAY_HEIGHT - (2*PLAY_PADDING),
1793 BUTTON_LAUNCHING_START,
1794 BUTTON_LAUNCHING_END,
1795 FALSE);
1796 _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y);
1797 }
1736}1798}
17371799
1738static void 1800static void
@@ -1750,6 +1812,30 @@
1750 (TransportState)initial_state);1812 (TransportState)initial_state);
1751}1813}
17521814
1815static gboolean
1816transport_widget_fade_playbutton (gpointer userdata)
1817{
1818 TransportWidget* bar = (TransportWidget*)userdata;
1819 g_return_val_if_fail(IS_TRANSPORT_WIDGET(bar), FALSE);
1820/*
1821 g_debug ("fade in /out timeout");
1822*/
1823 TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(bar);
1824 if (priv->launching_transparency == 1.0f){
1825 priv->fade_out = TRUE;
1826 }
1827 else if (priv->launching_transparency <= 0.3F){
1828 priv->fade_out = FALSE;
1829 }
1830 if (priv->fade_out == TRUE){
1831 priv->launching_transparency -= 0.05f;
1832 }
1833 else{
1834 priv->launching_transparency += 0.05f;
1835 }
1836 gtk_widget_queue_draw (GTK_WIDGET(bar));
1837 return TRUE;
1838}
1753/**1839/**
1754* transport_widget_update_state()1840* transport_widget_update_state()
1755* Callback for updates from the other side of dbus1841* Callback for updates from the other side of dbus
@@ -1761,12 +1847,28 @@
1761 //g_debug("transport_widget_update_state - with property %s", property);1847 //g_debug("transport_widget_update_state - with property %s", property);
1762 TransportWidget* bar = (TransportWidget*)userdata;1848 TransportWidget* bar = (TransportWidget*)userdata;
1763 g_return_if_fail(IS_TRANSPORT_WIDGET(bar));1849 g_return_if_fail(IS_TRANSPORT_WIDGET(bar));
1850 TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(bar);
17641851
1765 if(g_ascii_strcasecmp(DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, property) == 0)1852 if(g_ascii_strcasecmp(DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, property) == 0)
1766 {1853 {
1767 int update_value = g_variant_get_int32(value);1854 TransportState new_state = (TransportState)g_variant_get_int32(value);
1768 //g_debug("transport_widget_update_state - with value %i", update_value); 1855 //g_debug("transport_widget_update_state - with value %i", update_value);
1769 transport_widget_toggle_play_pause(bar, (TransportState)update_value);1856 if (new_state == TRANSPORT_STATE_LAUNCHING){
1857 priv->current_state = TRANSPORT_STATE_LAUNCHING;
1858 priv->launching_timer = g_timeout_add (100,
1859 transport_widget_fade_playbutton,
1860 bar);
1861 //g_debug("TransportWidget::toggle play state : %i", priv->current_state);
1862 }
1863 else{
1864 if (priv->launching_timer != 0){
1865 g_source_remove (priv->launching_timer);
1866 priv->launching_timer = 0;
1867 priv->fade_out = TRUE;
1868 priv->launching_transparency = 1.0f;
1869 }
1870 transport_widget_toggle_play_pause(bar, new_state);
1871 }
1770 }1872 }
1771}1873}
17721874
17731875
=== modified file 'src/voip-input-widget.c'
--- src/voip-input-widget.c 2011-03-16 12:11:27 +0000
+++ src/voip-input-widget.c 2011-03-21 15:53:27 +0000
@@ -129,9 +129,9 @@
129 g_return_if_fail (IS_VOIP_INPUT_WIDGET (userdata));129 g_return_if_fail (IS_VOIP_INPUT_WIDGET (userdata));
130 VoipInputWidget* mitem = VOIP_INPUT_WIDGET(userdata);130 VoipInputWidget* mitem = VOIP_INPUT_WIDGET(userdata);
131 VoipInputWidgetPrivate * priv = VOIP_INPUT_WIDGET_GET_PRIVATE(mitem);131 VoipInputWidgetPrivate * priv = VOIP_INPUT_WIDGET_GET_PRIVATE(mitem);
132 //g_debug("scrub-widget::property_update for prop %s", property);
133 if(g_ascii_strcasecmp(DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL, property) == 0){132 if(g_ascii_strcasecmp(DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL, property) == 0){
134 if(priv->grabbed == FALSE){133 g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE));
134 if (priv->grabbed == FALSE){
135 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_voip_input_slider);135 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_voip_input_slider);
136 GtkRange *range = (GtkRange*)slider;136 GtkRange *range = (GtkRange*)slider;
137 gdouble update = g_variant_get_double (value);137 gdouble update = g_variant_get_double (value);
138138
=== modified file 'src/volume-widget.c'
--- src/volume-widget.c 2011-03-16 12:11:27 +0000
+++ src/volume-widget.c 2011-03-21 15:53:27 +0000
@@ -131,26 +131,33 @@
131 g_return_if_fail (IS_VOLUME_WIDGET (userdata)); 131 g_return_if_fail (IS_VOLUME_WIDGET (userdata));
132 VolumeWidget* mitem = VOLUME_WIDGET(userdata);132 VolumeWidget* mitem = VOLUME_WIDGET(userdata);
133 VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);133 VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
134
135 if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){134 if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){
136 g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );135 g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
137 if(priv->grabbed == FALSE){136 if(priv->grabbed == FALSE){
138 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);137 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
139 GtkRange *range = (GtkRange*)slider;138 GtkRange *range = (GtkRange*)slider;
140 gdouble update = g_variant_get_double (value);139 gdouble update = g_variant_get_double (value);
140/*
141 g_debug ("volume widget volume prop update with %f", update);
142*/
141 gtk_range_set_value(range, update);143 gtk_range_set_value(range, update);
142 update_accessible_desc(priv->indicator);144 update_accessible_desc(priv->indicator);
143 }145 }
144 }146 }
145 if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_MUTE, property) == 0){147 if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_MUTE, property) == 0){
148/*
146 g_debug ("volume widget - mute update ");149 g_debug ("volume widget - mute update ");
150*/
151 g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32) );
147 if(priv->grabbed == FALSE){152 if(priv->grabbed == FALSE){
148 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);153 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
149 GtkRange *range = (GtkRange*)slider;154 GtkRange *range = (GtkRange*)slider;
150 gint update = g_variant_get_int32 (value);155 gint update = g_variant_get_int32 (value);
151 gdouble level;156 gdouble level;
152157
158/*
153 g_debug ("volume widget - mute update %i", update);159 g_debug ("volume widget - mute update %i", update);
160*/
154161
155 if (update == 1){162 if (update == 1){
156 level = 0;163 level = 0;
@@ -160,7 +167,9 @@
160 DBUSMENU_VOLUME_MENUITEM_LEVEL));167 DBUSMENU_VOLUME_MENUITEM_LEVEL));
161 }168 }
162 gtk_range_set_value(range, level);169 gtk_range_set_value(range, level);
170/*
163 g_debug ("volume-widget - update mute with value %i", update);171 g_debug ("volume-widget - update mute with value %i", update);
172*/
164 }173 }
165 }174 }
166}175}
@@ -197,8 +206,10 @@
197{206{
198 g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);207 g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
199 VolumeWidget* mitem = VOLUME_WIDGET(user_data);208 VolumeWidget* mitem = VOLUME_WIDGET(user_data);
200 //g_debug ("changed value %f", new_value);209/*
201 volume_widget_update(mitem, new_value);210 g_debug ("changed value %f", new_value);
211*/
212 volume_widget_update(mitem, new_value, "change-value");
202 return FALSE;213 return FALSE;
203}214}
204215
@@ -215,24 +226,35 @@
215 VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);226 VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
216 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);227 GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
217 gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100);228 gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100);
218 //g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider)));229/*
230 g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider)));
231*/
232
219 gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item,233 gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item,
220 DBUSMENU_VOLUME_MENUITEM_MUTE));234 DBUSMENU_VOLUME_MENUITEM_MUTE));
221235
222 if((current_value == 0 && mute != 1) || current_value == 100){236 if((current_value == 0 && mute != 1) || current_value == 100){
223 volume_widget_update(mitem, current_value);237/*
238 g_debug ("value changed - actual set %f", current_value);
239*/
240 volume_widget_update(mitem, current_value, "value-changed");
224 }241 }
225242
226 return FALSE;243 return FALSE;
227}244}
228245
229void 246void
230volume_widget_update(VolumeWidget* self, gdouble update)247volume_widget_update(VolumeWidget* self, gdouble update, gchar* label)
231{248{
249 gchar* source = NULL;
250 source = label;
251 if (label == NULL){
252 source = "v widget update";
253 }
232 VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);254 VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
233 gdouble clamped = CLAMP(update, 0, 100);255 gdouble clamped = CLAMP(update, 0, 100);
234 GVariant* new_volume = g_variant_new_double(clamped);256 GVariant* new_volume = g_variant_new_double(clamped);
235 dbusmenu_menuitem_handle_event (priv->twin_item, "update", new_volume, 0);257 dbusmenu_menuitem_handle_event (priv->twin_item, source, new_volume, 0);
236}258}
237259
238GtkWidget*260GtkWidget*
239261
=== modified file 'src/volume-widget.h'
--- src/volume-widget.h 2011-02-22 00:32:51 +0000
+++ src/volume-widget.h 2011-03-21 15:53:27 +0000
@@ -47,7 +47,7 @@
47GType volume_widget_get_type (void) G_GNUC_CONST;47GType volume_widget_get_type (void) G_GNUC_CONST;
48GtkWidget* volume_widget_new(DbusmenuMenuitem *item, IndicatorObject* io);48GtkWidget* volume_widget_new(DbusmenuMenuitem *item, IndicatorObject* io);
49GtkWidget* volume_widget_get_ido_slider(VolumeWidget* self);49GtkWidget* volume_widget_get_ido_slider(VolumeWidget* self);
50void volume_widget_update(VolumeWidget* self, gdouble update);50void volume_widget_update(VolumeWidget* self, gdouble update, gchar* label);
51void volume_widget_tidy_up (GtkWidget *widget);51void volume_widget_tidy_up (GtkWidget *widget);
52gdouble volume_widget_get_current_volume ( GtkWidget *widget );52gdouble volume_widget_get_current_volume ( GtkWidget *widget );
5353
5454
=== modified file 'vapi/common-defs.vapi'
--- vapi/common-defs.vapi 2011-03-09 18:00:36 +0000
+++ vapi/common-defs.vapi 2011-03-21 15:53:27 +0000
@@ -59,10 +59,12 @@
59 PLAY_PAUSE,59 PLAY_PAUSE,
60 NEXT,60 NEXT,
61 REWIND,61 REWIND,
62 FORWIND62 FORWIND,
63 NO_ACTION
63 }64 }
64 public enum State{65 public enum State{
65 PLAYING,66 PLAYING,
66 PAUSED67 PAUSED,
68 LAUNCHING
67 }69 }
68}70}

Subscribers

People subscribed via source and target branches