[Pkg-privacy-commits] [nautilus-wipe] 26/224: Properly set an error with unsupported locations.

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 19:45:31 UTC 2016


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

u-guest pushed a commit to branch master
in repository nautilus-wipe.

commit da269493dec4eeafa3bfa44f0ce2a5dcbc0de8eb
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Sat Feb 20 17:35:32 2010 +0100

    Properly set an error with unsupported locations.
    
    Do not skip silently URI that we cannot handle (like remote ones).
    Now we aborts with an error if an unsupported location is encountered.
---
 nautilus-srm/delete-operation.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/nautilus-srm/delete-operation.c b/nautilus-srm/delete-operation.c
index 2e4af9f..1ea08cd 100644
--- a/nautilus-srm/delete-operation.c
+++ b/nautilus-srm/delete-operation.c
@@ -51,32 +51,40 @@ nautilus_srm_delete_operation (GList    *files,
                                gpointer  data,
                                GError  **error)
 {
-  gboolean            success;
+  gboolean            success = TRUE;
   GsdDeleteOperation *operation;
   
   operation = gsd_delete_operation_new ();
-  for (; files; files = g_list_next (files)) {
+  for (; success && files; files = g_list_next (files)) {
     GFile *file = nautilus_file_info_get_location (files->data);
     gchar *path;
     
     path = g_file_get_path (file);
     if (! path) {
-      /* FIXME: */
+      gchar *uri = g_file_get_uri (file);
+      
+      success = FALSE;
+      /* FIXME: use correct error quark and code */
+      g_set_error (error, 0, 0, "Unsupported location: %s", uri);
+      g_free (uri);
     } else {
       gsd_delete_operation_add_path (operation, path);
     }
     g_free (path);
     g_object_unref (file);
   }
-  
-  g_signal_connect (operation, "progress", progress_handler, data);
-  g_signal_connect (operation, "finished", finished_handler, data);
-  /* unrefs the operation when done (notice that it is called after the default
-   * handler) */
-  g_signal_connect_after (operation, "finished",
-                          G_CALLBACK (g_object_unref), NULL);
-  success = gsd_secure_delete_operation_run (GSD_SECURE_DELETE_OPERATION (operation),
-                                             100, error);
+  /* if file addition succeeded, try to launch operation */
+  if (success) {
+    g_signal_connect (operation, "progress", progress_handler, data);
+    g_signal_connect (operation, "finished", finished_handler, data);
+    /* unrefs the operation when done (notice that it is called after the default
+     * handler) */
+    g_signal_connect_after (operation, "finished",
+                            G_CALLBACK (g_object_unref), NULL);
+    success = gsd_secure_delete_operation_run (GSD_SECURE_DELETE_OPERATION (operation),
+                                               100, error);
+  }
+  /* if something failed, abort */
   if (! success) {
     /* on failure here the callback will not be called, then unref right here */
     g_object_unref (operation);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/nautilus-wipe.git



More information about the Pkg-privacy-commits mailing list