[Pkg-privacy-commits] [nautilus-wipe] 47/224: Make operation providers return the operation object

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 19:45:33 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 d97e6349d5aca35872e70647771a7362dbee411d
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Tue Feb 23 22:08:07 2010 +0100

    Make operation providers return the operation object
    
    This will allow extra communication with the object, such as future
    support for cancellation.
---
 nautilus-srm/delete-operation.c  | 13 ++++++++-----
 nautilus-srm/delete-operation.h  | 16 ++++++++--------
 nautilus-srm/fill-operation.c    | 13 ++++++++-----
 nautilus-srm/fill-operation.h    | 16 ++++++++--------
 nautilus-srm/operation-manager.c | 11 +++++++----
 nautilus-srm/operation-manager.h | 23 ++++++++++++++---------
 6 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/nautilus-srm/delete-operation.c b/nautilus-srm/delete-operation.c
index 6ffec1b..f29159d 100644
--- a/nautilus-srm/delete-operation.c
+++ b/nautilus-srm/delete-operation.c
@@ -37,6 +37,9 @@
 /*
  * nsrm_delete_operation:
  * @files: A list of #NautilusFileInfo to delete.
+ * @fast: The Gsd.SecureDeleteOperation:fast setting
+ * @mode: The Gsd.SecureDeleteOperation:mode setting
+ * @zeroise: The Gsd.ZeroableOperation:zeroise setting
  * @finished_handler: A handler for GsdAsyncOperation::finished
  * @progress_handler: A handler for GsdAsyncOperation::progress
  * @data: User data to pass to @finished_handler and @progress_handler
@@ -45,11 +48,11 @@
  * 
  * Deletes the given files with libgsecuredelete.
  * 
- * Returns: %TRUE if operation successfully started, %FALSE otherwise. %TRUE
- *          does not mean that anything was actually done, but only that the
- *          operation started successfully.
+ * Returns: The operation object that was launched, or %NULL on failure.
+ *          The operation object should be unref'd with g_object_unref() when
+ *          no longer needed.
  */
-gboolean
+GsdAsyncOperation *
 nautilus_srm_delete_operation (GList                       *files,
                                gboolean                     fast,
                                GsdSecureDeleteOperationMode mode,
@@ -108,6 +111,6 @@ nautilus_srm_delete_operation (GList                       *files,
     g_object_unref (operation);
   }
   
-  return success;
+  return success ? g_object_ref (operation) : NULL;
 }
 
diff --git a/nautilus-srm/delete-operation.h b/nautilus-srm/delete-operation.h
index 0057e60..0d3d09c 100644
--- a/nautilus-srm/delete-operation.h
+++ b/nautilus-srm/delete-operation.h
@@ -29,14 +29,14 @@
 G_BEGIN_DECLS
 
 
-gboolean    nautilus_srm_delete_operation   (GList                       *files,
-                                             gboolean                     fast,
-                                             GsdSecureDeleteOperationMode mode,
-                                             gboolean                     zeroise,
-                                             GCallback                    finished_handler,
-                                             GCallback                    progress_handler,
-                                             gpointer                     data,
-                                             GError                     **error);
+GsdAsyncOperation  *nautilus_srm_delete_operation   (GList                       *files,
+                                                     gboolean                     fast,
+                                                     GsdSecureDeleteOperationMode mode,
+                                                     gboolean                     zeroise,
+                                                     GCallback                    finished_handler,
+                                                     GCallback                    progress_handler,
+                                                     gpointer                     data,
+                                                     GError                     **error);
 
 
 G_END_DECLS
diff --git a/nautilus-srm/fill-operation.c b/nautilus-srm/fill-operation.c
index b9d7e2e..f5533b0 100644
--- a/nautilus-srm/fill-operation.c
+++ b/nautilus-srm/fill-operation.c
@@ -283,6 +283,9 @@ filter_dir_list (GList *directories)
 /*
  * nautilus_srm_fill_operation:
  * @directories: A list of #NautilusFileInfo to work on
+ * @fast: The Gsd.SecureDeleteOperation:fast setting
+ * @mode: The Gsd.SecureDeleteOperation:mode setting
+ * @zeroise: The Gsd.ZeroableOperation:zeroise setting
  * @finished_handler: A handler for GsdAsyncOperation::finished
  * @progress_handler: A handler for GsdAsyncOperation::progress
  * @data: User data to pass to @finished_handler and @progress_handler
@@ -291,11 +294,11 @@ filter_dir_list (GList *directories)
  * 
  * "sfill"s the given directories.
  * 
- * Returns: %TRUE if operation successfully started, %FALSE otherwise. %TRUE
- *          does not mean that anything was actually done, but only that the
- *          operation started successfully.
+ * Returns: The operation object that was launched, or %NULL on failure.
+ *          The operation object should be unref'd with g_object_unref() when
+ *          no longer needed.
  */
-gboolean
+GsdAsyncOperation *
 nautilus_srm_fill_operation (GList                       *directories,
                              gboolean                     fast,
                              GsdSecureDeleteOperationMode mode,
@@ -337,6 +340,6 @@ nautilus_srm_fill_operation (GList                       *directories,
     }
   }
   
