[seahorse] Fix importing from SeahorseKeyserverResults window
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Fix importing from SeahorseKeyserverResults window
- Date: Tue, 13 Dec 2011 14:23:42 +0000 (UTC)
commit faf4b71610744156ee7efc5e3c368d493ce64d86
Author: Stef Walter <stefw collabora co uk>
Date: Tue Dec 13 09:44:06 2011 +0100
Fix importing from SeahorseKeyserverResults window
pgp/seahorse-keyserver-results.c | 4 +++-
pgp/seahorse-pgp-backend.c | 4 ++--
pgp/seahorse-transfer.c | 20 ++++++++++++++++----
pgp/seahorse-transfer.h | 2 +-
4 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/pgp/seahorse-keyserver-results.c b/pgp/seahorse-keyserver-results.c
index 18c7643..b225fb5 100644
--- a/pgp/seahorse-keyserver-results.c
+++ b/pgp/seahorse-keyserver-results.c
@@ -265,7 +265,9 @@ seahorse_keyserver_results_get_selected_objects (SeahorseCatalog *catalog)
static SeahorsePlace *
seahorse_keyserver_results_get_focused_place (SeahorseCatalog *catalog)
{
- return NULL;
+ SeahorseGpgmeKeyring *keyring;
+ keyring = seahorse_pgp_backend_get_default_keyring (NULL);
+ return SEAHORSE_PLACE (keyring);
}
/**
diff --git a/pgp/seahorse-pgp-backend.c b/pgp/seahorse-pgp-backend.c
index 6e373e6..28f9f71 100644
--- a/pgp/seahorse-pgp-backend.c
+++ b/pgp/seahorse-pgp-backend.c
@@ -554,12 +554,12 @@ seahorse_pgp_backend_transfer_async (SeahorsePgpBackend *self,
/* Export from this key place */
from = seahorse_object_get_place (object);
- g_return_if_fail (SEAHORSE_IS_GPGME_KEYRING (from));
+ g_return_if_fail (SEAHORSE_IS_PLACE (from));
if (from != to) {
/* Start a new transfer operation between the two places */
seahorse_progress_prep_and_begin (cancellable, GINT_TO_POINTER (closure->num_transfers), NULL);
- seahorse_transfer_keys_async (SEAHORSE_GPGME_KEYRING (from), to, keys, cancellable,
+ seahorse_transfer_keys_async (from, to, keys, cancellable,
on_source_transfer_ready, g_object_ref (res));
closure->num_transfers++;
}
diff --git a/pgp/seahorse-transfer.c b/pgp/seahorse-transfer.c
index 5b6c8fd..b2cce2e 100644
--- a/pgp/seahorse-transfer.c
+++ b/pgp/seahorse-transfer.c
@@ -171,7 +171,7 @@ on_timeout_start_transfer (gpointer user_data)
}
void
-seahorse_transfer_keys_async (SeahorseGpgmeKeyring *from,
+seahorse_transfer_keys_async (SeahorsePlace *from,
SeahorsePlace *to,
GList *keys,
GCancellable *cancellable,
@@ -180,9 +180,11 @@ seahorse_transfer_keys_async (SeahorseGpgmeKeyring *from,
{
GSimpleAsyncResult *res;
TransferClosure *closure;
+ GPtrArray *keyids;
+ GList *l;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEYRING (from));
- g_return_if_fail (SEAHORSE_PLACE (to));
+ g_return_if_fail (SEAHORSE_IS_PLACE (from));
+ g_return_if_fail (SEAHORSE_IS_PLACE (to));
res = g_simple_async_result_new (NULL, callback, user_data,
seahorse_transfer_finish);
@@ -197,9 +199,19 @@ seahorse_transfer_keys_async (SeahorseGpgmeKeyring *from,
closure->cancellable = cancellable ? g_object_ref (cancellable) : cancellable;
closure->from = g_object_ref (from);
closure->to = g_object_ref (to);
- closure->keys = seahorse_object_list_copy (keys);
g_simple_async_result_set_op_res_gpointer (res, closure, transfer_closure_free);
+ if (SEAHORSE_IS_GPGME_KEYRING (from)) {
+ closure->keys = seahorse_object_list_copy (keys);
+
+ } else {
+ keyids = g_ptr_array_new ();
+ for (l = keys; l != NULL; l = g_list_next (l))
+ g_ptr_array_add (keyids, g_strdup (seahorse_pgp_key_get_keyid (l->data)));
+ g_ptr_array_add (keyids, NULL);
+ closure->keyids = (gchar **)g_ptr_array_free (keyids, FALSE);
+ }
+
seahorse_progress_prep (cancellable, &closure->from,
SEAHORSE_IS_GPGME_KEYRING (closure->from) ?
_("Exporting data") : _("Retrieving data"));
diff --git a/pgp/seahorse-transfer.h b/pgp/seahorse-transfer.h
index 9e9ff63..ca9b56f 100644
--- a/pgp/seahorse-transfer.h
+++ b/pgp/seahorse-transfer.h
@@ -34,7 +34,7 @@ void seahorse_transfer_keyids_async (SeahorseServerSource *from,
GAsyncReadyCallback callback,
gpointer user_data);
-void seahorse_transfer_keys_async (SeahorseGpgmeKeyring *from,
+void seahorse_transfer_keys_async (SeahorsePlace *from,
SeahorsePlace *to,
GList *keys,
GCancellable *cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]