After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 361122 - Menu item to duplicate cd
Menu item to duplicate cd
Status: RESOLVED FIXED
Product: sound-juicer
Classification: Applications
Component: interface
2.16.x
Other Linux
: Normal enhancement
: ---
Assigned To: Sound Juicer Maintainers
Sound Juicer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-10 12:15 UTC by Sebastien Bacher
Modified: 2008-01-08 10:34 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Patch to add menu item to duplicate a cd. (126.25 KB, patch)
2008-01-04 23:28 UTC, Dave Meikle
needs-work Details | Review
Update to enable/disable the duplicate disc item based on disc presence (127.76 KB, patch)
2008-01-05 16:24 UTC, Dave Meikle
committed Details | Review
Fix to stop duplication being enabled when no disc is present at startup (718 bytes, patch)
2008-01-06 11:50 UTC, Dave Meikle
committed Details | Review
Update to function to check if CD duplication is available (1.98 KB, patch)
2008-01-07 21:27 UTC, Dave Meikle
none Details | Review
Update to function to check if CD duplication is available (2.16 KB, patch)
2008-01-07 21:56 UTC, Dave Meikle
none Details | Review
Update to function to check if CD duplication is available (2.10 KB, patch)
2008-01-07 22:37 UTC, Dave Meikle
committed Details | Review

Description Sebastien Bacher 2006-10-10 12:15:37 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/sound-juicer/+bug/65045

"It would be interesting if sound juicer has a menu item (under 'disc' menu) that duplicate the cd, by calling nautilus-cd-burner.

When cd is inserted, sound juicer is opened, giving you the ability to listen and to rip it.

If i want to make a 'backup' copy of my audio cd, i have to click on cd icon on desktop and choose 'copy disc' option.

If sound juicer has just a shortcut to this feature (provided by nautilus-cd-burner), the user would have all things he could do on a audio cd centralized.

Was i clear?"
Comment 1 Ross Burton 2008-01-02 21:15:59 UTC
This seems like a reasonable addition to the menu.  Plan of action:

1) Check that nautilus-cd-burner --source-device=[device path] works for audio CDs
2) On startup SJ should check for the nautilus-cd-burner binary and if its present, add the menu item.
Comment 2 Dave Meikle 2008-01-04 23:28:23 UTC
Created attachment 102178 [details] [review]
Patch to add menu item to duplicate a cd.
Comment 3 Ross Burton 2008-01-05 13:08:21 UTC
Looking good.  The Duplicate items also needs to enable/disable based on the presence of a disc.
Comment 4 Dave Meikle 2008-01-05 16:24:41 UTC
Created attachment 102214 [details] [review]
Update to enable/disable the duplicate disc item based on disc presence

This patch also addresses an issue of device selection for duplication on a multiple device system.
Comment 5 Ross Burton 2008-01-05 17:12:39 UTC
Committed, thanks!
Comment 6 Dave Meikle 2008-01-06 11:50:50 UTC
Created attachment 102267 [details] [review]
Fix to stop duplication being enabled when no disc is present at startup

A small problem - at startup the duplicate disc menu item is currently enabled if the facility to do so exists. This is wrong as it should only be if the facility to do so exists and there is a disc present. I have attached the change require to fix this in the last committed patch.
Comment 7 Ross Burton 2008-01-06 12:25:28 UTC
Good catch, can you tell I haven't actually tried this? :)
Comment 8 Bastien Nocera 2008-01-07 12:05:55 UTC
is_nautilus_cd_burner_available looks extremely complicated, for what it is, use g_find_program_in_path instead.

Also, it would be useful to check for cdrdao, which is used to duplicate CDs in nautilus-cd-burner. Maybe it would be better to have a check for nautilus-cd-burner and cdrdao directly in libnautilus-burn.

I also don't see any checks for whether there's a writer available on the system.
Comment 9 Ross Burton 2008-01-07 12:15:05 UTC
Aha, I knew there was a glib function to locale programs, but I couldn't find it when I had a search!

Re-opening for gnome-love:
1) use g_find_program_in_path
2) check for cdrdao as well as n-c-b
3) check there is a writer on startup, using libnautilus-burn
Comment 10 Bastien Nocera 2008-01-07 12:19:50 UTC
(In reply to comment #9)
<snip>
> 3) check there is a writer on startup, using libnautilus-burn

