[Xfce4-commits] <parole:master> Added --device command line.
Ali Abdallah
noreply at xfce.org
Wed Nov 25 10:40:01 CET 2009
Updating branch refs/heads/master
to ae82dfea92bbd132ee5003d5d465e6600826f6da (commit)
from ca9c1f46905d7dbdc8184eb1688a9450f8b4d92a (commit)
commit ae82dfea92bbd132ee5003d5d465e6600826f6da
Author: Ali Abdallah <ali at ali-xfce.org>
Date: Wed Nov 25 09:00:24 2009 +0100
Added --device command line.
src/main.c | 40 +++++++++++++++++++++++---------------
src/org.parole.media.list.xml | 4 ---
src/org.parole.media.player.xml | 5 ++++
src/parole-medialist.c | 18 -----------------
src/parole-player.c | 24 +++++++++++++++++++++-
src/parole-player.h | 3 +-
6 files changed, 53 insertions(+), 41 deletions(-)
diff --git a/src/main.c b/src/main.c
index fd12914..882dd9c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,12 +67,16 @@ parole_sig_handler (gint sig, gpointer data)
}
static void
-parole_send_play_disc (DBusGProxy *proxy, const gchar *uri)
+parole_send_play_disc (const gchar *uri, const gchar *device)
{
+ DBusGProxy *proxy;
GError *error = NULL;
+ proxy = parole_get_proxy (PAROLE_DBUS_PATH, PAROLE_DBUS_INTERFACE);
+
dbus_g_proxy_call (proxy, "PlayDisc", &error,
G_TYPE_STRING, uri,
+ G_TYPE_STRING, device,
G_TYPE_INVALID,
G_TYPE_INVALID);
@@ -81,15 +85,24 @@ parole_send_play_disc (DBusGProxy *proxy, const gchar *uri)
g_critical ("Unable to send uri to Parole: %s", error->message);
g_error_free (error);
}
+
+ g_object_unref (proxy);
}
static void
-parole_send_files (DBusGProxy *proxy, gchar **filenames)
+parole_send_files (gchar **filenames)
{
+ DBusGProxy *proxy;
GFile *file;
gchar **out_paths;
GError *error = NULL;
guint i;
+
+
+ proxy = parole_get_proxy (PAROLE_DBUS_PLAYLIST_PATH, PAROLE_DBUS_PLAYLIST_INTERFACE);
+
+ if ( !proxy )
+ g_error ("Unable to create proxy for %s", PAROLE_DBUS_NAME);
out_paths = g_new0 (gchar *, g_strv_length (filenames));
@@ -113,24 +126,16 @@ parole_send_files (DBusGProxy *proxy, gchar **filenames)
}
g_strfreev (out_paths);
+ g_object_unref (proxy);
}
static void
-parole_send (gchar **filenames)
+parole_send (gchar **filenames, gchar *device)
{
- DBusGProxy *proxy;
-
- proxy = parole_get_proxy (PAROLE_DBUS_PLAYLIST_PATH, PAROLE_DBUS_PLAYLIST_INTERFACE);
-
- if ( !proxy )
- g_error ("Unable to create proxy for %s", PAROLE_DBUS_NAME);
-
if ( g_strv_length (filenames) == 1 && parole_is_uri_disc (filenames[0]))
- parole_send_play_disc (proxy, filenames[0]);
+ parole_send_play_disc (filenames[0], device);
else
- parole_send_files (proxy, filenames);
-
- g_object_unref (proxy);
+ parole_send_files (filenames);
}
static void
@@ -166,6 +171,7 @@ int main (int argc, char **argv)
GError *error = NULL;
gchar **filenames = NULL;
+ gchar *device = NULL;
gboolean new_instance = FALSE;
gboolean version = FALSE;
gboolean play = FALSE;
@@ -184,6 +190,7 @@ int main (int argc, char **argv)
{
{ "new-instance", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &new_instance, N_("Open a new instance"), NULL },
{ "no-plugins", 'n', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &no_plugins, N_("Do not load plugins"), NULL },
+ { "device", '\0', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &device, N_("Set Audio-CD/VCD/DVD device path"), NULL },
{ "play", 'p', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &play, N_("Play or pause if already playing"), NULL },
{ "stop", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &stop, N_("Stop playing"), NULL },
{ "next-track", 'N', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &next_track, N_("Next track"), NULL },
@@ -235,7 +242,7 @@ int main (int argc, char **argv)
g_print (_("Parole is already running, use -i to open a new instance\n"));
if ( filenames && filenames[0] != NULL )
- parole_send (filenames);
+ parole_send (filenames, device);
if ( play )
parole_send_message ("Play");
@@ -280,7 +287,8 @@ int main (int argc, char **argv)
{
if ( g_strv_length (filenames) == 1 && parole_is_uri_disc (filenames[0]))
{
- parole_player_play_uri_disc (player, filenames[0]);
+ g_debug ("Yalla");
+ parole_player_play_uri_disc (player, filenames[0], device);
}
else
{
diff --git a/src/org.parole.media.list.xml b/src/org.parole.media.list.xml
index 5f01a1d..bc7e021 100644
--- a/src/org.parole.media.list.xml
+++ b/src/org.parole.media.list.xml
@@ -11,9 +11,5 @@
<arg type="as" name="files" direction="in"/>
</method>
- <method name="AddDisc">
- <arg type="s" name="uri" direction="in"/>
- </method>
-
</interface>
</node>
diff --git a/src/org.parole.media.player.xml b/src/org.parole.media.player.xml
index 0973af0..5be1362 100644
--- a/src/org.parole.media.player.xml
+++ b/src/org.parole.media.player.xml
@@ -33,6 +33,11 @@
<method name="Mute">
</method>
+
+ <method name="PlayDisc">
+ <arg type="s" name="uri" direction="in"/>
+ <arg type="s" name="device" direction="in"/>
+ </method>
</interface>
</node>
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 02d41c1..90bba79 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -1331,10 +1331,6 @@ static gboolean parole_media_list_dbus_add_files (ParoleMediaList *list,
gchar **in_files,
GError **error);
-static gboolean parole_media_list_dbus_add_disc (ParoleMediaList *list,
- gchar *in_uri,
- GError **error);
-
#include "org.parole.media.list.h"
/*
@@ -1366,20 +1362,6 @@ static gboolean parole_media_list_dbus_add_files (ParoleMediaList *list,
return TRUE;
}
-static gboolean parole_media_list_dbus_add_disc (ParoleMediaList *list,
- gchar *in_uri,
- GError **error)
-{
- TRACE ("uri : %s", in_uri);
-
- gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (list))));
-
- if ( parole_is_uri_disc (in_uri) )
- g_signal_emit (G_OBJECT (list), signals [URI_OPENED], 0, in_uri);
-
- return TRUE;
-}
-
void parole_media_list_grab_focus (ParoleMediaList *list)
{
if (GTK_WIDGET_VISIBLE (list->priv->view) )
diff --git a/src/parole-player.c b/src/parole-player.c
index 1b0d092..e615d9a 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -1858,9 +1858,9 @@ ParoleMediaList *parole_player_get_media_list (ParolePlayer *player)
return player->priv->list;
}
-void parole_player_play_uri_disc (ParolePlayer *player, const gchar *uri)
+void parole_player_play_uri_disc (ParolePlayer *player, const gchar *uri, const gchar *device)
{
- parole_player_disc_selected_cb (NULL, uri, NULL, player);
+ parole_player_disc_selected_cb (NULL, uri, device, player);
}
void parole_player_terminate (ParolePlayer *player)
@@ -1896,6 +1896,11 @@ static gboolean parole_player_dbus_lower_volume (ParolePlayer *player,
static gboolean parole_player_dbus_mute (ParolePlayer *player,
GError *error);
+static gboolean parole_player_dbus_play_disc (ParolePlayer *player,
+ gchar *in_uri,
+ gchar *in_device,
+ GError **error);
+
#include "org.parole.media.player.h"
/*
@@ -1983,3 +1988,18 @@ static gboolean parole_player_dbus_mute (ParolePlayer *player,
gtk_range_set_value (GTK_RANGE (player->priv->volume), 0);
return TRUE;
}
+
+static gboolean parole_player_dbus_play_disc (ParolePlayer *player,
+ gchar *in_uri,
+ gchar *in_device,
+ GError **error)
+{
+ TRACE ("uri : %s", in_uri);
+
+ gtk_window_present (GTK_WINDOW (player->priv->window));
+
+ if ( parole_is_uri_disc (in_uri) )
+ parole_player_disc_selected_cb (NULL, in_uri, in_device, player);
+
+ return TRUE;
+}
diff --git a/src/parole-player.h b/src/parole-player.h
index fbbed42..8060a22 100644
--- a/src/parole-player.h
+++ b/src/parole-player.h
@@ -51,7 +51,8 @@ ParolePlayer *parole_player_new (void);
ParoleMediaList *parole_player_get_media_list (ParolePlayer *player);
void parole_player_play_uri_disc (ParolePlayer *player,
- const gchar *uri);
+ const gchar *uri,
+ const gchar *device);
void parole_player_terminate (ParolePlayer *player);
More information about the Xfce4-commits
mailing list