89
static BraseroDriveSelectionClass* parent_class = NULL;
91
G_DEFINE_TYPE (BraseroDestSelection, brasero_dest_selection, BRASERO_TYPE_DRIVE_SELECTION);
97
static guint brasero_dest_selection_signals [LAST_SIGNAL] = { 0 };
99
#define BRASERO_DEST_SAVED_FLAGS (BRASERO_DRIVE_PROPERTIES_FLAGS|BRASERO_BURN_FLAG_MULTI)
102
brasero_dest_selection_save_drive_properties (BraseroDestSelection *self)
104
BraseroDestSelectionPrivate *priv;
105
BraseroBurnFlag flags;
111
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
113
client = gconf_client_get_default ();
115
rate = brasero_burn_session_get_rate (priv->session);
116
key = brasero_burn_session_get_config_key (priv->session, "speed");
118
g_object_unref (client);
122
gconf_client_set_int (client, key, rate / 1024, NULL);
125
key = brasero_burn_session_get_config_key (priv->session, "flags");
127
g_object_unref (client);
131
flags = gconf_client_get_int (client, key, NULL);
132
flags &= ~BRASERO_DRIVE_PROPERTIES_FLAGS;
133
flags |= (brasero_burn_session_get_flags (priv->session) & BRASERO_DEST_SAVED_FLAGS);
134
gconf_client_set_int (client, key, flags, NULL);
137
/* temporary directory */
138
path = brasero_burn_session_get_tmpdir (priv->session);
139
key = g_strdup_printf ("%s/tmpdir", BRASERO_DRIVE_PROPERTIES_KEY);
140
gconf_client_set_string (client, key, path, NULL);
143
g_object_unref (client);
147
brasero_dest_selection_check_same_src_dest (BraseroDestSelection *self)
149
BraseroDestSelectionPrivate *priv;
150
BraseroMedium *medium;
154
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
156
/* if we have the same source and destination as drives then we don't
157
* grey out the properties button as otherwise it would always remain
158
* so. Instead of that we grey it only if there is no medium or if the
159
* medium is blank. */
160
if (!brasero_burn_session_same_src_dest_drive (priv->session))
163
/* grey out button only if the source (and therefore dest drive)
164
* hasn't got any medium inside */
165
drive = brasero_burn_session_get_src_drive (priv->session);
169
medium = brasero_drive_get_medium (drive);
170
media = brasero_medium_get_status (medium);;
172
if (media == BRASERO_MEDIUM_NONE)
175
if (media & BRASERO_MEDIUM_BLANK
176
|| (media & (BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA)) == 0)
183
brasero_dest_selection_drive_properties (BraseroDestSelection *self)
185
BraseroDestSelectionPrivate *priv;
186
BraseroBurnFlag compulsory = 0;
187
BraseroBurnFlag supported = 0;
188
BraseroBurnFlag flags = 0;
195
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
198
priv->drive_prop = brasero_drive_properties_new ();
200
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
201
gtk_window_set_transient_for (GTK_WINDOW (priv->drive_prop), GTK_WINDOW (toplevel));
202
gtk_window_set_destroy_with_parent (GTK_WINDOW (priv->drive_prop), TRUE);
203
gtk_window_set_position (GTK_WINDOW (toplevel), GTK_WIN_POS_CENTER_ON_PARENT);
205
/* get information */
206
drive = brasero_burn_session_get_burner (priv->session);
207
rate = brasero_burn_session_get_rate (priv->session);
209
brasero_drive_properties_set_drive (BRASERO_DRIVE_PROPERTIES (priv->drive_prop),
213
flags = brasero_burn_session_get_flags (priv->session);
214
brasero_burn_caps_get_flags (priv->caps,
219
brasero_drive_properties_set_flags (BRASERO_DRIVE_PROPERTIES (priv->drive_prop),
224
path = brasero_burn_session_get_tmpdir (priv->session);
225
brasero_drive_properties_set_tmpdir (BRASERO_DRIVE_PROPERTIES (priv->drive_prop),
228
/* launch the dialog */
229
gtk_widget_show_all (priv->drive_prop);
230
result = gtk_dialog_run (GTK_DIALOG (priv->drive_prop));
231
if (result != GTK_RESPONSE_ACCEPT) {
232
gtk_widget_destroy (priv->drive_prop);
233
priv->drive_prop = NULL;
237
rate = brasero_drive_properties_get_rate (BRASERO_DRIVE_PROPERTIES (priv->drive_prop));
238
brasero_burn_session_set_rate (priv->session, rate);
240
brasero_burn_session_remove_flag (priv->session, BRASERO_DRIVE_PROPERTIES_FLAGS);
241
flags = brasero_drive_properties_get_flags (BRASERO_DRIVE_PROPERTIES (priv->drive_prop));
242
brasero_burn_session_add_flag (priv->session, flags);
244
path = brasero_drive_properties_get_tmpdir (BRASERO_DRIVE_PROPERTIES (priv->drive_prop));
245
brasero_burn_session_set_tmpdir (priv->session, path);
247
brasero_dest_selection_save_drive_properties (self);
249
gtk_widget_destroy (priv->drive_prop);
250
priv->drive_prop = NULL;
254
brasero_dest_selection_get_output_path (BraseroDestSelection *self)
257
BraseroImageFormat format;
258
BraseroDestSelectionPrivate *priv;
260
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
262
format = brasero_burn_session_get_output_format (priv->session);
264
case BRASERO_IMAGE_FORMAT_BIN:
265
brasero_burn_session_get_output (priv->session,
271
case BRASERO_IMAGE_FORMAT_CLONE:
272
brasero_burn_session_get_output (priv->session,
278
case BRASERO_IMAGE_FORMAT_CDRDAO:
279
brasero_burn_session_get_output (priv->session,
285
case BRASERO_IMAGE_FORMAT_CUE:
286
brasero_burn_session_get_output (priv->session,
300
brasero_dest_selection_set_output_path (BraseroDestSelection *self,
301
BraseroImageFormat format,
304
BraseroDestSelectionPrivate *priv;
306
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
309
case BRASERO_IMAGE_FORMAT_BIN:
310
brasero_burn_session_set_image_output_full (priv->session,
316
case BRASERO_IMAGE_FORMAT_CDRDAO:
317
case BRASERO_IMAGE_FORMAT_CLONE:
318
case BRASERO_IMAGE_FORMAT_CUE:
319
brasero_burn_session_set_image_output_full (priv->session,
331
brasero_dest_selection_get_default_output_format (BraseroDestSelection *self,
332
BraseroTrackType *output)
334
BraseroTrackType source;
335
BraseroBurnResult result;
336
BraseroDestSelectionPrivate *priv;
338
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
340
brasero_burn_session_get_input_type (priv->session, &source);
341
if (source.type == BRASERO_TRACK_TYPE_NONE) {
342
output->type = BRASERO_TRACK_TYPE_NONE;
346
output->type = BRASERO_TRACK_TYPE_IMAGE;
347
output->subtype.img_format = BRASERO_IMAGE_FORMAT_NONE;
349
if (source.type == BRASERO_TRACK_TYPE_IMAGE) {
350
output->subtype.img_format = source.subtype.img_format;
354
if (source.type == BRASERO_TRACK_TYPE_AUDIO) {
355
/* If that's AUDIO only without VIDEO then return */
356
if (!(source.subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED|BRASERO_VIDEO_FORMAT_VCD|BRASERO_VIDEO_FORMAT_VIDEO_DVD)))
359
/* Otherwise try all possible image types */
360
output->subtype.img_format = BRASERO_IMAGE_FORMAT_CDRDAO;
361
for (; output->subtype.img_format != BRASERO_IMAGE_FORMAT_NONE;
362
output->subtype.img_format >>= 1) {
364
result = brasero_burn_caps_is_output_supported (priv->caps,
367
if (result == BRASERO_BURN_OK)
373
if (source.type == BRASERO_TRACK_TYPE_DATA
374
|| source.subtype.media & (BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_DVD_DL)) {
375
output->subtype.img_format = BRASERO_IMAGE_FORMAT_BIN;
376
result = brasero_burn_caps_is_output_supported (priv->caps,
379
if (result != BRASERO_BURN_OK)
380
output->subtype.img_format = BRASERO_IMAGE_FORMAT_NONE;
385
/* for the input which are CDs there are lots of possible formats */
386
output->subtype.img_format = BRASERO_IMAGE_FORMAT_CDRDAO;
387
for (; output->subtype.img_format != BRASERO_IMAGE_FORMAT_NONE;
388
output->subtype.img_format >>= 1) {
390
result = brasero_burn_caps_is_output_supported (priv->caps,
393
if (result == BRASERO_BURN_OK)
401
brasero_dest_selection_get_default_output_path (BraseroDestSelection *self,
402
BraseroImageFormat format)
404
const gchar *suffixes [] = {".iso",
409
BraseroDestSelectionPrivate *priv;
410
const gchar *suffix = NULL;
414
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
416
if (format & BRASERO_IMAGE_FORMAT_BIN)
417
suffix = suffixes [0];
418
else if (format & BRASERO_IMAGE_FORMAT_CLONE)
419
suffix = suffixes [1];
420
else if (format & BRASERO_IMAGE_FORMAT_CUE)
421
suffix = suffixes [2];
422
else if (format & BRASERO_IMAGE_FORMAT_CDRDAO)
423
suffix = suffixes [3];
425
path = g_strdup_printf ("%s/brasero%s",
429
while (g_file_test (path, G_FILE_TEST_EXISTS)) {
432
path = g_strdup_printf ("%s/brasero-%i%s",
443
brasero_dest_selection_fix_image_extension (BraseroImageFormat format,
444
gboolean check_existence,
449
gchar *retval = NULL;
450
const gchar *suffix = NULL;;
451
const gchar *suffixes [] = {".iso",
457
/* search the last dot to check extension */
458
dot = g_utf8_strrchr (path, -1, '.');
459
if (dot && strlen (dot) < 5 && strlen (dot) > 1) {
460
if (format & BRASERO_IMAGE_FORMAT_BIN
461
&& strcmp (suffixes [0], dot))
463
else if (format & BRASERO_IMAGE_FORMAT_CLONE
464
&& strcmp (suffixes [1], dot))
466
else if (format & BRASERO_IMAGE_FORMAT_CUE
467
&& strcmp (suffixes [2], dot))
469
else if (format & BRASERO_IMAGE_FORMAT_CDRDAO
470
&& strcmp (suffixes [3], dot))
476
/* determine the proper suffix */
477
if (format & BRASERO_IMAGE_FORMAT_BIN)
478
suffix = suffixes [0];
479
else if (format & BRASERO_IMAGE_FORMAT_CLONE)
480
suffix = suffixes [1];
481
else if (format & BRASERO_IMAGE_FORMAT_CUE)
482
suffix = suffixes [2];
483
else if (format & BRASERO_IMAGE_FORMAT_CDRDAO)
484
suffix = suffixes [3];
488
/* make sure the file doesn't exist */
489
retval = g_strdup_printf ("%s%s", path, suffix);
490
if (!check_existence) {
495
while (g_file_test (retval, G_FILE_TEST_EXISTS)) {
497
retval = g_strdup_printf ("%s-%i%s", path, i, suffix);
506
brasero_dest_selection_get_possible_output_formats (BraseroDestSelection *self,
507
BraseroImageFormat *formats)
510
BraseroTrackType output;
511
BraseroImageFormat format;
512
BraseroDestSelectionPrivate *priv;
514
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
516
/* see how many output format are available */
517
format = BRASERO_IMAGE_FORMAT_CDRDAO;
518
(*formats) = BRASERO_IMAGE_FORMAT_NONE;
519
output.type = BRASERO_TRACK_TYPE_IMAGE;
521
for (; format > BRASERO_IMAGE_FORMAT_NONE; format >>= 1) {
522
BraseroBurnResult result;
524
output.subtype.img_format = format;
525
result = brasero_burn_caps_is_output_supported (priv->caps,
528
if (result == BRASERO_BURN_OK) {
529
(*formats) |= format;
538
brasero_dest_selection_image_format_changed_cb (BraseroImageProperties *dialog,
539
BraseroDestSelection *self)
541
BraseroDestSelectionPrivate *priv;
542
BraseroImageFormat format;
545
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
547
/* make sure the extension is still valid */
548
image_path = brasero_image_properties_get_path (dialog);
552
format = brasero_image_properties_get_format (dialog);
554
if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE) {
555
BraseroTrackType output;
557
brasero_dest_selection_get_default_output_format (self, &output);
558
format = output.subtype.img_format;
561
if (priv->default_path && !brasero_image_properties_is_path_edited (dialog)) {
562
/* not changed: get a new default path */
564
image_path = brasero_dest_selection_get_default_output_path (self, format);
567
image_path = brasero_dest_selection_fix_image_extension (format, FALSE, image_path);
569
image_path = brasero_dest_selection_get_default_output_path (self, format);
571
brasero_image_properties_set_path (dialog, image_path);
575
brasero_dest_selection_image_check_extension (BraseroDestSelection *self,
576
BraseroImageFormat format,
580
const gchar *suffixes [] = {".iso",
586
dot = g_utf8_strrchr (path, -1, '.');
588
if (format & BRASERO_IMAGE_FORMAT_BIN
589
&& !strcmp (suffixes [0], dot))
591
else if (format & BRASERO_IMAGE_FORMAT_CLONE
592
&& !strcmp (suffixes [1], dot))
594
else if (format & BRASERO_IMAGE_FORMAT_CUE
595
&& !strcmp (suffixes [2], dot))
597
else if (format & BRASERO_IMAGE_FORMAT_CDRDAO
598
&& !strcmp (suffixes [3], dot))
606
brasero_dest_selection_image_extension_ask (BraseroDestSelection *self)
610
GtkResponseType answer;
612
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
613
dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
614
GTK_DIALOG_DESTROY_WITH_PARENT |
618
_("Do you really want to keep the current extension for the disc image name?"));
621
gtk_window_set_title (GTK_WINDOW (dialog), _("Image Extension"));
622
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
623
_("If you choose to keep it programs may not be able to recognize the file type properly."));
625
gtk_dialog_add_button (GTK_DIALOG (dialog),
626
_("_Don't change extension"),
627
GTK_RESPONSE_CANCEL);
628
gtk_dialog_add_button (GTK_DIALOG (dialog),
629
_("Change _extension"),
632
answer = gtk_dialog_run (GTK_DIALOG (dialog));
633
gtk_widget_destroy (dialog);
635
if (answer == GTK_RESPONSE_YES)
642
brasero_dest_selection_image_properties (BraseroDestSelection *self)
644
BraseroDestSelectionPrivate *priv;
645
BraseroImageFormat formats;
646
BraseroImageFormat format;
647
BraseroTrackType output;
648
gulong format_changed;
649
gchar *original_path;
655
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
657
priv->drive_prop = brasero_image_properties_new ();
659
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
660
gtk_window_set_transient_for (GTK_WINDOW (priv->drive_prop), GTK_WINDOW (toplevel));
661
gtk_window_set_destroy_with_parent (GTK_WINDOW (priv->drive_prop), TRUE);
662
gtk_window_set_position (GTK_WINDOW (toplevel), GTK_WIN_POS_CENTER_ON_PARENT);
664
/* set all information namely path and format */
665
original_path = brasero_dest_selection_get_output_path (self);
666
brasero_image_properties_set_path (BRASERO_IMAGE_PROPERTIES (priv->drive_prop), original_path);
667
g_free (original_path);
669
if (!priv->default_format)
670
format = brasero_burn_session_get_output_format (priv->session);
672
format = BRASERO_IMAGE_FORMAT_ANY;
674
num = brasero_dest_selection_get_possible_output_formats (self, &formats);
675
brasero_image_properties_set_formats (BRASERO_IMAGE_PROPERTIES (priv->drive_prop),
676
num > 0 ? formats:BRASERO_IMAGE_FORMAT_NONE,
679
format_changed = g_signal_connect (priv->drive_prop,
681
G_CALLBACK (brasero_dest_selection_image_format_changed_cb),
684
/* and here we go ... run the thing */
685
gtk_widget_show (priv->drive_prop);
686
answer = gtk_dialog_run (GTK_DIALOG (priv->drive_prop));
688
g_signal_handler_disconnect (priv->drive_prop, format_changed);
690
if (answer != GTK_RESPONSE_OK) {
691
gtk_widget_destroy (priv->drive_prop);
692
priv->drive_prop = NULL;
696
/* get and check format */
697
format = brasero_image_properties_get_format (BRASERO_IMAGE_PROPERTIES (priv->drive_prop));
699
/* see if we are to choose the format ourselves */
700
if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE) {
701
brasero_dest_selection_get_default_output_format (self, &output);
702
format = output.subtype.img_format;
703
priv->default_format = TRUE;
706
priv->default_format = FALSE;
708
/* see if the user has changed the path */
709
if (brasero_image_properties_is_path_edited (BRASERO_IMAGE_PROPERTIES (priv->drive_prop)))
710
priv->default_path = FALSE;
712
if (!priv->default_path) {
713
/* check the extension */
714
image_path = brasero_image_properties_get_path (BRASERO_IMAGE_PROPERTIES (priv->drive_prop));
716
if (!brasero_dest_selection_image_check_extension (self, format, image_path)) {
717
if (brasero_dest_selection_image_extension_ask (self)) {
718
priv->default_ext = TRUE;
719
image_path = brasero_dest_selection_fix_image_extension (format, TRUE, image_path);
722
priv->default_ext = FALSE;
726
image_path = brasero_dest_selection_get_default_output_path (self, format);
728
gtk_widget_destroy (priv->drive_prop);
729
priv->drive_prop = NULL;
731
brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), image_path);
732
brasero_dest_selection_set_output_path (self,
739
brasero_dest_selection_properties_button_cb (GtkWidget *button,
740
BraseroDestSelection *self)
742
BraseroDestSelectionPrivate *priv;
745
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
747
drive = brasero_burn_session_get_burner (priv->session);
751
if (brasero_drive_is_fake (drive))
752
brasero_dest_selection_image_properties (self);
754
brasero_dest_selection_drive_properties (self);
758
brasero_dest_selection_add_drive_properties_flags (BraseroDestSelection *self,
759
BraseroBurnFlag flags,
760
BraseroBurnFlag *supported_retval,
761
BraseroBurnFlag *compulsory_retval)
763
BraseroBurnFlag flag;
764
BraseroDestSelectionPrivate *priv;
765
BraseroBurnFlag supported = BRASERO_BURN_FLAG_NONE;
766
BraseroBurnFlag compulsory = BRASERO_BURN_FLAG_NONE;
768
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
770
/* add flags then wipe out flags from session to check them one by one */
771
flags |= brasero_burn_session_get_flags (priv->session);
772
brasero_burn_session_remove_flag (priv->session, flags);
774
brasero_burn_caps_get_flags (priv->caps,
779
for (flag = 1; flag < BRASERO_BURN_FLAG_LAST; flag <<= 1) {
780
/* see if this flag was originally set */
784
/* Don't set write modes now in this case */
785
if (brasero_burn_session_same_src_dest_drive (priv->session)
786
&& (flag & (BRASERO_BURN_FLAG_DAO|BRASERO_BURN_FLAG_RAW)))
790
&& (compulsory & brasero_burn_session_get_flags (priv->session)) != compulsory) {
791
brasero_burn_session_add_flag (priv->session, compulsory);
792
supported = BRASERO_BURN_FLAG_NONE;
793
compulsory = BRASERO_BURN_FLAG_NONE;
794
brasero_burn_caps_get_flags (priv->caps,
800
if (supported & flag) {
801
brasero_burn_session_add_flag (priv->session, flag);
802
supported = BRASERO_BURN_FLAG_NONE;
803
compulsory = BRASERO_BURN_FLAG_NONE;
804
brasero_burn_caps_get_flags (priv->caps,
811
/* Always set this flag whenever possible */
812
if (supported & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
813
brasero_burn_session_add_flag (priv->session,
814
BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE|
815
BRASERO_BURN_FLAG_FAST_BLANK);
818
/* When copying with same drive don't set write mode, it'll be set later */
819
if (!brasero_burn_session_same_src_dest_drive (priv->session)) {
820
/* use DAO whenever it's possible */
821
if (supported & BRASERO_BURN_FLAG_DAO) {
822
brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_DAO);
823
brasero_burn_caps_get_flags (priv->caps,
830
if (supported_retval)
831
*supported_retval = supported;
832
if (compulsory_retval)
833
*compulsory_retval = compulsory;
837
brasero_dest_selection_set_drive_properties (BraseroDestSelection *self)
839
BraseroDestSelectionPrivate *priv;
840
BraseroBurnResult is_valid;
841
BraseroTrackType source;
842
BraseroBurnFlag flags;
843
BraseroMedium *medium;
851
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
853
brasero_burn_session_get_input_type (priv->session, &source);
854
if (source.type == BRASERO_TRACK_TYPE_NONE) {
856
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
859
gtk_widget_set_sensitive (priv->button, FALSE);
860
gtk_widget_set_sensitive (priv->copies_box, FALSE);
864
if (brasero_burn_session_is_dest_file (priv->session)) {
865
BraseroBurnResult result;
867
result = brasero_burn_caps_is_session_supported (priv->caps, priv->session);
869
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
871
(result == BRASERO_BURN_OK));
873
gtk_widget_set_sensitive (priv->button, (result == BRASERO_BURN_OK));
877
drive = brasero_burn_session_get_burner (priv->session);
880
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
883
gtk_widget_set_sensitive (priv->button, FALSE);
884
gtk_widget_set_sensitive (priv->copies_box, FALSE);
888
medium = brasero_drive_get_medium (drive);
889
if (!medium || brasero_medium_get_status (medium) == BRASERO_MEDIUM_NONE) {
891
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
894
gtk_widget_set_sensitive (priv->button, FALSE);
895
gtk_widget_set_sensitive (priv->copies_box, FALSE);
899
/* update/set the rate */
900
client = gconf_client_get_default ();
902
key = brasero_burn_session_get_config_key (priv->session, "speed");
904
g_object_unref (client);
908
value = gconf_client_get_without_default (client, key, NULL);
912
rate = brasero_medium_get_max_write_speed (medium);
914
rate = gconf_value_get_int (value) * 1024;
915
gconf_value_free (value);
918
brasero_burn_session_set_rate (priv->session, rate);
920
/* do the same with the flags.
921
* NOTE: every time we add a flag we have to re-ask for supported flags.
922
* Indeed two flags could be mutually exclusive and then adding both at
923
* the same would make the session unusable (MULTI and BLANK_BEFORE_WRITE) */
924
key = brasero_burn_session_get_config_key (priv->session, "flags");
926
g_object_unref (client);
930
value = gconf_client_get_without_default (client, key, NULL);
933
if (brasero_dest_selection_check_same_src_dest (self)) {
934
BraseroBurnFlag supported = BRASERO_BURN_FLAG_NONE;
935
BraseroBurnFlag compulsory = BRASERO_BURN_FLAG_NONE;
939
/* wipe out previous flags */
940
brasero_burn_session_remove_flag (priv->session,
941
BRASERO_DRIVE_PROPERTIES_FLAGS);
945
flags = gconf_value_get_int (value) & BRASERO_DEST_SAVED_FLAGS;
946
gconf_value_free (value);
949
flags = BRASERO_BURN_FLAG_EJECT|
950
BRASERO_BURN_FLAG_BURNPROOF;
952
brasero_dest_selection_add_drive_properties_flags (self,
954
BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE|
955
BRASERO_BURN_FLAG_FAST_BLANK,
959
/* NOTE: of course NO_TMP is not possible; DAO and BLANK_BEFORE
960
* could be yet. The problem here is that we cannot test all
961
* this since we don't know yet what the disc type is going to
962
* be. So we set DAO and BLANK_BEFORE_WRITE just in case.
963
* Hopefully burn.c will be able to handle that later. */
966
BraseroBurnFlag supported = BRASERO_BURN_FLAG_NONE;
967
BraseroBurnFlag compulsory = BRASERO_BURN_FLAG_NONE;
969
flags = BRASERO_BURN_FLAG_EJECT|
970
BRASERO_BURN_FLAG_BURNPROOF;
972
if (source.type == BRASERO_TRACK_TYPE_DATA
973
|| source.type == BRASERO_TRACK_TYPE_DISC
974
|| source.type == BRASERO_TRACK_TYPE_IMAGE)
975
flags |= BRASERO_BURN_FLAG_NO_TMP_FILES;
977
brasero_dest_selection_add_drive_properties_flags (self,
983
BraseroBurnFlag supported = BRASERO_BURN_FLAG_NONE;
984
BraseroBurnFlag compulsory = BRASERO_BURN_FLAG_NONE;
986
/* set the saved flags (make sure they are supported) */
987
flags = gconf_value_get_int (value) & BRASERO_DEST_SAVED_FLAGS;
988
gconf_value_free (value);
990
brasero_dest_selection_add_drive_properties_flags (self,
996
/* Now that we updated the session flags see if everything works */
997
is_valid = brasero_burn_caps_is_session_supported (priv->caps, priv->session);
999
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1001
(is_valid == BRASERO_BURN_OK));
1003
gtk_widget_set_sensitive (priv->copies_box, (is_valid == BRASERO_BURN_OK));
1004
gtk_widget_set_sensitive (priv->button, (is_valid == BRASERO_BURN_OK));
1006
key = g_strdup_printf ("%s/tmpdir", BRASERO_DRIVE_PROPERTIES_KEY);
1007
path = gconf_client_get_string (client, key, NULL);
1008
brasero_burn_session_set_tmpdir (priv->session, path);
1012
g_object_unref (client);
1016
brasero_dest_selection_set_image_properties (BraseroDestSelection *self)
1018
BraseroDestSelectionPrivate *priv;
1019
BraseroBurnResult result;
1020
BraseroTrackType output;
1023
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
1024
priv->default_format = TRUE;
1025
priv->default_path = TRUE;
1027
/* apparently nothing has been set yet so give a default location */
1028
brasero_dest_selection_get_default_output_format (self, &output);
1030
if (output.type == BRASERO_TRACK_TYPE_NONE
1031
|| output.subtype.img_format == BRASERO_IMAGE_FORMAT_NONE) {
1032
/* That means that we've got a problem */
1033
/* FIXME: we need to display a message nevertheless */
1034
brasero_burn_session_set_image_output_full (priv->session,
1035
BRASERO_IMAGE_FORMAT_NONE,
1038
g_signal_emit (self,
1039
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1043
gtk_widget_set_sensitive (priv->button, FALSE);
1047
path = brasero_dest_selection_get_default_output_path (self, output.subtype.img_format);
1048
g_signal_emit (self,
1049
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1052
gtk_widget_set_sensitive (priv->button, TRUE);
1053
brasero_dest_selection_set_output_path (self,
1054
output.subtype.img_format,
1056
brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), path);
1059
brasero_burn_session_remove_flag (priv->session,
1060
BRASERO_BURN_FLAG_DUMMY|
1061
BRASERO_BURN_FLAG_NO_TMP_FILES);
1063
result = brasero_burn_caps_is_session_supported (priv->caps, priv->session);
1064
g_signal_emit (self,
1065
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1067
(result == BRASERO_BURN_OK));
1068
gtk_widget_set_sensitive (priv->button, (result == BRASERO_BURN_OK));
1072
brasero_dest_selection_check_image_settings (BraseroDestSelection *self)
1074
BraseroDestSelectionPrivate *priv;
1075
BraseroBurnResult result;
1077
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
1079
if (brasero_burn_session_get_output (priv->session, NULL, NULL, NULL) == BRASERO_BURN_OK) {
1081
BraseroTrackType output;
1082
BraseroImageFormat format;
1084
/* we already have an output check its validity */
1085
output.type = BRASERO_TRACK_TYPE_IMAGE;
1087
if (!priv->default_format) {
1088
/* The user set a format */
1089
output.subtype.img_format = brasero_burn_session_get_output_format (priv->session);
1091
/* check that the format is still supported. If not then find a good default */
1092
result = brasero_burn_caps_is_output_supported (priv->caps,
1095
if (result != BRASERO_BURN_OK) {
1096
priv->default_format = TRUE;
1097
brasero_dest_selection_get_default_output_format (self, &output);
1100
else /* retrieve a possible better default format */
1101
brasero_dest_selection_get_default_output_format (self, &output);
1103
format = output.subtype.img_format;
1104
g_signal_emit (self,
1105
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1107
(format != BRASERO_IMAGE_FORMAT_NONE));
1110
gtk_widget_set_sensitive (priv->button, (format != BRASERO_IMAGE_FORMAT_NONE));
1112
if (format == BRASERO_IMAGE_FORMAT_NONE) {
1113
/* FIXME: we've got a problem and it's not possible,
1114
* display a message to say so */
1115
if (priv->drive_prop) {
1116
gtk_widget_destroy (priv->drive_prop);
1117
priv->drive_prop = NULL;
1123
if (!priv->default_path) {
1124
/* check that the extension is ok if not update it */
1125
path = brasero_dest_selection_get_output_path (self);
1126
if (priv->default_ext
1127
&& brasero_dest_selection_image_check_extension (self, format, path))
1128
path = brasero_dest_selection_fix_image_extension (format, TRUE, path);
1131
path = brasero_dest_selection_get_default_output_path (self, format);
1133
brasero_dest_selection_set_output_path (self,
1136
brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), path);
1140
brasero_dest_selection_set_image_properties (self);
1142
if (priv->drive_prop) {
1143
BraseroImageFormat formats;
1146
/* update image settings dialog if needed */
1147
num = brasero_dest_selection_get_possible_output_formats (self, &formats);
1148
brasero_image_properties_set_formats (BRASERO_IMAGE_PROPERTIES (priv->drive_prop),
1149
num > 1 ? formats:BRASERO_IMAGE_FORMAT_NONE,
1150
BRASERO_IMAGE_FORMAT_ANY);
1153
brasero_burn_session_remove_flag (priv->session, BRASERO_BURN_FLAG_DUMMY);
1155
result = brasero_burn_caps_is_session_supported (priv->caps, priv->session);
1156
g_signal_emit (self,
1157
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1159
(result == BRASERO_BURN_OK));
1160
gtk_widget_set_sensitive (priv->button, (result == BRASERO_BURN_OK));
1164
brasero_dest_selection_check_drive_settings (BraseroDestSelection *self)
1166
BraseroBurnFlag compulsory = BRASERO_BURN_FLAG_NONE;
1167
BraseroBurnFlag supported = BRASERO_BURN_FLAG_NONE;
1168
BraseroDestSelectionPrivate *priv;
1169
BraseroBurnResult result;
1170
BraseroBurnFlag flags;
1172
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
1174
/* Update the flags and save them */
1175
if (brasero_dest_selection_check_same_src_dest (self)) {
1176
/* These are always set in any case and there is no way to check
1177
* the current flags */
1178
brasero_dest_selection_add_drive_properties_flags (self,
1179
BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE|
1180
BRASERO_BURN_FLAG_FAST_BLANK,
1185
/* Try to properly update the flags for the current drive */
1186
flags = brasero_burn_session_get_flags (priv->session);
1188
/* check each flag before re-adding it */
1189
brasero_dest_selection_add_drive_properties_flags (self,
1195
/* NOTE: we save even if result != BRASERO_BURN_OK. That way if a flag
1196
* is no longer supported after the removal of a plugin then the
1197
* properties are reset and the user can access them again */
1199
/* save potential changes for the new profile */
1200
brasero_dest_selection_save_drive_properties (self);
1202
if (priv->drive_prop) {
1203
/* the dialog may need to be updated */
1204
brasero_drive_properties_set_flags (BRASERO_DRIVE_PROPERTIES (priv->drive_prop),
1210
/* Once we've updated the flags, send a signal to tell whether we
1211
* support this disc or not. Update everything. */
1212
result = brasero_burn_caps_is_session_supported (priv->caps, priv->session);
1213
g_signal_emit (self,
1214
brasero_dest_selection_signals [VALID_MEDIA_SIGNAL],
1216
(result == BRASERO_BURN_OK));
1219
gtk_widget_set_sensitive (priv->button, (result == BRASERO_BURN_OK));
1221
gtk_widget_set_sensitive (priv->copies_box, (result == BRASERO_BURN_OK));
1225
brasero_dest_selection_source_changed (BraseroBurnSession *session,
1226
BraseroDestSelection *self)
1228
BraseroDestSelectionPrivate *priv;
1230
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
1232
brasero_drive_info_set_same_src_dest (BRASERO_DRIVE_INFO (priv->info),
1233
brasero_burn_session_same_src_dest_drive (priv->session));
1235
if (brasero_burn_session_is_dest_file (priv->session)) {
1236
/* check that if a path was set there may be none if there was
1237
* no disc inserted when the dialog was created. */
1238
if (brasero_burn_session_get_output (priv->session, NULL, NULL, NULL) != BRASERO_BURN_OK)
1239
brasero_dest_selection_set_image_properties (self);
1241
brasero_dest_selection_check_image_settings (self);
1246
brasero_dest_selection_set_drive_properties (self);
1250
brasero_dest_selection_caps_changed (BraseroPluginManager *manager,
1251
BraseroDestSelection *self)
1253
BraseroDestSelectionPrivate *priv;
1255
/* In this case we are still in the same context (same src, dest) so we
1256
* check that all current flags and such are still valid */
1258
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
1260
/* The caps of the library / the source have changed so we must check:
1261
* if it's an image that the output type is still possible
1262
* if it's a drive that all flags are still supported and that the media is too */
1263
if (brasero_burn_session_is_dest_file (priv->session))
1264
brasero_dest_selection_check_image_settings (self);
1266
brasero_dest_selection_check_drive_settings (self);
1270
brasero_dest_selection_output_changed (BraseroBurnSession *session,
1271
BraseroDestSelection *self)
76
G_DEFINE_TYPE (BraseroDestSelection, brasero_dest_selection, BRASERO_TYPE_MEDIUM_SELECTION);
80
brasero_dest_selection_lock (BraseroDestSelection *self,
83
BraseroDestSelectionPrivate *priv;
85
priv = BRASERO_DEST_SELECTION_PRIVATE (self);
87
gtk_widget_set_sensitive (GTK_WIDGET (self), (locked != TRUE));
89
gtk_widget_queue_draw (GTK_WIDGET (self));
90
if (priv->locked_drive) {
91
brasero_drive_unlock (priv->locked_drive);
92
g_object_unref (priv->locked_drive);
98
drive = brasero_medium_selection_get_active_drive (BRASERO_MEDIUM_SELECTION (self));
99
priv->locked_drive = drive;
101
if (priv->locked_drive)
102
brasero_drive_lock (priv->locked_drive,
103
_("ongoing burning process"),
109
brasero_dest_selection_valid_session (BraseroSessionCfg *session,
110
BraseroDestSelection *self)
1273
112
BraseroDestSelectionPrivate *priv;
1274
113
BraseroDrive *burner;