sound-juicer r2181 - in trunk: . data src



Author: rburton
Date: Wed May 14 20:27:46 2008
New Revision: 2181
URL: http://svn.gnome.org/viewvc/sound-juicer?rev=2181&view=rev

Log:
2008-05-14  Ross Burton  <ross burtonini com>

	* data/sound-juicer.desktop.in.in:
	Specify that URLs can be passed when starting SJ
	
	* src/sj-main.c:
	Munge any passed URLs into device paths.

	#530423, thanks Bastien "Big Baz" Nocera.


Modified:
   trunk/ChangeLog
   trunk/data/sound-juicer.desktop.in.in
   trunk/src/sj-main.c

Modified: trunk/data/sound-juicer.desktop.in.in
==============================================================================
--- trunk/data/sound-juicer.desktop.in.in	(original)
+++ trunk/data/sound-juicer.desktop.in.in	Wed May 14 20:27:46 2008
@@ -2,7 +2,7 @@
 Encoding=UTF-8
 _Name=Audio CD Extractor
 _Comment=Copy music from your CDs
-Exec=sound-juicer
+Exec=sound-juicer %u
 Icon=sound-juicer
 StartupNotify=true
 MimeType=x-content/audio-cdda;

Modified: trunk/src/sj-main.c
==============================================================================
--- trunk/src/sj-main.c	(original)
+++ trunk/src/sj-main.c	Wed May 14 20:27:46 2008
@@ -1574,12 +1574,13 @@
   GnomeProgram *program;
   GError *error = NULL;
   GtkTreeSelection *selection;
-  char *device = NULL;
+  char *device = NULL, **uris = NULL;
   GOptionContext *ctx;
   const GOptionEntry entries[] = {
     { "auto-start", 'a', 0, G_OPTION_ARG_NONE, &autostart, N_("Start extracting immediately"), NULL },
     { "play", 'p', 0, G_OPTION_ARG_NONE, &autoplay, N_("Start playing immediately"), NULL},
     { "device", 'd', 0, G_OPTION_ARG_FILENAME, &device, N_("What CD device to read"), N_("DEVICE") },
+    { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &uris, N_("URI to the CD device to read"), NULL },
     { NULL }
   };
 
@@ -1801,10 +1802,26 @@
   eject_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_EJECT, NULL, TRUE, NULL), NULL);
   open_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_OPEN, NULL, TRUE, NULL), NULL);
   audio_volume_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_AUDIO_VOLUME, NULL, TRUE, NULL), NULL);
-  if (device == NULL) {
+  if (device == NULL && uris == NULL) {
     device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), GINT_TO_POINTER (TRUE));
   } else {
-    set_device (device, TRUE);
+    if (device)
+      set_device (device, TRUE);
+    else {
+      char *d;
+
+      /* Mash up the CDDA URIs into a device path */
+      if (g_str_has_prefix (uris[0], "cdda://")) {
+        guint len;
+        d = g_strdup_printf ("/dev/%s", uris[0] + strlen ("cdda://"));
+        len = strlen (d);
+        d[len - 1] = '\0';
+	set_device (d, TRUE);
+	g_free (d);
+      } else {
+        device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), GINT_TO_POINTER (TRUE));
+      }
+    }
   }
 
   if (sj_extractor_supports_encoding (&error) == FALSE) {



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