Author: pollux
Date: 2007-01-14 12:25:26 +0000 (Sun, 14 Jan 2007)
New Revision: 24436

Modified:
   xfburn/branches/libburn_trial/xfburn/xfburn-burn-data-composition-dialog.c
Log:
avoid eating lots of CPU cycles when writing to an ISO

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 09:49:07 UTC (rev 24435)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-burn-data-composition-dialog.c  
2007-01-14 12:25:26 UTC (rev 24436)
@@ -295,6 +295,7 @@
   guchar buf[2048];
   glong size = 0;
   glong written = 0;
+  guint i = 0;
 
   fd = open (params->iso_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
   if (fd == -1) {
@@ -327,12 +328,17 @@
       g_free (error_msg);
       goto cleanup;
     } else {
-      gdouble percent =0;
-
       written += 2048;
-      percent = ((gdouble) written / (gdouble) size);
+      i++;
 
-      xfburn_progress_dialog_set_progress_bar_fraction (XFBURN_PROGRESS_DIALOG 
(dialog_progress), percent);
+      if (i >= 1000) {
+       i = 0;
+       gdouble percent = 0;
+
+       percent = ((gdouble) written / (gdouble) size);
+
+       xfburn_progress_dialog_set_progress_bar_fraction 
(XFBURN_PROGRESS_DIALOG (dialog_progress), percent);
+      }
     }
   }
   xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG 
(dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_COMPLETED, _("Done"));

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to