[empathy/gnome-2-34] find_items_cb: always use the first password found
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy/gnome-2-34] find_items_cb: always use the first password found
- Date: Mon, 28 Feb 2011 14:06:47 +0000 (UTC)
commit f4d80d432a22487eeacfe4f3216c132d5a4e0a12
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Mon Feb 28 14:50:43 2011 +0100
find_items_cb: always use the first password found
libempathy/empathy-keyring.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/libempathy/empathy-keyring.c b/libempathy/empathy-keyring.c
index 4923a94..baeffbd 100644
--- a/libempathy/empathy-keyring.c
+++ b/libempathy/empathy-keyring.c
@@ -39,6 +39,7 @@ find_items_cb (GnomeKeyringResult result,
gpointer user_data)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
+ GnomeKeyringFound *found;
if (result != GNOME_KEYRING_RESULT_OK)
{
@@ -47,17 +48,25 @@ find_items_cb (GnomeKeyringResult result,
gnome_keyring_result_to_message (result));
g_simple_async_result_set_from_error (simple, error);
g_clear_error (&error);
+ goto out;
}
- if (g_list_length (list) == 1)
+ if (list == NULL)
{
- GnomeKeyringFound *found = list->data;
+ g_simple_async_result_set_error (simple, TP_ERROR,
+ TP_ERROR_DOES_NOT_EXIST, "Password not found");
+ goto out;
+ }
- DEBUG ("Got secret");
+ /* Get the first password returned. Ideally we should use the latest
+ * modified or something but we don't have this information from
+ * gnome-keyring atm. */
+ found = list->data;
+ DEBUG ("Got secret");
- g_simple_async_result_set_op_res_gpointer (simple, found->secret, NULL);
- }
+ g_simple_async_result_set_op_res_gpointer (simple, found->secret, NULL);
+out:
g_simple_async_result_complete (simple);
g_object_unref (simple);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]