[Goodies-commits] r7591 - in parole/trunk: . data data/desktop po src

Ali Abdallah aliov at xfce.org
Tue Jun 16 12:28:42 CEST 2009


Author: aliov
Date: 2009-06-16 10:28:42 +0000 (Tue, 16 Jun 2009)
New Revision: 7591

Added:
   parole/trunk/data/desktop/
   parole/trunk/data/desktop/Makefile.am
   parole/trunk/data/desktop/desktop.sh
   parole/trunk/data/desktop/parole.desktop.in.in
   parole/trunk/po/POTFILES.skip
   parole/trunk/src/dbus.c
   parole/trunk/src/dbus.h
   parole/trunk/src/org.parole.media.list.xml
Removed:
   parole/trunk/data/parole-media-player.desktop.in
Modified:
   parole/trunk/ChangeLog
   parole/trunk/configure.ac.in
   parole/trunk/data/Makefile.am
   parole/trunk/po/POTFILES.in
   parole/trunk/po/parole-media-player.pot
   parole/trunk/src/Makefile.am
   parole/trunk/src/main.c
   parole/trunk/src/medialist.c
   parole/trunk/src/medialist.h
   parole/trunk/src/player.c
   parole/trunk/src/player.h
Log:
	* Show busy cursor when dropping files in the media list view.
	* Fix the date in previous commit (2009 instead of 2008).
	* Added command line to add media files to list.
	* DBus interface for adding media files from a file manager
	if Parole is already running.
	* Add mime type handled by Parole in the desktop file.

Modified: parole/trunk/ChangeLog
===================================================================
--- parole/trunk/ChangeLog	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/ChangeLog	2009-06-16 10:28:42 UTC (rev 7591)
@@ -1,4 +1,12 @@
-2008-06-15: 20:00 Ali aliov at xfce.org
+2009-06-16: 11:30 Ali aliov at xfce.org
+	* Show busy cursor when dropping files in the media list view.
+	* Fix the date in previous commit (2009 instead of 2008).
+	* Added command line to add media files to list.
+	* DBus interface for adding media files from a file manager
+	if Parole is already running.
+	* Add mime type handled by Parole in the desktop file.
+
+2009-06-15: 20:00 Ali aliov at xfce.org
 	* Add support for drag and drop in the media list view, it can now
 	handle dropping of a single file or list of files or a folder 
 	contains media files/other subfolders with media files.

Modified: parole/trunk/configure.ac.in
===================================================================
--- parole/trunk/configure.ac.in	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/configure.ac.in	2009-06-16 10:28:42 UTC (rev 7591)
@@ -121,6 +121,7 @@
 data/interfaces/Makefile
 data/icons/Makefile
 data/mime/Makefile
+data/desktop/Makefile
 src/Makefile
 po/Makefile.in
 ])

Modified: parole/trunk/data/Makefile.am
===================================================================
--- parole/trunk/data/Makefile.am	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/data/Makefile.am	2009-06-16 10:28:42 UTC (rev 7591)
@@ -2,19 +2,5 @@
 	interfaces	\
 	pixmaps		\
 	icons		\
-	mime
-
-#
-# .desktop file
-#
-desktop_in_files = parole-media-player.desktop.in
-desktopdir = $(datadir)/applications
-desktop_DATA =  $(desktop_in_files:.desktop.in=.desktop)
-
- at INTLTOOL_DESKTOP_RULE@
-
-EXTRA_DIST =					\
-	$(desktop_in_files)
-
-DISTCLEANFILES =				\
-	$(desktop_DATA)
\ No newline at end of file
+	mime		\
+	desktop

Added: parole/trunk/data/desktop/Makefile.am
===================================================================
--- parole/trunk/data/desktop/Makefile.am	                        (rev 0)
+++ parole/trunk/data/desktop/Makefile.am	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1,21 @@
+MIME_LIST=$(top_srcdir)/data/mime/mime-type-list.txt
+
+#
+# .desktop file
+#
+desktop_in_files = parole.desktop.in
+desktopdir = $(datadir)/applications
+desktop_DATA =  $(desktop_in_files:.desktop.in=.desktop)
+ at INTLTOOL_DESKTOP_RULE@
+
+parole.desktop.in: parole.desktop.in.in desktop.sh $(MIME_LIST)
+	cat $(srcdir)/parole.desktop.in.in > $@ &&\
+	$(SHELL) $(srcdir)/desktop.sh $(MIME_LIST) >> $@
+
+EXTRA_DIST =					\
+	desktop.sh				\
+	parole.desktop.in.in
+
+CLEANFILES =					\
+	$(desktop_in_files)			\
+	$(desktop_DATA)
\ No newline at end of file

