2006-08-15 [colin] 2.4.0cvs51
authorColin Leroy <colin@colino.net>
Tue, 15 Aug 2006 10:19:08 +0000 (10:19 +0000)
committerColin Leroy <colin@colino.net>
Tue, 15 Aug 2006 10:19:08 +0000 (10:19 +0000)
* src/plugins/pgpcore/prefs_gpg.c
Set options sensitivity according to
key existence
* src/plugins/pgpcore/sgpgme.c
Allow to create key with no passphrase

ChangeLog
PATCHSETS
configure.ac
src/plugins/pgpcore/prefs_gpg.c
src/plugins/pgpcore/sgpgme.c

index 08960d837dc707ee58b26799438536345e0beb9b..a4b695963d78c3ea196649463b58715810011029 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-15 [colin]     2.4.0cvs51
+
+       * src/plugins/pgpcore/prefs_gpg.c
+               Set options sensitivity according to
+               key existence
+       * src/plugins/pgpcore/sgpgme.c
+               Allow to create key with no passphrase
+
 2006-08-14 [cleroy]    2.4.0cvs50
 
        * src/gtk/pluginwindow.c
 2006-08-14 [cleroy]    2.4.0cvs50
 
        * src/gtk/pluginwindow.c
index 5740457f005d80cf61fb6114831034de324c4595..d11225169a107e1e9504ddde69ad32094d7ec0f4 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.12.2.26 -r 1.12.2.27 src/gtk/prefswindow.c;  ) > 2.4.0cvs48.patchset
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/addressbook_foldersel.c;  ) > 2.4.0cvs49.patchset
 ( cvs diff -u -r 1.5.2.35 -r 1.5.2.36 src/gtk/gtkutils.c;  cvs diff -u -r 1.5.2.31 -r 1.5.2.32 src/gtk/pluginwindow.c;  cvs diff -u -r 1.1.2.15 -r 1.1.2.16 src/plugins/pgpcore/passphrase.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpcore/passphrase.h;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/plugins/pgpcore/plugin.c;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/plugins/pgpcore/prefs_gpg.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpcore/prefs_gpg.h;  cvs diff -u -r 1.1.2.23 -r 1.1.2.24 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpcore/sgpgme.h;  ) > 2.4.0cvs50.patchset
 ( cvs diff -u -r 1.12.2.26 -r 1.12.2.27 src/gtk/prefswindow.c;  ) > 2.4.0cvs48.patchset
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/addressbook_foldersel.c;  ) > 2.4.0cvs49.patchset
 ( cvs diff -u -r 1.5.2.35 -r 1.5.2.36 src/gtk/gtkutils.c;  cvs diff -u -r 1.5.2.31 -r 1.5.2.32 src/gtk/pluginwindow.c;  cvs diff -u -r 1.1.2.15 -r 1.1.2.16 src/plugins/pgpcore/passphrase.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpcore/passphrase.h;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/plugins/pgpcore/plugin.c;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/plugins/pgpcore/prefs_gpg.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpcore/prefs_gpg.h;  cvs diff -u -r 1.1.2.23 -r 1.1.2.24 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpcore/sgpgme.h;  ) > 2.4.0cvs50.patchset
+( cvs diff -u -r 1.1.2.10 -r 1.1.2.11 src/plugins/pgpcore/prefs_gpg.c;  cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/plugins/pgpcore/sgpgme.c;  ) > 2.4.0cvs51.patchset
index f9808337eeff6d8834935c1c8a0868c9af457bfe..dd877b8607ee21ff1e297cb6077583f85610c01e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=50
+EXTRA_VERSION=51
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index c59fd33412fcdbd28056ce8d46a4bb321d4e5df4..6aea605cd1f40759d5578450e6e1a915dbdd06b1 100644 (file)
@@ -215,10 +215,32 @@ void key_custom_toggled(GtkToggleButton *togglebutton, gpointer user_data)
                gtk_editable_delete_text(GTK_EDITABLE(page->keyid), 0, -1);
 }
 
                gtk_editable_delete_text(GTK_EDITABLE(page->keyid), 0, -1);
 }
 
