From 4bb3dcb5495bb6763aff0f10acec77541d437146 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Tue, 15 Aug 2006 10:19:08 +0000 Subject: [PATCH] 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 --- ChangeLog | 8 ++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/plugins/pgpcore/prefs_gpg.c | 35 +++++++++++++++++++++++++++++---- src/plugins/pgpcore/sgpgme.c | 7 +++++-- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08960d837..a4b695963 100644 --- 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 diff --git a/PATCHSETS b/PATCHSETS index 5740457f0..d11225169 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -1742,3 +1742,4 @@ ( 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 diff --git a/configure.ac b/configure.ac index f9808337e..dd877b860 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=4 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=50 +EXTRA_VERSION=51 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/plugins/pgpcore/prefs_gpg.c b/src/plugins/pgpcore/prefs_gpg.c index c59fd3341..6aea605cd 100644 --- a/src/plugins/pgpcore/prefs_gpg.c +++ b/src/plugins/pgpcore/prefs_gpg.c @@ -215,10 +215,32 @@ void key_custom_toggled(GtkToggleButton *togglebutton, gpointer user_data) 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); + prefs_gpg_update_sens(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_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_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); @@ -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->new_key_box = new_key_box; page->page.widget = vbox; page->account = account; + prefs_gpg_update_sens(page); } static void prefs_gpg_account_destroy_widget_func(PrefsPage *_page) diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c index d48b05448..53c77833a 100644 --- a/src/plugins/pgpcore/sgpgme.c +++ b/src/plugins/pgpcore/sgpgme.c @@ -645,9 +645,12 @@ again: "Name-Real: %s\n" "Name-Email: %s\n" "Expire-Date: 0\n" - "Passphrase: %s\n" + "%s%s%s" "\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"); -- 2.25.1