Added: parole/trunk/data/desktop/desktop.sh
===================================================================
--- parole/trunk/data/desktop/desktop.sh	                        (rev 0)
+++ parole/trunk/data/desktop/desktop.sh	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+echo_mime () {
+	printf "$i;";
+}
+
+MIMETYPES=`grep -v ^# $1`
+printf MimeType=;
+for i in $MIMETYPES ; do
+	echo_mime;
+done
+
+echo ""


Property changes on: parole/trunk/data/desktop/desktop.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: parole/trunk/data/desktop/parole.desktop.in.in
===================================================================
--- parole/trunk/data/desktop/parole.desktop.in.in	                        (rev 0)
+++ parole/trunk/data/desktop/parole.desktop.in.in	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1,8 @@
+[Desktop Entry]
+_Name=Parole Media Player
+Icon=multimedia
+Exec=parole-media-player %F
+Terminal=false
+Type=Application;
+Categories=GTK;AudioVideo;Player;Video;
+StartupNotify=true

Modified: parole/trunk/po/POTFILES.in
===================================================================
--- parole/trunk/po/POTFILES.in	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/po/POTFILES.in	2009-06-16 10:28:42 UTC (rev 7591)
@@ -3,7 +3,8 @@
 data/interfaces/playlist.ui
 data/interfaces/openlocation.ui
 data/interfaces/parole-settings.ui
-data/parole-media-player.desktop.in
+data/desktop/parole.desktop.in.in
+src/main.c
 src/gst.c
 src/builder.c
 src/mediachooser.c

Added: parole/trunk/po/POTFILES.skip
===================================================================
--- parole/trunk/po/POTFILES.skip	                        (rev 0)
+++ parole/trunk/po/POTFILES.skip	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1 @@
+data/desktop/parole.desktop.in

Modified: parole/trunk/po/parole-media-player.pot
===================================================================
--- parole/trunk/po/parole-media-player.pot	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/po/parole-media-player.pot	2009-06-16 10:28:42 UTC (rev 7591)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-06-15 12:41+0200\n"
+"POT-Creation-Date: 2009-06-16 12:25+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,10 +16,19 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: ../data/parole-media-player.desktop.in.h:1
+#: ../data/desktop/parole.desktop.in.in.h:1
 msgid "Parole Media Player"
 msgstr ""
 
+#: ../src/main.c:83
+msgid "Media to play"
+msgstr ""
+
+#: ../src/main.c:99
+#, c-format
+msgid "Type '%s --help' for usage."
+msgstr ""
+
 #: ../src/gst.c:650
 msgid "Error in changing state to ready"
 msgstr ""
@@ -38,47 +47,47 @@
 msgid "Check your Parole installation"
 msgstr ""
 
-#: ../src/mediachooser.c:436
+#: ../src/mediachooser.c:205
 msgid "Add media files"
 msgstr ""
 
-#: ../src/mediachooser.c:436
+#: ../src/mediachooser.c:205
 msgid "Open media file"
 msgstr ""
 
-#: ../src/mediachooser.c:453
+#: ../src/mediachooser.c:222
 msgid "Add"
 msgstr ""
 
-#: ../src/mediachooser.c:453
+#: ../src/mediachooser.c:222
 msgid "Open"
 msgstr ""
 
-#: ../src/medialist.c:416
+#: ../src/medialist.c:508
 msgid "Media list"
 msgstr ""
 
-#: ../src/player.c:168
+#: ../src/player.c:167
 msgid "Hide playlist"
 msgstr ""
 
-#: ../src/player.c:177
+#: ../src/player.c:176
 msgid "Show playlist"
 msgstr ""
 
-#: ../src/player.c:306 ../src/statusbar.c:125 ../src/statusbar.c:127
+#: ../src/player.c:309 ../src/statusbar.c:125 ../src/statusbar.c:127
 msgid "Playing"
 msgstr ""
 