+static void prefs_gpg_update_sens(struct GPGAccountPage *page)
+{
+       gboolean active;
+       active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->key_custom));
+       if (sgpgme_has_secret_key()) {
+               gtk_widget_hide(page->new_key_box);
+               gtk_widget_set_sensitive(page->key_default, TRUE);
+               gtk_widget_set_sensitive(page->key_by_from, TRUE);
+               gtk_widget_set_sensitive(page->key_custom, TRUE);
+               gtk_widget_set_sensitive(page->keyid, active);
+               gtk_widget_set_sensitive(page->keyid_label, active);
+       } else {
+               gtk_widget_show(page->new_key_box);
+               gtk_widget_set_sensitive(page->key_default, FALSE);
+               gtk_widget_set_sensitive(page->key_by_from, FALSE);
+               gtk_widget_set_sensitive(page->key_custom, FALSE);
+               gtk_widget_set_sensitive(page->keyid, FALSE);
+               gtk_widget_set_sensitive(page->keyid_label, FALSE);
+       }
+}
+
 static void new_key_clicked(GtkWidget *widget, gpointer user_data)
 {
        struct GPGAccountPage *page = (struct GPGAccountPage *) user_data;
        sgpgme_create_secret_key(page->account);
 static void new_key_clicked(GtkWidget *widget, gpointer user_data)
 {
        struct GPGAccountPage *page = (struct GPGAccountPage *) user_data;
        sgpgme_create_secret_key(page->account);
+       prefs_gpg_update_sens(page);
 }
 
 static void prefs_gpg_account_create_widget_func(PrefsPage *_page,
 }
 
 static void prefs_gpg_account_create_widget_func(PrefsPage *_page,
@@ -330,15 +352,18 @@ static void prefs_gpg_account_create_widget_func(PrefsPage *_page,
        new_key_label = gtk_label_new(
                        _("No secret key found."));
        gtk_box_pack_start(GTK_BOX(new_key_box), new_key_label, FALSE, FALSE, 0);
        new_key_label = gtk_label_new(
                        _("No secret key found."));
        gtk_box_pack_start(GTK_BOX(new_key_box), new_key_label, FALSE, FALSE, 0);
+
        new_key_btn = gtk_button_new_with_label(_("Generate new secret key"));
        new_key_btn = gtk_button_new_with_label(_("Generate new secret key"));
-       gtk_box_pack_start(GTK_BOX(new_key_box), new_key_btn, FALSE, FALSE, 0);
 
        gtk_box_pack_start(GTK_BOX(vbox2), new_key_box, FALSE, FALSE, 0);
 
 
        gtk_box_pack_start(GTK_BOX(vbox2), new_key_box, FALSE, FALSE, 0);
 
-       gtk_widget_show_all(new_key_box);
+       hbox = gtk_hbox_new (FALSE, 5);
+       gtk_widget_show (hbox);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox), new_key_btn, FALSE, FALSE, 0);
 
 
-       if (sgpgme_has_secret_key())
-               gtk_widget_hide(new_key_box);
+       gtk_widget_show_all(new_key_box);
+       gtk_widget_show(new_key_btn);
 
        if (config->sign_key_id != NULL)
                gtk_entry_set_text(GTK_ENTRY(keyid), config->sign_key_id);
 
        if (config->sign_key_id != NULL)
                gtk_entry_set_text(GTK_ENTRY(keyid), config->sign_key_id);
@@ -351,9 +376,11 @@ static void prefs_gpg_account_create_widget_func(PrefsPage *_page,
        page->key_custom = key_custom;
        page->keyid = keyid;
        page->keyid_label = keyid_label;
        page->key_custom = key_custom;
        page->keyid = keyid;
        page->keyid_label = keyid_label;
+       page->new_key_box = new_key_box;
 
        page->page.widget = vbox;
        page->account = account;
 
        page->page.widget = vbox;
        page->account = account;
+       prefs_gpg_update_sens(page);
 }
 
 static void prefs_gpg_account_destroy_widget_func(PrefsPage *_page)
 }
 
 static void prefs_gpg_account_destroy_widget_func(PrefsPage *_page)
index d48b05448825d51a4471b5f4506291694701844e..53c77833ac88ef00edebc26097ee1511169c50aa 100644 (file)
@@ -645,9 +645,12 @@ again:
                                        "Name-Real: %s\n"
                                        "Name-Email: %s\n"
                                        "Expire-Date: 0\n"
                                        "Name-Real: %s\n"
                                        "Name-Email: %s\n"
                                        "Expire-Date: 0\n"
-                                       "Passphrase: %s\n"
+                                       "%s%s%s"
                                        "</GnupgKeyParms>\n",
                                        "</GnupgKeyParms>\n",
-                                       name, email, passphrase);
+                                       name, email, 
+                                       strlen(passphrase)?"Passphrase: ":"",
+                                       passphrase,
+                                       strlen(passphrase)?"\n":"");
 #ifndef G_PLATFORM_WIN32
        if (mlock(passphrase, strlen(passphrase)) == -1)
                debug_print("couldn't lock passphrase\n");
 #ifndef G_PLATFORM_WIN32
        if (mlock(passphrase, strlen(passphrase)) == -1)
                debug_print("couldn't lock passphrase\n");