Note that the writer can be the same as the source, as nautilus-cd-burner handles that case using a temporary file.
Comment 11 Dave Meikle 2008-01-07 13:41:22 UTC
Ah, I was looking for a function to do it as well but could not find one. It seems so obvious when you see the name!

I will make these changes later today.

Thanks, Dave
Comment 12 Dave Meikle 2008-01-07 21:27:47 UTC
Created attachment 102346 [details] [review]
Update to function to check if CD duplication is available
Comment 13 Dave Meikle 2008-01-07 21:56:25 UTC
Created attachment 102348 [details] [review]
Update to function to check if CD duplication is available

The last one was missing g_free()'s for the g_find_program_in_path() results.
Comment 14 Dave Meikle 2008-01-07 22:35:06 UTC
Comment on attachment 102348 [details] [review]
Update to function to check if CD duplication is available

Index: src/sj-main.c
===================================================================
--- src/sj-main.c	(revision 1964)
+++ src/sj-main.c	(working copy)
@@ -1465,32 +1465,39 @@
 }
 
 /**
- * Searches for the nautilus-cd-burner tool in the system path.
+ * Performs various checks to ensure CD duplication is available.
  * If this is found TRUE is returned, otherwise FALSE is returned.
  */
 static gboolean
-is_nautilus_cd_burner_available()
+is_cd_duplication_available()
 {
-  char **paths, *path;
-  guint n;
-  gboolean result = FALSE;
+  // First check the nautilus-cd-burner tool is available in the path
+  gchar* nautilus_cd_burner = g_find_program_in_path ("nautilus-cd-burne");
+  if (nautilus_cd_burner == NULL) {
+    return FALSE;
+  } 
+  g_free(nautilus_cd_burner);
 
-  paths = g_strsplit (g_getenv ("PATH"), ":", -1);
-  for (n = 0; paths[n] != NULL; ++n) {
-    path = paths[n];
-    if (G_UNLIKELY (*path == '\0'))
-      continue;
+  // Second check the cdrdao tool is available in the path
+  gchar* cdrdao = g_find_program_in_path ("cdrdao");
+  if (cdrdao == NULL) {
+    return FALSE;
+  } 
+  g_free(cdrdao);  
 
-    path = g_strconcat (path, "/nautilus-cd-burner", NULL);
-    if (g_file_test (path, G_FILE_TEST_EXISTS)) {
-      result = TRUE;
-       g_free (path);
-      break;
-    }
-    g_free (path);
+  // Now check that there is at least one cd recorder available
+  GList                    *drives;
+  NautilusBurnDriveMonitor *monitor;
+
+  monitor = nautilus_burn_get_drive_monitor ();
+  drives = nautilus_burn_drive_monitor_get_recorder_drives (monitor);
+
+  if (drives == NULL) {
+     return FALSE;
   }
-  g_strfreev (paths);
-  return result;
+
+  g_list_free (drives);
+  return TRUE;
 }
 
 /**
@@ -1774,7 +1781,7 @@
 
   // Set whether duplication of a cd is available using the nautilus-cd-burner tool
   gtk_widget_set_sensitive (duplicate, FALSE);
-  duplication_enabled = is_nautilus_cd_burner_available ();
+  duplication_enabled = is_cd_duplication_available();
 
   gconf_bridge_bind_window_size(gconf_bridge_get(), GCONF_WINDOW, GTK_WINDOW (main_window));
   gtk_widget_show (main_window);
Comment 15 Dave Meikle 2008-01-07 22:37:10 UTC
Created attachment 102350 [details] [review]
Update to function to check if CD duplication is available

Sorry, didn't mean last update there. I was meaning to do this.

Maybe I should stop now as it clearly not my day ;-)
Comment 16 Jonh Wendell 2008-01-07 23:36:50 UTC
Nautilus can make iso images, so, i wouldn't check for a cd writer in the system.
Comment 17 Bastien Nocera 2008-01-08 08:49:23 UTC
(In reply to comment #16)
> Nautilus can make iso images, so, i wouldn't check for a cd writer in the
> system.

You can't make an ISO image of an audio CD, and I don't think that nautilus-cd-burner can spit out a .bin/.cue combination from cdrdao in the UI.
Comment 18 Ross Burton 2008-01-08 10:34:58 UTC
Committed, thanks.