[brasero] Avoid having error after reprobing which was caused by the disc selection widget
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero] Avoid having error after reprobing which was caused by the disc selection widget
- Date: Sun, 21 Jun 2009 17:08:49 -0400 (EDT)
commit 9d9f4cb0d5d037cccd31600153ce42c0a13c2af8
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Sun Jun 21 18:00:43 2009 +0200
Avoid having error after reprobing which was caused by the disc selection widget
libbrasero-burn/brasero-burn.c | 4 +-
libbrasero-burn/brasero-dest-selection.c | 118 +++++++++++++++++-------------
libbrasero-burn/brasero-dest-selection.h | 4 +
libbrasero-burn/brasero-session-cfg.c | 3 +-
libbrasero-burn/burn-job.c | 1 +
plugins/growisofs/burn-dvd-rw-format.c | 3 +-
src/brasero-project.c | 6 ++
7 files changed, 85 insertions(+), 54 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index 301f6d5..d692203 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -255,9 +255,11 @@ brasero_burn_reprobe (BraseroBurn *burn)
priv = BRASERO_BURN_PRIVATE (burn);
+ BRASERO_BURN_LOG ("Reprobing for medium");
+
/* reprobe the medium and wait for it to be probed */
brasero_drive_reprobe (priv->dest);
- while (!(medium = brasero_drive_get_medium (priv->dest)))
+ while ((medium = brasero_drive_get_medium (priv->dest)) == NULL)
result = brasero_burn_sleep (burn, 250);
return result;
diff --git a/libbrasero-burn/brasero-dest-selection.c b/libbrasero-burn/brasero-dest-selection.c
index 1bbeb08..c471467 100644
--- a/libbrasero-burn/brasero-dest-selection.c
+++ b/libbrasero-burn/brasero-dest-selection.c
@@ -62,8 +62,6 @@ struct _BraseroDestSelectionPrivate
BraseroBurnSession *session;
BraseroDrive *locked_drive;
-
- gulong valid_sig;
};
#define BRASERO_DEST_SELECTION_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DEST_SELECTION, BraseroDestSelectionPrivate))
@@ -201,25 +199,23 @@ brasero_dest_selection_init (BraseroDestSelection *object)
}
static void
-brasero_dest_selection_finalize (GObject *object)
+brasero_dest_selection_clean (BraseroDestSelection *self)
{
BraseroDestSelectionPrivate *priv;
- priv = BRASERO_DEST_SELECTION_PRIVATE (object);
-
- if (priv->valid_sig) {
- g_signal_handler_disconnect (priv->session,
- priv->valid_sig);
- priv->valid_sig = 0;
- }
+ priv = BRASERO_DEST_SELECTION_PRIVATE (self);
- g_signal_handlers_disconnect_by_func (priv->session,
- brasero_dest_selection_output_changed,
- object);
- g_signal_handlers_disconnect_by_func (priv->session,
- brasero_dest_selection_flags_changed,
- object);
if (priv->session) {
+ g_signal_handlers_disconnect_by_func (priv->session,
+ brasero_dest_selection_valid_session,
+ self);
+ g_signal_handlers_disconnect_by_func (priv->session,
+ brasero_dest_selection_output_changed,
+ self);
+ g_signal_handlers_disconnect_by_func (priv->session,
+ brasero_dest_selection_flags_changed,
+ self);
+
g_object_unref (priv->session);
priv->session = NULL;
}
@@ -228,7 +224,12 @@ brasero_dest_selection_finalize (GObject *object)
brasero_drive_unlock (priv->locked_drive);
g_object_unref (priv->locked_drive);
}
+}
+static void
+brasero_dest_selection_finalize (GObject *object)
+{
+ brasero_dest_selection_clean (BRASERO_DEST_SELECTION (object));
G_OBJECT_CLASS (brasero_dest_selection_parent_class)->finalize (object);
}
@@ -350,6 +351,54 @@ brasero_dest_selection_choose_best (BraseroDestSelection *self)
}
}
+void
+brasero_dest_selection_set_session (BraseroDestSelection *selection,
+ BraseroBurnSession *session)
+{
+ BraseroDestSelectionPrivate *priv;
+
+ priv = BRASERO_DEST_SELECTION_PRIVATE (selection);
+
+ if (priv->session)
+ brasero_dest_selection_clean (selection);
+
+ if (!session)
+ return;
+
+ priv->session = g_object_ref (session);
+ if (brasero_burn_session_get_flags (session) & BRASERO_BURN_FLAG_MERGE) {
+ BraseroDrive *drive;
+
+ drive = brasero_burn_session_get_burner (session);
+ brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (selection),
+ brasero_drive_get_medium (drive));
+ }
+ else {
+ BraseroMedium *medium;
+
+ medium = brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (selection));
+ if (medium) {
+ brasero_burn_session_set_burner (session, brasero_medium_get_drive (medium));
+ g_object_unref (medium);
+ }
+ }
+
+ g_signal_connect (session,
+ "is-valid",
+ G_CALLBACK (brasero_dest_selection_valid_session),
+ selection);
+ g_signal_connect (session,
+ "output-changed",
+ G_CALLBACK (brasero_dest_selection_output_changed),
+ selection);
+ g_signal_connect (session,
+ "flags-changed",
+ G_CALLBACK (brasero_dest_selection_flags_changed),
+ selection);
+
+ brasero_medium_selection_update_media_string (BRASERO_MEDIUM_SELECTION (selection));
+}
+
static void
brasero_dest_selection_set_property (GObject *object,
guint property_id,
@@ -366,40 +415,7 @@ brasero_dest_selection_set_property (GObject *object,
/* NOTE: no need to unref a potential previous session since
* it's only set at construct time */
session = g_value_get_object (value);
- priv->session = session;
- g_object_ref (session);
-
- if (brasero_burn_session_get_flags (session) & BRASERO_BURN_FLAG_MERGE) {
- BraseroDrive *drive;
-
- drive = brasero_burn_session_get_burner (session);
- brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (object),
- brasero_drive_get_medium (drive));
- }
- else {
- BraseroMedium *medium;
-
- medium = brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (object));
- if (medium) {
- brasero_burn_session_set_burner (session, brasero_medium_get_drive (medium));
- g_object_unref (medium);
- }
- }
-
- priv->valid_sig = g_signal_connect (session,
- "is-valid",
- G_CALLBACK (brasero_dest_selection_valid_session),
- object);
- g_signal_connect (session,
- "output-changed",
- G_CALLBACK (brasero_dest_selection_output_changed),
- object);
- g_signal_connect (session,
- "flags-changed",
- G_CALLBACK (brasero_dest_selection_flags_changed),
- object);
-
- brasero_medium_selection_update_media_string (BRASERO_MEDIUM_SELECTION (object));
+ brasero_dest_selection_set_session (BRASERO_DEST_SELECTION (object), session);
break;
default:
@@ -622,7 +638,7 @@ brasero_dest_selection_class_init (BraseroDestSelectionClass *klass)
"The session",
"The session to work with",
BRASERO_TYPE_BURN_SESSION,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE));
}
GtkWidget *
diff --git a/libbrasero-burn/brasero-dest-selection.h b/libbrasero-burn/brasero-dest-selection.h
index d649862..0e46d51 100644
--- a/libbrasero-burn/brasero-dest-selection.h
+++ b/libbrasero-burn/brasero-dest-selection.h
@@ -66,6 +66,10 @@ GtkWidget *
brasero_dest_selection_new (BraseroBurnSession *selection);
void
+brasero_dest_selection_set_session (BraseroDestSelection *selection,
+ BraseroBurnSession *session);
+
+void
brasero_dest_selection_choose_best (BraseroDestSelection *selection);
G_END_DECLS
diff --git a/libbrasero-burn/brasero-session-cfg.c b/libbrasero-burn/brasero-session-cfg.c
index 2fd8a4c..0517e6d 100644
--- a/libbrasero-burn/brasero-session-cfg.c
+++ b/libbrasero-burn/brasero-session-cfg.c
@@ -526,7 +526,8 @@ brasero_session_cfg_set_drive_properties_flags (BraseroSessionCfg *self,
brasero_burn_session_add_flag (BRASERO_BURN_SESSION (self),
BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE);
- if (priv->supported & BRASERO_BURN_FLAG_FAST_BLANK)
+ if (priv->supported & BRASERO_BURN_FLAG_FAST_BLANK
+ && (media & BRASERO_MEDIUM_UNFORMATTED) == 0)
brasero_burn_session_add_flag (BRASERO_BURN_SESSION (self),
BRASERO_BURN_FLAG_FAST_BLANK);
diff --git a/libbrasero-burn/burn-job.c b/libbrasero-burn/burn-job.c
index 64c8bfb..08c98c4 100644
--- a/libbrasero-burn/burn-job.c
+++ b/libbrasero-burn/burn-job.c
@@ -1504,6 +1504,7 @@ brasero_job_get_device (BraseroJob *self, gchar **device)
session = brasero_task_ctx_get_session (priv->ctx);
drive = brasero_burn_session_get_burner (session);
+ g_print ("DRIVE %p %s\n", drive, brasero_drive_get_device (drive));
path = brasero_drive_get_device (drive);
*device = g_strdup (path);
diff --git a/plugins/growisofs/burn-dvd-rw-format.c b/plugins/growisofs/burn-dvd-rw-format.c
index e0be9c5..fc0365d 100644
--- a/plugins/growisofs/burn-dvd-rw-format.c
+++ b/plugins/growisofs/burn-dvd-rw-format.c
@@ -108,7 +108,8 @@ brasero_dvd_rw_format_set_argv (BraseroProcess *process,
brasero_job_get_flags (BRASERO_JOB (process), &flags);
if (!BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_BDRE)
&& !BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS)
- && !BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)) {
+ && !BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)
+ && (flags & BRASERO_BURN_FLAG_FAST_BLANK)) {
gchar *blank_str;
/* This creates a sequential DVD-RW */
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 502ec71..06157ba 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1450,10 +1450,13 @@ brasero_project_burn (BraseroProject *project)
project->priv->is_burning = 1;
+ /* This is to avoid having the settings being wrongly reflected or changed */
current_disc = project->priv->current;
brasero_disc_set_session_contents (current_disc, NULL);
project->priv->current = NULL;
+ brasero_dest_selection_set_session (BRASERO_DEST_SELECTION (project->priv->selection), NULL);
+
brasero_project_setup_session (project, BRASERO_BURN_SESSION (project->priv->session));
/* This is to stop the preview widget from playing */
@@ -1469,6 +1472,9 @@ brasero_project_burn (BraseroProject *project)
project->priv->current = current_disc;
brasero_disc_set_session_contents (current_disc, BRASERO_BURN_SESSION (project->priv->session));
+ brasero_dest_selection_set_session (BRASERO_DEST_SELECTION (project->priv->selection),
+ project->priv->session);
+
project->priv->is_burning = 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]