static void
on_remote_sync (GtkAction* action,
                gpointer user_data)
{
	SeahorseActions *actions = SEAHORSE_ACTIONS (user_data);
	SeahorseGpgmeKeyring *keyring;
	SeahorseCatalog *catalog;
	GList *objects = NULL;
	GList *keys = NULL;
	GList *l;

	catalog = seahorse_actions_get_catalog (actions);
	if (catalog != NULL) {
		objects = seahorse_catalog_get_selected_objects (catalog);
		for (l = objects; l != NULL; l = g_list_next (l)) {
			if (SEAHORSE_IS_PGP_KEY (l->data))
				keys = g_list_prepend (keys, l->data);
		}
		g_list_free (objects);
	}
	g_object_unref (catalog);

	if (keys == NULL) {
		keyring = seahorse_pgp_backend_get_default_keyring (NULL);
		keys = gcr_collection_get_objects (GCR_COLLECTION (keyring));
	}

	seahorse_keyserver_sync_show (keys, seahorse_action_get_window (action));
	g_list_free (keys);
}
static void
on_import_button_clicked (GtkButton *import_button, gpointer user_data)
{
    SeahorseKeyserverResultsRow *row = user_data;
    g_autoptr(GtkWidget) spinner = NULL;
    g_autoptr(GList) keys = NULL;
    g_autoptr(GCancellable) cancellable = NULL;
    SeahorsePgpBackend *backend;
    SeahorseGpgmeKeyring *keyring;

    /* Let the button show a spinner while importing */
    gtk_widget_set_sensitive (GTK_WIDGET (import_button), FALSE);
    spinner = gtk_spinner_new ();
    gtk_spinner_start (GTK_SPINNER (spinner));
    gtk_button_set_image (import_button, g_steal_pointer (&spinner));

    /* Now import the key */
    keys = g_list_append (keys, row->key);
    cancellable = g_cancellable_new ();
    backend = seahorse_pgp_backend_get ();
    keyring = seahorse_pgp_backend_get_default_keyring (backend);
    seahorse_pgp_backend_transfer_async (backend, keys,
                                         SEAHORSE_PLACE (keyring),
                                         cancellable, on_import_complete,
                                         g_object_ref (row));
}
static void
on_key_import_keyring (GtkAction* action, SeahorseCatalog* self)
{
	GCancellable *cancellable;
	SeahorsePgpBackend *backend;
	SeahorseGpgmeKeyring *keyring;
	GList* objects;

	g_return_if_fail (SEAHORSE_IS_CATALOG (self));
	g_return_if_fail (GTK_IS_ACTION (action));

	objects = seahorse_catalog_get_selected_objects (self);
	objects = objects_prune_non_exportable (objects);

	/* No objects, nothing to do */
	if (objects == NULL)
		return;

	cancellable = g_cancellable_new ();
	backend = seahorse_pgp_backend_get ();
	keyring = seahorse_pgp_backend_get_default_keyring (NULL);
	seahorse_pgp_backend_transfer_async (backend, objects, SEAHORSE_PLACE (keyring),
	                                     cancellable, on_import_complete, g_object_ref (self));
	seahorse_progress_show (cancellable, _ ("Importing keys from key servers"), TRUE);
	g_object_unref (cancellable);

	g_list_free (objects);
}
static SeahorsePlace *
seahorse_keyserver_results_get_focused_place (SeahorseCatalog *catalog)
{
	SeahorseGpgmeKeyring *keyring;
	keyring = seahorse_pgp_backend_get_default_keyring (NULL);
	return SEAHORSE_PLACE (keyring);
}
guint
seahorse_pgp_signature_get_sigtype (SeahorsePgpSignature *self)
{
	SeahorseGpgmeKeyring *keyring;
	SeahorseGpgmeKey *key;
	SeahorseObject *obj;

	g_return_val_if_fail (SEAHORSE_IS_PGP_SIGNATURE (self), 0);

	keyring = seahorse_pgp_backend_get_default_keyring (NULL);
	key = seahorse_gpgme_keyring_lookup (keyring, self->pv->keyid);

	if (key != NULL) {
		obj = SEAHORSE_OBJECT (key);
		if (seahorse_object_get_usage (obj) == SEAHORSE_USAGE_PRIVATE_KEY)
			return SKEY_PGPSIG_TRUSTED | SKEY_PGPSIG_PERSONAL;
		if (seahorse_object_get_flags (obj) & SEAHORSE_FLAG_TRUSTED)
			return SKEY_PGPSIG_TRUSTED;
	}

	return 0;
}