[gnac: 15/15] Merge branch 'devel'



commit e8ac7fbb4facbf153717d0ad17a03c15fc4890ae
Merge: b21a4ae 940ae71
Author: David Joaquim <djoaquim src gnome org>
Date:   Fri May 7 19:58:36 2010 +0200

    Merge branch 'devel'
    
    Conflicts:
    	configure.ac
    	libgnac/libgnac-converter.c
    	libgnac/libgnac-output.c
    	src/gnac-properties.h

 .gitignore                                   |    4 +
 configure.ac                                 |   69 ++++++---
 data/profiles/base.xml.in                    |    2 +-
 data/profiles/default/Voice,_Lossless.xml.in |    2 +-
 libgnac/libgnac-converter.c                  |  210 ++++++++++++++++++++++---
 libgnac/libgnac-converter.h                  |    1 -
 libgnac/libgnac-debug.c                      |   51 ++++---
 libgnac/libgnac-debug.h                      |   39 +++++-
 libgnac/libgnac-gst.c                        |   13 ++-
 libgnac/libgnac-output.c                     |    3 +-
 man/gnac.1                                   |   10 +-
 po/POTFILES.in                               |    1 +
 src/Makefile.am                              |    2 +
 src/gnac-main.c                              |   63 ++-------
 src/gnac-main.h                              |    3 +
 src/gnac-options.c                           |  168 ++++++++++++++++++++
 src/gnac-options.h                           |   52 +++++++
 src/gnac-properties.h                        |    4 +
 src/gnac-ui.c                                |    6 +-
 19 files changed, 573 insertions(+), 130 deletions(-)
---
diff --cc libgnac/libgnac-converter.c
index 8c9c7ba,6ab012d..c6cf361
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@@ -1023,95 -1163,50 +1163,115 @@@ libgnac_converter_error_cb(GstBus      
    item = (LibgnacConverterItem*)data;
    libgnac_converter_item_clear_event_source(item);
  
-   src = GST_MESSAGE_SRC(message);
-   name = gst_object_get_name(src);
- 
    uri = g_file_get_uri(item->source);
- 
+   out_uri = g_file_get_uri(item->destination);
+   src = GST_MESSAGE_SRC(message);
+   name = GST_MESSAGE_SRC_NAME(message);
    gst_message_parse_error(message, &error, NULL);
  
++<<<<<<< HEAD
 +  if (g_str_has_prefix(name, "giosink"))
 +  {
 +    if (g_error_matches(error, 
 +            GST_RESOURCE_ERROR, 
 +            GST_RESOURCE_ERROR_NOT_FOUND)) 
 +    {
 +      /* Create missing directory */
 +      GError *err = NULL;
 +      GFile *folder;
 +
 +      folder = g_file_get_parent(item->destination);
 +      g_file_make_directory_with_parents(folder, NULL, &err);
 +      g_object_unref(folder);
 +      if (err) {
 +        g_signal_emit(item->converter, signals[ERROR], 0, uri, 
 +                        _("Unable to create destination directory"), NULL);
 +        g_clear_error(&err);
 +      } else if (libgnac_converter_restart_current(item->converter)) return;
 +
 +    } else if (g_error_matches(error,
 +                  GST_RESOURCE_ERROR,
 +                  GST_RESOURCE_ERROR_OPEN_WRITE))
 +    {
 +      if (g_file_test(g_file_get_path(item->destination), G_FILE_TEST_EXISTS))
 +      {
 +        gboolean overwrite = FALSE;
 +        g_signal_emit(item->converter, signals[OVERWRITE], 0, 
 +                        item->destination, &overwrite);
 +        if (overwrite)
 +        {
 +          GError *err = NULL;
 +          g_file_delete(item->destination, NULL, &err);
 +          if (err) {
 +            libgnac_debug("Unable to overwrite file %s: %s", uri, err->message);
 +            g_clear_error(&err);
 +          }
 +          if (!err && libgnac_converter_restart_current(item->converter)) 
 +          {
 +            g_clear_error(&error);
 +            g_free(name);
 +            g_free(uri);
 +            return;
 +          }
 +        }
 +        else 
 +        {
 +          gchar  *msg;
 +          GError *err = NULL;
 +          msg = g_strdup_printf(_("Destination file %s already exists"), uri);
 +          g_set_error_literal(&err, LIBGNAC_ERROR, 
 +              LIBGNAC_ERROR_FILE_EXISTS, msg);
 +          g_signal_emit(item->converter, signals[ERROR], 0, uri, msg, err);
 +          g_clear_error(&err);
 +          g_free(msg);
 +        }
 +      } 
 +      else
 +      {
 +        g_signal_emit(item->converter, signals[ERROR], 0, uri, 
 +                          _("Unable to access destination file"), error);
 +      }
 +    }
++=======
+   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")) {
+     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);
++>>>>>>> devel
    } else if (g_str_has_prefix(name, "giosrc")) {
-     g_signal_emit(item->converter, signals[ERROR], 0, uri, 
-                     _("Unable to read source file"), error);
+     libgnac_debug("Source error");
+     restart = libgnac_converter_error_src(item, message, uri, error);
    } else {
-     GError *err = NULL;
-     g_file_delete(item->destination, NULL, &err);
-     if (err) {
-       libgnac_debug("Unable to remove partial file %s: %s", uri, err->message);
-       g_clear_error(&err);
-     }
-     g_signal_emit(item->converter, signals[ERROR], 0, uri, 
-                     _("An error occured during conversion"), error);
+     libgnac_debug("Other error");
+     restart = libgnac_converter_error_other(item, message, uri, error);
    }
  
-   libgnac_debug("Conversion failed:\n Object: %s\n Message: %s\n File: %s", 
-                   name, error->message, uri);
- 
    g_clear_error(&error);
-   g_free(name);
    g_free(uri);
+   g_free(out_uri);
+ 
+   /* 
+    * We cannot remove partial file here, in some case the error is 
+    * access error and we do not want and cannot remove the file
+    */
+ 
+   // TODO restart current if needed
+   if (restart) {
+     if (libgnac_converter_restart_current(item->converter)) {
+       /* The restart was ok, do not send any signal and do not start next*/
+       return;
+     }
+   }
  
    if (!libgnac_converter_start_next(item->converter))
    {
diff --cc src/gnac-properties.h
index a1bcf43,f7a9493..78d62d5
--- a/src/gnac-properties.h
+++ b/src/gnac-properties.h
@@@ -79,7 -79,7 +79,11 @@@ gnac_on_close_properties(GtkWidget *wid
  gboolean
  gnac_properties_on_delete_event(GtkWidget *widget,
                                  GdkEvent  *event,
++<<<<<<< HEAD
 +                                gpointer   data);
++=======
+                                 gpointer   user_data);
++>>>>>>> devel
  
  void
  gnac_properties_destroy(void);



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