brasero r1303 - in trunk: . po src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1303 - in trunk: . po src
- Date: Wed, 24 Sep 2008 11:43:06 +0000 (UTC)
Author: philippr
Date: Wed Sep 24 11:43:06 2008
New Revision: 1303
URL: http://svn.gnome.org/viewvc/brasero?rev=1303&view=rev
Log:
Move size check to a parent dialog class BraseroBurnOptions
Allow overburn to be activated for any type of project
* src/Makefile.am:
* src/brasero-audio-disc.c (brasero_audio_disc_set_session_param):
* src/brasero-data-disc.c (brasero_data_disc_set_session_param):
* src/brasero-dest-selection.c
(brasero_dest_selection_image_properties),
(brasero_dest_selection_update_image_output),
(brasero_dest_selection_valid_session),
(brasero_dest_selection_init), (brasero_dest_selection_finalize),
(brasero_dest_selection_set_property):
* src/brasero-disc-copy-dialog.c (brasero_disc_copy_dialog_init),
(brasero_disc_copy_dialog_finalize):
* src/brasero-disc-copy-dialog.h:
* src/brasero-disc-option-dialog.c
(brasero_disc_option_dialog_save_multi_state),
(brasero_disc_option_dialog_load_multi_state),
(brasero_disc_option_dialog_get_default_label),
(brasero_disc_option_dialog_update_label),
(brasero_disc_option_dialog_update_joliet),
(brasero_disc_option_dialog_update_multi),
(brasero_disc_option_dialog_update_video),
(brasero_disc_option_dialog_set_joliet),
(brasero_disc_option_dialog_set_multi),
(brasero_disc_option_label_changed),
(brasero_disc_option_dialog_title_widget),
(brasero_disc_option_dialog_joliet_widget),
(brasero_disc_option_dialog_add_data_options),
(brasero_disc_option_dialog_add_audio_options),
(brasero_disc_option_dialog_AC3), (brasero_disc_option_dialog_MP2),
(brasero_disc_option_dialog_set_tag),
(brasero_disc_option_dialog_native_framerate),
(brasero_disc_option_dialog_native_aspect),
(brasero_disc_option_dialog_add_video_options),
(brasero_disc_option_dialog_set_disc),
(brasero_disc_option_dialog_get_session),
(brasero_disc_option_dialog_valid_media_cb),
(brasero_disc_option_dialog_init),
(brasero_disc_option_dialog_finalize):
* src/brasero-disc-option-dialog.h:
* src/brasero-drive-selection.c
(brasero_drive_selection_set_button),
(brasero_drive_selection_init):
* src/brasero-image-option-dialog.c
(brasero_image_option_dialog_set_track),
(brasero_image_option_dialog_set_formats),
(brasero_image_option_dialog_get_session),
(brasero_image_option_dialog_valid_media_cb),
(brasero_image_option_dialog_init),
(brasero_image_option_dialog_finalize):
* src/brasero-image-option-dialog.h:
* src/brasero-project-manager.c
(brasero_project_manager_copy_disc):
* src/brasero-project-size.c (brasero_project_size_check_status):
* src/brasero-project.c:
* src/brasero-session-cfg.c
(brasero_session_cfg_set_drive_properties),
(brasero_session_cfg_check_size), (brasero_session_cfg_update),
(brasero_session_cfg_check), (brasero_session_cfg_add_flags),
(brasero_session_cfg_class_init):
* src/brasero-session-cfg.h:
* src/brasero-utils.c (brasero_utils_pack_properties_list):
* src/brasero-video-disc.c (brasero_video_disc_set_session_param):
Modified:
trunk/ChangeLog
trunk/po/ChangeLog
trunk/po/POTFILES.in
trunk/src/Makefile.am
trunk/src/brasero-audio-disc.c
trunk/src/brasero-data-disc.c
trunk/src/brasero-dest-selection.c
trunk/src/brasero-disc-copy-dialog.c
trunk/src/brasero-disc-copy-dialog.h
trunk/src/brasero-disc-option-dialog.c
trunk/src/brasero-disc-option-dialog.h
trunk/src/brasero-drive-selection.c
trunk/src/brasero-image-option-dialog.c
trunk/src/brasero-image-option-dialog.h
trunk/src/brasero-project-manager.c
trunk/src/brasero-project-size.c
trunk/src/brasero-project.c
trunk/src/brasero-session-cfg.c
trunk/src/brasero-session-cfg.h
trunk/src/brasero-utils.c
trunk/src/brasero-video-disc.c
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Wed Sep 24 11:43:06 2008
@@ -1,6 +1,7 @@
# List of source files containing translatable strings.
[encoding: UTF-8]
+src/brasero-burn-options.c
src/brasero-src-info.c
src/brasero-app.c
data/brasero.desktop.in.in
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Sep 24 11:43:06 2008
@@ -274,7 +274,9 @@
brasero-src-info.c \
brasero-src-info.h \
brasero-session-cfg.h \
- brasero-session-cfg.c
+ brasero-session-cfg.c \
+ brasero-burn-options.h \
+ brasero-burn-options.c
if BUILD_INOTIFY
brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h
Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c (original)
+++ trunk/src/brasero-audio-disc.c Wed Sep 24 11:43:06 2008
@@ -70,6 +70,7 @@
#include "brasero-song-properties.h"
#include "brasero-io.h"
#include "brasero-split-dialog.h"
+#include "brasero-session-cfg.h"
#include "eggtreemultidnd.h"
#ifdef BUILD_INOTIFY
@@ -256,7 +257,6 @@
BraseroIOJobBase *add_uri;
BraseroIOJobBase *add_playlist;
-
GtkWidget *notebook;
GtkWidget *tree;
@@ -2015,10 +2015,19 @@
BraseroBurnSession *session)
{
BraseroTrackType type;
+ GValue *value = NULL;
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_INT64);
+ g_value_set_int64 (value, BRASERO_AUDIO_DISC (disc)->priv->sectors);
+ brasero_burn_session_tag_add (session,
+ BRASERO_AUDIO_TRACK_SIZE_TAG,
+ value);
type.type = BRASERO_TRACK_TYPE_AUDIO;
type.subtype.audio_format = BRASERO_AUDIO_FORMAT_UNDEFINED;
brasero_burn_session_set_input_type (session, &type);
+
return BRASERO_BURN_OK;
}
Modified: trunk/src/brasero-data-disc.c
==============================================================================
--- trunk/src/brasero-data-disc.c (original)
+++ trunk/src/brasero-data-disc.c Wed Sep 24 11:43:06 2008
@@ -61,6 +61,7 @@
#include "brasero-disc-message.h"
#include "brasero-rename.h"
#include "brasero-notify.h"
+#include "brasero-session-cfg.h"
#include "brasero-app.h"
#include "brasero-project-manager.h"
@@ -1336,6 +1337,7 @@
brasero_data_disc_set_session_param (BraseroDisc *self,
BraseroBurnSession *session)
{
+ GValue *value;
BraseroFileNode *root;
BraseroTrackType type;
BraseroImageFS fs_type;
@@ -1360,9 +1362,12 @@
if (brasero_data_project_is_video_project (priv->project))
fs_type |= BRASERO_IMAGE_FS_VIDEO;
- type.type = BRASERO_TRACK_TYPE_DATA;
- type.subtype.fs_type = fs_type;
- brasero_burn_session_set_input_type (session, &type);
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_INT64);
+ g_value_set_int64 (value, brasero_data_project_get_size (priv->project));
+ brasero_burn_session_tag_add (session,
+ BRASERO_DATA_TRACK_SIZE_TAG,
+ value);
/* set multisession options */
if (brasero_data_session_get_loaded_medium (BRASERO_DATA_SESSION (priv->project))) {
@@ -1374,6 +1379,10 @@
brasero_burn_session_set_burner (session, brasero_data_session_get_loaded_medium (BRASERO_DATA_SESSION (priv->project)));
}
+ type.type = BRASERO_TRACK_TYPE_DATA;
+ type.subtype.fs_type = fs_type;
+ brasero_burn_session_set_input_type (session, &type);
+
return BRASERO_DISC_OK;
}
Modified: trunk/src/brasero-dest-selection.c
==============================================================================
--- trunk/src/brasero-dest-selection.c (original)
+++ trunk/src/brasero-dest-selection.c Wed Sep 24 11:43:06 2008
@@ -47,6 +47,7 @@
#include "burn-track.h"
#include "burn-medium.h"
#include "burn-session.h"
+#include "brasero-session-cfg.h"
#include "burn-plugin-manager.h"
#include "burn-drive.h"
#include "brasero-drive-selection.h"
@@ -62,13 +63,10 @@
BraseroBurnCaps *caps;
BraseroBurnSession *session;
- GtkWidget *info;
-
GtkWidget *drive_prop;
GtkWidget *button;
- GtkWidget *copies_box;
- GtkWidget *copies_spin;
+ glong valid_sig;
guint default_format:1;
guint default_path:1;
@@ -468,7 +466,6 @@
gtk_widget_destroy (priv->drive_prop);
priv->drive_prop = NULL;
- brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), image_path);
brasero_dest_selection_set_output_path (self,
format,
image_path);
@@ -544,7 +541,6 @@
/* Now check, fix the output path, _provided__the__format__changed_ */
if (valid_format == format) {
- brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), path);
g_free (path);
return;
}
@@ -565,9 +561,6 @@
g_free (tmp);
}
- /* Do it now !!! before a possible nested "is-valid" signal is fired */
- brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), path);
-
/* we always need to do this */
brasero_dest_selection_set_output_path (self,
valid_format,
@@ -589,7 +582,7 @@
static void
brasero_dest_selection_valid_session (BraseroBurnSession *session,
- gboolean is_valid,
+ BraseroSessionError is_valid,
BraseroDestSelection *self)
{
BraseroDestSelectionPrivate *priv;
@@ -614,33 +607,16 @@
g_object_unref (drive);
if (!burner) {
- gtk_widget_set_sensitive (priv->button, is_valid);
+ gtk_widget_set_sensitive (priv->button, is_valid == BRASERO_SESSION_VALID);
return;
}
/* do it now !!! */
- gtk_widget_set_sensitive (priv->button, is_valid);
-
- if (!brasero_drive_is_fake (burner)) {
- gint numcopies;
-
- numcopies = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->copies_spin));
- brasero_burn_session_set_num_copies (priv->session, numcopies);
- gtk_widget_set_sensitive (priv->copies_box, is_valid);
- gtk_widget_show (priv->copies_box);
-
- brasero_drive_info_set_medium (BRASERO_DRIVE_INFO (priv->info),
- brasero_drive_get_medium (drive));
- brasero_drive_info_set_same_src_dest (BRASERO_DRIVE_INFO (priv->info),
- brasero_burn_session_same_src_dest_drive (priv->session));
- }
- else {
- gtk_widget_hide (priv->copies_box);
- brasero_burn_session_set_num_copies (priv->session, 1);
+ gtk_widget_set_sensitive (priv->button, is_valid == BRASERO_SESSION_VALID);
+ if (brasero_drive_is_fake (burner))
/* need to update the format and perhaps the path */
- brasero_dest_selection_update_image_output (self, is_valid);
- }
+ brasero_dest_selection_update_image_output (self, is_valid == BRASERO_SESSION_VALID);
}
static void
@@ -656,33 +632,12 @@
}
static void
-brasero_dest_selection_copies_num_changed_cb (GtkSpinButton *button,
- BraseroDestSelection *self)
-{
- gint numcopies;
- BraseroDestSelectionPrivate *priv;
-
- priv = BRASERO_DEST_SELECTION_PRIVATE (self);
- numcopies = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->copies_spin));
- brasero_burn_session_set_num_copies (priv->session, numcopies);
-}
-
-static void
brasero_dest_selection_init (BraseroDestSelection *object)
{
BraseroDestSelectionPrivate *priv;
- GtkWidget *label;
priv = BRASERO_DEST_SELECTION_PRIVATE (object);
- priv->info = brasero_drive_info_new ();
- gtk_widget_show (priv->info);
- gtk_box_pack_start (GTK_BOX (object),
- priv->info,
- FALSE,
- FALSE,
- 0);
-
priv->caps = brasero_burn_caps_get_default ();
priv->button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES);
@@ -699,23 +654,6 @@
brasero_drive_selection_set_button (BRASERO_DRIVE_SELECTION (object),
priv->button);
- priv->copies_box = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (priv->copies_box);
- gtk_box_pack_end (GTK_BOX (object), priv->copies_box, FALSE, FALSE, 0);
-
- label = gtk_label_new (_("Number of copies "));
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (priv->copies_box), label, FALSE, FALSE, 0);
-
- priv->copies_spin = gtk_spin_button_new_with_range (1.0, 99.0, 1.0);
- gtk_widget_show (priv->copies_spin);
- gtk_box_pack_start (GTK_BOX (priv->copies_box), priv->copies_spin, FALSE, FALSE, 0);
- g_signal_connect (priv->copies_spin,
- "value-changed",
- G_CALLBACK (brasero_dest_selection_copies_num_changed_cb),
- object);
-
/* Only show media on which we can write and which are in a burner.
* There is one exception though, when we're copying media and when the
* burning device is the same as the dest device. */
@@ -739,6 +677,12 @@
priv->caps = NULL;
}
+ if (priv->valid_sig) {
+ g_signal_handler_disconnect (priv->session,
+ priv->valid_sig);
+ priv->valid_sig = 0;
+ }
+
if (priv->session) {
g_object_unref (priv->session);
priv->session = NULL;
@@ -770,10 +714,10 @@
* it's only set at construct time */
priv->session = session;
g_object_ref (session);
- g_signal_connect (session,
- "is-valid",
- G_CALLBACK (brasero_dest_selection_valid_session),
- object);
+ priv->valid_sig = g_signal_connect (session,
+ "is-valid",
+ G_CALLBACK (brasero_dest_selection_valid_session),
+ object);
drive = brasero_drive_selection_get_drive (BRASERO_DRIVE_SELECTION (object));
brasero_burn_session_set_burner (session, drive);
Modified: trunk/src/brasero-disc-copy-dialog.c
==============================================================================
--- trunk/src/brasero-disc-copy-dialog.c (original)
+++ trunk/src/brasero-disc-copy-dialog.c Wed Sep 24 11:43:06 2008
@@ -25,14 +25,14 @@
*/
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
@@ -53,16 +53,12 @@
#include "brasero-disc-copy-dialog.h"
#include "brasero-dest-selection.h"
#include "brasero-src-selection.h"
+#include "brasero-burn-options.h"
-G_DEFINE_TYPE (BraseroDiscCopyDialog, brasero_disc_copy_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (BraseroDiscCopyDialog, brasero_disc_copy_dialog, BRASERO_TYPE_BURN_OPTIONS);
struct BraseroDiscCopyDialogPrivate {
- GtkWidget *selection;
GtkWidget *source;
-
- GtkWidget *button;
-
- BraseroBurnSession *session;
};
typedef struct BraseroDiscCopyDialogPrivate BraseroDiscCopyDialogPrivate;
@@ -70,16 +66,6 @@
static GObjectClass *parent_class = NULL;
-BraseroBurnSession *
-brasero_disc_copy_dialog_get_session (BraseroDiscCopyDialog *self)
-{
- BraseroDiscCopyDialogPrivate *priv;
-
- priv = BRASERO_DISC_COPY_DIALOG_PRIVATE (self);
- g_object_ref (priv->session);
- return priv->session;
-}
-
gboolean
brasero_disc_copy_dialog_set_drive (BraseroDiscCopyDialog *self,
BraseroDrive *drive)
@@ -91,78 +77,30 @@
}
static void
-brasero_disc_copy_dialog_valid_media_cb (BraseroBurnSession *session,
- gboolean valid,
- BraseroDiscCopyDialog *self)
-{
- BraseroDiscCopyDialogPrivate *priv;
-
- priv = BRASERO_DISC_COPY_DIALOG_PRIVATE (self);
- gtk_widget_set_sensitive (priv->button, valid);
-}
-
-static void
brasero_disc_copy_dialog_init (BraseroDiscCopyDialog *obj)
{
gchar *title_str;
- GtkWidget *button;
+ BraseroBurnSession *session;
BraseroDiscCopyDialogPrivate *priv;
priv = BRASERO_DISC_COPY_DIALOG_PRIVATE (obj);
- gtk_dialog_set_has_separator (GTK_DIALOG (obj), FALSE);
gtk_window_set_title (GTK_WINDOW (obj), _("CD/DVD Copy Options"));
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_widget_show (button);
- gtk_dialog_add_action_widget (GTK_DIALOG (obj),
- button,
- GTK_RESPONSE_CANCEL);
-
- priv->button = brasero_utils_make_button (_("_Copy"),
- NULL,
- "media-optical-burn",
- GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (priv->button);
- gtk_dialog_add_action_widget (GTK_DIALOG (obj),
- priv->button,
- GTK_RESPONSE_OK);
-
- /* create a session and add some default sane flags */
- priv->session = BRASERO_BURN_SESSION (brasero_session_cfg_new ());
- g_signal_connect (priv->session,
- "is_valid",
- G_CALLBACK (brasero_disc_copy_dialog_valid_media_cb),
- obj);
-
- brasero_burn_session_add_flag (priv->session,
- BRASERO_BURN_FLAG_NOGRACE|
- BRASERO_BURN_FLAG_CHECK_SIZE|
- BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT);
+ brasero_burn_options_add_burn_button (BRASERO_BURN_OPTIONS (obj),
+ _("_Copy"),
+ "media-optical-burn");
/* take care of source media */
- priv->source = brasero_src_selection_new (priv->session);
- title_str = g_strdup_printf ("<b>%s</b>", _("Select disc to copy"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (obj)->vbox),
- brasero_utils_pack_properties (title_str,
- priv->source,
- NULL),
- FALSE,
- FALSE,
- 0);
- g_free (title_str);
-
- /* destination drive */
- priv->selection = brasero_dest_selection_new (priv->session);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (obj));
+ priv->source = brasero_src_selection_new (session);
+ g_object_unref (session);
- title_str = g_strdup_printf ("<b>%s</b>", _("Select a disc to write to"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (obj)->vbox),
- brasero_utils_pack_properties (title_str,
- priv->selection,
- NULL),
- FALSE,
- FALSE,
- 0);
+ title_str = g_strdup_printf ("<b>%s</b>", _("Select disc to copy"));
+ brasero_burn_options_add_source (BRASERO_BURN_OPTIONS (obj),
+ title_str,
+ priv->source,
+ NULL);
g_free (title_str);
/* only show media with something to be read on them */
@@ -172,22 +110,14 @@
/* This is a special case. When we're copying, someone may want to read
* and burn to the same drive so provided that the drive is a burner
* then show its contents. */
- brasero_drive_selection_set_type_shown (BRASERO_DRIVE_SELECTION (priv->selection),
- BRASERO_MEDIA_TYPE_ANY_IN_BURNER|
- BRASERO_MEDIA_TYPE_FILE);
+ brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (obj),
+ BRASERO_MEDIA_TYPE_ANY_IN_BURNER|
+ BRASERO_MEDIA_TYPE_FILE);
}
static void
brasero_disc_copy_dialog_finalize (GObject *object)
{
- BraseroDiscCopyDialogPrivate *priv;
-
- priv = BRASERO_DISC_COPY_DIALOG_PRIVATE (object);
- if (priv->session) {
- g_object_unref (priv->session);
- priv->session = NULL;
- }
-
G_OBJECT_CLASS (parent_class)->finalize (object);
}
Modified: trunk/src/brasero-disc-copy-dialog.h
==============================================================================
--- trunk/src/brasero-disc-copy-dialog.h (original)
+++ trunk/src/brasero-disc-copy-dialog.h Wed Sep 24 11:43:06 2008
@@ -32,7 +32,7 @@
#include <gtk/gtkdialog.h>
-#include "burn-session.h"
+#include "brasero-burn-options.h"
#include "burn-drive.h"
G_BEGIN_DECLS
@@ -45,11 +45,11 @@
#define BRASERO_DISC_COPY_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BRASERO_TYPE_DISC_COPY_DIALOG, BraseroDiscCopyDialogClass))
typedef struct {
- GtkDialog parent;
+ BraseroBurnOptions parent;
} BraseroDiscCopyDialog;
typedef struct {
- GtkDialogClass parent_class;
+ BraseroBurnOptionsClass parent_class;
} BraseroDiscCopyDialogClass;
GType brasero_disc_copy_dialog_get_type ();
@@ -57,9 +57,6 @@
GtkWidget *
brasero_disc_copy_dialog_new ();
-BraseroBurnSession *
-brasero_disc_copy_dialog_get_session (BraseroDiscCopyDialog *self);
-
gboolean
brasero_disc_copy_dialog_set_drive (BraseroDiscCopyDialog *self,
BraseroDrive *drive);
Modified: trunk/src/brasero-disc-option-dialog.c
==============================================================================
--- trunk/src/brasero-disc-option-dialog.c (original)
+++ trunk/src/brasero-disc-option-dialog.c Wed Sep 24 11:43:06 2008
@@ -53,26 +53,20 @@
#include "brasero-session-cfg.h"
#include "brasero-disc.h"
#include "brasero-utils.h"
+#include "brasero-burn-options.h"
-G_DEFINE_TYPE (BraseroDiscOptionDialog, brasero_disc_option_dialog, GTK_TYPE_DIALOG);
-struct _BraseroDiscOptionDialogPrivate {
- BraseroBurnSession *session;
+G_DEFINE_TYPE (BraseroDiscOptionDialog, brasero_disc_option_dialog, BRASERO_TYPE_BURN_OPTIONS);
+struct _BraseroDiscOptionDialogPrivate {
BraseroBurnCaps *caps;
BraseroDisc *disc;
- guint caps_sig;
- guint output_sig;
-
GtkWidget *joliet_toggle;
GtkWidget *multi_toggle;
- GtkWidget *selection;
GtkWidget *label;
- GtkWidget *button;
-
GtkWidget *video_options;
GtkWidget *dvd_audio;
GtkWidget *vcd_label;
@@ -82,6 +76,8 @@
guint label_modified:1;
guint joliet_warning:1;
+ gulong valid_sig;
+
guint checksum_saved:1;
guint joliet_saved:1;
guint multi_saved:1;
@@ -96,21 +92,26 @@
brasero_disc_option_dialog_save_multi_state (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
GConfClient *client;
gboolean multi_on;
gchar *key;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
- key = brasero_burn_session_get_config_key (priv->session, "multi");
- if (!key)
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ key = brasero_burn_session_get_config_key (session, "multi");
+ if (!key) {
+ g_object_unref (session);
return;
+ }
- multi_on = (brasero_burn_session_get_flags (priv->session) & BRASERO_BURN_FLAG_MULTI) != 0;
+ multi_on = (brasero_burn_session_get_flags (session) & BRASERO_BURN_FLAG_MULTI) != 0;
client = gconf_client_get_default ();
gconf_client_set_int (client, key, multi_on, NULL);
g_object_unref (client);
+ g_object_unref (session);
g_free (key);
}
@@ -118,19 +119,25 @@
brasero_disc_option_dialog_load_multi_state (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
GConfClient *client;
gboolean multi_on;
gchar *key;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+
/* That's only provided multi is not compulsory or unsupported */
- key = brasero_burn_session_get_config_key (priv->session, "multi");
- if (!key)
+ key = brasero_burn_session_get_config_key (session, "multi");
+ if (!key) {
+ g_object_unref (session);
return;
+ }
client = gconf_client_get_default ();
multi_on = gconf_client_get_int (client, key, NULL);
+ g_object_unref (session);
g_object_unref (client);
g_free (key);
@@ -169,12 +176,15 @@
BraseroDrive *drive;
gchar *title_str = NULL;
BraseroTrackType source;
+ BraseroBurnSession *session;
BraseroDiscOptionDialogPrivate *priv;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
- brasero_burn_session_get_input_type (priv->session, &source);
- drive = brasero_drive_selection_get_drive (BRASERO_DRIVE_SELECTION (priv->selection));
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+
+ brasero_burn_session_get_input_type (session, &source);
+ drive = brasero_burn_session_get_burner (session);
t = time (NULL);
strftime (buffer, sizeof (buffer), "%d %b %y", localtime (&t));
@@ -182,7 +192,7 @@
if (source.type == BRASERO_TRACK_TYPE_DATA) {
BraseroBurnFlag flags;
- flags = brasero_burn_session_get_flags (priv->session);
+ flags = brasero_burn_session_get_flags (session);
if (flags & BRASERO_BURN_FLAG_MERGE) {
BraseroMedium *medium;
@@ -219,9 +229,6 @@
}
}
- if (drive)
- g_object_unref (drive);
-
if (strlen (title_str) > 32) {
gchar *tmp;
@@ -231,6 +238,8 @@
title_str = tmp;
}
+ g_object_unref (session);
+
return title_str;
}
@@ -238,6 +247,7 @@
brasero_disc_option_dialog_update_label (BraseroDiscOptionDialog *dialog)
{
gchar *label;
+ BraseroBurnSession *session;
BraseroDiscOptionDialogPrivate *priv;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
@@ -249,7 +259,10 @@
gtk_entry_set_text (GTK_ENTRY (priv->label), label);
g_free (label);
- brasero_burn_session_set_label (priv->session, label);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_burn_session_set_label (session, label);
+ g_object_unref (session);
+
return TRUE;
}
@@ -263,6 +276,7 @@
{
BraseroTrackType source;
BraseroBurnResult result;
+ BraseroBurnSession *session;
BraseroDiscOptionDialogPrivate *priv;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
@@ -270,41 +284,51 @@
return FALSE;
/* what we want to check Joliet support */
- brasero_burn_session_get_input_type (priv->session, &source);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_burn_session_get_input_type (session, &source);
source.subtype.fs_type |= BRASERO_IMAGE_FS_JOLIET;
result = brasero_burn_caps_is_input_supported (priv->caps,
- priv->session,
+ session,
&source,
FALSE);
if (result == BRASERO_BURN_OK) {
- if (GTK_WIDGET_IS_SENSITIVE (priv->joliet_toggle))
+ if (GTK_WIDGET_IS_SENSITIVE (priv->joliet_toggle)) {
+ g_object_unref (session);
return FALSE;
+ }
gtk_widget_set_sensitive (priv->joliet_toggle, TRUE);
- if (!priv->joliet_saved)
+ if (!priv->joliet_saved) {
+ g_object_unref (session);
return FALSE;
+ }
source.subtype.fs_type |= BRASERO_IMAGE_FS_JOLIET;
- brasero_burn_session_set_input_type (priv->session, &source);
+ brasero_burn_session_set_input_type (session, &source);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->joliet_toggle), priv->joliet_saved);
+ g_object_unref (session);
return TRUE;
}
- if (!GTK_WIDGET_IS_SENSITIVE (priv->joliet_toggle))
+ if (!GTK_WIDGET_IS_SENSITIVE (priv->joliet_toggle)) {
+ g_object_unref (session);
return FALSE;
+ }
priv->joliet_saved = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->joliet_toggle));
if (priv->joliet_saved) {
source.subtype.fs_type &= ~BRASERO_IMAGE_FS_JOLIET;
- brasero_burn_session_set_input_type (priv->session, &source);
+ brasero_burn_session_set_input_type (session, &source);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->joliet_toggle), FALSE);
}
gtk_widget_set_sensitive (priv->joliet_toggle, FALSE);
+ g_object_unref (session);
+
return TRUE;
}
@@ -312,6 +336,7 @@
brasero_disc_option_dialog_update_multi (BraseroDiscOptionDialog *dialog)
{
BraseroTrackType input;
+ BraseroBurnSession *session;
BraseroDiscOptionDialogPrivate *priv;
BraseroBurnFlag supported = BRASERO_BURN_FLAG_NONE;
BraseroBurnFlag compulsory = BRASERO_BURN_FLAG_NONE;
@@ -321,30 +346,29 @@
if (!priv->multi_toggle)
return;
- brasero_burn_session_get_input_type (priv->session, &input);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_burn_session_get_input_type (session, &input);
if (input.type == BRASERO_TRACK_TYPE_DATA
&& (input.subtype.fs_type & BRASERO_IMAGE_FS_VIDEO)
- && (brasero_burn_session_get_dest_media (priv->session) & (BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_DVD_DL))) {
+ && (brasero_burn_session_get_dest_media (session) & (BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_DVD_DL))) {
gtk_widget_set_sensitive (priv->multi_toggle, FALSE);
goto end;
}
/* Wipe out some flags before trying to see if MULTI is supported:
- * DAO/BLANK_BEFORE_WRITE don't really get along well with MULTI */
- brasero_burn_session_remove_flag (priv->session,
- BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE|
- BRASERO_BURN_FLAG_DAO);
+ * DAO don't really get along well with MULTI */
+ brasero_burn_session_remove_flag (session, BRASERO_BURN_FLAG_DAO);
/* see if multi disc option is supported or compulsory. The returned
* value just indicate if the button state can be modified. */
brasero_burn_caps_get_flags (priv->caps,
- priv->session,
+ session,
&supported,
&compulsory);
if (!(supported & BRASERO_BURN_FLAG_MULTI)) {
/* just in case it was already set */
- brasero_burn_session_remove_flag (priv->session, BRASERO_BURN_FLAG_MULTI);
+ brasero_burn_session_remove_flag (session, BRASERO_BURN_FLAG_MULTI);
gtk_widget_set_sensitive (priv->multi_toggle, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->multi_toggle), FALSE);
@@ -353,7 +377,7 @@
if (compulsory & BRASERO_BURN_FLAG_MULTI) {
/* NOTE: in this case video button is updated later see caps_changed and media_changed */
- brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_MULTI);
+ brasero_burn_session_add_flag (session, BRASERO_BURN_FLAG_MULTI);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->multi_toggle), TRUE);
gtk_widget_set_sensitive (priv->multi_toggle, FALSE);
@@ -367,55 +391,29 @@
end:
/* Try to see if previously wiped out flags can be re-enabled now */
brasero_burn_caps_get_flags (priv->caps,
- priv->session,
+ session,
&supported,
&compulsory);
- /* we need to do that to override the flags that may be set in
- * brasero-dest-selection.c. The following doesn't like MULTI. */
- if (supported & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
- /* clean up the disc and have more space when possible */
- brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE);
- brasero_burn_caps_get_flags (priv->caps,
- priv->session,
- &supported,
- &compulsory);
-
- if (supported & BRASERO_BURN_FLAG_FAST_BLANK) {
- brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_FAST_BLANK);
- brasero_burn_caps_get_flags (priv->caps,
- priv->session,
- &supported,
- &compulsory);
- }
- }
-
/* Likewise DAO and MULTI don't always get along well but use DAO
* whenever it's possible */
if (supported & BRASERO_BURN_FLAG_DAO)
- brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_DAO);
-}
+ brasero_burn_session_add_flag (session, BRASERO_BURN_FLAG_DAO);
-static void
-brasero_disc_option_dialog_caps_changed (BraseroPluginManager *manager,
- BraseroDiscOptionDialog *dialog)
-{
- /* update the multi button:
- * NOTE: order is important here multi then video */
- brasero_disc_option_dialog_update_multi (dialog);
- /* update the joliet button */
- brasero_disc_option_dialog_update_joliet (dialog);
+ g_object_unref (session);
}
static void
brasero_disc_option_dialog_update_video (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroMedia media;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
- media = brasero_burn_session_get_dest_media (priv->session);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ media = brasero_burn_session_get_dest_media (session);
if (media & BRASERO_MEDIUM_DVD) {
gtk_widget_show (priv->dvd_audio);
@@ -433,9 +431,11 @@
BraseroImageFormat format;
/* if we create a CUE file then that's a SVCD */
- format = brasero_burn_session_get_output_format (priv->session);
- if (format == BRASERO_IMAGE_FORMAT_NONE)
+ format = brasero_burn_session_get_output_format (session);
+ if (format == BRASERO_IMAGE_FORMAT_NONE) {
+ g_object_unref (session);
return;
+ }
if (format == BRASERO_IMAGE_FORMAT_CUE) {
gtk_widget_hide (priv->dvd_audio);
@@ -450,30 +450,8 @@
gtk_widget_hide (priv->svcd_button);
}
}
-}
-
-static void
-brasero_disc_option_dialog_output_changed (BraseroBurnSession *session,
- BraseroDiscOptionDialog *dialog)
-{
- BraseroDiscOptionDialogPrivate *priv;
-
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
-
- /* update the multi button:
- * NOTE: order is important here multi then video */
- brasero_disc_option_dialog_update_multi (dialog);
-
- /* update the joliet button */
- brasero_disc_option_dialog_update_joliet (dialog);
-
- /* see if we need to update the label */
- if (!priv->label_modified)
- brasero_disc_option_dialog_update_label (dialog);
- /* for video disc see what's the output : CD or DVD */
- if (priv->dvd_audio)
- brasero_disc_option_dialog_update_video (dialog);
+ g_object_unref (session);
}
/**
@@ -485,6 +463,7 @@
brasero_disc_option_dialog_set_joliet (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroTrackType source;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
@@ -492,34 +471,43 @@
if (!priv->joliet_toggle)
return;
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+
/* NOTE: we don't check for the sensitive property since when
* something is compulsory the button is active but insensitive */
- brasero_burn_session_get_input_type (priv->session, &source);
+ brasero_burn_session_get_input_type (session, &source);
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->joliet_toggle)))
source.subtype.fs_type &= ~BRASERO_IMAGE_FS_JOLIET;
else
source.subtype.fs_type |= BRASERO_IMAGE_FS_JOLIET;
- brasero_burn_session_set_input_type (priv->session, &source);
+ brasero_burn_session_set_input_type (session, &source);
+
+ g_object_unref (session);
}
static void
brasero_disc_option_dialog_set_multi (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
if (!priv->multi_toggle)
return;
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->multi_toggle))) {
- brasero_burn_session_remove_flag (priv->session, BRASERO_BURN_FLAG_MULTI);
+ brasero_burn_session_remove_flag (session, BRASERO_BURN_FLAG_MULTI);
+ brasero_disc_option_dialog_save_multi_state (dialog);
+ }
+ else {
+ brasero_burn_session_add_flag (session, BRASERO_BURN_FLAG_MULTI);
brasero_disc_option_dialog_save_multi_state (dialog);
- return;
}
- brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_MULTI);
- brasero_disc_option_dialog_save_multi_state (dialog);
+ g_object_unref (session);
}
static void
@@ -657,25 +645,31 @@
BraseroDiscOptionDialog *dialog)
{
const gchar *label;
+ BraseroBurnSession *session;
BraseroDiscOptionDialogPrivate *priv;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
label = gtk_entry_get_text (GTK_ENTRY (priv->label));
- brasero_burn_session_set_label (priv->session, label);
+ brasero_burn_session_set_label (session, label);
priv->label_modified = 1;
+
+ g_object_unref (session);
}
static void
brasero_disc_option_dialog_title_widget (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
gchar *title_str = NULL;
BraseroTrackType type;
gchar *label = NULL;
GtkWidget *widget;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
if (!priv->label)
priv->label = gtk_entry_new ();
@@ -692,10 +686,10 @@
title_str = brasero_disc_option_dialog_get_default_label (dialog);
gtk_entry_set_text (GTK_ENTRY (priv->label), title_str);
- brasero_burn_session_set_label (priv->session, title_str);
+ brasero_burn_session_set_label (session, title_str);
g_free (title_str);
- brasero_burn_session_get_input_type (priv->session, &type);
+ brasero_burn_session_get_input_type (session, &type);
if (type.type == BRASERO_TRACK_TYPE_DATA)
label = g_strdup_printf ("<b>%s</b>", _("Label of the disc"));
else if (type.type == BRASERO_TRACK_TYPE_AUDIO)
@@ -710,12 +704,15 @@
FALSE,
FALSE,
0);
+
+ g_object_unref (session);
}
static gboolean
brasero_disc_option_dialog_joliet_widget (BraseroDiscOptionDialog *dialog)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroTrackType type;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
@@ -727,7 +724,8 @@
/* NOTE: we take for granted that if the source does not require
* to have the joliet extension, it's because it does have some
* incompatible filenames inside */
- brasero_burn_session_get_input_type (priv->session, &type);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_burn_session_get_input_type (session, &type);
if (type.subtype.fs_type & BRASERO_IMAGE_FS_JOLIET) {
priv->joliet_warning = 1;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->joliet_toggle), TRUE);
@@ -739,6 +737,8 @@
"toggled",
G_CALLBACK (brasero_disc_option_dialog_joliet_toggled_cb),
dialog);
+
+ g_object_unref (session);
return TRUE;
}
@@ -774,11 +774,7 @@
/* create the options */
widget = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- widget,
- TRUE,
- FALSE,
- 6);
+ brasero_burn_options_add_options (BRASERO_BURN_OPTIONS (dialog), widget);
/* multisession options */
brasero_disc_option_dialog_multi_widget (dialog);
@@ -809,11 +805,7 @@
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
widget = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- widget,
- TRUE,
- FALSE,
- 6);
+ brasero_burn_options_add_options (BRASERO_BURN_OPTIONS (dialog), widget);
/* multisession options */
priv->multi_toggle = gtk_check_button_new_with_mnemonic (_("Leave the disc _open to add a data session later"));
@@ -840,13 +832,13 @@
brasero_disc_option_dialog_AC3 (GtkToggleButton *button,
BraseroDiscOptionDialog *dialog)
{
- BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroAudioFormat format;
GValue *value = NULL;
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
- brasero_burn_session_tag_lookup (priv->session,
+ brasero_burn_session_tag_lookup (session,
BRASERO_DVD_AUDIO_STREAMS,
&value);
@@ -863,22 +855,24 @@
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, format);
- brasero_burn_session_tag_add (priv->session,
+ brasero_burn_session_tag_add (session,
BRASERO_DVD_AUDIO_STREAMS,
value);
+
+ g_object_unref (session);
}
static void
brasero_disc_option_dialog_MP2 (GtkToggleButton *button,
BraseroDiscOptionDialog *dialog)
{
- BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroAudioFormat format;
GValue *value = NULL;
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
- brasero_burn_session_tag_lookup (priv->session,
+ brasero_burn_session_tag_lookup (session,
BRASERO_DVD_AUDIO_STREAMS,
&value);
@@ -895,9 +889,11 @@
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, format);
- brasero_burn_session_tag_add (priv->session,
+ brasero_burn_session_tag_add (session,
BRASERO_DVD_AUDIO_STREAMS,
value);
+
+ g_object_unref (session);
}
static void
@@ -905,17 +901,19 @@
const gchar *tag,
gint contents)
{
- BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
GValue *value;
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, contents);
- brasero_burn_session_tag_add (priv->session,
+ brasero_burn_session_tag_add (session,
tag,
value);
+
+ g_object_unref (session);
}
static void
@@ -970,14 +968,14 @@
brasero_disc_option_dialog_native_framerate (GtkToggleButton *button,
BraseroDiscOptionDialog *dialog)
{
- BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
if (!gtk_toggle_button_get_active (button))
return;
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
- brasero_burn_session_tag_remove (priv->session,
- BRASERO_VIDEO_OUTPUT_FRAMERATE);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_burn_session_tag_remove (session, BRASERO_VIDEO_OUTPUT_FRAMERATE);
+ g_object_unref (session);
}
static void
@@ -1006,16 +1004,16 @@
static void
brasero_disc_option_dialog_native_aspect (GtkToggleButton *button,
- BraseroDiscOptionDialog *dialog)
+ BraseroDiscOptionDialog *dialog)
{
- BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
if (!gtk_toggle_button_get_active (button))
return;
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
- brasero_burn_session_tag_remove (priv->session,
- BRASERO_VIDEO_OUTPUT_ASPECT);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_burn_session_tag_remove (session, BRASERO_VIDEO_OUTPUT_ASPECT);
+ g_object_unref (session);
}
static void
@@ -1034,11 +1032,7 @@
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
widget = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- widget,
- FALSE,
- FALSE,
- 6);
+ brasero_burn_options_add_options (BRASERO_BURN_OPTIONS (dialog), widget);
table = gtk_table_new (3, 4, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
@@ -1241,8 +1235,8 @@
BraseroDisc *disc)
{
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroTrackType type;
- gboolean lock_drive;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
@@ -1252,134 +1246,97 @@
priv->disc = disc;
g_object_ref (disc);
- if (priv->output_sig) {
- g_signal_handler_disconnect (priv->session, priv->output_sig);
- priv->output_sig = 0;
- }
-
- brasero_disc_set_session_param (disc, priv->session);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+ brasero_disc_set_session_param (disc, session);
/* see if we should lock the drive only with MERGE */
- lock_drive = (brasero_burn_session_get_flags (priv->session) & BRASERO_BURN_FLAG_MERGE) != 0;
- brasero_drive_selection_lock (BRASERO_DRIVE_SELECTION (priv->selection), lock_drive);
-
- priv->output_sig = g_signal_connect (priv->session,
- "output-changed",
- G_CALLBACK (brasero_disc_option_dialog_output_changed),
- dialog);
+ if (brasero_burn_session_get_flags (session) & BRASERO_BURN_FLAG_MERGE)
+ brasero_burn_options_lock_selection (BRASERO_BURN_OPTIONS (dialog));
/* NOTE: the caller must have ensured the disc is ready */
brasero_disc_option_dialog_title_widget (dialog);
- brasero_burn_session_get_input_type (priv->session, &type);
+ brasero_burn_session_get_input_type (session, &type);
if (type.type == BRASERO_TRACK_TYPE_DATA) {
- brasero_drive_selection_set_type_shown (BRASERO_DRIVE_SELECTION (priv->selection),
- BRASERO_MEDIA_TYPE_WRITABLE|
- BRASERO_MEDIA_TYPE_FILE);
+ brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (dialog),
+ BRASERO_MEDIA_TYPE_WRITABLE|
+ BRASERO_MEDIA_TYPE_FILE);
brasero_disc_option_dialog_add_data_options (dialog);
}
else if (type.type == BRASERO_TRACK_TYPE_AUDIO) {
if (type.subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED|BRASERO_VIDEO_FORMAT_VCD|BRASERO_VIDEO_FORMAT_VIDEO_DVD)) {
- brasero_drive_selection_set_type_shown (BRASERO_DRIVE_SELECTION (priv->selection),
- BRASERO_MEDIA_TYPE_WRITABLE|
- BRASERO_MEDIA_TYPE_FILE);
+ brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (dialog),
+ BRASERO_MEDIA_TYPE_WRITABLE|
+ BRASERO_MEDIA_TYPE_FILE);
brasero_disc_option_dialog_add_video_options (dialog);
}
else {
- brasero_drive_selection_set_type_shown (BRASERO_DRIVE_SELECTION (priv->selection),
- BRASERO_MEDIA_TYPE_WRITABLE);
+ brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (dialog),
+ BRASERO_MEDIA_TYPE_WRITABLE);
brasero_disc_option_dialog_add_audio_options (dialog);
}
}
+
+ g_object_unref (session);
+}
+
+BraseroBurnSession *
+brasero_disc_option_dialog_get_session (BraseroDiscOptionDialog *self)
+{
+ BraseroBurnSession *session;
+ BraseroDiscOptionDialogPrivate *priv;
+
+ priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (self);
+
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (self));
+ brasero_disc_set_session_contents (priv->disc, session);
+ return session;
}
static void
brasero_disc_option_dialog_valid_media_cb (BraseroDestSelection *selection,
- gboolean valid,
+ BraseroSessionError valid,
BraseroDiscOptionDialog *self)
{
BraseroDiscOptionDialogPrivate *priv;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (self);
- gtk_widget_set_sensitive (priv->button, valid);
if (priv->video_options)
- gtk_widget_set_sensitive (priv->video_options, valid);
-}
+ gtk_widget_set_sensitive (priv->video_options, valid == BRASERO_SESSION_VALID);
-BraseroBurnSession *
-brasero_disc_option_dialog_get_session (BraseroDiscOptionDialog *dialog)
-{
- BraseroDiscOptionDialogPrivate *priv;
+ /* update the multi button:
+ * NOTE: order is important here multi then video */
+ brasero_disc_option_dialog_update_multi (self);
- priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
+ /* update the joliet button */
+ brasero_disc_option_dialog_update_joliet (self);
- brasero_disc_set_session_contents (priv->disc, priv->session);
- g_object_ref (priv->session);
+ /* see if we need to update the label */
+ if (!priv->label_modified)
+ brasero_disc_option_dialog_update_label (self);
- return priv->session;
+ /* for video disc see what's the output : CD or DVD */
+ if (priv->dvd_audio)
+ brasero_disc_option_dialog_update_video (self);
}
static void
brasero_disc_option_dialog_init (BraseroDiscOptionDialog *obj)
{
- gchar *string;
- GtkWidget *button;
- GtkWidget *options;
- BraseroPluginManager *manager;
BraseroDiscOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (obj);
- gtk_dialog_set_has_separator (GTK_DIALOG (obj), FALSE);
-
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_widget_show (button);
- gtk_dialog_add_action_widget (GTK_DIALOG (obj),
- button,
- GTK_RESPONSE_CANCEL);
-
- priv->button = brasero_utils_make_button (_("_Burn"),
- NULL,
- "media-optical-burn",
- GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (priv->button);
- gtk_dialog_add_action_widget (GTK_DIALOG (obj),
- priv->button,
- 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_disc_option_dialog_caps_changed),
- obj);
-
- priv->session = BRASERO_BURN_SESSION (brasero_session_cfg_new ());
- g_signal_connect (priv->session,
- "is-valid",
- G_CALLBACK (brasero_disc_option_dialog_valid_media_cb),
- obj);
- brasero_burn_session_add_flag (priv->session,
- BRASERO_BURN_FLAG_NOGRACE|
- BRASERO_BURN_FLAG_CHECK_SIZE|
- BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT);
- /* first box */
- priv->selection = brasero_dest_selection_new (priv->session);
-
- string = g_strdup_printf ("<b>%s</b>", _("Select a disc to write to"));
- options = brasero_utils_pack_properties (string,
- priv->selection,
- NULL);
- g_free (string);
- gtk_widget_show (options);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (obj)->vbox),
- options,
- FALSE,
- FALSE,
- 6);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (obj));
+ priv->valid_sig = g_signal_connect (session,
+ "is-valid",
+ G_CALLBACK (brasero_disc_option_dialog_valid_media_cb),
+ obj);
+ g_object_unref (session);
}
static void
@@ -1389,12 +1346,14 @@
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (object);
- if (priv->caps_sig) {
- BraseroPluginManager *manager;
+ if (priv->valid_sig) {
+ BraseroBurnSession *session;
+
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (object));
+ g_signal_handler_disconnect (session, priv->valid_sig);
+ g_object_unref (session);
- manager = brasero_plugin_manager_get_default ();
- g_signal_handler_disconnect (manager, priv->caps_sig);
- priv->caps_sig = 0;
+ priv->valid_sig = 0;
}
if (priv->caps) {
@@ -1402,16 +1361,6 @@
priv->caps = NULL;
}
- if (priv->output_sig) {
- g_signal_handler_disconnect (priv->session, priv->output_sig);
- priv->output_sig = 0;
- }
-
- if (priv->session) {
- g_object_unref (priv->session);
- priv->session = NULL;
- }
-
if (priv->disc) {
g_object_unref (priv->disc);
priv->disc = NULL;
Modified: trunk/src/brasero-disc-option-dialog.h
==============================================================================
--- trunk/src/brasero-disc-option-dialog.h (original)
+++ trunk/src/brasero-disc-option-dialog.h Wed Sep 24 11:43:06 2008
@@ -34,7 +34,7 @@
#include <gtk/gtkdialog.h>
#include "brasero-disc.h"
-#include "burn-session.h"
+#include "brasero-burn-options.h"
G_BEGIN_DECLS
@@ -49,11 +49,11 @@
typedef struct _BraseroDiscOptionDialogClass BraseroDiscOptionDialogClass;
struct _BraseroDiscOptionDialog {
- GtkDialog parent;
+ BraseroBurnOptions parent;
};
struct _BraseroDiscOptionDialogClass {
- GtkDialogClass parent_class;
+ BraseroBurnOptionsClass parent_class;
};
GType brasero_disc_option_dialog_get_type ();
Modified: trunk/src/brasero-drive-selection.c
==============================================================================
--- trunk/src/brasero-drive-selection.c (original)
+++ trunk/src/brasero-drive-selection.c Wed Sep 24 11:43:06 2008
@@ -195,11 +195,13 @@
GtkWidget *button)
{
BraseroDriveSelectionPrivate *priv;
- GtkWidget *parent;
priv = BRASERO_DRIVE_SELECTION_PRIVATE (self);
- parent = gtk_widget_get_parent (priv->selection);
- gtk_box_pack_start (GTK_BOX (parent), button, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->box),
+ button,
+ FALSE,
+ TRUE,
+ 0);
}
void
@@ -231,10 +233,14 @@
BraseroDriveSelectionPrivate *priv;
priv = BRASERO_DRIVE_SELECTION_PRIVATE (object);
- gtk_box_set_spacing (GTK_BOX (object), 12);
+ gtk_box_set_spacing (GTK_BOX (object), 6);
priv->box = gtk_hbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (object), priv->box, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (object),
+ priv->box,
+ FALSE,
+ TRUE,
+ 0);
priv->selection = brasero_medium_selection_new ();
g_signal_connect (priv->selection,
@@ -243,8 +249,8 @@
object);
gtk_box_pack_start (GTK_BOX (priv->box),
priv->selection,
- FALSE,
- FALSE,
+ TRUE,
+ TRUE,
0);
gtk_widget_show_all (GTK_WIDGET (object));
Modified: trunk/src/brasero-image-option-dialog.c
==============================================================================
--- trunk/src/brasero-image-option-dialog.c (original)
+++ trunk/src/brasero-image-option-dialog.c Wed Sep 24 11:43:06 2008
@@ -41,21 +41,23 @@
#include <gconf/gconf-client.h>
-#include "brasero-utils.h"
#include "burn-basics.h"
-#include "burn-plugin-manager.h"
+#include "burn-caps.h"
+#include "burn-drive.h"
+
+#include "brasero-utils.h"
#include "brasero-session-cfg.h"
#include "brasero-image-option-dialog.h"
#include "brasero-image-type-chooser.h"
#include "brasero-dest-selection.h"
-#include "burn-drive.h"
#include "brasero-io.h"
+#include "brasero-burn-options.h"
+
#define BRASERO_KEY_ISO_DIRECTORY "/apps/brasero/display/iso_folder"
-G_DEFINE_TYPE (BraseroImageOptionDialog, brasero_image_option_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (BraseroImageOptionDialog, brasero_image_option_dialog, BRASERO_TYPE_BURN_OPTIONS);
struct _BraseroImageOptionDialogPrivate {
- BraseroBurnSession *session;
BraseroTrack *track;
BraseroBurnCaps *caps;
@@ -63,10 +65,10 @@
BraseroIO *io;
BraseroIOJobBase *info_type;
- GtkWidget *selection;
GtkWidget *format;
GtkWidget *file;
- GtkWidget *button;
+
+ gulong valid_sig;
};
typedef struct _BraseroImageOptionDialogPrivate BraseroImageOptionDialogPrivate;
@@ -86,8 +88,10 @@
const gchar *toc)
{
BraseroImageOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (dialog);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
/* add a track every time to send a signal */
if (priv->track) {
@@ -102,19 +106,22 @@
else if (toc)
uri = brasero_track_get_toc_source (priv->track, TRUE);
- if (!toc && !image && !uri)
+ if (!toc && !image && !uri) {
+ g_object_unref (session);
return;
+ }
if((format == type.subtype.img_format)
&& uri && (image || toc)
- && !strcmp (uri, image?image:toc)) {
+ && !strcmp (uri, image? image:toc)) {
+ g_object_unref (session);
g_free (uri);
return;
}
g_free (uri);
- brasero_burn_session_clear_current_track (priv->session);
+ brasero_burn_session_clear_current_track (session);
brasero_track_unref (priv->track);
}
@@ -124,7 +131,8 @@
image,
toc,
format);
- brasero_burn_session_add_track (priv->session, priv->track);
+ brasero_burn_session_add_track (session, priv->track);
+ g_object_unref (session);
}
static void
@@ -301,6 +309,7 @@
brasero_image_option_dialog_set_formats (BraseroImageOptionDialog *dialog)
{
BraseroImageOptionDialogPrivate *priv;
+ BraseroBurnSession *session;
BraseroImageFormat formats;
BraseroImageFormat format;
BraseroTrackType output;
@@ -313,9 +322,11 @@
if (!priv->format)
return;
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
+
/* get the available image types */
output.type = BRASERO_TRACK_TYPE_DISC;
- drive = brasero_burn_session_get_burner (priv->session);
+ drive = brasero_burn_session_get_burner (session);
medium = brasero_drive_get_medium (drive);
output.subtype.media = brasero_medium_get_status (medium);
@@ -328,7 +339,7 @@
input.subtype.img_format = format;
result = brasero_burn_caps_is_input_supported (priv->caps,
- priv->session,
+ session,
&input,
FALSE);
if (result == BRASERO_BURN_OK)
@@ -337,6 +348,8 @@
brasero_image_type_chooser_set_formats (BRASERO_IMAGE_TYPE_CHOOSER (priv->format),
formats);
+
+ g_object_unref (session);
}
void
@@ -473,21 +486,15 @@
g_free (uri);
}
- g_object_ref (priv->session);
- return priv->session;
+ return brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
}
static void
brasero_image_option_dialog_valid_media_cb (BraseroBurnSession *session,
- gboolean valid,
+ BraseroSessionError valid,
BraseroImageOptionDialog *self)
{
- BraseroImageOptionDialogPrivate *priv;
-
- priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (self);
-
brasero_image_option_dialog_set_formats (self);
- gtk_widget_set_sensitive (priv->button, valid);
}
static void
@@ -514,64 +521,26 @@
{
gchar *uri;
gchar *string;
+ GtkWidget *box1;
GtkWidget *label;
- GtkWidget *button;
- GtkWidget *options;
GConfClient *client;
- GtkWidget *box, *box1;
GtkFileFilter *filter;
+ BraseroBurnSession *session;
BraseroImageOptionDialogPrivate *priv;
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (obj);
- gtk_dialog_set_has_separator (GTK_DIALOG (obj), FALSE);
-
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_widget_show (button);
- gtk_dialog_add_action_widget (GTK_DIALOG (obj),
- button,
- GTK_RESPONSE_CANCEL);
-
- priv->button = brasero_utils_make_button (_("_Burn"),
- NULL,
- "media-optical-burn",
- GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (priv->button);
- gtk_dialog_add_action_widget (GTK_DIALOG (obj),
- priv->button,
- GTK_RESPONSE_OK);
-
priv->caps = brasero_burn_caps_get_default ();
- priv->session = BRASERO_BURN_SESSION (brasero_session_cfg_new ());
- g_signal_connect (priv->session,
- "is-valid",
- G_CALLBACK (brasero_image_option_dialog_valid_media_cb),
- obj);
-
- brasero_burn_session_add_flag (priv->session,
- BRASERO_BURN_FLAG_NOGRACE|
- BRASERO_BURN_FLAG_CHECK_SIZE|
- BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT);
-
- /* first box */
- priv->selection = brasero_dest_selection_new (priv->session);
-
- string = g_strdup_printf ("<b>%s</b>", _("Select a disc to write to"));
- options = brasero_utils_pack_properties (string,
- priv->selection,
- NULL);
- g_free (string);
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (obj));
+ priv->valid_sig = g_signal_connect (session,
+ "is-valid",
+ G_CALLBACK (brasero_image_option_dialog_valid_media_cb),
+ obj);
+ g_object_unref (session);
- gtk_widget_show (options);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (obj)->vbox),
- options,
- FALSE,
- FALSE,
- 6);
-
- brasero_drive_selection_set_type_shown (BRASERO_DRIVE_SELECTION (priv->selection),
- BRASERO_MEDIA_TYPE_WRITABLE);
+ brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (obj),
+ BRASERO_MEDIA_TYPE_WRITABLE);
/* Image properties */
box1 = gtk_table_new (2, 2, FALSE);
@@ -672,18 +641,14 @@
obj);
string = g_strdup_printf ("<b>%s</b>", _("Image"));
- box = brasero_utils_pack_properties (string,
- box1,
- NULL);
+ brasero_burn_options_add_source (BRASERO_BURN_OPTIONS (obj),
+ string,
+ box1,
+ NULL);
g_free (string);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (obj)->vbox),
- box,
- TRUE,
- FALSE,
- 6);
+ gtk_widget_show_all (box1);
- gtk_widget_show_all (box);
brasero_image_option_dialog_set_formats (obj);
}
@@ -709,9 +674,14 @@
priv->track = NULL;
}
- if (priv->session) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->valid_sig) {
+ BraseroBurnSession *session;
+
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (object));
+ g_signal_handler_disconnect (session, priv->valid_sig);
+ g_object_unref (session);
+
+ priv->valid_sig = 0;
}
if (priv->caps) {
Modified: trunk/src/brasero-image-option-dialog.h
==============================================================================
--- trunk/src/brasero-image-option-dialog.h (original)
+++ trunk/src/brasero-image-option-dialog.h Wed Sep 24 11:43:06 2008
@@ -31,9 +31,8 @@
#include <glib-object.h>
#include <gtk/gtkwidget.h>
-#include <gtk/gtkdialog.h>
-#include "burn-caps.h"
+#include "brasero-burn-options.h"
G_BEGIN_DECLS
@@ -48,11 +47,11 @@
typedef struct _BraseroImageOptionDialogClass BraseroImageOptionDialogClass;
struct _BraseroImageOptionDialog {
- GtkDialog parent;
+ BraseroBurnOptions parent;
};
struct _BraseroImageOptionDialogClass {
- GtkDialogClass parent_class;
+ BraseroBurnOptionsClass parent_class;
};
GType brasero_image_option_dialog_get_type ();
@@ -61,7 +60,6 @@
void
brasero_image_option_dialog_set_image_uri (BraseroImageOptionDialog *dialog,
const gchar *uri);
-
BraseroBurnSession *
brasero_image_option_dialog_get_session (BraseroImageOptionDialog *dialog);
Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c (original)
+++ trunk/src/brasero-project-manager.c Wed Sep 24 11:43:06 2008
@@ -625,7 +625,7 @@
return;
}
- session = brasero_disc_copy_dialog_get_session (BRASERO_DISC_COPY_DIALOG (dialog));
+ session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
gtk_widget_destroy (dialog);
brasero_project_manager_burn (manager, session);
Modified: trunk/src/brasero-project-size.c
==============================================================================
--- trunk/src/brasero-project-size.c (original)
+++ trunk/src/brasero-project-size.c Wed Sep 24 11:43:06 2008
@@ -1465,6 +1465,7 @@
gint64 max_sectors;
gint64 disc_size;
+ return TRUE;
if (!self->priv->current)
return FALSE;
Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c (original)
+++ trunk/src/brasero-project.c Wed Sep 24 11:43:06 2008
@@ -83,6 +83,7 @@
#include "brasero-disc-message.h"
#include "brasero-file-chooser.h"
#include "brasero-notify.h"
+#include "brasero-burn-options.h"
static void brasero_project_class_init (BraseroProjectClass *klass);
static void brasero_project_init (BraseroProject *sp);
Modified: trunk/src/brasero-session-cfg.c
==============================================================================
--- trunk/src/brasero-session-cfg.c (original)
+++ trunk/src/brasero-session-cfg.c Wed Sep 24 11:43:06 2008
@@ -30,6 +30,7 @@
#include <gconf/gconf-client.h>
#include "burn-basics.h"
+#include "burn-debug.h"
#include "burn-plugin-manager.h"
#include "burn-session.h"
#include "burn-caps.h"
@@ -206,8 +207,8 @@
static void
brasero_session_cfg_set_drive_properties (BraseroSessionCfg *self)
{
+ BraseroTrackType source = { 0, };
BraseroSessionCfgPrivate *priv;
- BraseroTrackType source;
BraseroBurnFlag flags;
BraseroMedium *medium;
BraseroDrive *drive;
@@ -219,13 +220,9 @@
priv = BRASERO_SESSION_CFG_PRIVATE (self);
+ /* The next two must work as they were checked earlier */
brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), &source);
- if (source.type == BRASERO_TRACK_TYPE_NONE)
- return;
-
drive = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
- if (!drive)
- return;
medium = brasero_drive_get_medium (drive);
if (!medium || brasero_medium_get_status (medium) == BRASERO_MEDIUM_NONE)
@@ -324,10 +321,116 @@
brasero_session_cfg_save_drive_properties (self);
}
+static BraseroSessionError
+brasero_session_cfg_check_size (BraseroSessionCfg *self)
+{
+ BraseroBurnFlag flags;
+ BraseroMedium *medium;
+ BraseroDrive *burner;
+ GValue *value = NULL;
+ /* in sectors */
+ gint64 session_size;
+ gint64 max_sectors;
+ gint64 disc_size;
+ GSList *iter;
+
+ burner = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
+ if (!burner)
+ return BRASERO_SESSION_NO_OUTPUT;
+
+ /* FIXME: here we could check the hard drive space */
+ if (brasero_drive_is_fake (burner))
+ return BRASERO_SESSION_VALID;
+
+ medium = brasero_drive_get_medium (burner);
+ if (!medium)
+ return BRASERO_SESSION_NO_OUTPUT;
+
+ flags = brasero_burn_session_get_flags (BRASERO_BURN_SESSION (self));
+ if (flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
+ brasero_medium_get_free_space (medium, NULL, &disc_size);
+ else
+ brasero_medium_get_capacity (medium, NULL, &disc_size);
+
+ if (disc_size < 0)
+ disc_size = 0;
+
+ /* get input track size */
+ iter = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (self));
+ session_size = 0;
+
+ if (brasero_burn_session_tag_lookup (BRASERO_BURN_SESSION (self),
+ BRASERO_DATA_TRACK_SIZE_TAG,
+ &value) == BRASERO_BURN_OK) {
+ session_size = g_value_get_int64 (value);
+ }
+ else if (brasero_burn_session_tag_lookup (BRASERO_BURN_SESSION (self),
+ BRASERO_AUDIO_TRACK_SIZE_TAG,
+ &value) == BRASERO_BURN_OK) {
+ session_size = g_value_get_int64 (value);
+ }
+ else for (; iter; iter = iter->next) {
+ BraseroTrackDataType type;
+ BraseroTrack *track;
+ gint64 sectors;
+
+ track = iter->data;
+ sectors = 0;
+
+ type = brasero_track_get_type (track, NULL);
+ if (type == BRASERO_TRACK_TYPE_DISC)
+ brasero_track_get_disc_data_size (track, §ors, NULL);
+ else if (type == BRASERO_TRACK_TYPE_IMAGE)
+ brasero_track_get_image_size (track, NULL, §ors, NULL, NULL);
+ else if (type == BRASERO_TRACK_TYPE_AUDIO) {
+ gint64 len = 0;
+
+ brasero_track_get_audio_length (track, &len);
+ sectors = BRASERO_DURATION_TO_SECTORS (len);
+ }
+
+ session_size += sectors;
+ }
+
+ BRASERO_BURN_LOG ("Session size %lli/Disc size %lli",
+ session_size,
+ disc_size);
+
+ if (session_size < disc_size)
+ return BRASERO_SESSION_VALID;
+
+ /* FIXME: This is not good since with a DVD 3% of 4.3G may be too much
+ * with 3% we are slightly over the limit of the most overburnable discs
+ * but at least users can try to overburn as much as they can. */
+
+ /* The idea would be to test write the disc with cdrecord from /dev/null
+ * until there is an error and see how much we were able to write. So,
+ * when we propose overburning to the user, we could ask if he wants
+ * us to determine how much data can be written to a particular disc
+ * provided he has chosen a real disc. */
+ max_sectors = disc_size * 103 / 100;
+ if (max_sectors < session_size)
+ return BRASERO_SESSION_INSUFFICIENT_SPACE;
+
+ if (!(flags & BRASERO_BURN_FLAG_OVERBURN)) {
+ BraseroSessionCfgPrivate *priv;
+
+ priv = BRASERO_SESSION_CFG_PRIVATE (self);
+
+ if (!(priv->supported & BRASERO_BURN_FLAG_OVERBURN))
+ return BRASERO_SESSION_INSUFFICIENT_SPACE;
+
+ return BRASERO_SESSION_OVERBURN_NECESSARY;
+ }
+
+ return BRASERO_SESSION_VALID;
+}
+
static void
brasero_session_cfg_update (BraseroSessionCfg *self)
{
BraseroSessionCfgPrivate *priv;
+ BraseroTrackType source = { 0, };
BraseroBurnResult result;
BraseroDrive *burner;
@@ -338,13 +441,45 @@
priv->configuring = TRUE;
+ /* make sure there is a source */
+ brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), &source);
+ if (source.type == BRASERO_TRACK_TYPE_NONE) {
+ priv->configuring = FALSE;
+ g_signal_emit (self,
+ session_cfg_signals [IS_VALID_SIGNAL],
+ 0,
+ BRASERO_SESSION_NOT_SUPPORTED);
+ return;
+ }
+
+ if (source.type == BRASERO_TRACK_TYPE_DISC
+ && source.subtype.media == BRASERO_MEDIUM_NONE) {
+ priv->configuring = FALSE;
+ g_signal_emit (self,
+ session_cfg_signals [IS_VALID_SIGNAL],
+ 0,
+ BRASERO_SESSION_NO_INPUT_MEDIUM);
+ return;
+ }
+
+ if (source.type == BRASERO_TRACK_TYPE_IMAGE
+ && source.subtype.img_format == BRASERO_IMAGE_FORMAT_NONE) {
+ priv->configuring = FALSE;
+ g_signal_emit (self,
+ session_cfg_signals [IS_VALID_SIGNAL],
+ 0,
+ BRASERO_SESSION_NO_INPUT_IMAGE);
+ return;
+ }
+
+ /* make sure there is an output set */
burner = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
if (!burner) {
priv->configuring = FALSE;
g_signal_emit (self,
session_cfg_signals [IS_VALID_SIGNAL],
0,
- FALSE);
+ BRASERO_SESSION_NO_OUTPUT);
return;
}
@@ -358,10 +493,26 @@
priv->configuring = FALSE;
result = brasero_burn_caps_is_session_supported (priv->caps, BRASERO_BURN_SESSION (self));
- g_signal_emit (self,
- session_cfg_signals [IS_VALID_SIGNAL],
- 0,
- (result == BRASERO_BURN_OK));
+
+ if (result != BRASERO_BURN_OK) {
+ g_signal_emit (self,
+ session_cfg_signals [IS_VALID_SIGNAL],
+ 0,
+ BRASERO_SESSION_NOT_SUPPORTED);
+ return;
+ }
+
+ if (brasero_burn_session_same_src_dest_drive (BRASERO_BURN_SESSION (self)))
+ g_signal_emit (self,
+ session_cfg_signals [IS_VALID_SIGNAL],
+ 0,
+ BRASERO_SESSION_VALID);
+
+ else
+ g_signal_emit (self,
+ session_cfg_signals [IS_VALID_SIGNAL],
+ 0,
+ brasero_session_cfg_check_size (self));
}
static void
@@ -408,7 +559,7 @@
g_signal_emit (self,
session_cfg_signals [IS_VALID_SIGNAL],
0,
- FALSE);
+ BRASERO_SESSION_NO_OUTPUT);
return;
}
@@ -425,7 +576,8 @@
g_signal_emit (self,
session_cfg_signals [IS_VALID_SIGNAL],
0,
- (result == BRASERO_BURN_OK));
+ (result == BRASERO_BURN_OK)?
+ BRASERO_SESSION_VALID:BRASERO_SESSION_NOT_SUPPORTED);
}
static void
@@ -439,6 +591,14 @@
brasero_session_cfg_check (self);
}
+void
+brasero_session_cfg_add_flags (BraseroSessionCfg *self,
+ BraseroBurnFlag flags)
+{
+ brasero_session_cfg_add_drive_properties_flags (self, flags);
+ brasero_session_cfg_update (self);
+}
+
static void
brasero_session_cfg_init (BraseroSessionCfg *object)
{
@@ -498,10 +658,10 @@
G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP | G_SIGNAL_ACTION,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
+ g_cclosure_marshal_VOID__INT,
G_TYPE_NONE,
1,
- G_TYPE_BOOLEAN);
+ G_TYPE_INT);
}
BraseroSessionCfg *
Modified: trunk/src/brasero-session-cfg.h
==============================================================================
--- trunk/src/brasero-session-cfg.h (original)
+++ trunk/src/brasero-session-cfg.h Wed Sep 24 11:43:06 2008
@@ -22,6 +22,7 @@
#include <glib-object.h>
+#include "burn-basics.h"
#include "burn-session.h"
G_BEGIN_DECLS
@@ -56,6 +57,32 @@
BraseroSessionCfg *
brasero_session_cfg_new (void);
+void
+brasero_session_cfg_add_flags (BraseroSessionCfg *cfg,
+ BraseroBurnFlag flags);
+
+/**
+ * This is for the signal sent to tell whether or not session is valid
+ */
+
+typedef enum {
+ BRASERO_SESSION_VALID = 0,
+ BRASERO_SESSION_NO_INPUT_IMAGE = 1,
+ BRASERO_SESSION_NO_INPUT_MEDIUM,
+ BRASERO_SESSION_NO_OUTPUT,
+ BRASERO_SESSION_NOT_SUPPORTED,
+ BRASERO_SESSION_INSUFFICIENT_SPACE,
+ BRASERO_SESSION_OVERBURN_NECESSARY
+} BraseroSessionError;
+
+/**
+ * This tag (for sessions) is used to set an estimated size, used to determine
+ * in the burn option dialog is the selected medium is big enough.
+ */
+
+#define BRASERO_DATA_TRACK_SIZE_TAG "track::data::estimated_size"
+#define BRASERO_AUDIO_TRACK_SIZE_TAG "track::audio::estimated_size"
+
G_END_DECLS
#endif /* _BRASERO_SESSION_CFG_H_ */
Modified: trunk/src/brasero-utils.c
==============================================================================
--- trunk/src/brasero-utils.c (original)
+++ trunk/src/brasero-utils.c Wed Sep 24 11:43:06 2008
@@ -344,15 +344,23 @@
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
- gtk_box_pack_end (GTK_BOX (vbox_main), hbox, TRUE, TRUE, 6);
+ gtk_box_pack_end (GTK_BOX (vbox_main),
+ hbox,
+ TRUE,
+ TRUE,
+ 6);
label = gtk_label_new ("\t");
gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
vbox_prop = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox_prop);
- gtk_box_pack_start (GTK_BOX (hbox), vbox_prop, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox),
+ vbox_prop,
+ TRUE,
+ TRUE,
+ 0);
for (iter = list; iter; iter = iter->next) {
gtk_box_pack_start (GTK_BOX (vbox_prop),
@@ -376,6 +384,8 @@
gtk_container_add (GTK_CONTAINER (frame), vbox_main);
return frame;
}
+ else
+ gtk_container_set_border_width (GTK_CONTAINER (vbox_main), 6);
return vbox_main;
}
Modified: trunk/src/brasero-video-disc.c
==============================================================================
--- trunk/src/brasero-video-disc.c (original)
+++ trunk/src/brasero-video-disc.c Wed Sep 24 11:43:06 2008
@@ -41,6 +41,7 @@
#include "brasero-video-tree-model.h"
#include "brasero-multi-song-props.h"
#include "brasero-song-properties.h"
+#include "brasero-session-cfg.h"
typedef struct _BraseroVideoDiscPrivate BraseroVideoDiscPrivate;
struct _BraseroVideoDiscPrivate
@@ -1326,11 +1327,24 @@
brasero_video_disc_set_session_param (BraseroDisc *self,
BraseroBurnSession *session)
{
+ BraseroVideoDiscPrivate *priv;
BraseroTrackType type;
+ GtkTreeModel *model;
+ GValue *value;
+
+ priv = BRASERO_VIDEO_DISC_PRIVATE (self);
type.type = BRASERO_TRACK_TYPE_AUDIO;
type.subtype.audio_format = BRASERO_AUDIO_FORMAT_UNDEFINED|BRASERO_VIDEO_FORMAT_UNDEFINED;
brasero_burn_session_set_input_type (session, &type);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_INT64);
+ g_value_set_int64 (value, brasero_video_project_get_size (BRASERO_VIDEO_PROJECT (model)));
+ brasero_burn_session_tag_add (session,
+ BRASERO_AUDIO_TRACK_SIZE_TAG,
+ value);
return BRASERO_BURN_OK;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]