← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~cjcurran/indicator-sound/properties-changed-issues into lp:indicator-sound

 

Conor Curran has proposed merging lp:~cjcurran/indicator-sound/properties-changed-issues into lp:indicator-sound.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  #631893 mpris2 playback status behaving as if it were static
  https://bugs.launchpad.net/bugs/631893


Fixes related bug and removes redundant scrub code from the controller and the indicator.
-- 
https://code.launchpad.net/~cjcurran/indicator-sound/properties-changed-issues/+merge/35274
Your team ayatana-commits is subscribed to branch lp:indicator-sound.
=== modified file 'src/Makefile.am'
--- src/Makefile.am	2010-09-01 14:29:26 +0000
+++ src/Makefile.am	2010-09-13 12:38:46 +0000
@@ -18,8 +18,6 @@
 	indicator-sound.c \
 	title-widget.c \
 	title-widget.h \
-	scrub-widget.c \
-	scrub-widget.h \
 	volume-widget.c \
 	volume-widget.h \
 	dbus-shared-names.h \
@@ -62,7 +60,6 @@
 	music-player-bridge.vala \
 	transport-menu-item.vala \
 	metadata-menu-item.vala \
-	scrub-menu-item.vala \
 	title-menu-item.vala \
 	player-controller.vala \
 	mpris2-controller.vala \

=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c	2010-09-08 17:06:26 +0000
+++ src/indicator-sound.c	2010-09-13 12:38:46 +0000
@@ -36,7 +36,6 @@
 #include "transport-widget.h"
 #include "metadata-widget.h"
 #include "title-widget.h"
-#include "scrub-widget.h"
 #include "volume-widget.h"
 
 #include "dbus-shared-names.h"
@@ -79,7 +78,6 @@
 static gboolean new_transport_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
 static gboolean new_metadata_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
 static gboolean new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
-static gboolean new_scrub_bar_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
 
 // DBUS communication
 static DBusGProxy *sound_dbus_proxy = NULL;
@@ -219,7 +217,6 @@
   dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TRANSPORT_MENUITEM_TYPE, new_transport_widget);
   dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget);
   dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget);
-	dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SCRUB_MENUITEM_TYPE, new_scrub_bar_widget);	
 	// register Key-press listening on the menu widget as the slider does not allow this.
   g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), io);
 
@@ -297,26 +294,6 @@
 }
 
 static gboolean
-new_scrub_bar_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client)
-{
-  g_debug("indicator-sound: new_scrub_bar_widget");
-
-  GtkWidget* scrub_bar = NULL;
-
-  g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
-  g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
-
-  scrub_bar = scrub_widget_new (newitem);
-  GtkMenuItem *menu_scrub_widget = GTK_MENU_ITEM(scrub_widget_get_ido_bar(SCRUB_WIDGET(scrub_bar)));
-
-  gtk_widget_show_all(scrub_widget_get_ido_bar(SCRUB_WIDGET(scrub_bar)));
-
-	dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_scrub_widget, parent);
-
-  return TRUE;
-}
-
-static gboolean
 new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client)
 {
   g_debug("indicator-sound: new_volume_slider_widget");

=== modified file 'src/mpris2-controller.vala'
--- src/mpris2-controller.vala	2010-09-09 16:07:19 +0000
+++ src/mpris2-controller.vala	2010-09-13 12:38:46 +0000
@@ -1,5 +1,4 @@
 /*
-This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel.
 Copyright 2010 Canonical Ltd.
 
 Authors:
@@ -84,10 +83,8 @@
 			this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()),
 				                                               "/org/mpris/MediaPlayer2",
 				                                               root_interface.concat(".Player"));						
-			this.player.Seeked += onSeeked;
-
-			this.properties_interface = (FreeDesktopProperties) connection.get_object(root_interface.concat(".").concat(this.owner.name.down()),
-			                                                                          "/org/mpris/MediaPlayer2");
+			this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",//root_interface.concat(".").concat(this.owner.name.down()),
+			                                                                          "/org/mpris/MediaPlayer2");                                                                                
 			this.properties_interface.PropertiesChanged += property_changed_cb;			
 			
 		} catch (DBus.Error e) {
@@ -98,16 +95,14 @@
 	public void property_changed_cb(string interface_source, HashTable<string, Value?> changed_properties, string[] invalid )
 	{	
 		debug("properties-changed for interface %s and owner %s", interface_source, this.owner.name.down());
-    debug("is the invalid array null : %s", (invalid == null).to_string());
-    debug("invalid length  : %i", invalid.length);
     
 		if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false ){
-			warning("Property-changed hash is null or this is an interface that concerns us");
+			warning("Property-changed hash is null or this is an interface that doesn't concerns us");
 			return;
 		}
 		Value? play_v = changed_properties.lookup("PlaybackStatus");
 		if(play_v != null){
-			string state = play_v.get_string();		
+			string state = this.player.PlaybackStatus;		
 			debug("new playback state = %s", state);			
 			TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state);
 			(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);			
@@ -207,42 +202,6 @@
 			}								
 		}	
 	}
-	/**
-		TODO: SetPosition on the player object is not working with rhythmbox,
-	  runtime error - "dbus function not supported"
-	 */
-	public void set_track_position(double position)
-	{			
-		debug("Set position with pos (0-100) %f", position);
-		Value? time_value = this.player.Metadata.lookup("mpris:length");
-		if(time_value == null){
-			warning("Can't fetch the duration of the track therefore cant set the position");
-			return;
-		}
-		// work in microseconds (scale up by 10 TTP-of 6)
-		int64 total_time = time_value.get_int64();
-		debug("total time of track = %i", (int)total_time);				
-		double new_time_position = total_time * (position/100.0);
-		debug("new position = %f", (new_time_position));		
-
-		Value? v = this.player.Metadata.lookup("mpris:trackid");
-		if(v != null){
-			if(v.holds (typeof (string))){
-				DBus.ObjectPath path = new ObjectPath(v.get_string());
-				try{
-					this.player.SetPosition(path, (int64)(new_time_position));
-				}
-				catch(DBus.Error e){
-					error("DBus Error calling the player objects SetPosition method %s",
-						     e.message);
-				}							
-			}
-		}			        
-	}
-
-	public void onSeeked(int64 position){
-		debug("Seeked signal callback with pos = %i", (int)position/1000);
-	}
 	
 	public bool connected()
 	{

=== modified file 'src/transport-widget.c'
--- src/transport-widget.c	2010-09-07 09:04:07 +0000
+++ src/transport-widget.c	2010-09-13 12:38:46 +0000
@@ -46,7 +46,6 @@
 
 static void transport_widget_set_twin_item(TransportWidget* self,
                            								 DbusmenuMenuitem* twin_item);
-
 static gboolean transport_widget_expose_event(GtkWidget* widget,
                                               GdkEventExpose* event);
 


Follow ups