[epiphany/gnome-keyring: 2/6] pdm-dialog.c: Make password loading async.



commit d2a549bedff2428b47a3623f78e0c7a0d94ba013
Author: Priit Laes <plaes plaes org>
Date:   Fri Jul 24 20:09:32 2009 +0300

    pdm-dialog.c: Make password loading async.
    
    Signed-off-by: Priit Laes <plaes plaes org>

 src/pdm-dialog.c |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index b417d2f..e917ebf 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -1269,26 +1269,32 @@ pdm_dialog_passwords_construct (PdmActionInfo *info)
 }
 
 static void
-pdm_dialog_fill_passwords_list (PdmActionInfo *info)
+pdm_dialog_fill_passwords_list_async_cb (GnomeKeyringResult result,
+						GList *list,
+						gpointer data)
 {
-	GList *list, *l;
-	GnomeKeyringResult result;
+	GList *l;
+	PdmActionInfo *info = (PdmActionInfo *)data;
 
-	result = gnome_keyring_list_item_ids_sync (GNOME_KEYRING_DEFAULT, &list);
+	if (result != GNOME_KEYRING_RESULT_OK)
+		return;
 
-	if (result == GNOME_KEYRING_RESULT_OK)
-	{
-		for (l = list; l != NULL; l = l->next)
-			info->add (info, l->data);
-		g_list_free (list);
-	}
+	for (l = list; l != NULL; l = l->next)
+		info->add (info, l->data);
 
-	/* Let's get notified when the list changes */
 	info->filled = TRUE;
-
 	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (info->model),
-					      COL_PASSWORDS_HOST,
-					      GTK_SORT_ASCENDING);
+							COL_PASSWORDS_HOST,
+							GTK_SORT_ASCENDING);
+}
+
+static void
+pdm_dialog_fill_passwords_list (PdmActionInfo *info)
+{
+	gnome_keyring_list_item_ids (GNOME_KEYRING_DEFAULT,
+							pdm_dialog_fill_passwords_list_async_cb,
+							info,
+							NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]