Re: [Rhythmbox-devel] rb applet



And here is the patch I talked about :)

Le ven 12/09/2003 à 09:32, Christophe Fergeau a écrit :
> > Christophe, are you still interested in helping with this?
> 
> Yeah, I'm interested, I even started to export a property bag (with no
> properties yet though), but I'm lacking time :( Hopefully I'll be able
> to do that this week end.
> Here is what the patch looks like for now (iirc it compiles, but I had
> to solve a few conflicts some time ago, maybe I didn't retest it after
> that). The "get_current_song_properties" method should probably be
> called something like "get_player_status" and the property bag should
> contain a structure containing info about the current song, as well as
> the status for repeat/shuffle/playing/...
> What remains to be done is to fill the get/set property methods, to add
> the appropriate properties in rb_shell_current_song_properties, and to
> emit a signal when properties change (I don't remember exactly how it is
> done, but I have code to do that at home).
> 
> Hope that helps,
> 
> Christophe
> 
> > 
> > Jon
> > 
> > _______________________________________________
> > rhythmbox-devel mailing list
> > rhythmbox-devel@gnome.org
> > http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
> _______________________________________________
> rhythmbox-devel mailing list
> rhythmbox-devel@gnome.org
> http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
Index: shell/rb-shell.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v
retrieving revision 1.184
diff -u -r1.184 rb-shell.c
--- shell/rb-shell.c	5 Sep 2003 06:05:24 -0000	1.184
+++ shell/rb-shell.c	12 Sep 2003 07:28:40 -0000
@@ -120,6 +120,9 @@
 						   CORBA_Environment *ev);
 static void rb_shell_corba_set_playing_time (PortableServer_Servant _servant,
 						   CORBA_long time, CORBA_Environment *ev);
+
+static Bonobo_PropertyBag rb_shell_corba_get_current_song_properties (PortableServer_Servant _servant, CORBA_Environment *ev);
+
 void rb_shell_handle_playlist_entry (RBShell *shell, GList *locations, const char *title,
 				     const char *genre);
 static gboolean rb_shell_window_state_cb (GtkWidget *widget,
@@ -285,6 +288,8 @@
 
 	RBTrayIcon *tray_icon;
 
+	BonoboPropertyBag *pb;
+
 	char *cached_title;
 	char *cached_duration;
 };
@@ -369,6 +374,7 @@
 	epv->getPlayingSongDuration = rb_shell_corba_get_playing_song_duration;
 	epv->getPlayingTime = rb_shell_corba_get_playing_time;
 	epv->setPlayingTime = rb_shell_corba_set_playing_time;
+	epv->getCurrentSongProperties = rb_shell_corba_get_current_song_properties;
 }
 
 static void
@@ -535,8 +541,7 @@
 
 	GDK_THREADS_ENTER ();
 	str = gtk_window_get_title (GTK_WINDOW (shell->priv->window));
-	ret = CORBA_string_alloc (strlen (str));
-	strcpy (ret, str);
+	ret = CORBA_string_dup (str);
 	GDK_THREADS_LEAVE ();
 	return ret;
 }
@@ -553,13 +558,61 @@
 	str = rb_shell_player_get_playing_path (shell->priv->player_shell);
 	if (str == NULL)
 		str = "";
-	ret = CORBA_string_alloc (strlen (str));
-	strcpy (ret, str);
+	ret = CORBA_string_dup (str);
 	GDK_THREADS_LEAVE ();
 	return ret;
 }
 
 static void
+shell_pb_get_prop (BonoboPropertyBag *bag,
+		   BonoboArg         *arg,
+		   guint              arg_id,
+		   CORBA_Environment *ev,
+		   gpointer           user_data)
+{	
+}
+
+static void
+shell_pb_set_prop (BonoboPropertyBag *bag,
+		   const BonoboArg   *arg,
+		   guint              arg_id,
+		   CORBA_Environment *ev,
+		   gpointer           user_data)
+{	
+}
+
+enum SongProperties {
+	PROP_TITLE,
+	PROP_URI
+};
+
+static Bonobo_PropertyBag
+rb_shell_corba_get_current_song_properties (PortableServer_Servant _servant, 
+					    CORBA_Environment *ev)
+{	
+	RBShell *shell = RB_SHELL (bonobo_object (_servant));
+
+	if (shell->priv->pb == NULL) {
+		shell->priv->pb = bonobo_property_bag_new (shell_pb_get_prop, 
+							   shell_pb_set_prop, 
+							   shell);
+
+		bonobo_property_bag_add (shell->priv->pb, "title", 
+					 PROP_TITLE, BONOBO_ARG_STRING, NULL, 
+					 _("Title of the current song"), 0);
+		bonobo_property_bag_add (shell->priv->pb, "uri", 
+					 PROP_URI, BONOBO_ARG_STRING, NULL, 
+					 _("URI of the current song"), 0);
+
+	}
+	/* If the creation of the property bag failed, 
+	 * return a corba exception
+	 */
+	
+	return BONOBO_OBJREF (shell->priv->pb);
+}
+
+static void
 rb_shell_corba_set_shuffle (PortableServer_Servant _servant,
 				 CORBA_boolean shuffle,
 				 CORBA_Environment *ev)
@@ -896,7 +949,6 @@
 	}
 		
 	CORBA_exception_free (&ev);
-
 	rb_debug ("Registered with Bonobo Activation");
 
 	/* now that the lib is loaded, we can load the music playlists */
@@ -1056,6 +1108,7 @@
 rb_shell_library_progress_cb (RBLibrary *library, double progress, RBShell *shell)
 {
 	rb_debug ("setting progress to %f", progress);
+//	g_print ("setting progress to %f", progress);
 	rb_statusbar_set_progress (shell->priv->statusbar, progress);
 }
 
Index: corba/Rhythmbox.idl
===================================================================
RCS file: /cvs/gnome/rhythmbox/corba/Rhythmbox.idl,v
retrieving revision 1.3
diff -u -r1.3 Rhythmbox.idl
--- corba/Rhythmbox.idl	5 Sep 2003 06:05:26 -0000	1.3
+++ corba/Rhythmbox.idl	12 Sep 2003 07:28:40 -0000
@@ -1,4 +1,5 @@
 #include <Bonobo.idl>
+#include <Bonobo_Property.idl>
 
 /* arch-tag: Rhythmbox Bonobo interface definition
  */
@@ -32,7 +33,9 @@
 		long getPlayingSongDuration (); /* returns -1 if no current song */
 		long getPlayingTime ();         /* returns -1 if not playing */
 		void setPlayingTime (in long seconds);
-	
+	        
+	        Bonobo::PropertyBag getCurrentSongProperties ();
+
 		void quit ();
 	};
 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]