Author: pollux
Date: 2007-01-14 14:14:02 +0000 (Sun, 14 Jan 2007)
New Revision: 24443

Modified:
   xfburn/branches/libburn_trial/xfburn/xfburn-burn-data-composition-dialog.c
   xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
Log:
report more info about what's going on during the burning process

Modified: 
xfburn/branches/libburn_trial/xfburn/xfburn-burn-data-composition-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-burn-data-composition-dialog.c  
2007-01-14 14:09:16 UTC (rev 24442)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-burn-data-composition-dialog.c  
2007-01-14 14:14:02 UTC (rev 24443)
@@ -376,9 +376,10 @@
 
   struct burn_write_opts * burn_options;
   enum burn_disc_status disc_state;
+  enum burn_drive_status status;
   struct burn_progress progress;
-  gboolean burning_has_started = FALSE;
   gint ret;
+  time_t time_start;
 
   if (!burn_initialize ()) {
     g_critical ("Unable to initialize libburn");
@@ -465,20 +466,57 @@
   burn_disc_write (burn_options, disc); 
   burn_write_opts_free (burn_options);
 
-  xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning 
composition..."));
-
   while (burn_drive_get_status (drive, NULL) == BURN_DRIVE_SPAWNING)
     usleep(1002);
-  while (burn_drive_get_status (drive, &progress) != BURN_DRIVE_IDLE) {
-    if (progress.sectors > 0 && progress.sector >= 0) {
-      gdouble percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) 
progress.sectors) * 98.0;
-      
-      burning_has_started = TRUE;
-      xfburn_progress_dialog_set_progress_bar_fraction (XFBURN_PROGRESS_DIALOG 
(dialog_progress), percent / 100.0);
-    } else if (burning_has_started && progress.sectors == 0) {
-      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Finalizing 
disc..."));
-    }
+  time_start = time (NULL);
+  while ((status = burn_drive_get_status (drive, &progress)) != 
BURN_DRIVE_IDLE) {
+    gdouble percent = 0.0;
+    time_t time_now = time (NULL);
 
+    switch (status) {
+    case BURN_DRIVE_WRITING:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning 
composition..."));
+      //      DBG ("buffer capacity: %d", progress.buffer_capacity);
+      //      DBG ("buffer available: %d", progress.buffer_available);
+      //      DBG ("buffer: %f", ((gdouble) progress.buffer_available / 
(gdouble) progress.buffer_capacity));
+      if (progress.sectors > 0 && progress.sector >= 0) {
+       percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) 
progress.sectors) * 98.0;
+
+       xfburn_progress_dialog_set_buffer_bar_fraction (XFBURN_PROGRESS_DIALOG 
(dialog_progress), ((gdouble) progress.buffer_available / (gdouble) 
progress.buffer_capacity));
+       xfburn_progress_dialog_set_progress_bar_fraction 
(XFBURN_PROGRESS_DIALOG (dialog_progress), percent / 100.0);
+
+       xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                 ((gdouble) (progress.sector * 
2048) / (gdouble) (time_now - time_start)) / (150 * 1024));
+      }
+      break;
+    case BURN_DRIVE_WRITING_LEADIN:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Writing Lead-In..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_WRITING_LEADOUT:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Writing Lead-Out..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_WRITING_PREGAP:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Writing pregap..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_CLOSING_TRACK:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Closing track..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_CLOSING_SESSION:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Closing session..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    default:
+      break;
+    }    
     usleep (500000);
   }
 

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c     
2007-01-14 14:09:16 UTC (rev 24442)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c     
2007-01-14 14:14:02 UTC (rev 24443)
@@ -212,9 +212,10 @@
 
   struct burn_write_opts * burn_options;
   enum burn_disc_status disc_state;
+  enum burn_drive_status status;
   struct burn_progress progress;
-  gboolean burning_has_started = FALSE;
   gint ret;
+  time_t time_start;
 
   if (!burn_initialize ()) {
     g_critical ("Unable to initialize libburn");
@@ -324,16 +325,56 @@
 
   while (burn_drive_get_status (drive, NULL) == BURN_DRIVE_SPAWNING)
     usleep(1002);
-  while (burn_drive_get_status (drive, &progress) != BURN_DRIVE_IDLE) {
-    if (progress.sectors > 0 && progress.sector >= 0) {
-      gdouble percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) 
progress.sectors) * 98.0;
-      
-      burning_has_started = TRUE;
-      xfburn_progress_dialog_set_progress_bar_fraction (XFBURN_PROGRESS_DIALOG 
(dialog_progress), percent / 100.0);
-    } else if (burning_has_started && progress.sectors == 0) {
-      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Finalizing 
disc..."));
-    }
+  time_start = time (NULL);
+  while ((status = burn_drive_get_status (drive, &progress)) != 
BURN_DRIVE_IDLE) {
+    gdouble percent = 0.0;
+    time_t time_now = time (NULL);
 
+    switch (status) {
+    case BURN_DRIVE_WRITING:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning 
composition..."));
+      //      DBG ("buffer capacity: %d", progress.buffer_capacity);
+      //      DBG ("buffer available: %d", progress.buffer_available);
+      //      DBG ("buffer: %f", ((gdouble) progress.buffer_available / 
(gdouble) progress.buffer_capacity));
+      if (progress.sectors > 0 && progress.sector >= 0) {
+       percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) 
progress.sectors) * 98.0;
+
+       xfburn_progress_dialog_set_buffer_bar_fraction (XFBURN_PROGRESS_DIALOG 
(dialog_progress), ((gdouble) progress.buffer_available / (gdouble) 
progress.buffer_capacity));
+       xfburn_progress_dialog_set_progress_bar_fraction 
(XFBURN_PROGRESS_DIALOG (dialog_progress), percent / 100.0);
+
+       xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                 ((gdouble) (progress.sector * 
2048) / (gdouble) (time_now - time_start)) / (150 * 1024));
+      }
+      break;
+    case BURN_DRIVE_WRITING_LEADIN:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Writing Lead-In..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_WRITING_LEADOUT:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Writing Lead-Out..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_WRITING_PREGAP:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Writing pregap..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_CLOSING_TRACK:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Closing track..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    case BURN_DRIVE_CLOSING_SESSION:
+      xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), 
+                                                  
XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Closing session..."));
+      xfburn_progress_dialog_set_writing_speed (XFBURN_PROGRESS_DIALOG 
(dialog_progress), -1); 
+      break;
+    default:
+      break;
+    }    
+
     usleep (500000);
   }
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to