static void
on_open_session (GObject *obj, GAsyncResult *res, gpointer user_data)
{
	GError *error = NULL;
	GP11Session *session = gp11_slot_open_session_finish (GP11_SLOT (obj), res, &error);
	complete_open_session (GCR_IMPORTER (user_data), session, error);
}
static void 
on_open_session(GP11Slot *slot, GAsyncResult *result, SeahorsePkcs11Refresher *self) 
{
	GError *err = NULL;
	GP11Attributes *attrs;
	
	g_return_if_fail (SEAHORSE_IS_PKCS11_REFRESHER (self));
	
	self->session = gp11_slot_open_session_finish (slot, result, &err);
	if (!self->session) {
		seahorse_pkcs11_mark_complete (SEAHORSE_OPERATION (self), err);
		return;
	}
	
	/* Step 2. Load all the objects that we want */
	attrs = gp11_attributes_new ();
	gp11_attributes_add_boolean (attrs, CKA_TOKEN, TRUE);
	gp11_attributes_add_ulong (attrs, CKA_CLASS, CKO_CERTIFICATE);
	gp11_session_find_objects_async (self->session, attrs, self->cancellable, 
	                                 (GAsyncReadyCallback)on_find_objects, self);
	gp11_attributes_unref (attrs);
}
static void
opened_session (GObject *obj, GAsyncResult *result, gpointer user_data)
{
	GP11Session *session;
	GError *err = NULL;
	GP11Call *call;
	
	g_assert (GP11_IS_CALL (user_data));
	call = GP11_CALL (user_data);
	
	session = gp11_slot_open_session_finish (GP11_SLOT (obj), result, &err);
	
	/* Transtfer the error to the outer call and finish */
	if (!session) {
		_gp11_call_async_short (user_data, err->code);
		g_error_free (err);
		return;
	}

	run_call_with_session (GP11_CALL (user_data), session);
	g_object_unref (session);
}