-#: ../src/player.c:307
+#: ../src/player.c:310
 msgid "Media stream is not seekable"
 msgstr ""
 
-#: ../src/player.c:323 ../src/player.c:336
+#: ../src/player.c:328 ../src/player.c:341
 msgid "Paused"
 msgstr ""
 
-#: ../src/player.c:354
+#: ../src/player.c:359
 msgid "Stopped"
 msgstr ""
 

Modified: parole/trunk/src/Makefile.am
===================================================================
--- parole/trunk/src/Makefile.am	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/src/Makefile.am	2009-06-16 10:28:42 UTC (rev 7591)
@@ -4,7 +4,8 @@
 	gmarshal.c				\
 	gmarshal.h				\
 	enum-gtypes.c				\
-	enum-gtypes.h
+	enum-gtypes.h				\
+	org.parole.media.list.h
 
 MOD_FLAGS = 					\
 	-export_dynamic 			\
@@ -47,6 +48,8 @@
 	rc-utils.h				\
 	utils.c					\
 	utils.h					\
+	dbus.c					\
+	dbus.h					\
 	debug.c					\
 	debug.h
 
@@ -89,10 +92,7 @@
 if MAINTAINER_MODE
 
 BUILT_SOURCES = 				\
-	gmarshal.c				\
-	gmarshal.h				\
-	enum-gtypes.c				\
-	enum-gtypes.h
+	$(GENERATED_FILES)
 
 gmarshal.c: gmarshal.list
 	echo "#include \"gmarshal.h\"" > $@ && \
@@ -123,6 +123,9 @@
         && cp xgen enum-gtypes.c  \
         && rm -f xgen xgen~
 
+org.parole.media.list.h: $(srcdir)/org.parole.media.list.xml
+	dbus-binding-tool --mode=glib-server --prefix=parole_media_list $< >$@
+
 endif
 
 EXTRA_DIST =					\

Added: parole/trunk/src/dbus.c
===================================================================
--- parole/trunk/src/dbus.c	                        (rev 0)
+++ parole/trunk/src/dbus.c	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1,121 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <glib.h>
+
+#include "dbus.h"
+
+static DBusConnection *
+parole_session_bus_get (void)
+{
+    return dbus_g_connection_get_connection (parole_g_session_bus_get ());
+}
+
+DBusGConnection *
+parole_g_session_bus_get	(void)
+{
+    static DBusGConnection *bus = NULL;
+    GError *error = NULL;
+    
+    if ( bus == NULL )
+    {
+	bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+    
+	if ( error )
+	{
+	    g_error ("%s", error->message);
+	}
+    }
+    return bus;
+}
+
+gboolean	parole_dbus_name_has_owner		(const gchar *name)
+{
+    DBusError error;
+    gboolean ret;
+    
+    dbus_error_init (&error);
+    
+    ret = dbus_bus_name_has_owner (parole_session_bus_get (), name, &error);
+    
+    if ( dbus_error_is_set (&error) )
+    {
+        g_warning ("Failed to get name owner: %s\n", error.message);
+        dbus_error_free (&error);
+    }
+    
+    return ret;
+}
+
+gboolean	parole_dbus_register_name		(const gchar *name)
+{
+    DBusError error;
+    int ret;
+    
+    dbus_error_init (&error);
+    
+    ret =
+        dbus_bus_request_name (parole_session_bus_get (),
+                               name,
+                               DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                               &error);
+        
+    if ( dbus_error_is_set (&error) )
+    {
+        g_warning ("Error: %s\n", error.message);
+        dbus_error_free (&error);
+        return FALSE;
+    }
+
+    return ret == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER ? TRUE : FALSE;
+}
+
+gboolean	parole_dbus_release_name		(const gchar *name)
+{
+    DBusError error;
+    int ret;
+    
+    dbus_error_init (&error);
+    
+    ret =
+        dbus_bus_release_name (parole_session_bus_get (),
+                               name,
+                               &error);
+    
+    if ( dbus_error_is_set (&error) )
+    {
+        g_warning ("Error: %s\n", error.message);
+        dbus_error_free (&error);
+        return FALSE;
+    }
+
+    return ret == -1 ? FALSE : TRUE;
+}

