[Pkg-privacy-commits] [nautilus-wipe] 95/224: Code cleanup

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 19:45:38 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 1037e787374ad22dda787439c05ceca54529ea2b
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Mon Apr 12 20:02:39 2010 +0200

    Code cleanup
    
    * Removed useless message printing;
    * Removed some useless commented code;
    * Marked as translatable some missing strings;
    * Use of correct error quarks and codes.
---
 nautilus-srm/delete-operation.c  | 18 ++++++++++++++++--
 nautilus-srm/delete-operation.h  | 19 +++++++++++++++++++
 nautilus-srm/fill-operation.c    | 22 ++++++++++++++++++++--
 nautilus-srm/fill-operation.h    | 23 +++++++++++++++++++++++
 nautilus-srm/nautilus-srm.c      | 28 +++++-----------------------
 nautilus-srm/operation-manager.c |  1 -
 6 files changed, 83 insertions(+), 28 deletions(-)

diff --git a/nautilus-srm/delete-operation.c b/nautilus-srm/delete-operation.c
index 57dca83..2698396 100644
--- a/nautilus-srm/delete-operation.c
+++ b/nautilus-srm/delete-operation.c
@@ -32,6 +32,18 @@
 #include <gsecuredelete/gsecuredelete.h>
 
 
+GQuark
+nautilus_srm_delete_operation_error_quark (void)
+{
+  static GQuark q = 0;
+  
+  if (G_UNLIKELY (q == 0)) {
+    q = g_quark_from_static_string ("NautilusSrmDeleteOperationError");
+  }
+  
+  return q;
+}
+
 /*
  * nsrm_delete_operation:
  * @files: A list of paths to delete.
@@ -70,8 +82,10 @@ nautilus_srm_delete_operation (GList                       *files,
     n_files ++;
   }
   if (n_files < 1) {
-    /* FIXME: use correct error quark and code */
-    g_set_error (error, 0, 0, _("Nothing to do!"));
+    g_set_error (error,
+                 NAUTILUS_SRM_DELETE_OPERATION_ERROR,
+                 NAUTILUS_SRM_DELETE_OPERATION_ERROR_FAILED,
+                 _("Nothing to do!"));
     success = FALSE;
   } else {
     /* if file addition succeeded, try to launch operation */
diff --git a/nautilus-srm/delete-operation.h b/nautilus-srm/delete-operation.h
index 0d3d09c..6a789cc 100644
--- a/nautilus-srm/delete-operation.h
+++ b/nautilus-srm/delete-operation.h
@@ -29,6 +29,25 @@
 G_BEGIN_DECLS
 
 
+/**
+ * NautilusSrmDeleteOperationError:
+ * @NAUTILUS_SRM_DELETE_OPERATION_ERROR_FAILED: An error occurred
+ * 
+ * Possible errors from the %NAUTILUS_SRM_DELETE_OPERATION_ERROR domain.
+ */
+typedef enum
+{
+  NAUTILUS_SRM_DELETE_OPERATION_ERROR_FAILED
+} NautilusSrmDeleteOperationError;
+
+/**
+ * NAUTILUS_SRM_DELETE_OPERATION_ERROR:
+ * 
+ * Domain for error coming from a NautilusSrm's delete operation.
+ */
+#define NAUTILUS_SRM_DELETE_OPERATION_ERROR (nautilus_srm_delete_operation_error_quark ())
+
+GQuark              nautilus_srm_delete_operation_error_quark (void) G_GNUC_CONST;
 GsdAsyncOperation  *nautilus_srm_delete_operation   (GList                       *files,
                                                      gboolean                     fast,
                                                      GsdSecureDeleteOperationMode mode,
diff --git a/nautilus-srm/fill-operation.c b/nautilus-srm/fill-operation.c
index 6e358c9..9b1e451 100644
--- a/nautilus-srm/fill-operation.c
+++ b/nautilus-srm/fill-operation.c
@@ -36,6 +36,18 @@
 #include "nautilus-srm.h"
 
 
+GQuark
+nautilus_srm_fill_operation_error_quark (void)
+{
+  static GQuark q = 0;
+  
+  if (G_UNLIKELY (q == 0)) {
+    q = g_quark_from_static_string ("NautilusSrmFillOperationError");
+  }
+  
+  return q;
+}
+
 #if HAVE_GIO_UNIX
 /*
  * find_mountpoint_unix:
@@ -101,7 +113,10 @@ find_mountpoint (const gchar *path,
     if (! mountpoint_path) {
       gchar *uri = g_file_get_uri (mountpoint_file);
       
-      g_set_error (&err, 0, 0, _("Mount \"%s\" is not local"), uri);
+      g_set_error (&err,
+                   NAUTILUS_SRM_FILL_OPERATION_ERROR,
+                   NAUTILUS_SRM_FILL_OPERATION_ERROR_REMOTE_MOUNT,
+                   _("Mount \"%s\" is not local"), uri);
       g_free (uri);
     }
     g_object_unref (mountpoint_file);
@@ -114,7 +129,10 @@ find_mountpoint (const gchar *path,
     g_clear_error (&err);
     mountpoint_path = find_mountpoint_unix (path);
     if (! mountpoint_path) {
-      g_set_error (&err, 0, 0, _("No mount point found for path \"%s\""), path);
+      g_set_error (&err,
+                   NAUTILUS_SRM_FILL_OPERATION_ERROR,
+                   NAUTILUS_SRM_FILL_OPERATION_ERROR_MISSING_MOUNT,
+                   _("No mount point found for path \"%s\""), path);
     }
   }
   #endif
diff --git a/nautilus-srm/fill-operation.h b/nautilus-srm/fill-operation.h
index 5d20181..33df0d6 100644
--- a/nautilus-srm/fill-operation.h
+++ b/nautilus-srm/fill-operation.h
@@ -29,6 +29,29 @@
 G_BEGIN_DECLS
 
 
+/**
+ * NautilusSrmFillOperationError:
+ * @NAUTILUS_SRM_FILL_OPERATION_ERROR_MISSING_MOUNT: A file have no mount
+ * @NAUTILUS_SRM_FILL_OPERATION_ERROR_REMOTE_MOUNT: A mount is not local
+ * @NAUTILUS_SRM_FILL_OPERATION_ERROR_FAILED: An error occurred
+ * 
+ * Possible errors from the %NAUTILUS_SRM_FILL_OPERATION_ERROR domain.
+ */
+typedef enum
+{
+  NAUTILUS_SRM_FILL_OPERATION_ERROR_MISSING_MOUNT,
+  NAUTILUS_SRM_FILL_OPERATION_ERROR_REMOTE_MOUNT,
+  NAUTILUS_SRM_FILL_OPERATION_ERROR_FAILED
+} NautilusSrmFillOperationError;
+
+/**
+ * NAUTILUS_SRM_FILL_OPERATION_ERROR:
+ * 
+ * Domain for error coming from a NautilusSrm's fill operation.
+ */
+#define NAUTILUS_SRM_FILL_OPERATION_ERROR (nautilus_srm_fill_operation_error_quark ())
+
+GQuark   nautilus_srm_fill_operation_error_quark  (void) G_GNUC_CONST;
 gboolean nautilus_srm_fill_operation_filter_files (GList    *paths,
                                                    GList   **work_paths_,
                                                    GList   **work_mounts_,
diff --git a/nautilus-srm/nautilus-srm.c b/nautilus-srm/nautilus-srm.c
index 6bb7bc4..0b52fbb 100644
--- a/nautilus-srm/nautilus-srm.c
+++ b/nautilus-srm/nautilus-srm.c
@@ -60,7 +60,7 @@ static GList *nautilus_srm_get_background_items (NautilusMenuProvider *provider,
 void
 nautilus_module_initialize (GTypeModule *module)
 {
-  g_message (_("Initializing"));
+  g_message ("Initializing");
   bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
   nautilus_srm_register_type (module);
   provider_types[0] = nautilus_srm_get_type ();
@@ -81,7 +81,6 @@ nautilus_module_list_types (const GType **types,
 void
 nautilus_module_shutdown (void)
 {
-  g_message (_("Shutting down"));
   /* Any module-specific shutdown code*/
 }
 
@@ -110,29 +109,13 @@ nautilus_srm_menu_provider_iface_init (NautilusMenuProviderIface *iface)
 static void 
 nautilus_srm_instance_init (NautilusSrm *srm)
 {
-  g_message ("Object [%p] initialized", srm);
-}
-
-static void 
-nautilus_srm_instance_finalize (GObject *object)
-{
-  g_message ("Object [%p] finalized", object);
+  /* instance initialization */
 }
 
 static void
 nautilus_srm_class_init (NautilusSrmClass *class)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (class);
-  
-  object_class->finalize = nautilus_srm_instance_finalize;
-  
-  g_message ("Class initialized");
-}
-
-static void
-nautilus_srm_class_finalize (NautilusSrmClass *class)
-{
-  g_message ("Class finalized");
+  /* class initialization */
 }
 
 GType
@@ -213,7 +196,6 @@ nautilus_srm_nfi_has_uri_scheme (NautilusFileInfo *nfi,
   gchar    *nfi_scheme;
   
   nfi_scheme = nautilus_file_info_get_uri_scheme (nfi);
-  /*g_message ("does %s match %s?", nfi_scheme, scheme);*/
   if (nfi_scheme == scheme || strcmp (nfi_scheme, scheme) == 0) {
     matches = TRUE;
   }
@@ -377,7 +359,7 @@ nautilus_srm_menu_item_srm (NautilusMenuProvider *provider,
   
   item = nautilus_menu_item_new (item_name,
                                  _("Wipe"),
-                                 _("Delete each selected item, and overwrite its data"),
+                                 _("Delete each selected item and overwrite its data"),
                                  GTK_STOCK_DELETE);
   add_item_data (item, window, paths, NULL);
   g_signal_connect (item, "activate",
@@ -409,7 +391,7 @@ nautilus_srm_menu_item_sfill (NautilusMenuProvider *provider,
 
   if (! nautilus_srm_fill_operation_filter_files (files, &folders, &mountpoints,
                                                   &err)) {
-    g_warning ("File filtering failed: %s", err->message);
+    g_warning (_("File filtering failed: %s"), err->message);
     g_error_free (err);
   } else {
     item = nautilus_menu_item_new (item_name,
diff --git a/nautilus-srm/operation-manager.c b/nautilus-srm/operation-manager.c
index 8e25e03..c051114 100644
--- a/nautilus-srm/operation-manager.c
+++ b/nautilus-srm/operation-manager.c
@@ -148,7 +148,6 @@ struct NautilusSrmOperationData
   gchar                      *failed_primary_text;
   gchar                      *success_primary_text;
   gchar                      *success_secondary_text;
-  /*GList                      *files;*/
 };
 
 /* Frees a NautilusSrmOperationData structure */

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