-  return success;
+  return success ? g_object_ref (opdata->operation) : NULL;
 }
 
diff --git a/nautilus-srm/fill-operation.h b/nautilus-srm/fill-operation.h
index 3b29b81..523c2c0 100644
--- a/nautilus-srm/fill-operation.h
+++ b/nautilus-srm/fill-operation.h
@@ -29,14 +29,14 @@
 G_BEGIN_DECLS
 
 
-gboolean    nautilus_srm_fill_operation     (GList                       *files,
-                                             gboolean                     fast,
-                                             GsdSecureDeleteOperationMode mode,
-                                             gboolean                     zeroise,
-                                             GCallback                    finished_handler,
-                                             GCallback                    progress_handler,
-                                             gpointer                     data,
-                                             GError                     **error);
+GsdAsyncOperation  *nautilus_srm_fill_operation   (GList                       *files,
+                                                   gboolean                     fast,
+                                                   GsdSecureDeleteOperationMode mode,
+                                                   gboolean                     zeroise,
+                                                   GCallback                    finished_handler,
+                                                   GCallback                    progress_handler,
+                                                   gpointer                     data,
+                                                   GError                     **error);
 
 
 G_END_DECLS
diff --git a/nautilus-srm/operation-manager.c b/nautilus-srm/operation-manager.c
index 017a846..5e944de 100644
--- a/nautilus-srm/operation-manager.c
+++ b/nautilus-srm/operation-manager.c
@@ -104,6 +104,7 @@ display_dialog (GtkWindow       *parent,
 
 struct NautilusSrmOperationData
 {
+  GsdAsyncOperation          *operation;
   GtkWindow                  *window;
   gulong                      window_destroy_hid;
   NautilusSrmProgressDialog  *progress_dialog;
@@ -120,6 +121,7 @@ free_opdata (struct NautilusSrmOperationData *opdata)
   if (opdata->window_destroy_hid) {
     g_signal_handler_disconnect (opdata->window, opdata->window_destroy_hid);
   }
+  g_object_unref (opdata->operation);
   g_free (opdata->failed_primary_text);
   g_free (opdata->success_primary_text);
   g_free (opdata->success_secondary_text);
@@ -389,10 +391,11 @@ nautilus_srm_operation_manager_run (GtkWindow                *parent,
     opdata->failed_primary_text = g_strdup (failed_primary_text);
     opdata->success_primary_text = g_strdup (success_primary_text);
     opdata->success_secondary_text = g_strdup (success_secondary_text);
-    if (! operation_launcher_func (files, fast, delete_mode, zeroise,
-                                   G_CALLBACK (operation_finished_handler),
-                                   G_CALLBACK (operation_progress_handler),
-                                   opdata, &err)) {
+    opdata->operation = operation_launcher_func (files, fast, delete_mode, zeroise,
+                                                 G_CALLBACK (operation_finished_handler),
+                                                 G_CALLBACK (operation_progress_handler),
+                                                 opdata, &err);
+    if (! opdata->operation) {
       if (err->code == G_SPAWN_ERROR_NOENT) {
         gchar *message;
         
diff --git a/nautilus-srm/operation-manager.h b/nautilus-srm/operation-manager.h
index cb9b5c3..0838107 100644
--- a/nautilus-srm/operation-manager.h
+++ b/nautilus-srm/operation-manager.h
@@ -33,22 +33,27 @@ G_BEGIN_DECLS
 /**
  * NautilusSrmOperationFunc:
  * @files: Files to work on
+ * @fast: The Gsd.SecureDeleteOperation:fast setting
+ * @mode: The Gsd.SecureDeleteOperation:mode setting
+ * @zeroise: The Gsd.ZeroableOperation:zeroise setting
  * @finished_handler: Handler for GsdAsyncOperation::finished
  * @progress_handler: Handler for GsdAsyncOperation::progress
  * @data: User data for @finished_hanlder and @progress_handler
  * @error: Return location for errors, or %NULL to ignore them
  * 
  * 
- * Returns: %TRUE if operation successfully started, %FALSE otherwise.
+ * Returns: The operation object that was launched, or %NULL on failure.
+ *          The operation object should be unref'd with g_object_unref() when
+ *          no longer needed.
  */
-typedef gboolean (*NautilusSrmOperationFunc)  (GList                       *files,
-                                               gboolean                     fast,
-                                               GsdSecureDeleteOperationMode mode,
-                                               gboolean                     zeroise,
-                                               GCallback                    finished_handler,
-                                               GCallback                    progress_handler,
-                                               gpointer                     data,
-                                               GError                     **error);
+typedef GsdAsyncOperation  *(*NautilusSrmOperationFunc) (GList                       *files,
+                                                         gboolean                     fast,
+                                                         GsdSecureDeleteOperationMode mode,
+                                                         gboolean                     zeroise,
+                                                         GCallback                    finished_handler,
+                                                         GCallback                    progress_handler,
+                                                         gpointer                     data,
+                                                         GError                     **error);
 
 void    nautilus_srm_operation_manager_run    (GtkWindow                *parent,
                                                GList                    *files,

-- 
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