Added: parole/trunk/src/dbus.h
===================================================================
--- parole/trunk/src/dbus.h	                        (rev 0)
+++ parole/trunk/src/dbus.h	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1,38 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __PAROLE_DBUS_H_
+#define __PAROLE_DBUS_H_
+
+#include <dbus/dbus-glib.h>
+
+#define PAROLE_DBUS_NAME	"org.Parole.Media.Player"
+#define PAROLE_DBUS_PATH	"/org/Parole/Media/Player"
+#define PAROLE_DBUS_INTERFACE	"org.Parole.Media.Player"
+
+DBusGConnection 	*parole_g_session_bus_get		(void);
+
+gboolean		 parole_dbus_name_has_owner		(const gchar *name);
+
+gboolean		 parole_dbus_register_name		(const gchar *name);
+
+gboolean		 parole_dbus_release_name		(const gchar *name);
+
+#endif /* __PAROLE_DBUS_ */

Modified: parole/trunk/src/main.c
===================================================================
--- parole/trunk/src/main.c	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/src/main.c	2009-06-16 10:28:42 UTC (rev 7591)
@@ -40,24 +40,98 @@
 #include <dbus/dbus-glib-lowlevel.h>
 
 #include "player.h"
+#include "utils.h"
+#include "dbus.h"
 
+static void
+parole_send_files (gchar **filenames)
+{
+    DBusGConnection *bus;
+    DBusGProxy *proxy;
+    GError *error = NULL;
+    
+    bus = parole_g_session_bus_get ();
+    
+    proxy = dbus_g_proxy_new_for_name (bus, 
+				       PAROLE_DBUS_NAME,
+				       PAROLE_DBUS_PATH,
+				       PAROLE_DBUS_INTERFACE);
+				       
+    dbus_g_proxy_call (proxy, "AddFiles", &error,
+		       G_TYPE_STRV, filenames,
+		       G_TYPE_INVALID,
+		       G_TYPE_INVALID);
+		       
+    if ( error )
+    {
+	g_critical ("Unable to send media files to Parole: %s", error->message);
+	g_error_free (error);
+    }
+    
+    g_object_unref (proxy);
+    dbus_g_connection_unref (bus);
+}
+
 int main (int argc, char **argv)
 {
     ParolePlayer *player;
+    GError *error = NULL;
+    gchar **filenames = NULL;
     
+    GOptionEntry option_entries[] = 
+    {
+	{G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, N_("Media to play"), NULL},
+        { NULL, },
+    };
+    
     if ( !g_thread_supported () )
 	g_thread_init (NULL);
-	
-    gtk_init (&argc, &argv);
+
+    xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
+    
     gst_init (&argc, &argv);
     
-    player = parole_player_new ();
-    
-    gdk_notify_startup_complete ();
-    
-    gtk_main ();
+    if ( !gtk_init_with_args (&argc, &argv, (gchar *)"", option_entries, (gchar *)PACKAGE, &error))
+    {
+	if (G_LIKELY (error) ) 
+        {
+            g_printerr ("%s: %s.\n", G_LOG_DOMAIN, error->message);
+            g_printerr (_("Type '%s --help' for usage."), G_LOG_DOMAIN);
+            g_printerr ("\n");
+            g_error_free (error);
+        }
+        else
+        {
+            g_error ("Unable to open display.");
+        }
 
+        return EXIT_FAILURE;
+    }
+
+    if ( parole_dbus_name_has_owner (PAROLE_DBUS_NAME) )
+    {
+	TRACE ("Parole is already running");
+	if ( filenames && filenames[0] != NULL )
+	    parole_send_files (filenames);
+    }
+    else
+    {
+	parole_dbus_register_name (PAROLE_DBUS_NAME);
+	
+	player = parole_player_new ();
+
+	if ( filenames && filenames[0] != NULL )
+	{
+	    ParoleMediaList *list;
+	    list = parole_player_get_media_list (player);
+	    parole_media_list_add_files (list, filenames);
+	}
+	    
+	gdk_notify_startup_complete ();
+	gtk_main ();
+	parole_dbus_release_name (PAROLE_DBUS_NAME);
+    }
+
     gst_deinit ();
-
     return 0;
 }

