[gnac/devel] Fixed bug #606762 (trac ticket #2) and trac ticket #1



commit 4793e16b0f2af47ab1f0d3ea912b800fb6608fcc
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Mon Apr 26 19:06:10 2010 +0100

    Fixed bug #606762 (trac ticket #2) and trac ticket #1

 libgnac/libgnac-converter.c |   31 ++++++++++++++-----------------
 libgnac/libgnac-output.c    |    2 --
 2 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/libgnac/libgnac-converter.c b/libgnac/libgnac-converter.c
index f78996b..6ab012d 100644
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@ -1026,7 +1026,6 @@ libgnac_converter_error_sink(LibgnacConverterItem *item,
                              gchar      *uri, 
                              GError     *error)
 {
-
   g_return_val_if_fail(item, FALSE);
   g_return_val_if_fail(item->destination, FALSE);
   g_return_val_if_fail(error, FALSE);
@@ -1036,8 +1035,6 @@ libgnac_converter_error_sink(LibgnacConverterItem *item,
   GFile *folder;
   gboolean folder_creation;
 
-  libgnac_debug("Resource not found");
-
   // TODO libgnac_utils
   /* Get parent folder name */
   folder = g_file_get_parent(item->destination);
@@ -1046,20 +1043,16 @@ libgnac_converter_error_sink(LibgnacConverterItem *item,
 
   /* New folder create relaunch pipeline */
   if (folder_creation && !err) {
-
     libgnac_debug("Folder successfully created");
     return TRUE;
   }
 
   if (err) {
   /* If folder existed but something went wrong */
-    if (!g_error_matches(error,
-                G_IO_ERROR,
-                G_IO_ERROR_EXISTS)) {
-
+    if (!g_error_matches(err, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
       libgnac_debug("Unable to create directory");
       g_signal_emit(item->converter, signals[ERROR], 0, uri, 
-                    _("Unable to create destination directory"), NULL);
+          _("Unable to create destination directory"), NULL);
       g_clear_error(&err);
       return FALSE;
     }
@@ -1074,10 +1067,9 @@ libgnac_converter_error_sink(LibgnacConverterItem *item,
     gboolean overwrite = FALSE;
 
     /* TODO; do not interrupt user's workflow
-     * Provide some notification => GtkInfoBar
+     * Provide some notification => GtkInfoBar */
     g_signal_emit(item->converter, signals[OVERWRITE], 0, 
                     item->destination, &overwrite);
-    */
 
     if (overwrite)
     {
@@ -1177,14 +1169,20 @@ libgnac_converter_error_cb(GstBus      *bus,
   name = GST_MESSAGE_SRC_NAME(message);
   gst_message_parse_error(message, &error, NULL);
 
-  libgnac_warning("An error is detected:\n\tFile: %s\n\tOut file %s\n\tBin name: %s\n\tError message: %s", 
-                  uri, out_uri, name, error->message);
+  libgnac_debug("An error has occured:\n"
+                "\tFile: %s\n"
+                "\tOut file %s\n"
+                "\tBin name: %s\n"
+                "\tError message: %s",
+                uri, out_uri, name, error->message);
 
-
-  if (g_str_has_prefix(name, "giosink"))
-  {
+  if (g_str_has_prefix(name, "giosink")) {
     libgnac_debug("Sink error");
+    /* flush the bus to avoid receiving the same message twice */
+    gst_bus_set_flushing(bus, TRUE);
     restart = libgnac_converter_error_sink(item, message, uri, error);
+    /* restore the normal state of the bus */
+    gst_bus_set_flushing(bus, FALSE);
   } else if (g_str_has_prefix(name, "giosrc")) {
     libgnac_debug("Source error");
     restart = libgnac_converter_error_src(item, message, uri, error);
@@ -1215,7 +1213,6 @@ libgnac_converter_error_cb(GstBus      *bus,
     item->converter->priv->n_converted = -1;
     g_signal_emit(item->converter, signals[COMPLETION], 0);
   }     
-
 }
 
 
diff --git a/libgnac/libgnac-output.c b/libgnac/libgnac-output.c
index c360953..4b16a40 100644
--- a/libgnac/libgnac-output.c
+++ b/libgnac/libgnac-output.c
@@ -31,8 +31,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gst/gst.h>
-#include <stdarg.h>
-#include <string.h>
 
 #include "libgnac-debug.h"
 #include "libgnac-error.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]