[Goodies-commits] r6015 - in xfburn/trunk: . xfburn

David Mohr squisher at xfce.org
Sat Nov 8 06:46:41 CET 2008


Author: squisher
Date: 2008-11-08 05:46:41 +0000 (Sat, 08 Nov 2008)
New Revision: 6015

Modified:
   xfburn/trunk/TODO
   xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c
   xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
   xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
   xfburn/trunk/xfburn/xfburn-global.h
   xfburn/trunk/xfburn/xfburn-perform-burn.c
   xfburn/trunk/xfburn/xfburn-perform-burn.h
Log:
(Double)check that the burn job fits on the disc before starting to burn

Modified: xfburn/trunk/TODO
===================================================================
--- xfburn/trunk/TODO	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/TODO	2008-11-08 05:46:41 UTC (rev 6015)
@@ -39,8 +39,6 @@
 - check if all the enter/leaving of gdk threads slows adding down
 - aborting the adding process can lead to invalid an composition size,
   or invalid size of a composition item
-- rework refresh_speed_list, to make it more easily understandable when the 
   disc status should get refreshed
 - cairo animation for blanking progress
 - allow usage of gtk bookmarks
-- check compilation size against free space on inserted media (I thought that was already in place?)

Modified: xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/xfburn/xfburn-burn-audio-cd-composition-dialog.c	2008-11-08 05:46:41 UTC (rev 6015)
@@ -492,7 +492,7 @@
   burn_write_opts_set_underrun_proof (burn_options, params->burnfree ? 1 : 0);
   burn_drive_set_buffer_waiting (drive, 1, -1, -1, -1, 75, 95);
 
-  xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, srcs, track_sectors);
+  xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, AUDIO_BYTES_PER_SECTOR, disc, srcs, track_sectors);
 
   burn_write_opts_free (burn_options);
 }

Modified: xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c	2008-11-08 05:46:41 UTC (rev 6015)
@@ -582,7 +582,7 @@
     fifos[0] = params->src;
   }
 
-  xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, fifos, sectors);
+  xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, DATA_BYTES_PER_SECTOR, disc, fifos, sectors);
 
   if (params->is_fifo) {
     g_free (fifos);

Modified: xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-image-dialog.c	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/xfburn/xfburn-burn-image-dialog.c	2008-11-08 05:46:41 UTC (rev 6015)
@@ -161,7 +161,7 @@
   priv->image_label = gtk_label_new ("");
   gtk_widget_show (priv->image_label);
   gtk_box_pack_start (GTK_BOX (box), priv->image_label, FALSE, FALSE, 0);
-  update_image_label (priv->chooser_image, obj);
+  update_image_label (GTK_FILE_CHOOSER (priv->chooser_image), obj);
   g_signal_connect (G_OBJECT (priv->chooser_image), "selection-changed", G_CALLBACK (update_image_label), obj);
     
   /* devices list */
@@ -354,7 +354,7 @@
   fifos = g_new(struct burn_source *,1);
   fifos[0] = fifo_src;
 
-  xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, disc, fifos, sectors);
+  xfburn_perform_burn_write (dialog_progress, drive, params->write_mode, burn_options, DATA_BYTES_PER_SECTOR, disc, fifos, sectors);
 
   g_free (fifos);
 

Modified: xfburn/trunk/xfburn/xfburn-global.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-global.h	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/xfburn/xfburn-global.h	2008-11-08 05:46:41 UTC (rev 6015)
@@ -45,6 +45,7 @@
 #define FIFO_DEFAULT_SIZE  4096    /* in kb, as int */
 
 #define AUDIO_BYTES_PER_SECTOR 2352
+#define DATA_BYTES_PER_SECTOR 2048
 
 #define PCM_BYTES_PER_SECS 176400
 

Modified: xfburn/trunk/xfburn/xfburn-perform-burn.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.c	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.c	2008-11-08 05:46:41 UTC (rev 6015)
@@ -46,8 +46,8 @@
 
 void
 xfburn_perform_burn_write (GtkWidget *dialog_progress, 
-                           struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options, struct burn_disc *disc,
-                           struct burn_source **fifos, int *track_sectors)
+                           struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options, int sector_size, 
+                           struct burn_disc *disc, struct burn_source **fifos, int *track_sectors)
 {
   enum burn_disc_status disc_state;
   enum burn_drive_status status;
@@ -69,6 +69,7 @@
   gdouble percent = 0.0;
   int dbg_no;
   int total_sectors, burned_sectors;
+  off_t disc_size;
 
   while (burn_drive_get_status (drive, NULL) != BURN_DRIVE_IDLE)
     usleep(100001);
@@ -94,7 +95,7 @@
     return;
   } else if (disc_state != BURN_DISC_BLANK) {
     if (disc_state == BURN_DISC_FULL)
-      xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Closed disc with data detected. Need blank or appendable media"));
+      xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Closed disc with data detected. Need blank or appendable disc"));
     else if (disc_state == BURN_DISC_EMPTY) 
       xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("No disc detected in drive"));
     else {
@@ -104,14 +105,20 @@
     return;
   }
 
+  total_sectors = burn_disc_get_sectors (disc);
+
+  disc_size = burn_disc_available_space (drive, burn_options);
+  if (disc_size < ((off_t)total_sectors * sector_size)) {
+    xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("There is not enough space available on the inserted disc"));
+    return;
+  }
+
   /* set us up to receive fatal errors */
   ret = burn_msgs_set_severities ("ALL", "NEVER", "libburn");
 
   if (ret <= 0)
     g_warning ("Failed to set libburn message severities, burn errors might not get detected!");
  
-  total_sectors = burn_disc_get_sectors (disc);
-
   /* Install the default libburn abort signal handler.
    * Hopefully this means the drive won't be left in a burning state if we catch a signal */
   burn_set_signal_handling ("xfburn", NULL, 0);

Modified: xfburn/trunk/xfburn/xfburn-perform-burn.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.h	2008-11-08 05:06:17 UTC (rev 6014)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.h	2008-11-08 05:46:41 UTC (rev 6015)
@@ -32,7 +32,8 @@
 
 #include "xfburn-device-box.h"
 
-void xfburn_perform_burn_write (GtkWidget *dialog_progress, struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options, 
+void xfburn_perform_burn_write (GtkWidget *dialog_progress, 
+                                struct burn_drive *drive, XfburnWriteMode write_mode, struct burn_write_opts *burn_options, int sector_size,
                                 struct burn_disc *disc, struct burn_source **fifos, int *track_sectors);
 
 #endif /* __XFBURN_PERFORM_BURN_H__ */




More information about the Goodies-commits mailing list