[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_99-33-g9a99c28

Pierre Biava nobody at users.sourceforge.net
Fri Feb 4 23:33:46 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  9a99c2818e5f751bdac006e391a57a257b817295 (commit)
      from  b5297b4b00fa2566411a418b57c3402ad762364d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9a99c2818e5f751bdac006e391a57a257b817295
Author: pbiava <pierre.biava at nerim.net>
Date:   Fri Feb 4 23:33:16 2011 +0100

    add the visibility of password

-----------------------------------------------------------------------

Changes:
diff --git a/src/gsb_assistant_file.c b/src/gsb_assistant_file.c
index 3f36cf7..3b98827 100644
--- a/src/gsb_assistant_file.c
+++ b/src/gsb_assistant_file.c
@@ -46,6 +46,7 @@
 #include "utils.h"
 #include "affichage.h"
 #include "structures.h"
+#include "erreur.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/
@@ -323,6 +324,9 @@ static GtkWidget *gsb_assistant_file_page_2 ( GtkWidget *assistant )
     gtk_box_pack_start ( GTK_BOX ( paddingbox ), button,
 			 FALSE, FALSE, 0 );
 
+    if ( etat.crypt_file )
+        run.new_crypted_file = TRUE;
+
     /* date format */
     paddingbox = gsb_config_date_format_chosen ( vbox, GTK_ORIENTATION_HORIZONTAL );
 
diff --git a/src/gsb_assistant_first.c b/src/gsb_assistant_first.c
index 02af5e0..a699995 100644
--- a/src/gsb_assistant_first.c
+++ b/src/gsb_assistant_first.c
@@ -250,6 +250,9 @@ static GtkWidget *gsb_assistant_first_page_2 ( GtkWidget *assistant )
     gtk_box_pack_start ( GTK_BOX ( paddingbox ), button,
 			 FALSE, FALSE, 0 );
 
+    if ( etat.crypt_file )
+        run.new_crypted_file = TRUE;
+
     /* Automatic backup ? */
     button = gsb_automem_checkbutton_new (_("Make a backup copy before saving files"),
 					  &conf.make_backup, NULL, NULL);
diff --git a/src/parametres.c b/src/parametres.c
index 493545c..34c748f 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -993,7 +993,8 @@ gboolean gsb_gui_encryption_toggled ( GtkWidget * checkbox, gpointer data )
 {
     if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (checkbox)))
     {
-    dialog_message ( "encryption-is-irreversible" );
+        dialog_message ( "encryption-is-irreversible" );
+        run.new_crypted_file = TRUE;
     }
 
     return FALSE;
diff --git a/src/plugins/openssl/openssl.c b/src/plugins/openssl/openssl.c
index b1c85ab..d97b77a 100644
--- a/src/plugins/openssl/openssl.c
+++ b/src/plugins/openssl/openssl.c
@@ -53,6 +53,7 @@ static gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * addit
                         gboolean encrypt );
 static gulong gsb_file_util_crypt_file ( gchar * file_name, gchar **file_content,
                         gboolean crypt, gulong length );
+static void gsb_file_util_show_hide_passwd ( GtkToggleButton *togglebutton, GtkWidget *entry );
 /*END_STATIC*/
 #endif
 
@@ -83,6 +84,13 @@ gulong gsb_file_util_crypt_file ( gchar * file_name, gchar **file_content,
     DES_key_schedule sched;
     gulong output_length;
 
+    if ( run.new_crypted_file )
+    {
+        if ( saved_crypt_key )
+            g_free ( saved_crypt_key );
+	    saved_crypt_key = NULL;
+    }
+
     if ( crypt )
     {
         /* we want to encrypt the file */
@@ -103,7 +111,7 @@ gulong gsb_file_util_crypt_file ( gchar * file_name, gchar **file_content,
 
         /* Encrypted files begin with a special marker */
         output_length = MARKER_SIZE;
-        g_printf("TOTO: %d\n", MARKER_SIZE);
+/*         g_printf("TOTO: %ld\n", MARKER_SIZE);  */
 
         /* DES_cbc_encrypt output is always a multiple of 8 bytes. Adjust the
          * length of the output allocation accordingly. */
@@ -276,6 +284,16 @@ gchar *gsb_file_util_ask_for_crypt_key ( gchar * file_name, gchar * additional_m
     gtk_entry_set_visibility ( GTK_ENTRY ( entry ), FALSE );
     gtk_box_pack_start ( GTK_BOX ( hbox2 ), entry, TRUE, TRUE, 0 );
 
+    if ( run.new_crypted_file )
+    {
+        button = gtk_check_button_new_with_label ( _("View password") );
+        gtk_box_pack_start ( GTK_BOX ( vbox ), button, FALSE, FALSE, 5 );
+        g_signal_connect ( G_OBJECT ( button ),
+			            "toggled",
+			            G_CALLBACK ( gsb_file_util_show_hide_passwd ),
+			            entry );
+    }
+
     button = gtk_check_button_new_with_label ( _("Don't ask password again for this session."));
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
     gtk_box_pack_start ( GTK_BOX ( vbox ), button, FALSE, FALSE, 5 );
@@ -312,6 +330,9 @@ return_bad_password:
             saved_crypt_key = key;
         else
             saved_crypt_key = NULL;
+
+        run.new_crypted_file = FALSE;
+
         break;
 
     case GTK_RESPONSE_CANCEL:
@@ -352,6 +373,19 @@ G_MODULE_EXPORT extern gpointer openssl_plugin_run ( gchar * file_name, gchar **
 }
 
 
+void gsb_file_util_show_hide_passwd ( GtkToggleButton *togglebutton, GtkWidget *entry )
+{
+    gint visibility;
+
+    visibility = gtk_entry_get_visibility ( GTK_ENTRY ( entry ) );
+    if ( visibility )
+        gtk_button_set_label ( GTK_BUTTON ( togglebutton ), _("View password") );
+    else
+        gtk_button_set_label ( GTK_BUTTON ( togglebutton ), _("Hide password") );
+
+    gtk_entry_set_visibility ( GTK_ENTRY ( entry ), !visibility );
+}
+
 
 /* Local Variables: */
 /* c-basic-offset: 4 */
diff --git a/src/structures.h b/src/structures.h
index 6a1f549..23935f4 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -222,6 +222,9 @@ extern struct gsb_conf_t conf;
 
 struct gsb_run_t
 {
+    /* initialisation variables */
+    gboolean new_crypted_file;      /* 0 à l'exécution de init_variables () 1 si new crypted file*/
+
     /* largeur des colonnes */
     gchar *transaction_column_width;
     gchar *scheduler_column_width;
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index ee704c1..7c75cc2 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -247,6 +247,9 @@ void init_variables ( void )
  * et les variables liées à grisbi (ex sauvegarde auto...) qui doivent rester */
     devel_debug (NULL);
 
+    /* init the new crypted file */
+    run.new_crypted_file = FALSE;
+
     /* init the format date */
     initialise_format_date ( );
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list