Modified: parole/trunk/src/medialist.c
===================================================================
--- parole/trunk/src/medialist.c	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/src/medialist.c	2009-06-16 10:28:42 UTC (rev 7591)
@@ -38,7 +38,11 @@
 #include "builder.h"
 #include "filters.h"
 #include "utils.h"
+#include "dbus.h"
 
+static void 	parole_media_list_dbus_class_init (ParoleMediaListClass *klass);
+static void 	parole_media_list_dbus_init 	  (ParoleMediaList      *list);
+
 /*
  * Callbacks for GtkBuilder
  */
@@ -192,6 +196,42 @@
     gtk_widget_show_all (GTK_WIDGET (chooser));
 }
 
+static gboolean
+parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path)
+{
+    GSList *file_list = NULL;
+    GtkFileFilter *filter;
+    ParoleMediaFile *file;
+    guint len;
+    gboolean ret = FALSE;
+    
+    filter = parole_get_supported_media_filter ();
+    g_object_ref_sink (filter);
+    
+    parole_get_media_files (filter, path, &file_list);
+    file_list = g_slist_sort (file_list, (GCompareFunc) thunar_file_compare_by_name);
+    
+    for ( len = 0; len < g_slist_length (file_list); len++)
+    {
+	file = g_slist_nth_data (file_list, len);
+	parole_media_list_add (list, file, FALSE);
+	ret = TRUE;
+    }
+    
+    g_object_unref (filter);
+    g_slist_free (file_list);
+    return ret;
+}
+
+static void
+parole_media_list_add_by_uri (ParoleMediaList *list, const gchar *uri)
+{
+    ParoleMediaFile *file;
+    TRACE ("uri %s", uri);
+    file = parole_media_file_new (uri);
+    parole_media_list_add (list, file, FALSE);
+}
+
 void	parole_media_list_drag_data_received_cb (GtkWidget *widget,
 						 GdkDragContext *drag_context,
 						 gint x,
@@ -201,38 +241,28 @@
 						 guint drag_time,
 						 ParoleMediaList *list)
 {
-    GtkFileFilter *filter;
-    ParoleMediaFile *file;
     gchar **uri_list;
     gchar *path;
     guint i;
-    guint len;
-    gboolean ret = FALSE;
+    guint added = 0;
     
+    parole_window_busy_cursor (GTK_WIDGET (list)->window);
+    
     uri_list = g_uri_list_extract_uris ((const gchar *)data->data);
-    filter = parole_get_supported_media_filter ();
-    g_object_ref_sink (filter);
     
     for ( i = 0; uri_list[i] != NULL; i++)
     {
-	GSList *file_list = NULL;
 	path = g_filename_from_uri (uri_list[i], NULL, NULL);
-	parole_get_media_files (filter, path, &file_list);
-	
-	file_list = g_slist_sort (file_list, (GCompareFunc) thunar_file_compare_by_name);
-	
-	for ( len = 0; len < g_slist_length (file_list); len++)
-	{
-	    file = g_slist_nth_data (file_list, len);
-	    parole_media_list_add (list, file, FALSE);
-	    ret = TRUE;
-	}
-	g_slist_free (file_list);
+	if ( parole_media_list_add_by_path (list, path) )
+	    added++;
+	    
+	g_free (path);
     }
-    
-    g_object_unref (filter);
-    
-    gtk_drag_finish (drag_context, ret, FALSE, drag_time);
+
+    g_strfreev (uri_list);
+
+    gdk_window_set_cursor (GTK_WIDGET (list)->window, NULL);
+    gtk_drag_finish (drag_context, added == i ? TRUE : FALSE, FALSE, drag_time);
 }
 
 void
@@ -446,6 +476,8 @@
                       G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 
     g_type_class_add_private (klass, sizeof (ParoleMediaListPrivate));
+    
+    parole_media_list_dbus_class_init (klass);
 }
 
 static void
@@ -503,6 +535,8 @@
     g_object_unref (builder);
     
     gtk_widget_show_all (GTK_WIDGET (list));
+    
+    parole_media_list_dbus_init (list);
 }
 
 GtkWidget *
@@ -591,3 +625,52 @@
 {
     parole_media_list_open_location_internal (list);
 }
