sound-juicer r2404 - in trunk: . data libjuicer src
- From: lmedinas svn gnome org
- To: svn-commits-list gnome org
- Subject: sound-juicer r2404 - in trunk: . data libjuicer src
- Date: Wed, 28 Jan 2009 01:30:42 +0000 (UTC)
Author: lmedinas
Date: Wed Jan 28 01:30:42 2009
New Revision: 2404
URL: http://svn.gnome.org/viewvc/sound-juicer?rev=2404&view=rev
Log:
2009-01-28 Luis Medinas <lmedinas gnome org>
* configure.in:
* data/sound-juicer.glade:
* libjuicer/sj-metadata.c (sj_metadata_helper_check_media):
* src/sj-extracting.c (cleanup), (finished_actions),
(on_extract_activate):
* src/sj-main.c (on_eject_activate), (is_audio_cd),
(media_added_cb), (media_removed_cb), (set_drive_from_device),
(set_device), (cd_drive_exists), (prefs_get_default_device),
(is_cd_duplication_available), (on_duplicate_activate), (main):
* src/sj-play.c (setup):
* src/sj-prefs.c (device_changed_cb), (prefs_drive_changed),
(on_edit_preferences_cb):
* src/sound-juicer.h:
Use libbrasero-media instead of nautilus-cd-burner for burning,
Brasero will replace n-c-b for GNOME 2.26.
Patch from Philippe Rouquier <bonfire-app wanadoo fr>
Closes bgo #567286.
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/data/sound-juicer.glade
trunk/libjuicer/sj-metadata.c
trunk/src/sj-extracting.c
trunk/src/sj-main.c
trunk/src/sj-play.c
trunk/src/sj-prefs.c
trunk/src/sound-juicer.h
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Wed Jan 28 01:30:42 2009
@@ -40,16 +40,16 @@
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-# Find nautilus-burn
-PKG_CHECK_MODULES(BURN, libnautilus-burn >= 2.15.3)
+# Find libbrasero-media
+PKG_CHECK_MODULES(BURN, libbrasero-media >= 0.9.1)
AC_SUBST(BURN_CFLAGS)
AC_SUBST(BURN_LIBS)
# Set a flag if we have _can_eject, added in 2.21.5.
-oldlibs=$LIBS
+# oldlibs=$LIBS
LIBS="$LIBS $BURN_LIBS"
-AC_CHECK_FUNCS(nautilus_burn_drive_can_eject)
-LIBS="$oldlibs"
+# AC_CHECK_FUNCS(nautilus_burn_drive_can_eject)
+# LIBS="$oldlibs"
# Find the UI libraries
PKG_CHECK_MODULES(UI, gtk+-2.0 >= 2.14 libglade-2.0 gconf-2.0 gio-2.0 gmodule-export-2.0 dbus-glib-1)
Modified: trunk/data/sound-juicer.glade
==============================================================================
--- trunk/data/sound-juicer.glade (original)
+++ trunk/data/sound-juicer.glade Wed Jan 28 01:30:42 2009
@@ -775,7 +775,7 @@
<widget class="Custom" id="cd_option">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="creation_function">nautilus_burn_drive_selection_new</property>
+ <property name="creation_function">brasero_drive_selection_new</property>
</widget>
<packing>
<property name="left_attach">1</property>
Modified: trunk/libjuicer/sj-metadata.c
==============================================================================
--- trunk/libjuicer/sj-metadata.c (original)
+++ trunk/libjuicer/sj-metadata.c Wed Jan 28 01:30:42 2009
@@ -26,7 +26,7 @@
#ifndef USE_TOTEM_PL_PARSER
#include <unistd.h>
-#include <nautilus-burn.h>
+#include <brasero-medium-selection.h>
#else
#include <totem-disc.h>
#endif /* USE_TOTEM_PL_PARSER */
@@ -164,22 +164,21 @@
sj_metadata_helper_check_media (const char *cdrom, GError **error)
{
#ifndef USE_TOTEM_PL_PARSER
- NautilusBurnMediaType type;
- NautilusBurnDriveMonitor *monitor;
- NautilusBurnDrive *drive;
+ BraseroMediumMonitor *monitor;
+ BraseroMedium *medium;
+ BraseroDrive *drive;
- if (! nautilus_burn_initialized ()) {
- nautilus_burn_init ();
- }
- monitor = nautilus_burn_get_drive_monitor ();
- drive = nautilus_burn_drive_monitor_get_drive_for_device (monitor, cdrom);
+
+ /* This initialize the library if it isn't done yet */
+ monitor = brasero_medium_monitor_get_default ();
+ drive = brasero_medium_monitor_get_drive (monitor, cdrom);
if (drive == NULL) {
return FALSE;
}
- type = nautilus_burn_drive_get_media_type (drive);
- nautilus_burn_drive_unref (drive);
+ medium = brasero_drive_get_medium (drive);
+ g_object_unref (drive);
- if (type == NAUTILUS_BURN_MEDIA_TYPE_ERROR) {
+ if (!medium || !BRASERO_MEDIUM_VALID (brasero_medium_get_status (medium))) {
char *msg;
SjError err;
Modified: trunk/src/sj-extracting.c
==============================================================================
--- trunk/src/sj-extracting.c (original)
+++ trunk/src/sj-extracting.c Wed Jan 28 01:30:42 2009
@@ -31,6 +31,8 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
+#include <brasero-volume.h>
+
#include "sj-error.h"
#include "sj-extracting.h"
#include "sj-util.h"
@@ -201,7 +203,7 @@
/* We're not extracting any more */
extracting = FALSE;
- nautilus_burn_drive_unlock (drive);
+ brasero_drive_unlock (drive);
sj_uninhibit (cookie);
@@ -597,7 +599,7 @@
/* Maybe eject */
if (eject_finished && successful_extract) {
- nautilus_burn_drive_eject (drive);
+ brasero_drive_eject (drive, FALSE, NULL);
}
/* Maybe open the target directory */
@@ -807,7 +809,7 @@
g_object_set (G_OBJECT (artist_renderer), "editable", FALSE, NULL);
g_signal_handlers_block_by_func (track_listview, on_tracklist_row_activate, NULL);
- if (! nautilus_burn_drive_lock (drive, _("Extracting audio from CD"), &reason)) {
+ if (! brasero_drive_lock (drive, _("Extracting audio from CD"), &reason)) {
g_warning ("Could not lock drive: %s", reason);
g_free (reason);
}
Modified: trunk/src/sj-main.c
==============================================================================
--- trunk/src/sj-main.c (original)
+++ trunk/src/sj-main.c Wed Jan 28 01:30:42 2009
@@ -32,7 +32,8 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <gconf/gconf-client.h>
-#include <nautilus-burn.h>
+#include <brasero-medium-selection.h>
+#include <brasero-volume.h>
#include <profiles/gnome-media-profiles.h>
#include <gst/gst.h>
@@ -85,7 +86,7 @@
const char *path_pattern, *file_pattern;
GFile *base_uri;
-NautilusBurnDrive *drive = NULL;
+BraseroDrive *drive = NULL;
gboolean strip_chars;
gboolean eject_finished;
gboolean open_finished;
@@ -214,7 +215,7 @@
/* first make sure we're not playing */
stop_playback ();
- nautilus_burn_drive_eject (drive);
+ brasero_drive_eject (drive, FALSE, NULL);
}
gboolean on_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
@@ -859,19 +860,21 @@
}
static gboolean
-is_audio_cd (NautilusBurnDrive *drive)
+is_audio_cd (BraseroDrive *drive)
{
- NautilusBurnMediaType type;
- gboolean audio;
- if (drive == NULL) return FALSE;
- type = nautilus_burn_drive_get_media_type_full (drive, NULL, NULL, NULL, &audio);
- if (type == NAUTILUS_BURN_MEDIA_TYPE_ERROR) {
+ BraseroMedium *medium;
+ BraseroMedia type;
+
+ medium = brasero_drive_get_medium (drive);
+ if (medium == NULL) return FALSE;
+ type = brasero_medium_get_status (medium);
+ if (type == BRASERO_MEDIUM_UNSUPPORTED) {
g_warning ("Error getting media type\n");
}
- if (type == NAUTILUS_BURN_MEDIA_TYPE_BUSY) {
+ if (type == BRASERO_MEDIUM_BUSY) {
g_warning ("BUSY getting media type, should re-check\n");
}
- return audio;
+ return BRASERO_MEDIUM_IS (type, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_CD);
}
/**
@@ -941,19 +944,21 @@
}
static void
-media_added_cb (NautilusBurnDrive *drive,
- gpointer data)
+media_added_cb (BraseroMediumMonitor *drive,
+ BraseroMedium *medium,
+ gpointer data)
{
if (extracting == TRUE) {
/* FIXME: recover? */
}
- sj_debug (DEBUG_CD, "Media added to device %s\n", nautilus_burn_drive_get_device (drive));
+ sj_debug (DEBUG_CD, "Media added to device %s\n", brasero_drive_get_device (brasero_medium_get_drive (medium)));
reread_cd (TRUE);
}
static void
-media_removed_cb (NautilusBurnDrive *drive,
+media_removed_cb (BraseroMediumMonitor *drive,
+ BraseroMedium *medium,
gpointer data)
{
if (extracting == TRUE) {
@@ -963,7 +968,7 @@
/* first make sure we're not playing */
stop_playback ();
- sj_debug (DEBUG_CD, "Media removed from device %s\n", nautilus_burn_drive_get_device (drive));
+ sj_debug (DEBUG_CD, "Media removed from device %s\n", brasero_drive_get_device (brasero_medium_get_drive (medium)));
stop_ui_hack ();
update_ui_for_album (NULL);
}
@@ -971,18 +976,18 @@
static void
set_drive_from_device (const char *device)
{
- NautilusBurnDriveMonitor *monitor;
+ BraseroMediumMonitor *monitor;
if (drive) {
- nautilus_burn_drive_unref (drive);
+ g_object_unref (drive);
drive = NULL;
}
if (! device)
return;
- monitor = nautilus_burn_get_drive_monitor ();
- drive = nautilus_burn_drive_monitor_get_drive_for_device (monitor, device);
+ monitor = brasero_medium_monitor_get_default ();
+ drive = brasero_medium_monitor_get_drive (monitor, device);
if (! drive) {
GtkWidget *dialog;
char *message;
@@ -1001,8 +1006,8 @@
return;
}
- g_signal_connect (drive, "media-added", G_CALLBACK (media_added_cb), NULL);
- g_signal_connect (drive, "media-removed", G_CALLBACK (media_removed_cb), NULL);
+ g_signal_connect (monitor, "medium-added", G_CALLBACK (media_added_cb), NULL);
+ g_signal_connect (monitor, "medium-removed", G_CALLBACK (media_removed_cb), NULL);
}
static void
@@ -1045,30 +1050,29 @@
sj_extractor_set_device (extractor, device);
if (drive != NULL) {
- tray_opened = nautilus_burn_drive_door_is_open (drive);
+ tray_opened = brasero_drive_is_door_open (drive);
if (tray_opened == FALSE) {
reread_cd (ignore_no_media);
}
-#if HAVE_NAUTILUS_BURN_DRIVE_CAN_EJECT
+
// Enable/disable the eject options based on wether the drive supports ejection
- gtk_widget_set_sensitive (eject, nautilus_burn_drive_can_eject (drive));
-#endif
+ gtk_widget_set_sensitive (eject, brasero_drive_can_eject (drive));
}
}
gboolean cd_drive_exists (const char *device)
{
- NautilusBurnDriveMonitor *monitor;
- NautilusBurnDrive *drive;
+ BraseroMediumMonitor *monitor;
+ BraseroDrive *drive;
gboolean exists;
if (device == NULL)
return FALSE;
- monitor = nautilus_burn_get_drive_monitor ();
- drive = nautilus_burn_drive_monitor_get_drive_for_device (monitor, device);
+ monitor = brasero_medium_monitor_get_default ();
+ drive = brasero_medium_monitor_get_drive (monitor, device);
exists = (drive != NULL);
- nautilus_burn_drive_unref (drive);
+ g_object_unref (drive);
return exists;
}
@@ -1079,20 +1083,21 @@
static const char * default_device = NULL;
if (default_device == NULL) {
- NautilusBurnDriveMonitor *monitor;
- NautilusBurnDrive *drive;
- GList *drives;
+ BraseroMediumMonitor *monitor;
- monitor = nautilus_burn_get_drive_monitor ();
- drives = nautilus_burn_drive_monitor_get_drives (monitor);
+ BraseroDrive *drive;
+ GSList *drives;
+
+ monitor = brasero_medium_monitor_get_default ();
+ drives = brasero_medium_monitor_get_drives (monitor, BRASERO_DRIVE_TYPE_ALL);
if (drives == NULL)
return NULL;
drive = drives->data;
- default_device = nautilus_burn_drive_get_device (drive);
+ default_device = brasero_drive_get_device (drive);
- g_list_foreach (drives, (GFunc)nautilus_burn_drive_unref, NULL);
- g_list_free (drives);
+ g_slist_foreach (drives, (GFunc) g_object_unref, NULL);
+ g_slist_free (drives);
}
return default_device;
}
@@ -1503,12 +1508,12 @@
static gboolean
is_cd_duplication_available()
{
- // First check the nautilus-cd-burner tool is available in the path
- gchar* nautilus_cd_burner = g_find_program_in_path ("nautilus-cd-burner");
- if (nautilus_cd_burner == NULL) {
+ // First check the brasero tool is available in the path
+ gchar* brasero_cd_burner = g_find_program_in_path ("brasero");
+ if (brasero_cd_burner == NULL) {
return FALSE;
}
- g_free(nautilus_cd_burner);
+ g_free(brasero_cd_burner);
// Second check the cdrdao tool is available in the path
gchar* cdrdao = g_find_program_in_path ("cdrdao");
@@ -1518,18 +1523,27 @@
g_free(cdrdao);
// 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;
+ BraseroMediumMonitor *monitor;
+ GSList *drives;
+ GSList *iter;
+
+ monitor = brasero_medium_monitor_get_default ();
+ drives = brasero_medium_monitor_get_drives (monitor, BRASERO_DRIVE_TYPE_ALL);
+
+ for (iter = drives; iter; iter = iter->next) {
+ BraseroDrive *drive;
+
+ drive = iter->data;
+ if (brasero_drive_can_write (drive)) {
+ g_slist_foreach (drives, (GFunc) g_object_unref, NULL);
+ g_slist_free (drives);
+ return TRUE;
+ }
}
- g_list_free (drives);
- return TRUE;
+ g_slist_foreach (drives, (GFunc) g_object_unref, NULL);
+ g_slist_free (drives);
+ return FALSE;
}
/**
@@ -1540,8 +1554,8 @@
GError *error = NULL;
const gchar* device;
- device = nautilus_burn_drive_get_device (drive);
- if (!g_spawn_command_line_async (g_strconcat ("nautilus-cd-burner --source-device=", device, NULL), &error)) {
+ device = brasero_drive_get_device (drive);
+ if (!g_spawn_command_line_async (g_strconcat ("brasero -c ", device, NULL), &error)) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
@@ -1596,6 +1610,7 @@
g_option_context_set_translation_domain(ctx, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, gtk_get_option_group (FALSE));
g_option_context_add_group (ctx, gst_init_get_option_group ());
+ g_option_context_add_group (ctx, brasero_media_get_option_group ());
g_option_context_set_ignore_unknown_options (ctx, TRUE);
g_option_context_parse (ctx, &argc, &argv, &error);
@@ -1611,8 +1626,6 @@
sj_stock_init ();
- nautilus_burn_init ();
-
gtk_window_set_default_icon_name ("sound-juicer");
connection = bacon_message_connection_new ("sound-juicer");
@@ -1624,6 +1637,8 @@
bacon_message_connection_set_callback (connection, on_message_received, NULL);
}
+ brasero_media_library_start ();
+
metadata = sj_metadata_getter_new ();
g_signal_connect (metadata, "metadata", G_CALLBACK (metadata_cb), NULL);
@@ -1825,7 +1840,7 @@
return 0;
}
- // Set whether duplication of a cd is available using the nautilus-cd-burner tool
+ // Set whether duplication of a cd is available using the brasero tool
gtk_widget_set_sensitive (duplicate, FALSE);
duplication_enabled = is_cd_duplication_available();
@@ -1833,11 +1848,11 @@
gtk_widget_show (main_window);
gtk_main ();
- nautilus_burn_shutdown ();
-
g_object_unref (base_uri);
g_object_unref (metadata);
g_object_unref (extractor);
g_object_unref (gconf_client);
+ brasero_media_library_stop ();
+
return 0;
}
Modified: trunk/src/sj-play.c
==============================================================================
--- trunk/src/sj-play.c (original)
+++ trunk/src/sj-play.c Wed Jan 28 01:30:42 2009
@@ -380,7 +380,7 @@
NULL);
}
g_object_set (G_OBJECT (cdp),
- "device", nautilus_burn_drive_get_device (drive),
+ "device", brasero_drive_get_device (drive),
NULL);
queue = gst_element_factory_make ("queue", "queue"); g_assert (queue);
Modified: trunk/src/sj-prefs.c
==============================================================================
--- trunk/src/sj-prefs.c (original)
+++ trunk/src/sj-prefs.c Wed Jan 28 01:30:42 2009
@@ -27,8 +27,7 @@
#include <glade/glade-xml.h>
#include <gconf/gconf-client.h>
#include <profiles/gnome-media-profiles.h>
-#include <nautilus-burn-drive.h>
-#include <nautilus-burn-drive-selection.h>
+#include <brasero/brasero-drive-selection.h>
#include "sj-util.h"
#include "gconf-bridge.h"
@@ -321,6 +320,36 @@
}
/**
+ * Default device changed (either GConf key or the widget)
+ */
+static void device_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+ g_return_if_fail (strcmp (entry->key, GCONF_DEVICE) == 0);
+
+ if (entry->value == NULL)
+ return;
+
+ if (entry->value->type == GCONF_VALUE_STRING) {
+ BraseroDrive *drive;
+ BraseroMediumMonitor *monitor;
+
+ monitor = brasero_medium_monitor_get_default ();
+ drive = brasero_medium_monitor_get_drive (monitor, gconf_value_get_string (entry->value));
+ brasero_drive_selection_set_active (BRASERO_DRIVE_SELECTION (cd_option), drive);
+ g_object_unref (drive);
+ g_object_unref (monitor);
+ }
+}
+
+static void prefs_drive_changed (BraseroDriveSelection *selection, BraseroDrive *drive, gpointer user_data)
+{
+ if (drive)
+ gconf_client_set_string (gconf_client, GCONF_DEVICE, brasero_drive_get_device (drive), NULL);
+ else
+ gconf_client_set_string (gconf_client, GCONF_DEVICE, NULL, NULL);
+}
+
+/**
* The GConf key for the strip characters option changed
*/
static void strip_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
@@ -414,11 +443,13 @@
populate_pattern_combo (GTK_COMBO_BOX (file_option), file_patterns);
g_signal_connect (file_option, "changed", G_CALLBACK (prefs_file_option_changed), NULL);
+ g_signal_connect (cd_option, "drive-changed", G_CALLBACK (prefs_drive_changed), NULL);
+
/* Connect to GConf to update the UI */
gconf_bridge_bind_property (bridge, GCONF_EJECT, G_OBJECT (check_eject), "active");
gconf_bridge_bind_property (bridge, GCONF_OPEN, G_OBJECT (check_open), "active");
gconf_bridge_bind_property (bridge, GCONF_STRIP, G_OBJECT (check_strip), "active");
- gconf_bridge_bind_property (bridge, GCONF_DEVICE, G_OBJECT (cd_option), "device");
+ gconf_client_notify_add (gconf_client, GCONF_DEVICE, device_changed_cb, NULL, NULL, NULL);
gconf_client_notify_add (gconf_client, GCONF_BASEURI, baseuri_changed_cb, NULL, NULL, NULL);
gconf_client_notify_add (gconf_client, GCONF_AUDIO_PROFILE, audio_profile_changed_cb, NULL, NULL, NULL);
gconf_client_notify_add (gconf_client, GCONF_PATH_PATTERN, path_pattern_changed_cb, NULL, NULL, NULL);
@@ -431,6 +462,7 @@
audio_profile_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_AUDIO_PROFILE, NULL, TRUE, NULL), NULL);
file_pattern_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_FILE_PATTERN, NULL, TRUE, NULL), NULL);
path_pattern_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_PATH_PATTERN, NULL, TRUE, NULL), NULL);
+ device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), NULL);
g_signal_connect (GTK_DIALOG (prefs_dialog), "response", G_CALLBACK (on_response), NULL);
Modified: trunk/src/sound-juicer.h
==============================================================================
--- trunk/src/sound-juicer.h (original)
+++ trunk/src/sound-juicer.h Wed Jan 28 01:30:42 2009
@@ -28,7 +28,7 @@
#endif /* HAVE_CONFIG_H */
#include <glib/gi18n.h>
-#include <nautilus-burn-drive.h>
+#include <brasero-medium-selection.h>
#include <gconf/gconf-client.h>
#include <glade/glade-xml.h>
#include <gio/gio.h>
@@ -98,7 +98,7 @@
/**
* The device we are extracting from.
*/
-extern NautilusBurnDrive *drive;
+extern BraseroDrive *drive;
/**
* The root path to write files too
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]