brasero r1272 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1272 - in trunk: . src
- Date: Sat, 13 Sep 2008 13:37:08 +0000 (UTC)
Author: philippr
Date: Sat Sep 13 13:37:08 2008
New Revision: 1272
URL: http://svn.gnome.org/viewvc/brasero?rev=1272&view=rev
Log:
Some more cleanups and work on flags management
Fix a problem with burn button being available for clicking when no
image is set as source in burn image dialog
Fix a problem with dummy still available with CLONE images
* src/brasero-dest-selection.c
(brasero_dest_selection_add_drive_properties_flags):
* src/brasero-disc-option-dialog.c
(brasero_disc_option_dialog_update_joliet):
* src/brasero-image-option-dialog.c
(brasero_image_option_dialog_set_track),
(brasero_image_option_dialog_changed),
(brasero_image_option_dialog_format_changed),
(brasero_image_option_dialog_file_changed),
(brasero_image_option_dialog_set_formats),
(brasero_image_option_dialog_valid_media_cb),
(brasero_image_option_dialog_init),
(brasero_image_option_dialog_finalize):
* src/brasero-image-type-chooser.c
(brasero_image_type_chooser_set_formats),
(brasero_image_type_chooser_get_format),
(brasero_image_type_chooser_changed_cb),
(brasero_image_type_chooser_finalize):
* src/burn-basics.h:
* src/burn-caps.c (brasero_caps_is_compatible_type),
(brasero_caps_find_link), (brasero_caps_try_output),
(brasero_caps_try_output_with_blanking),
(brasero_burn_caps_is_input_supported),
(brasero_burn_caps_is_output_supported),
(brasero_burn_caps_is_session_supported_same_src_dest),
(brasero_burn_caps_is_session_supported),
(brasero_burn_caps_get_required_media_type),
(brasero_caps_get_flags_for_disc),
(brasero_burn_caps_get_flags_for_medium),
(brasero_burn_caps_get_flags_same_src_dest):
* src/burn-caps.h:
Modified:
trunk/ChangeLog
trunk/src/brasero-dest-selection.c
trunk/src/brasero-disc-option-dialog.c
trunk/src/brasero-image-option-dialog.c
trunk/src/brasero-image-type-chooser.c
trunk/src/burn-basics.h
trunk/src/burn-caps.c
trunk/src/burn-caps.h
Modified: trunk/src/brasero-dest-selection.c
==============================================================================
--- trunk/src/brasero-dest-selection.c (original)
+++ trunk/src/brasero-dest-selection.c Sat Sep 13 13:37:08 2008
@@ -786,6 +786,17 @@
&& (flag & (BRASERO_BURN_FLAG_DAO|BRASERO_BURN_FLAG_RAW)))
continue;
+ if (compulsory
+ && (compulsory & brasero_burn_session_get_flags (priv->session)) != compulsory) {
+ brasero_burn_session_add_flag (priv->session, compulsory);
+ supported = BRASERO_BURN_FLAG_NONE;
+ compulsory = BRASERO_BURN_FLAG_NONE;
+ brasero_burn_caps_get_flags (priv->caps,
+ priv->session,
+ &supported,
+ &compulsory);
+ }
+
if (supported & flag) {
brasero_burn_session_add_flag (priv->session, flag);
supported = BRASERO_BURN_FLAG_NONE;
Modified: trunk/src/brasero-disc-option-dialog.c
==============================================================================
--- trunk/src/brasero-disc-option-dialog.c (original)
+++ trunk/src/brasero-disc-option-dialog.c Sat Sep 13 13:37:08 2008
@@ -268,13 +268,14 @@
if (!priv->joliet_toggle)
return FALSE;
- /* what we want to check is Joliet support */
+ /* what we want to check Joliet support */
brasero_burn_session_get_input_type (priv->session, &source);
source.subtype.fs_type |= BRASERO_IMAGE_FS_JOLIET;
result = brasero_burn_caps_is_input_supported (priv->caps,
priv->session,
- &source);
+ &source,
+ FALSE);
if (result == BRASERO_BURN_OK) {
if (GTK_WIDGET_IS_SENSITIVE (priv->joliet_toggle))
return FALSE;
Modified: trunk/src/brasero-image-option-dialog.c
==============================================================================
--- trunk/src/brasero-image-option-dialog.c (original)
+++ trunk/src/brasero-image-option-dialog.c Sat Sep 13 13:37:08 2008
@@ -59,9 +59,6 @@
BraseroBurnCaps *caps;
- gulong caps_sig;
- gulong session_sig;
-
BraseroIO *io;
BraseroIOJobBase *info_type;
@@ -93,6 +90,29 @@
/* add a track every time to send a signal */
if (priv->track) {
+ gchar *uri = NULL;
+ BraseroTrackType type = { 0, };
+
+ /* make sure something actually changed */
+ brasero_track_get_type (priv->track, &type);
+
+ if (image)
+ uri = brasero_track_get_image_source (priv->track, TRUE);
+ else if (toc)
+ uri = brasero_track_get_toc_source (priv->track, TRUE);
+
+ if (!toc && !image && !uri)
+ return;
+
+ if((format == type.subtype.img_format)
+ && uri && (image || toc)
+ && !strcmp (uri, image?image:toc)) {
+ g_free (uri);
+ return;
+ }
+
+ g_free (uri);
+
brasero_burn_session_clear_current_track (priv->session);
brasero_track_unref (priv->track);
}
@@ -226,8 +246,7 @@
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (dialog);
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (priv->file));
- brasero_image_type_chooser_get_format (BRASERO_IMAGE_TYPE_CHOOSER (priv->format),
- &format);
+ brasero_image_type_chooser_get_format (BRASERO_IMAGE_TYPE_CHOOSER (priv->format), &format);
switch (format) {
case BRASERO_IMAGE_FORMAT_NONE:
@@ -264,6 +283,20 @@
}
static void
+brasero_image_option_dialog_format_changed (BraseroImageTypeChooser *format,
+ BraseroImageOptionDialog *dialog)
+{
+ brasero_image_option_dialog_changed (dialog);
+}
+
+static void
+brasero_image_option_dialog_file_changed (GtkFileChooser *chooser,
+ BraseroImageOptionDialog *dialog)
+{
+ brasero_image_option_dialog_changed (dialog);
+}
+
+static void
brasero_image_option_dialog_set_formats (BraseroImageOptionDialog *dialog)
{
BraseroImageOptionDialogPrivate *priv;
@@ -295,42 +328,16 @@
input.subtype.img_format = format;
result = brasero_burn_caps_is_input_supported (priv->caps,
priv->session,
- &input);
+ &input,
+ FALSE);
if (result == BRASERO_BURN_OK)
formats |= format;
}
+
brasero_image_type_chooser_set_formats (BRASERO_IMAGE_TYPE_CHOOSER (priv->format),
formats);
}
-static void
-brasero_image_option_dialog_format_changed (BraseroImageTypeChooser *format,
- BraseroImageOptionDialog *dialog)
-{
- brasero_image_option_dialog_changed (dialog);
-}
-
-static void
-brasero_image_option_dialog_file_changed (GtkFileChooser *chooser,
- BraseroImageOptionDialog *dialog)
-{
- brasero_image_option_dialog_changed (dialog);
-}
-
-static void
-brasero_image_option_dialog_output_changed_cb (BraseroBurnSession *session,
- BraseroImageOptionDialog *dialog)
-{
- brasero_image_option_dialog_set_formats (dialog);
-}
-
-static void
-brasero_image_option_dialog_caps_changed (BraseroPluginManager *manager,
- BraseroImageOptionDialog *dialog)
-{
- brasero_image_option_dialog_set_formats (dialog);
-}
-
void
brasero_image_option_dialog_set_image_uri (BraseroImageOptionDialog *dialog,
const gchar *uri)
@@ -477,6 +484,8 @@
BraseroImageOptionDialogPrivate *priv;
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (self);
+
+ brasero_image_option_dialog_set_formats (self);
gtk_widget_set_sensitive (priv->button, valid);
}
@@ -509,7 +518,6 @@
GConfClient *client;
GtkWidget *box, *box1;
GtkFileFilter *filter;
- BraseroPluginManager *manager;
BraseroImageOptionDialogPrivate *priv;
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (obj);
@@ -532,11 +540,6 @@
GTK_RESPONSE_OK);
priv->caps = brasero_burn_caps_get_default ();
- manager = brasero_plugin_manager_get_default ();
- priv->caps_sig = g_signal_connect (manager,
- "caps-changed",
- G_CALLBACK (brasero_image_option_dialog_caps_changed),
- obj);
priv->session = brasero_burn_session_new ();
brasero_burn_session_add_flag (priv->session,
@@ -546,10 +549,6 @@
BRASERO_BURN_FLAG_CHECK_SIZE|
BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT|
BRASERO_BURN_FLAG_FAST_BLANK);
- priv->session_sig = g_signal_connect (priv->session,
- "output-changed",
- G_CALLBACK (brasero_image_option_dialog_output_changed_cb),
- obj);
/* first box */
priv->selection = brasero_dest_selection_new (priv->session);
@@ -706,19 +705,6 @@
priv->track = NULL;
}
- if (priv->caps_sig) {
- BraseroPluginManager *manager;
-
- manager = brasero_plugin_manager_get_default ();
- g_signal_handler_disconnect (manager, priv->caps_sig);
- priv->caps_sig = 0;
- }
-
- if (priv->session_sig) {
- g_signal_handler_disconnect (priv->session, priv->session_sig);
- priv->session_sig = 0;
- }
-
if (priv->session) {
g_object_unref (priv->session);
priv->session = NULL;
Modified: trunk/src/brasero-image-type-chooser.c
==============================================================================
--- trunk/src/brasero-image-type-chooser.c (original)
+++ trunk/src/brasero-image-type-chooser.c Sat Sep 13 13:37:08 2008
@@ -66,7 +66,9 @@
GtkWidget *combo;
BraseroBurnCaps *caps;
- BraseroImageFormat *formats;
+ BraseroImageFormat format;
+
+ guint updating:1;
};
static GtkHBoxClass *parent_class = NULL;
@@ -77,18 +79,16 @@
{
GtkTreeIter iter;
GtkTreeModel *store;
- BraseroImageFormat format;
BraseroImageTypeChooserPrivate *priv;
priv = BRASERO_IMAGE_TYPE_CHOOSER_PRIVATE (self);
+ priv->updating = TRUE;
+
/* clean */
store = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo));
gtk_list_store_clear (GTK_LIST_STORE (store));
- /* save the current format to restore it later */
- brasero_image_type_chooser_get_format (self, &format);
-
/* now we get the targets available and display them */
gtk_list_store_prepend (GTK_LIST_STORE (store), &iter);
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
@@ -128,7 +128,13 @@
-1);
}
- brasero_image_type_chooser_set_format (self, format);
+ priv->updating = FALSE;
+
+ /* Make sure the selected format is still supported */
+ if (priv->format & formats)
+ brasero_image_type_chooser_set_format (self, priv->format);
+ else
+ brasero_image_type_chooser_set_format (self, BRASERO_IMAGE_FORMAT_NONE);
}
void
@@ -176,28 +182,38 @@
brasero_image_type_chooser_get_format (BraseroImageTypeChooser *self,
BraseroImageFormat *format)
{
+ BraseroImageTypeChooserPrivate *priv;
+
+ priv = BRASERO_IMAGE_TYPE_CHOOSER_PRIVATE (self);
+ *format = priv->format;
+}
+
+static void
+brasero_image_type_chooser_changed_cb (GtkComboBox *combo,
+ BraseroImageTypeChooser *self)
+{
GtkTreeIter iter;
GtkTreeModel *store;
+ BraseroImageFormat current;
BraseroImageTypeChooserPrivate *priv;
priv = BRASERO_IMAGE_TYPE_CHOOSER_PRIVATE (self);
+ if (priv->updating)
+ return;
+
store = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo));
+ if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo), &iter))
+ gtk_tree_model_get (store, &iter,
+ FORMAT_TYPE, ¤t,
+ -1);
+ else
+ current = BRASERO_IMAGE_FORMAT_NONE;
- if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo), &iter)) {
- *format = BRASERO_IMAGE_FORMAT_NONE;
+ if (current == priv->format)
return;
- }
-
- gtk_tree_model_get (store, &iter,
- FORMAT_TYPE, format,
- -1);
-}
-static void
-brasero_image_type_chooser_changed_cb (GtkComboBox *combo,
- BraseroImageTypeChooser *self)
-{
+ priv->format = current;
g_signal_emit (self,
brasero_image_type_chooser_signals [CHANGED_SIGNAL],
0);
@@ -246,11 +262,6 @@
priv->caps = NULL;
}
- if (priv->formats) {
- g_free (priv->formats);
- priv->formats = NULL;
- }
-
G_OBJECT_CLASS (parent_class)->finalize (object);
}
Modified: trunk/src/burn-basics.h
==============================================================================
--- trunk/src/burn-basics.h (original)
+++ trunk/src/burn-basics.h Sat Sep 13 13:37:08 2008
@@ -124,7 +124,7 @@
brasero_burn_action_to_string (BraseroBurnAction action);
/* These flags are sorted by importance. That's done to solve the problem of
- * exclusive flags: that way MULTI will always win over any other flag if they
+ * exclusive flags: that way MERGE will always win over any other flag if they
* are exclusive. On the other hand DAO will always lose. */
typedef enum {
BRASERO_BURN_FLAG_NONE = 0,
@@ -152,7 +152,7 @@
BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE = 1 << 12,
BRASERO_BURN_FLAG_FAST_BLANK = 1 << 13,
- /* NOTE: these two are contradictory */
+ /* NOTE: these two are contradictory? */
BRASERO_BURN_FLAG_DAO = 1 << 14,
BRASERO_BURN_FLAG_RAW = 1 << 15,
Modified: trunk/src/burn-caps.c
==============================================================================
--- trunk/src/burn-caps.c (original)
+++ trunk/src/burn-caps.c Sat Sep 13 13:37:08 2008
@@ -267,7 +267,7 @@
}
}
-gboolean
+static gboolean
brasero_caps_is_compatible_type (const BraseroCaps *caps,
const BraseroTrackType *type)
{
@@ -289,6 +289,9 @@
break;
case BRASERO_TRACK_TYPE_IMAGE:
+ if (type->subtype.img_format == BRASERO_IMAGE_FORMAT_NONE)
+ return FALSE;
+
if ((caps->type.subtype.img_format & type->subtype.img_format) != type->subtype.img_format)
return FALSE;
break;
@@ -1739,6 +1742,7 @@
static gboolean
brasero_caps_find_link (BraseroCaps *caps,
BraseroBurnFlag session_flags,
+ gboolean use_flags,
BraseroMedia media,
BraseroTrackType *input,
BraseroPluginIOFlag io_flags)
@@ -1774,7 +1778,8 @@
/* since this link contains recorders, check that at least one
* of them can handle the record flags */
- if (caps->type.type == BRASERO_TRACK_TYPE_DISC
+ if (use_flags
+ && caps->type.type == BRASERO_TRACK_TYPE_DISC
&& !brasero_caps_link_check_record_flags (link, session_flags, media))
continue;
@@ -1782,7 +1787,8 @@
* - it must have the same caps (type + subtype)
* - it must have the proper IO */
if (link->caps->type.type == BRASERO_TRACK_TYPE_DATA) {
- if (!brasero_caps_link_check_data_flags (link, session_flags, media))
+ if (use_flags
+ && !brasero_caps_link_check_data_flags (link, session_flags, media))
continue;
}
else if (!brasero_caps_link_check_media_restrictions (link, media))
@@ -1802,6 +1808,7 @@
/* try to see where the inputs of this caps leads to */
result = brasero_caps_find_link (link->caps,
session_flags,
+ use_flags,
media,
input,
io_flags);
@@ -1814,6 +1821,7 @@
static gboolean
brasero_caps_try_output (BraseroBurnFlag session_flags,
+ gboolean use_flags,
BraseroTrackType *output,
BraseroTrackType *input,
BraseroPluginIOFlag flags)
@@ -1835,6 +1843,7 @@
return brasero_caps_find_link (caps,
session_flags,
+ use_flags,
media,
input,
flags);
@@ -1845,15 +1854,19 @@
BraseroBurnSession *session,
BraseroTrackType *output,
BraseroTrackType *input,
- BraseroPluginIOFlag io_flags)
+ BraseroPluginIOFlag io_flags,
+ gboolean use_flags)
{
gboolean result;
BraseroMedia media;
BraseroCaps *last_caps;
- BraseroBurnFlag session_flags;
+ BraseroBurnFlag session_flags = BRASERO_BURN_FLAG_NONE;
+
+ if (use_flags)
+ session_flags = brasero_burn_session_get_flags (session);
- session_flags = brasero_burn_session_get_flags (session);
result = brasero_caps_try_output (session_flags,
+ use_flags,
output,
input,
io_flags);
@@ -1879,8 +1892,8 @@
/* apparently nothing can be done to reach our goal. Maybe that
* is because we first have to blank the disc. If so add a blank
* task to the others as a first step */
- if (!(session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
- || brasero_burn_caps_can_blank (self, session) != BRASERO_BURN_OK)
+ if ((use_flags && !(session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE))
+ || brasero_burn_caps_can_blank (self, session) != BRASERO_BURN_OK)
return FALSE;
BRASERO_BURN_LOG ("Trying with initial blanking");
@@ -1899,12 +1912,9 @@
if (!last_caps)
return FALSE;
- /* if the flag BLANK_BEFORE_WRITE was set then remove it since
- * we are actually blanking. Simply the record plugin won't have
- * to do it. */
- session_flags &= ~BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
return brasero_caps_find_link (last_caps,
session_flags,
+ use_flags,
media,
input,
io_flags);
@@ -1913,13 +1923,14 @@
BraseroBurnResult
brasero_burn_caps_is_input_supported (BraseroBurnCaps *self,
BraseroBurnSession *session,
- BraseroTrackType *input)
+ BraseroTrackType *input,
+ gboolean use_flags)
{
gboolean result;
BraseroTrackType output;
BraseroPluginIOFlag io_flags;
- if (!brasero_burn_caps_flags_check_for_drive (session))
+ if (use_flags && !brasero_burn_caps_flags_check_for_drive (session))
BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
if (!brasero_burn_session_is_dest_file (session)) {
@@ -1942,13 +1953,16 @@
BRASERO_BURN_LOG_TYPE (input, "Checking support for input");
BRASERO_BURN_LOG_TYPE (&output, "and output");
- BRASERO_BURN_LOG_FLAGS (brasero_burn_session_get_flags (session), "with flags");
+
+ if (use_flags)
+ BRASERO_BURN_LOG_FLAGS (brasero_burn_session_get_flags (session), "with flags");
result = brasero_caps_try_output_with_blanking (self,
session,
&output,
input,
- io_flags);
+ io_flags,
+ use_flags);
if (!result) {
BRASERO_BURN_LOG_TYPE (input, "Input not supported");
return BRASERO_BURN_NOT_SUPPORTED;
@@ -1973,10 +1987,8 @@
* The only thing we could do would be to check some known forbidden
* flags for some media provided the output type is DISC. */
- /* Here flags don't matter as we don't record anything.
- * Even the IOFlags since that can be checked later with
- * brasero_burn_caps_get_flags.
- */
+ /* Here flags don't matter as we don't record anything. Even the IOFlags
+ * since that can be checked later with brasero_burn_caps_get_flags. */
if (BRASERO_BURN_SESSION_NO_TMP_FILE (session))
io_flags = BRASERO_PLUGIN_IO_ACCEPT_PIPE;
else
@@ -1991,7 +2003,8 @@
session,
output,
&input,
- io_flags);
+ io_flags,
+ TRUE);
if (!result) {
BRASERO_BURN_LOG_TYPE (output, "Output not supported");
return BRASERO_BURN_NOT_SUPPORTED;
@@ -2047,7 +2060,8 @@
session,
&output,
&input,
- BRASERO_PLUGIN_IO_ACCEPT_FILE);
+ BRASERO_PLUGIN_IO_ACCEPT_FILE,
+ TRUE);
if (!supported)
continue;
@@ -2063,6 +2077,7 @@
continue;
result = brasero_caps_find_link (caps,
+ TRUE,
session_flags,
caps->type.subtype.media,
&input,
@@ -2127,7 +2142,8 @@
session,
&output,
&input,
- io_flags);
+ io_flags,
+ TRUE);
if (!result) {
BRASERO_BURN_LOG_TYPE (&output, "Output not supported");
return BRASERO_BURN_NOT_SUPPORTED;
@@ -2182,6 +2198,7 @@
/* Put BRASERO_MEDIUM_NONE so we can always succeed */
result = brasero_caps_find_link (caps,
session_flags,
+ TRUE,
BRASERO_MEDIUM_NONE,
&input,
io_flags);
@@ -2374,16 +2391,18 @@
/* RAW write mode should (must) only be used in this case */
if ((supported_flags & BRASERO_BURN_FLAG_RAW)
&& input->type == BRASERO_TRACK_TYPE_IMAGE
- && input->subtype.img_format == BRASERO_IMAGE_FORMAT_CLONE)
+ && input->subtype.img_format == BRASERO_IMAGE_FORMAT_CLONE) {
+ supported_flags &= ~BRASERO_BURN_FLAG_DAO;
+ compulsory_flags &= ~BRASERO_BURN_FLAG_DAO;
compulsory_flags |= BRASERO_BURN_FLAG_RAW;
+ }
else
supported_flags &= ~BRASERO_BURN_FLAG_RAW;
if (io_flags & BRASERO_PLUGIN_IO_ACCEPT_PIPE) {
supported_flags |= BRASERO_BURN_FLAG_NO_TMP_FILES;
- if ((session_flags & BRASERO_BURN_FLAG_NO_TMP_FILES)
- && (io_flags & BRASERO_PLUGIN_IO_ACCEPT_FILE) == 0)
+ if ((io_flags & BRASERO_PLUGIN_IO_ACCEPT_FILE) == 0)
compulsory_flags |= BRASERO_BURN_FLAG_NO_TMP_FILES;
}
@@ -2490,6 +2509,10 @@
(*compulsory_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
}
+ /* FIXME! we should restart the whole process if
+ * ((session_flags & compulsory_flags) != compulsory_flags) since that
+ * means that some supported files could be excluded but were not */
+
return BRASERO_BURN_OK;
}
@@ -2548,7 +2571,8 @@
session,
&output,
&input,
- BRASERO_PLUGIN_IO_ACCEPT_FILE);
+ BRASERO_PLUGIN_IO_ACCEPT_FILE,
+ TRUE);
if (!format_supported) {
BRASERO_BURN_LOG_TYPE (&output, "Format not supported");
continue;
Modified: trunk/src/burn-caps.h
==============================================================================
--- trunk/src/burn-caps.h (original)
+++ trunk/src/burn-caps.h Sat Sep 13 13:37:08 2008
@@ -104,7 +104,8 @@
BraseroBurnResult
brasero_burn_caps_is_input_supported (BraseroBurnCaps *caps,
BraseroBurnSession *session,
- BraseroTrackType *input);
+ BraseroTrackType *input,
+ gboolean use_flags);
BraseroBurnResult
brasero_burn_caps_is_output_supported (BraseroBurnCaps *caps,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]