+
+void parole_media_list_add_files (ParoleMediaList *list, gchar **filenames)
+{
+    guint i;
+    
+    for ( i = 0; filenames && filenames[i] != NULL; i++)
+    {
+	TRACE ("Adding file %s\n", filenames [i]);
+	if ( g_str_has_prefix (filenames[i], "file:") )
+	    parole_media_list_add_by_uri (list, filenames[i]);
+	else
+	    parole_media_list_add_by_path (list, filenames[i]);
+    }
+}
+
+static gboolean	 parole_media_list_dbus_add_files (ParoleMediaList *list,
+					           gchar **in_files,
+						   GError **error);
+
+#include "org.parole.media.list.h"
+
+/*
+ * DBus server implementation
+ */
+static void 
+parole_media_list_dbus_class_init (ParoleMediaListClass *klass)
+{
+    dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
+				     &dbus_glib_parole_media_list_object_info);
+}
+
+static void
+parole_media_list_dbus_init (ParoleMediaList *list)
+{
+    dbus_g_connection_register_g_object (parole_g_session_bus_get (),
+					 PAROLE_DBUS_PATH,
+					 G_OBJECT (list));
+}
+
+static gboolean	 parole_media_list_dbus_add_files (ParoleMediaList *list,
+						   gchar **in_files,
+						   GError **error)
+{
+    TRACE ("Adding files for DBus request");
+    
+    parole_media_list_add_files (list, in_files);
+    
+    return TRUE;
+}

Modified: parole/trunk/src/medialist.h
===================================================================
--- parole/trunk/src/medialist.h	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/src/medialist.h	2009-06-16 10:28:42 UTC (rev 7591)
@@ -77,6 +77,10 @@
 								     gboolean multiple);
 
 void			         parole_media_list_open_location    (ParoleMediaList *list);
+
+void				 parole_media_list_add_files        (ParoleMediaList *list,
+								     gchar **filenames);
+
 G_END_DECLS
 
 #endif /* __PAROLE_MEDIA_LIST_H */

Added: parole/trunk/src/org.parole.media.list.xml
===================================================================
--- parole/trunk/src/org.parole.media.list.xml	                        (rev 0)
+++ parole/trunk/src/org.parole.media.list.xml	2009-06-16 10:28:42 UTC (rev 7591)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<node name="/">
+    <interface name="org.Parole.Media.Player">
+        <annotation name="org.freedesktop.DBus.GLib.CSymbol"
+                    value="parole_media_list_dbus"/>
+        <annotation name="org.freedesktop.DBus.GLib.ClientCSymbol"
+                    value="parole_media_list_dbus_client"/>
+
+    <method name="AddFiles">
+      <arg type="as" name="files" direction="in"/>
+    </method>
+
+    </interface>
+</node>

Modified: parole/trunk/src/player.c
===================================================================
--- parole/trunk/src/player.c	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/src/player.c	2009-06-16 10:28:42 UTC (rev 7591)
@@ -35,7 +35,6 @@
 #include "player.h"
 #include "builder.h"
 #include "gst.h"
-#include "medialist.h"
 #include "mediachooser.h"
 #include "mediafile.h"
 #include "sidebar.h"
@@ -931,3 +930,8 @@
     player = g_object_new (PAROLE_TYPE_PLAYER, NULL);
     return player;
 }
+
+ParoleMediaList	*parole_player_get_media_list (ParolePlayer *player)
+{
+    return player->priv->list;
+}

Modified: parole/trunk/src/player.h
===================================================================
--- parole/trunk/src/player.h	2009-06-16 07:35:30 UTC (rev 7590)
+++ parole/trunk/src/player.h	2009-06-16 10:28:42 UTC (rev 7591)
@@ -22,6 +22,7 @@
 #define __PAROLE_PLAYER_H
 
 #include <glib-object.h>
+#include "medialist.h"
 
 G_BEGIN_DECLS
 
@@ -47,6 +48,8 @@
 GType        			 parole_player_get_type        (void) G_GNUC_CONST;
 ParolePlayer       		*parole_player_new             (void);
 
+ParoleMediaList			*parole_player_get_media_list  (ParolePlayer *player);
+
 G_END_DECLS
 
 #endif /* __PAROLE_PLAYER_H */




More information about the Goodies-commits mailing list