seahorse r2262 - in seahorse-plugins/trunk: . plugins/nautilus
- From: sadam svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2262 - in seahorse-plugins/trunk: . plugins/nautilus
- Date: Sun, 6 Jul 2008 01:21:33 +0000 (UTC)
Author: sadam
Date: Sun Jul 6 01:21:33 2008
New Revision: 2262
URL: http://svn.gnome.org/viewvc/seahorse?rev=2262&view=rev
Log:
2008-07-05 Adam Schreiber <sadam clemson edu>
* plugins/nautilus/seahorse-tools: Prompt to create key when needed.
Fixes
bug #538696
Modified:
seahorse-plugins/trunk/ChangeLog
seahorse-plugins/trunk/plugins/nautilus/seahorse-tool.c
Modified: seahorse-plugins/trunk/plugins/nautilus/seahorse-tool.c
==============================================================================
--- seahorse-plugins/trunk/plugins/nautilus/seahorse-tool.c (original)
+++ seahorse-plugins/trunk/plugins/nautilus/seahorse-tool.c Sun Jul 6 01:21:33 2008
@@ -158,73 +158,79 @@
GArray *keys;
gchar **recips;
gchar *signer;
-
+
*signkey = NULL;
keyset = cryptui_keyset_new ("openpgp", TRUE);
- recips = cryptui_prompt_recipients (keyset, _("Choose Recipients"), &signer);
- if (recips) {
+ if (cryptui_keyset_get_count (keyset) == 0) {
+ cryptui_need_to_get_keys (TRUE);
+ } else {
+ recips = cryptui_prompt_recipients (keyset, _("Choose Recipients"), &signer);
- gerr = gpgme_new (&ctx);
- g_return_val_if_fail (GPG_IS_OK (gerr), NULL);
-
- if (signer) {
- /* Load up the GPGME secret key */
- gchar *id = cryptui_keyset_key_raw_keyid (keyset, signer);
- gerr = gpgme_get_key (ctx, id, signkey, 1);
- g_free (id);
+ if (recips) {
- /* A more descriptive error message */
- if (GPG_ERR_EOF == gpgme_err_code (gerr))
- gerr = GPG_E (GPG_ERR_NOT_FOUND);
- }
+ gerr = gpgme_new (&ctx);
+ g_return_val_if_fail (GPG_IS_OK (gerr), NULL);
- if (GPG_IS_OK (gerr)) {
- gchar **ids;
- guint num;
-
- /* Load up the GPGME keys */
- ids = cryptui_keyset_keys_raw_keyids (keyset, (const gchar**)recips);
- num = seahorse_util_strvec_length ((const gchar**)ids);
- keys = g_array_new (TRUE, TRUE, sizeof (gpgme_key_t));
- gerr = gpgme_op_keylist_ext_start (ctx, (const gchar**)ids, 0, 0);
- g_free (ids);
+ if (signer) {
+ /* Load up the GPGME secret key */
+ gchar *id = cryptui_keyset_key_raw_keyid (keyset, signer);
+ gerr = gpgme_get_key (ctx, id, signkey, 1);
+ g_free (id);
+
+ /* A more descriptive error message */
+ if (GPG_ERR_EOF == gpgme_err_code (gerr))
+ gerr = GPG_E (GPG_ERR_NOT_FOUND);
+ }
if (GPG_IS_OK (gerr)) {
- while (GPG_IS_OK (gerr = gpgme_op_keylist_next (ctx, &key)))
- g_array_append_val (keys, key);
- gpgme_op_keylist_end (ctx);
+ gchar **ids;
+ guint num;
+
+ /* Load up the GPGME keys */
+ ids = cryptui_keyset_keys_raw_keyids (keyset, (const gchar**)recips);
+ num = seahorse_util_strvec_length ((const gchar**)ids);
+ keys = g_array_new (TRUE, TRUE, sizeof (gpgme_key_t));
+ gerr = gpgme_op_keylist_ext_start (ctx, (const gchar**)ids, 0, 0);
+ g_free (ids);
+
+ if (GPG_IS_OK (gerr)) {
+ while (GPG_IS_OK (gerr = gpgme_op_keylist_next (ctx, &key)))
+ g_array_append_val (keys, key);
+ gpgme_op_keylist_end (ctx);
+ }
+
+ /* Ignore EOF error */
+ if (GPG_ERR_EOF == gpgme_err_code (gerr))
+ gerr = GPG_OK;
+
+ if (GPG_IS_OK (gerr) && num != keys->len)
+ g_warning ("couldn't load all the keys (%d/%d) from GPGME", keys->len, num);
}
- /* Ignore EOF error */
- if (GPG_ERR_EOF == gpgme_err_code (gerr))
- gerr = GPG_OK;
-
- if (GPG_IS_OK (gerr) && num != keys->len)
- g_warning ("couldn't load all the keys (%d/%d) from GPGME", keys->len, num);
+ gpgme_release (ctx);
}
- gpgme_release (ctx);
- }
-
- g_object_unref (keyset);
+ g_object_unref (keyset);
- if (!recips)
- return NULL;
+ if (!recips)
+ return NULL;
- g_strfreev (recips);
- g_free (signer);
-
- if (GPG_IS_OK (gerr) && keys->len)
- return (gpgme_key_t*)g_array_free (keys, FALSE);
-
- /* When failure, free all our return values */
- seahorse_util_free_keys ((gpgme_key_t*)g_array_free (keys, FALSE));
- if (*signkey)
- gpgmex_key_unref (*signkey);
+ g_strfreev (recips);
+ g_free (signer);
+
+ if (GPG_IS_OK (gerr) && keys->len)
+ return (gpgme_key_t*)g_array_free (keys, FALSE);
+
+ /* When failure, free all our return values */
+ seahorse_util_free_keys ((gpgme_key_t*)g_array_free (keys, FALSE));
+ if (*signkey)
+ gpgmex_key_unref (*signkey);
+
+ seahorse_util_handle_gpgme (gerr, _("Couldn't load keys"));
+ }
- seahorse_util_handle_gpgme (gerr, _("Couldn't load keys"));
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]