[Xfce4-commits] [apps/xfburn] 02/02: Properly handle the BD & auto formatting mock up cases

noreply at xfce.org noreply at xfce.org
Sun Apr 6 05:24:12 CEST 2014


This is an automated email from the git hooks/post-receive script.

squisher pushed a commit to branch master
in repository apps/xfburn.

commit b74459950246f6a533835c73b729cebaf931e15b
Author: David Mohr <david at mcbf.net>
Date:   Sat Apr 5 21:22:33 2014 -0600

    Properly handle the BD & auto formatting mock up cases
---
 xfburn/xfburn-perform-burn.c    |   21 +++++++++++++--------
 xfburn/xfburn-progress-dialog.c |    9 +++++++++
 xfburn/xfburn-progress-dialog.h |    1 +
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/xfburn/xfburn-perform-burn.c b/xfburn/xfburn-perform-burn.c
index 4b1788c..c2640cf 100644
--- a/xfburn/xfburn-perform-burn.c
+++ b/xfburn/xfburn-perform-burn.c
@@ -36,7 +36,7 @@
 /*************/
 
 /* ts B40225 : Automatically format unformatted BD-RE and DVD-RAM
-   Return: <= 0 = failure, 1 = formatting happened, 2 = no formatting needed
+   Return: <=-1 failure, 0 = aborted, 1 = formatting happened, 2 = no formatting needed
 */
 static int
 xfburn_auto_format(GtkWidget *dialog_progress, struct burn_drive *drive)
@@ -103,8 +103,8 @@ xfburn_auto_format(GtkWidget *dialog_progress, struct burn_drive *drive)
                                                _("Formatting..."));
 
 #ifdef XFBURN_KEEP_UNFORMATTED
-  g_warning ("Will Not Format");
-  return -1;
+  g_warning ("Will not Format");
+  return 0;
 #endif
 
   /* Apply formatting */
@@ -137,7 +137,6 @@ xfburn_auto_format(GtkWidget *dialog_progress, struct burn_drive *drive)
     DBG ("Formatting done");
  
     if (stopping) {
-      xfburn_progress_dialog_set_status (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_CANCELLED);
       return 0;
     }
     
@@ -148,9 +147,7 @@ xfburn_auto_format(GtkWidget *dialog_progress, struct burn_drive *drive)
   } else {
     DBG ("Formatting failed");
 
-    xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Formatting failed."));
- 
-    return 0;
+    return -1;
   }
   return 1;
 }
@@ -285,8 +282,16 @@ xfburn_perform_burn_write (GtkWidget *dialog_progress,
   }
 
   ret = xfburn_auto_format (dialog_progress, drive);
-  if (ret <= 0)
+  if (ret < 0) {
+    xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Formatting failed."));
     return;
+  } else if (ret == 0) {
+    xfburn_progress_dialog_set_status (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_CANCELLED);
+    return;
+  } else if (ret == 1) {
+    /* formatting happened, reset the dialog */
+    xfburn_progress_dialog_reset (XFBURN_PROGRESS_DIALOG(dialog_progress));
+  }
 
   total_sectors = burn_disc_get_sectors (disc);
 
diff --git a/xfburn/xfburn-progress-dialog.c b/xfburn/xfburn-progress-dialog.c
index 7141237..c6c911f 100644
--- a/xfburn/xfburn-progress-dialog.c
+++ b/xfburn/xfburn-progress-dialog.c
@@ -547,6 +547,15 @@ xfburn_progress_dialog_set_fifo_bar_text (XfburnProgressDialog * dialog, const g
 }
 
 void
+xfburn_progress_dialog_reset (XfburnProgressDialog * dialog)
+{
+  xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog),
+                                               XFBURN_PROGRESS_DIALOG_STATUS_RUNNING,
+                                               _("Initializing..."));
+  xfburn_progress_dialog_set_progress_bar_fraction (dialog, -1.0);
+}
+
+void
 xfburn_progress_dialog_set_progress_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction)
 {
   XfburnProgressDialogPrivate *priv = XFBURN_PROGRESS_DIALOG_GET_PRIVATE (dialog);
diff --git a/xfburn/xfburn-progress-dialog.h b/xfburn/xfburn-progress-dialog.h
index bec5161..eeb3513 100644
--- a/xfburn/xfburn-progress-dialog.h
+++ b/xfburn/xfburn-progress-dialog.h
@@ -72,6 +72,7 @@ void xfburn_progress_dialog_pulse_progress_bar (XfburnProgressDialog * dialog);
 XfburnProgressDialogStatus xfburn_progress_dialog_get_status (XfburnProgressDialog * dialog);
 gdouble xfburn_progress_dialog_get_progress_bar_fraction (XfburnProgressDialog * dialog);
 
+void xfburn_progress_dialog_reset (XfburnProgressDialog * dialog);
 void xfburn_progress_dialog_set_progress_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction);
 void xfburn_progress_dialog_set_fifo_bar_fraction (XfburnProgressDialog * dialog, gdouble fraction);
 void xfburn_progress_dialog_set_fifo_bar_text (XfburnProgressDialog * dialog, const gchar *text);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list