245
brasero_burn_dialog_wait_for_insertion (NautilusBurnDriveMonitor *monitor,
246
NautilusBurnDrive *drive,
249
NautilusBurnDrive *waited_drive;
251
waited_drive = g_object_get_data (G_OBJECT (message), WAITED_FOR_DRIVE);
253
/* we must make sure that the change was triggered
254
* by the current selected drive */
255
if (!nautilus_burn_drive_equal (drive, waited_drive))
258
/* we might have a dialog waiting for the
259
* insertion of a disc if so close it */
260
gtk_dialog_response (GTK_DIALOG (message), GTK_RESPONSE_OK);
224
263
static BraseroBurnResult
225
264
brasero_burn_dialog_insert_disc_cb (BraseroBurn *burn,
265
NautilusBurnDrive *drive,
226
266
BraseroBurnError error,
227
267
BraseroMediaType type,
228
268
BraseroBurnDialog *dialog)
231
273
GtkWindow *window;
232
274
GtkWidget *message;
233
275
gboolean hide = FALSE;
234
char *main_message = NULL, *secondary_message = NULL;
276
NautilusBurnDriveMonitor *monitor;
277
gchar *main_message = NULL, *secondary_message = NULL;
236
279
if (!GTK_WIDGET_VISIBLE (dialog)) {
237
280
gtk_widget_show (GTK_WIDGET (dialog));
284
/* FIXME: we should specify the name of the drive where to put the disc */
286
drive_name = nautilus_burn_drive_get_name_for_display (drive);
241
290
if (error == BRASERO_BURN_ERROR_MEDIA_BUSY) {
242
main_message = g_strdup (_("The disc in the drive is busy:"));
243
secondary_message = g_strdup (_("make sure another application is not using it and click OK"));
291
main_message = g_strdup_printf (_("The disc in \"%s\" is busy:"),
293
secondary_message = g_strdup (_("make sure another application is not using it."));
245
295
else if (error == BRASERO_BURN_ERROR_MEDIA_NONE) {
246
main_message = g_strdup (_("There is no disc in the drive:"));
296
main_message = g_strdup_printf (_("There is no disc in \"%s\":"),
247
298
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, TRUE);
249
300
else if (error == BRASERO_BURN_ERROR_MEDIA_NOT_REWRITABLE) {
250
main_message = g_strdup (_("The disc in the drive is not rewritable:"));
301
main_message = g_strdup_printf (_("The disc in \"%s\" is not rewritable:"),
251
303
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
253
305
else if (error == BRASERO_BURN_ERROR_MEDIA_BLANK) {
254
main_message = g_strdup (_("The disc in the drive is empty:"));
306
main_message = g_strdup_printf (_("The disc in \"%s\" is empty:"),
255
308
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
257
310
else if (error == BRASERO_BURN_ERROR_MEDIA_NOT_WRITABLE) {
258
main_message = g_strdup (_("The disc in the drive is not writable:"));
311
main_message = g_strdup_printf (_("The disc in \"%s\" is not writable:"),
259
313
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
261
315
else if (error == BRASERO_BURN_ERROR_DVD_NOT_SUPPORTED) {
262
main_message = g_strdup (_("The disc in the drive is a DVD:"));
316
main_message = g_strdup_printf (_("The disc in \"%s\" is a DVD:"),
263
318
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
265
320
else if (error == BRASERO_BURN_ERROR_CD_NOT_SUPPORTED) {
266
main_message = g_strdup (_("The disc in the drive is a CD:"));
321
main_message = g_strdup_printf (_("The disc in \"%s\" is a CD:"),
267
323
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
269
325
else if (error == BRASERO_BURN_ERROR_MEDIA_SPACE) {
270
main_message = g_strdup (_("The disc in the drive is not big enough:"));
326
main_message = g_strdup_printf (_("The disc in \"%s\" is not big enough:"),
271
328
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
273
330
else if (error == BRASERO_BURN_ERROR_NONE) {
274
main_message = g_strdup_printf ("<b><big>%s</big></b>",
275
brasero_burn_dialog_get_media_type_string (burn, type, FALSE));
331
secondary_message = brasero_burn_dialog_get_media_type_string (burn, type, FALSE);
332
main_message = g_strdup_printf ("<b><big>%s</big></b>", secondary_message);
333
g_free (secondary_message);
334
secondary_message = NULL;
277
336
else if (error == BRASERO_BURN_ERROR_RELOAD_MEDIA) {
278
main_message = g_strdup (_("The disc in the drive needs to be reloaded:"));
337
main_message = g_strdup_printf (_("The disc in \"%s\" needs to be reloaded:"),
279
339
secondary_message = g_strdup (_("eject the disc and reload it."));
282
344
window = GTK_WINDOW (dialog);
284
346
if (secondary_message) {
786
975
gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->priv->image), pixbuf);
787
976
g_object_unref (pixbuf);
789
gtk_label_set_markup (GTK_LABEL (dialog->priv->header), header);
978
gtk_label_set_text (GTK_LABEL (dialog->priv->header), header);
979
gtk_label_set_use_markup (GTK_LABEL (dialog->priv->header), TRUE);
794
brasero_burn_dialog_media_added_cb (NautilusBurnDrive *drive,
984
brasero_burn_dialog_media_added_cb (NautilusBurnDriveMonitor *monitor,
985
NautilusBurnDrive *drive,
795
986
BraseroBurnDialog *dialog)
988
/* we must make sure that the change was triggered
989
* by the current selected drive */
990
if (!nautilus_burn_drive_equal (drive, dialog->priv->drive))
797
993
brasero_burn_dialog_update_info (dialog);
799
/* we might have a dialog waiting for the
800
* insertion of a disc if so close it */
801
if (dialog->priv->waiting_disc_dialog) {
802
gtk_dialog_response (GTK_DIALOG (dialog->priv->waiting_disc_dialog),
808
brasero_burn_dialog_media_removed_cb (NautilusBurnDrive *drive,
997
brasero_burn_dialog_media_removed_cb (NautilusBurnDriveMonitor *monitor,
998
NautilusBurnDrive *drive,
809
999
BraseroBurnDialog *dialog)
811
1001
GdkPixbuf *pixbuf;
1003
/* we must make sure that the change was triggered
1004
* by the current selected drive */
1005
if (!nautilus_burn_drive_equal (drive, dialog->priv->drive))
813
1008
pixbuf = brasero_utils_get_icon ("gnome-dev-removable", 48);
814
1009
gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->priv->image), pixbuf);
815
1010
g_object_unref (pixbuf);
818
#ifdef HAVE_LIBNOTIFY
821
brasero_burn_dialog_notify_daemon_close (NotifyNotification *notification,
822
BraseroBurnDialog *dialog)
824
if (dialog->priv->loop
825
&& g_main_loop_is_running (dialog->priv->loop))
826
g_main_loop_quit (dialog->priv->loop);
830
brasero_burn_dialog_notify_daemon (BraseroBurnDialog *dialog,
832
const char *secondary)
834
NotifyNotification *notification;
837
notification = notify_notification_new (primary,
844
g_signal_connect (notification,
846
G_CALLBACK (brasero_burn_dialog_notify_daemon_close),
849
notify_notification_set_timeout (notification, 10000);
850
notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
851
result = notify_notification_show (notification, NULL);
853
/* now we wait for the notification to disappear or for the user to
854
* click on the icon in the tray */
855
dialog->priv->loop = g_main_loop_new (NULL, FALSE);
856
g_main_loop_run (dialog->priv->loop);
858
if (dialog->priv->loop) {
859
g_main_loop_unref (dialog->priv->loop);
860
dialog->priv->loop = NULL;
1013
static BraseroBurnResult
1014
brasero_burn_dialog_job_get_track (BraseroBurnDialog *dialog,
1016
const BraseroTrackSource *source,
1017
BraseroTrackSource **retval,
1020
BraseroBurnResult result;
1023
result = brasero_job_set_source (job,
1027
if (result != BRASERO_BURN_OK)
1030
brasero_job_set_debug (job, debug);
1031
brasero_job_set_session (job, dialog->priv->session);
1033
/* NOTE: here we don't obey the flags as that data is ours and not
1034
* part of the resulting track. */
1035
result = brasero_imager_set_output (BRASERO_IMAGER (job),
1037
TRUE, /* we don't overwrite */
1038
TRUE, /* we clean everything */
1041
if (result != BRASERO_BURN_OK)
1044
task = brasero_task_new ();
1045
brasero_task_set_total (task, dialog->priv->isosize);
1047
g_signal_connect (task,
1049
G_CALLBACK (brasero_burn_dialog_job_progress_changed),
1051
g_signal_connect (task,
1053
G_CALLBACK (brasero_burn_dialog_job_action_changed),
1056
brasero_job_set_task (job, task);
1057
result = brasero_imager_get_track (BRASERO_IMAGER (job),
1061
brasero_job_set_task (job, NULL);
1062
g_object_unref (task);
869
brasero_burn_dialog_success_timeout (GtkDialog *dialog)
871
gtk_dialog_response (dialog, GTK_RESPONSE_CANCEL);
1067
static BraseroBurnResult
1068
brasero_burn_dialog_get_local_source (BraseroBurnDialog *dialog,
1069
const BraseroTrackSource *source,
1070
BraseroTrackSource **local,
1073
if (source->type == BRASERO_TRACK_SOURCE_DISC
1074
|| source->type == BRASERO_TRACK_SOURCE_INF) {
1075
*local = brasero_track_source_copy (source);
1076
return BRASERO_BURN_OK;
1079
if (dialog->priv->local_image)
1080
g_object_unref (dialog->priv->local_image);
1082
dialog->priv->local_image = g_object_new (BRASERO_TYPE_LOCAL_IMAGE, NULL);
1083
return brasero_burn_dialog_job_get_track (dialog,
1084
dialog->priv->local_image,
1090
static BraseroBurnResult
1091
brasero_burn_dialog_get_checksumed_source (BraseroBurnDialog *dialog,
1092
const BraseroTrackSource *source,
1093
BraseroTrackSource **checksum,
1096
if (source->type != BRASERO_TRACK_SOURCE_DATA) {
1097
*checksum = brasero_track_source_copy (source);
1098
return BRASERO_BURN_OK;
1101
if (dialog->priv->checksum)
1102
g_object_unref (dialog->priv->checksum);
1104
dialog->priv->checksum = g_object_new (BRASERO_TYPE_BURN_SUM, NULL);
1105
if (!dialog->priv->checksum)
1106
return BRASERO_BURN_ERR;
1108
return brasero_burn_dialog_job_get_track (dialog,
1109
dialog->priv->checksum,
876
brasero_burn_dialog_notify_dialog (BraseroBurnDialog *dialog,
877
const gchar *primary,
878
const gchar *secondary,
1116
brasero_burn_dialog_message (BraseroBurnDialog *dialog,
1118
const gchar *primary_message,
1119
const gchar *secondary_message,
1120
GtkMessageType type)
883
1122
GtkWidget *message;
884
GtkResponseType response;
886
if (!GTK_WIDGET_VISIBLE (dialog))
887
gtk_widget_show (GTK_WIDGET (dialog));
889
1124
message = gtk_message_dialog_new (GTK_WINDOW (dialog),
890
GTK_DIALOG_DESTROY_WITH_PARENT |
1126
GTK_DIALOG_DESTROY_WITH_PARENT,
893
1128
GTK_BUTTONS_CLOSE,
1131
gtk_window_set_title (GTK_WINDOW (message), title);
1133
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
1135
gtk_dialog_run (GTK_DIALOG (message));
1136
gtk_widget_destroy (message);
1140
brasero_burn_dialog_integrity_ok (BraseroBurnDialog *dialog)
1142
brasero_burn_dialog_message (dialog,
1143
_("Data integrity check"),
1144
_("The file integrity check succeeded:"),
1145
_("there seems to be no corrupted file on the disc."),
1150
brasero_burn_dialog_integrity_error (BraseroBurnDialog *dialog,
1151
const GError *error)
1153
brasero_burn_dialog_message (dialog,
1154
_("Data integrity check"),
1155
_("The data integrity check could not be performed:"),
1156
error ? error->message:_("unknown error."),
1161
brasero_burn_dialog_integrity_wrong_sums (BraseroBurnDialog *dialog)
1163
brasero_burn_dialog_message (dialog,
1164
_("Data integrity check"),
1165
_("The file integrity check failed:"),
1166
_("some files may be corrupted on the disc."),
1171
brasero_burn_dialog_integrity_check_end (BraseroBurnDialog *dialog,
1172
BraseroBurnResult result,
1175
if (result == BRASERO_BURN_CANCEL)
1179
brasero_burn_dialog_integrity_error (dialog, error);
1180
g_error_free (error);
1182
else if (result != BRASERO_BURN_OK)
1183
brasero_burn_dialog_integrity_wrong_sums (dialog);
1185
brasero_burn_dialog_integrity_ok (dialog);
1188
static BraseroBurnResult
1189
brasero_burn_dialog_reload_disc_dlg (BraseroBurnDialog *dialog,
1190
NautilusBurnDrive *drive,
1191
const gchar *primary,
1192
const gchar *secondary)
1197
NautilusBurnDriveMonitor *monitor;
1199
/* display a dialog to the user explaining what we're
1200
* going to do, that is reload the disc before checking */
1201
message = gtk_message_dialog_new (GTK_WINDOW (dialog),
1203
GTK_DIALOG_DESTROY_WITH_PARENT,
1208
gtk_window_set_title (GTK_WINDOW (message), _("Data integrity check"));
896
1210
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
901
&& gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check)))
902
id = g_timeout_add (10000,
903
(GSourceFunc) brasero_burn_dialog_success_timeout,
906
response = gtk_dialog_run (GTK_DIALOG (message));
907
gtk_widget_destroy (message);
909
if (id && response != GTK_RESPONSE_CANCEL)
910
g_source_remove (id);
1213
g_object_set_data (G_OBJECT (message), WAITED_FOR_DRIVE, drive);
1214
monitor = nautilus_burn_get_drive_monitor ();
1215
added_id = g_signal_connect_after (monitor,
1217
G_CALLBACK (brasero_burn_dialog_wait_for_insertion),
1220
answer = gtk_dialog_run (GTK_DIALOG (message));
1222
g_signal_handler_disconnect (monitor, added_id);
1223
gtk_widget_destroy (message);
1225
if (answer != GTK_RESPONSE_OK)
1226
return BRASERO_BURN_CANCEL;
1228
return BRASERO_BURN_OK;
1231
static BraseroBurnResult
1232
brasero_burn_dialog_check_image_integrity (BraseroBurnDialog *dialog,
1233
NautilusBurnDrive *drive,
1234
const BraseroTrackSource *source,
1238
BraseroBurnResult result;
1239
BraseroTrackSource track;
1240
BraseroTrackSource *checksum_disc, *checksum_track;
1242
/* NOTE: since we don't want to destroy that track we don't ref drive */
1243
track.type = BRASERO_TRACK_SOURCE_DISC;
1244
track.format = BRASERO_IMAGE_FORMAT_NONE;
1245
track.contents.drive.disc = drive;
1247
if (dialog->priv->checksum)
1248
g_object_unref (dialog->priv->checksum);
1250
dialog->priv->checksum = g_object_new (BRASERO_TYPE_BURN_SUM, NULL);
1251
if (!dialog->priv->checksum)
1252
return BRASERO_BURN_ERR;
1254
result = brasero_burn_dialog_job_get_track (dialog,
1255
dialog->priv->checksum,
1259
if (result != BRASERO_BURN_OK)
1262
if (source->type == BRASERO_TRACK_SOURCE_DISC) {
1263
NautilusBurnMediaType media;
1264
NautilusBurnDrive *src_drive;
1266
src_drive = source->contents.drive.disc;
1267
media = nautilus_burn_drive_get_media_type (src_drive);
1268
if (media == NAUTILUS_BURN_MEDIA_TYPE_ERROR) {
1272
name = nautilus_burn_drive_get_name_for_display (src_drive);
1273
message = g_strdup_printf (_("Please insert it in \"%s\"."),
1277
result = brasero_burn_dialog_reload_disc_dlg (dialog,
1279
_("The source media needs to be inserted:"),
1283
else if (nautilus_burn_drive_equal (drive, src_drive)) {
1287
nautilus_burn_drive_eject (src_drive);
1289
name = nautilus_burn_drive_get_name_for_display (src_drive);
1290
message = g_strdup_printf (_("Please insert it again in \"%s\"."), name);
1293
result = brasero_burn_dialog_reload_disc_dlg (dialog,
1295
_("The source media needs to be reloaded:"),
1300
if (result == BRASERO_BURN_CANCEL) {
1301
brasero_track_source_free (checksum_disc);
1306
/* now that we have a checksum for the drive we compare get one
1308
result = brasero_burn_dialog_job_get_track (dialog,
1309
dialog->priv->checksum,
1313
if (result != BRASERO_BURN_OK) {
1314
brasero_track_source_free (checksum_disc);
1318
/* compare the checksums */
1319
success = brasero_md5_equal (&checksum_track->contents.sum.md5,
1320
&checksum_disc->contents.sum.md5);
1322
brasero_track_source_free (checksum_disc);
1323
brasero_track_source_free (checksum_track);
1326
return BRASERO_BURN_OK;
1328
return BRASERO_BURN_ERR;
1332
brasero_burn_dialog_check_integrity_report (gpointer user_data)
1334
BraseroBurnDialog *dialog = BRASERO_BURN_DIALOG (user_data);
1336
if (dialog->priv->file_ctx) {
1337
gint checked, total;
1340
brasero_sum_check_progress (dialog->priv->file_ctx,
1344
progress = (gdouble) checked / (gdouble) total;
1345
brasero_burn_progress_set_status (BRASERO_BURN_PROGRESS (dialog->priv->progress),
1358
static BraseroBurnResult
1359
brasero_burn_dialog_check_files_integrity (BraseroBurnDialog *dialog,
1360
const gchar *mount_point,
1364
BraseroBurnResult result;
1365
GSList *wrong_sums = NULL;
1367
id = g_timeout_add (500,
1368
brasero_burn_dialog_check_integrity_report,
1371
brasero_burn_progress_set_action (BRASERO_BURN_PROGRESS (dialog->priv->progress),
1372
BRASERO_BURN_ACTION_CHECKSUM,
1373
_("Checking files integrity"));
1375
/* check the sum of every file */
1376
dialog->priv->file_ctx = brasero_sum_check_new ();
1377
result = brasero_sum_check (dialog->priv->file_ctx,
1382
brasero_sum_check_free (dialog->priv->file_ctx);
1383
g_source_remove (id);
1386
g_slist_foreach (wrong_sums, (GFunc) g_free, NULL);
1387
g_slist_free (wrong_sums);
1389
result = BRASERO_BURN_ERR;
1396
brasero_burn_dialog_get_mount_point_cb (NautilusBurnDrive *drive,
1397
const gchar *mount_point,
1398
gboolean mounted_by_us,
1399
const GError *error,
1400
gpointer callback_data)
1402
BraseroBurnDialog *dialog = callback_data;
1403
GError *local_error = NULL;
1407
brasero_burn_dialog_integrity_error (dialog, error);
1408
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
1412
success = brasero_burn_dialog_check_files_integrity (dialog,
1417
NCB_DRIVE_UNMOUNT (drive, NULL);
1419
brasero_burn_dialog_integrity_check_end (dialog, success, local_error);
1421
g_error_free (local_error);
1423
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
1427
brasero_burn_dialog_integrity_start (BraseroBurnDialog *dialog,
1428
NautilusBurnDrive *burner,
1429
const BraseroTrackSource *source)
1431
BraseroBurnResult result;
1434
if (nautilus_burn_drive_get_media_type (burner) < NAUTILUS_BURN_MEDIA_TYPE_CD) {
1438
/* display a dialog to the user explaining what we're
1439
* going to do, that is reload the disc before checking */
1440
name = nautilus_burn_drive_get_name_for_display (burner);
1441
message = g_strdup_printf (_("please, insert it again in \"%s\"."),
1445
result = brasero_burn_dialog_reload_disc_dlg (dialog,
1447
_("The burnt media needs to be reloaded to perform integrity check:"),
1451
if (result == BRASERO_BURN_CANCEL)
1455
/* change the text */
1456
header = g_strdup (gtk_label_get_text (GTK_LABEL (dialog->priv->header)));
1458
brasero_burn_dialog_activity_start (dialog);
1459
gtk_label_set_text (GTK_LABEL (dialog->priv->header),
1460
_("<b><big>Performing integrity check</big></b>"));
1461
gtk_label_set_use_markup (GTK_LABEL (dialog->priv->header), TRUE);
1463
/* get the mount point */
1464
if (source->type == BRASERO_TRACK_SOURCE_DATA) {
1465
BraseroMountHandle *handle;
1466
GtkResponseType answer;
1468
brasero_burn_dialog_action_changed_real (dialog,
1469
BRASERO_BURN_ACTION_CHECKSUM,
1470
_("Mounting disc"));
1472
handle = NCB_DRIVE_GET_MOUNT_POINT (burner,
1473
brasero_burn_dialog_get_mount_point_cb,
1476
answer = gtk_dialog_run (GTK_DIALOG (dialog));
1477
if (answer == GTK_RESPONSE_CANCEL)
1478
NCB_DRIVE_GET_MOUNT_POINT_CANCEL (handle);
1481
GError *error = NULL;
1483
result = brasero_burn_dialog_check_image_integrity (dialog,
1488
brasero_burn_dialog_integrity_check_end (dialog,
1493
brasero_burn_progress_set_action (BRASERO_BURN_PROGRESS (dialog->priv->progress),
1494
BRASERO_BURN_ACTION_FINISHED,
1497
brasero_burn_dialog_activity_stop (dialog, header);
1501
static BraseroBurnResult
1502
brasero_burn_dialog_setup_session (BraseroBurnDialog *dialog,
1503
const BraseroTrackSource *source,
1504
BraseroTrackSource **track,
1508
BraseroTrackSource *local_track;
1509
BraseroBurnResult result;
1511
dialog->priv->session = brasero_burn_session_new ();
1512
brasero_burn_session_start (dialog->priv->session);
1514
/* make sure all files in track are local if not download */
1515
result = brasero_burn_dialog_get_local_source (dialog,
1520
if (result != BRASERO_BURN_OK)
1523
/* generates a checksum if the user wants it */
1524
if (checksum && local_track->type == BRASERO_TRACK_SOURCE_DATA) {
1525
result = brasero_burn_dialog_get_checksumed_source (dialog,
1529
brasero_track_source_free (local_track);
1530
if (result != BRASERO_BURN_OK)
1534
*track = local_track;
1536
dialog->priv->burn = brasero_burn_new ();
1537
g_signal_connect (dialog->priv->burn,
1539
G_CALLBACK (brasero_burn_dialog_insert_disc_cb),
1541
g_signal_connect (dialog->priv->burn,
1543
G_CALLBACK (brasero_burn_dialog_data_loss_cb),
1545
g_signal_connect (dialog->priv->burn,
1547
G_CALLBACK (brasero_burn_dialog_rewritable_cb),
1549
g_signal_connect (dialog->priv->burn,
1551
G_CALLBACK (brasero_burn_dialog_disable_joliet_cb),
1553
g_signal_connect (dialog->priv->burn,
1555
G_CALLBACK (brasero_burn_dialog_progress_changed_cb),
1557
g_signal_connect (dialog->priv->burn,
1559
G_CALLBACK (brasero_burn_dialog_action_changed_cb),
1562
brasero_burn_set_session (dialog->priv->burn,
1563
dialog->priv->session);
1565
brasero_burn_progress_set_status (BRASERO_BURN_PROGRESS (dialog->priv->progress),
1574
brasero_tray_icon_set_progress (BRASERO_TRAYICON (dialog->priv->tray),
1578
brasero_burn_progress_set_action (BRASERO_BURN_PROGRESS (dialog->priv->progress),
1579
BRASERO_BURN_ACTION_NONE,
1582
brasero_tray_icon_set_action (BRASERO_TRAYICON (dialog->priv->tray),
1583
BRASERO_BURN_ACTION_NONE);
1584
return BRASERO_BURN_OK;
1588
brasero_burn_dialog_save_log (BraseroBurnDialog *dialog)
1593
GtkResponseType answer;
1595
chooser = gtk_file_chooser_dialog_new (_("Save current session"),
1596
GTK_WINDOW (dialog),
1597
GTK_FILE_CHOOSER_ACTION_SAVE,
1598
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1599
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
1602
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), TRUE);
1603
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser),
1605
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (chooser),
1606
"brasero-session.log");
1608
gtk_widget_show (chooser);
1609
answer = gtk_dialog_run (GTK_DIALOG (chooser));
1610
if (answer != GTK_RESPONSE_OK) {
1611
gtk_widget_destroy (chooser);
1615
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
1616
gtk_widget_destroy (chooser);
1621
if (path && *path == '\0') {
1626
g_file_get_contents (brasero_burn_session_get_log_path (dialog->priv->session),
1630
g_file_set_contents (path, contents, -1, NULL);
1637
brasero_burn_dialog_show_log (BraseroBurnDialog *dialog)
1644
GtkWidget *scrolled;
1645
GtkTextBuffer *text;
1646
GtkTextTag *object_tag;
1647
GtkTextTag *domain_tag;
1649
message = gtk_dialog_new_with_buttons (_("Session log"),
1650
GTK_WINDOW (dialog),
1651
GTK_DIALOG_DESTROY_WITH_PARENT |
1653
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
1655
gtk_window_set_default_size (GTK_WINDOW (message), 500, 375);
1656
scrolled = gtk_scrolled_window_new (NULL, NULL);
1657
gtk_container_set_border_width (GTK_CONTAINER (scrolled), 6);
1658
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
1659
GTK_POLICY_AUTOMATIC,
1660
GTK_POLICY_AUTOMATIC);
1661
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
1662
GTK_SHADOW_ETCHED_IN);
1663
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (message)->vbox),
1669
view = gtk_text_view_new ();
1670
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
1671
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled), view);
1673
/* fill the buffer */
1674
text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
1675
g_file_get_contents (brasero_burn_session_get_log_path (dialog->priv->session),
1679
gtk_text_buffer_set_text (text, contents, -1);
1682
/* create tags and apply them */
1683
object_tag = gtk_text_buffer_create_tag (text,
1685
"foreground", "red",
1686
"weight", PANGO_WEIGHT_BOLD,
1688
domain_tag = gtk_text_buffer_create_tag (text,
1690
"foreground", "blue",
1692
gtk_text_buffer_get_start_iter (text, &iter);
1694
while (gtk_text_iter_forward_word_end (&iter)) {
1695
GtkTextIter start = iter;
1697
gtk_text_iter_backward_word_start (&start);
1700
gtk_text_buffer_apply_tag (text, object_tag, &start, &iter);
1701
else if (gtk_text_iter_starts_line (&start)) {
1703
gtk_text_buffer_apply_tag (text, domain_tag, &start, &iter);
1709
/* run everything */
1710
gtk_widget_show_all (scrolled);
1711
gtk_dialog_run (GTK_DIALOG (message));
1713
gtk_widget_destroy (message);
914
1717
brasero_burn_dialog_notify_error (BraseroBurnDialog *dialog,
1723
GtkResponseType response;
920
1726
secondary = g_strdup (error->message);
924
1730
secondary = g_strdup (_("An unknown error occured. Check your disc"));
926
brasero_burn_dialog_notify_dialog (dialog,
927
_("Error while burning:"),
1732
if (!GTK_WIDGET_VISIBLE (dialog))
1733
gtk_widget_show (GTK_WIDGET (dialog));
1735
message = gtk_message_dialog_new (GTK_WINDOW (dialog),
1736
GTK_DIALOG_DESTROY_WITH_PARENT |
1740
_("Error while burning:"));
1742
gtk_window_set_title (GTK_WINDOW (message), _("Burning error"));
1743
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
932
1746
g_free (secondary);
1748
button = brasero_utils_make_button (_("Save log"), GTK_STOCK_SAVE_AS, NULL);
1749
gtk_widget_show_all (button);
1750
gtk_dialog_add_action_widget (GTK_DIALOG (message), button, GTK_RESPONSE_APPLY);
1752
button = brasero_utils_make_button (_("View log"), GTK_STOCK_EDIT, NULL);
1753
gtk_widget_show_all (button);
1754
gtk_dialog_add_action_widget (GTK_DIALOG (message), button, GTK_RESPONSE_OK);
1756
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
1757
gtk_widget_show (button);
1758
gtk_dialog_add_action_widget (GTK_DIALOG (message), button, GTK_RESPONSE_CLOSE);
1760
response = gtk_dialog_run (GTK_DIALOG (message));
1762
if (response == GTK_RESPONSE_APPLY)
1763
brasero_burn_dialog_save_log (dialog);
1764
else if (response == GTK_RESPONSE_OK)
1765
brasero_burn_dialog_show_log (dialog);
1769
response = gtk_dialog_run (GTK_DIALOG (message));
1772
gtk_widget_destroy (message);
1776
brasero_burn_dialog_success_timeout (BraseroBurnDialog *dialog)
1778
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
1779
dialog->priv->close_timeout = 0;
1785
brasero_burn_dialog_success_run (BraseroBurnDialog *dialog,
1786
NautilusBurnDrive *drive,
1787
const BraseroTrackSource *source,
1791
GtkWidget *button = NULL;
1794
button = brasero_utils_make_button (_("Check integrity"),
1795
GTK_STOCK_FIND, NULL);
1796
gtk_widget_show_all (button);
1798
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
1800
GTK_RESPONSE_APPLY);
1805
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check))) {
1806
dialog->priv->close_timeout = g_timeout_add (TIMEOUT,
1807
(GSourceFunc) brasero_burn_dialog_success_timeout,
1812
answer = gtk_dialog_run (GTK_DIALOG (dialog));
1814
/* remove the timeout if need be */
1815
if (dialog->priv->close_timeout) {
1816
g_source_remove (dialog->priv->close_timeout);
1817
dialog->priv->close_timeout = 0;
1820
if (answer == GTK_RESPONSE_APPLY) {
1821
gtk_widget_set_sensitive (button, FALSE);
1822
brasero_burn_dialog_integrity_start (dialog,
1825
gtk_widget_set_sensitive (button, TRUE);
936
1831
brasero_burn_dialog_notify_success (BraseroBurnDialog *dialog,
1832
NautilusBurnDrive *burner,
937
1833
const BraseroTrackSource *track,
940
char *primary = NULL;
941
char *secondary = NULL;
1836
gchar *primary = NULL;
1837
gchar *secondary = NULL;
1838
NautilusBurnDrive *drive;
1840
drive = dialog->priv->drive;
943
1842
switch (track->type) {
944
1843
case BRASERO_TRACK_SOURCE_SONG:
945
primary = g_strdup (_("Audio disc successfully burnt:"));
1844
primary = g_strdup (_("Audio CD successfully burnt"));
946
1845
secondary = g_strdup_printf (_("\"%s\" is now ready for use"), track->contents.songs.album);
948
1847
case BRASERO_TRACK_SOURCE_DISC:
950
primary = g_strdup (_("Disc successfully copied to disc:"));
951
secondary = g_strdup_printf (_("disc is now ready for use"));
1848
if (NCB_DRIVE_GET_TYPE (drive) != NAUTILUS_BURN_DRIVE_TYPE_FILE) {
1849
if (dialog->priv->media_type > NAUTILUS_BURN_MEDIA_TYPE_CDRW) {
1850
primary = g_strdup (_("DVD successfully copied"));
1851
secondary = g_strdup_printf (_("DVD is now ready for use"));
1854
primary = g_strdup (_("CD successfully copied"));
1855
secondary = g_strdup_printf (_("CD is now ready for use"));
954
primary = g_strdup (_("Disc successfully copied:"));
955
secondary = g_strdup_printf (_("Image is now ready for use"));
1859
if (dialog->priv->media_type > NAUTILUS_BURN_MEDIA_TYPE_CDRW) {
1860
primary = g_strdup (_("Image of DVD successfully created"));
1861
secondary = g_strdup_printf (_("DVD is now ready for use"));
1864
primary = g_strdup (_("Image of CD successfully created"));
1865
secondary = g_strdup_printf (_("CD is now ready for use"));
958
case BRASERO_TRACK_SOURCE_ISO:
959
case BRASERO_TRACK_SOURCE_RAW:
960
case BRASERO_TRACK_SOURCE_ISO_JOLIET:
961
case BRASERO_TRACK_SOURCE_CUE:
962
primary = g_strdup (_("Image successfully burnt to disc:"));
963
secondary = g_strdup_printf (_("disc is now ready for use"));
1869
case BRASERO_TRACK_SOURCE_IMAGE:
1870
if (NCB_DRIVE_GET_TYPE (drive) != NAUTILUS_BURN_DRIVE_TYPE_FILE) {
1871
if (dialog->priv->media_type > NAUTILUS_BURN_MEDIA_TYPE_CDRW) {
1872
primary = g_strdup (_("Image successfully burnt to DVD"));
1873
secondary = g_strdup_printf (_("DVD is now ready for use"));
1876
primary = g_strdup (_("Image successfully burnt to CD"));
1877
secondary = g_strdup_printf (_("CD is now ready for use"));
967
primary = g_strdup (_("Data disc successfully burnt:"));
968
secondary = g_strdup_printf (_("\"%s\" is now ready for use"), track->contents.data.label);
1882
if (NCB_DRIVE_GET_TYPE (drive) != NAUTILUS_BURN_DRIVE_TYPE_FILE) {
1883
if (dialog->priv->media_type > NAUTILUS_BURN_MEDIA_TYPE_CDRW) {
1884
primary = g_strdup (_("Data DVD successfully burnt"));
1885
secondary = g_strdup_printf (_("\"%s\" is now ready for use"), track->contents.data.label);
1888
primary = g_strdup (_("Data CD successfully burnt"));
1889
secondary = g_strdup_printf (_("\"%s\" is now ready for use"), track->contents.data.label);
971
primary = g_strdup (_("Image successfully created on disc:"));
1893
primary = g_strdup (_("Image successfully created"));
972
1894
secondary = g_strdup_printf (_("\"%s\" is now ready for use"), track->contents.data.label);
977
#ifdef HAVE_LIBNOTIFY
979
if (GTK_WIDGET_VISIBLE (dialog))
980
brasero_burn_dialog_notify_dialog (dialog,
985
else if (!brasero_burn_dialog_notify_daemon (dialog,
991
brasero_burn_dialog_notify_dialog (dialog,
1899
brasero_burn_dialog_activity_stop (dialog, primary);
1900
brasero_burn_dialog_success_run (dialog,
996
1905
g_free (primary);
997
1906
g_free (secondary);
1910
brasero_burn_dialog_end_session (BraseroBurnDialog *dialog,
1911
NautilusBurnDrive *burner,
1912
const BraseroTrackSource *track,
1914
BraseroBurnResult result,
1917
gboolean close_dialog;
1919
if (dialog->priv->local_image) {
1920
g_object_unref (dialog->priv->local_image);
1921
dialog->priv->local_image = NULL;
1924
if (dialog->priv->checksum) {
1925
g_object_unref (dialog->priv->checksum);
1926
dialog->priv->checksum = NULL;
1929
if (dialog->priv->burn) {
1930
g_object_unref (dialog->priv->burn);
1931
dialog->priv->burn = NULL;
1934
brasero_burn_session_stop (dialog->priv->session);
1936
if (result == BRASERO_BURN_CANCEL) {
1938
close_dialog = FALSE;
1940
else if (error || result != BRASERO_BURN_OK) {
1941
close_dialog = FALSE;
1942
brasero_burn_dialog_notify_error (dialog,
1946
brasero_burn_dialog_notify_success (dialog,
1951
close_dialog = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check));
1954
return close_dialog;
1001
1958
brasero_burn_dialog_run (BraseroBurnDialog *dialog,
1002
1959
NautilusBurnDrive *drive,
1005
const BraseroTrackSource *track,
1006
BraseroBurnFlag flags)
1961
const gchar *output,
1962
const BraseroTrackSource *source,
1963
BraseroBurnFlag flags,
1011
1969
GError *error = NULL;
1012
1970
gboolean close_dialog;
1013
1971
BraseroBurnResult result;
1015
gtk_widget_show_all (dialog->priv->tray);
1017
dialog->priv->track_type = track->type;
1972
BraseroTrackSource *track = NULL;
1973
NautilusBurnDriveMonitor *monitor;
1975
dialog->priv->track_type = source->type;
1976
dialog->priv->isosize = sectors * 2048;
1020
1979
flags |= BRASERO_BURN_FLAG_DEBUG;
1981
/* try to get the media type for the title */
1022
1982
if (NCB_DRIVE_GET_TYPE (drive) == NAUTILUS_BURN_DRIVE_TYPE_FILE
1023
&& track->type == BRASERO_TRACK_SOURCE_DISC)
1024
dialog->priv->drive = track->contents.drive.disc;
1983
&& source->type == BRASERO_TRACK_SOURCE_DISC)
1984
dialog->priv->drive = source->contents.drive.disc;
1026
1986
dialog->priv->drive = drive;
1028
g_object_ref (dialog->priv->drive);
1988
nautilus_burn_drive_ref (dialog->priv->drive);
1030
nautilus_burn_drive_ref (drive);
1031
added_id = g_signal_connect (drive,
1033
G_CALLBACK (brasero_burn_dialog_media_added_cb),
1035
removed_id = g_signal_connect (drive,
1037
G_CALLBACK (brasero_burn_dialog_media_removed_cb),
1990
/* Leave the time to all sub systems and libs to get notified */
1991
monitor = nautilus_burn_get_drive_monitor ();
1992
added_id = g_signal_connect_after (monitor,
1994
G_CALLBACK (brasero_burn_dialog_media_added_cb),
1996
removed_id = g_signal_connect_after (monitor,
1998
G_CALLBACK (brasero_burn_dialog_media_removed_cb),
1040
2001
brasero_burn_dialog_update_info (dialog);
1042
cursor = gdk_cursor_new (GDK_WATCH);
1043
gdk_window_set_cursor (GTK_WIDGET (dialog)->window, cursor);
1044
gdk_cursor_unref (cursor);
1046
result = brasero_burn_record (dialog->priv->burn,
2002
brasero_burn_dialog_activity_start (dialog);
2004
/* start the recording session */
2005
result = brasero_burn_dialog_setup_session (dialog,
2011
if (result == BRASERO_BURN_OK) {
2012
if ((flags & (BRASERO_BURN_FLAG_APPEND|BRASERO_BURN_FLAG_MERGE)) == 0
2013
&& NCB_DRIVE_GET_TYPE (drive) != NAUTILUS_BURN_DRIVE_TYPE_FILE)
2014
flags |= BRASERO_BURN_FLAG_DAO;
2016
result = brasero_burn_record (dialog->priv->burn,
1053
2025
if (added_id) {
1054
g_signal_handler_disconnect (drive, added_id);
2026
g_signal_handler_disconnect (monitor, added_id);
1058
2030
if (removed_id) {
1059
g_signal_handler_disconnect (drive, removed_id);
2031
g_signal_handler_disconnect (monitor, removed_id);
1060
2032
removed_id = 0;
1063
g_object_unref (dialog->priv->burn);
1064
dialog->priv->burn = NULL;
2035
checksum = NCB_DRIVE_GET_TYPE (drive) != NAUTILUS_BURN_DRIVE_TYPE_FILE &&
2037
(source->type == BRASERO_TRACK_SOURCE_IMAGE && (source->format & BRASERO_IMAGE_FORMAT_ISO)) ||
2038
(source->type == BRASERO_TRACK_SOURCE_DISC));
2040
close_dialog = brasero_burn_dialog_end_session (dialog,
1066
g_object_unref (dialog->priv->drive);
2047
nautilus_burn_drive_unref (dialog->priv->drive);
1067
2048
dialog->priv->drive = NULL;
1069
/* tell the user the result of the operation */
1070
if (result == BRASERO_BURN_CANCEL) {
1072
close_dialog = FALSE;
1074
else if (error || result != BRASERO_BURN_OK) {
1075
close_dialog = FALSE;
1076
brasero_burn_dialog_notify_error (dialog,
1080
brasero_burn_dialog_notify_success (dialog,
1082
(NCB_DRIVE_GET_TYPE (drive) != NAUTILUS_BURN_DRIVE_TYPE_FILE));
1084
close_dialog = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check));
1087
nautilus_burn_drive_unref (drive);
2051
brasero_track_source_free (track);
1088
2053
return close_dialog;