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);
}
Esempio n. 2
0
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 gboolean
on_key_list_popup_menu (GtkTreeView* view, SeahorseKeyserverResults* self)
{
	GList *objects;

	g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), FALSE);
	g_return_val_if_fail (GTK_IS_TREE_VIEW (view), FALSE);

	objects = seahorse_catalog_get_selected_objects (SEAHORSE_CATALOG (self));
	if (objects != NULL)
		seahorse_catalog_show_context_menu (SEAHORSE_CATALOG (self),
		                                   SEAHORSE_CATALOG_MENU_OBJECT,
		                                   0, gtk_get_current_event_time ());
	g_list_free (objects);
	return TRUE;
}