[seahorse-plugins] Embed filename when encrypting gpg files.



commit 4c3ef9f664f12a96b98c1d6f12898a6cc4c072f3
Author: Patrick Toomey <ptoomey3 mac com>
Date:   Mon May 9 10:23:18 2011 +0200

    Embed filename when encrypting gpg files.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=588432

 plugins/nautilus/seahorse-tool-files.c |    9 +++++++++
 plugins/nautilus/seahorse-tool.c       |   12 ++++++------
 plugins/nautilus/seahorse-tool.h       |    7 +++++++
 3 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/plugins/nautilus/seahorse-tool-files.c b/plugins/nautilus/seahorse-tool-files.c
index fe2a270..d3534d7 100644
--- a/plugins/nautilus/seahorse-tool-files.c
+++ b/plugins/nautilus/seahorse-tool-files.c
@@ -764,6 +764,7 @@ step_operation (FilesCtx *ctx, SeahorseToolMode *mode, GError **err)
     SeahorseOperation *op;
     FileInfo *finfo;
     GList *l;
+    gchar *filename;
     
     /* Reset our done counter */
     ctx->done = 0;
@@ -788,6 +789,14 @@ step_operation (FilesCtx *ctx, SeahorseToolMode *mode, GError **err)
         
         /* Inhibit popping up of progress dialog */
         seahorse_tool_progress_block (TRUE);
+
+        /* Embed filename during encryption */
+        if (mode_encrypt)
+        {
+            filename = g_file_get_basename (finfo->file);
+            gpgme_data_set_file_name (data, filename);
+            g_free (filename);
+        }
     
         /* The start callback */
         if (mode->startcb) {
diff --git a/plugins/nautilus/seahorse-tool.c b/plugins/nautilus/seahorse-tool.c
index ea727d8..055753b 100644
--- a/plugins/nautilus/seahorse-tool.c
+++ b/plugins/nautilus/seahorse-tool.c
@@ -50,12 +50,12 @@
 
 static gchar **arg_uris = NULL;
 static gboolean read_uris = FALSE;
-static gboolean mode_import = FALSE;
-static gboolean mode_encrypt = FALSE;
-static gboolean mode_sign = FALSE;
-static gboolean mode_encrypt_sign = FALSE;
-static gboolean mode_decrypt = FALSE;
-static gboolean mode_verify = FALSE;
+gboolean mode_import = FALSE;
+gboolean mode_encrypt = FALSE;
+gboolean mode_sign = FALSE;
+gboolean mode_encrypt_sign = FALSE;
+gboolean mode_decrypt = FALSE;
+gboolean mode_verify = FALSE;
 
 static const GOptionEntry options[] = {
     { "import", 'i', 0, G_OPTION_ARG_NONE, &mode_import,
diff --git a/plugins/nautilus/seahorse-tool.h b/plugins/nautilus/seahorse-tool.h
index 0ff3bc3..99aeae0 100644
--- a/plugins/nautilus/seahorse-tool.h
+++ b/plugins/nautilus/seahorse-tool.h
@@ -24,6 +24,13 @@
 
 #include "seahorse-pgp-operation.h"
 
+extern gboolean mode_import;
+extern gboolean mode_encrypt;
+extern gboolean mode_sign;
+extern gboolean mode_encrypt_sign;
+extern gboolean mode_decrypt;
+extern gboolean mode_verify;
+
 struct _SeahorseToolMode;
 typedef gboolean (*SeahorseToolCallback) (struct _SeahorseToolMode *mode, const gchar *uri, 
                                           gpgme_data_t uridata, SeahorsePGPOperation *pop, 



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