[epiphany/gnome-keyring-v2: 2/3] pdm-dialog.c: Make password removal async.



commit e7cf1a1483df2612430451699b544bc051ec7a6f
Author: Priit Laes <plaes plaes org>
Date:   Tue Jul 28 21:59:19 2009 +0300

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

 src/pdm-dialog.c |   50 +++++++++++++++++++++-----------------------------
 1 files changed, 21 insertions(+), 29 deletions(-)
---
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index b8f371a..1c4d222 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -57,7 +57,7 @@ struct PdmActionInfo
 	void (* fill)		(PdmActionInfo *info);
 	void (* add)		(PdmActionInfo *info,
 				 gpointer data);
-	gboolean (* remove)	(PdmActionInfo *info,
+	void (* remove)	(PdmActionInfo *info,
 				 gpointer data);
 	void (* scroll_to)	(PdmActionInfo *info);
 
@@ -140,7 +140,7 @@ EphyDialogProperty properties [] =
 static void pdm_dialog_class_init	(PdmDialogClass *klass);
 static void pdm_dialog_init		(PdmDialog *dialog);
 static void pdm_dialog_finalize		(GObject *object);
-static gboolean pdm_dialog_password_remove (PdmActionInfo *info, gpointer data);
+static void pdm_dialog_password_remove (PdmActionInfo *info, gpointer data);
 
 G_DEFINE_TYPE (PdmDialog, pdm_dialog, EPHY_TYPE_DIALOG)
 
@@ -538,27 +538,16 @@ pdm_cmd_delete_selection (PdmActionInfo *action)
 	gtk_tree_path_free (path);
 
 	/* Removal */
-
-	for (r = rlist; r != NULL; r = r->next)
-	{
+	for (r = rlist; r != NULL; r = r->next) {
 		GValue val = { 0, };
-		gboolean remove;
-
-		path = gtk_tree_row_reference_get_path
-			((GtkTreeRowReference *)r->data);
 
+		path = gtk_tree_row_reference_get_path ((GtkTreeRowReference *)r->data);
 		gtk_tree_model_get_iter (model, &iter, path);
 		gtk_tree_model_get_value (model, &iter, action->data_col, &val);
-		remove = action->remove (action, g_value_get_boxed (&val));
+		action->remove (action, g_value_get_boxed (&val));
 		g_value_unset (&val);
 
-        /*
-         * Remove the item:
-         * cookies are deleted using callback, passwords right here
-         */
-		if (remove)
-			gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
-
+		gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
 		gtk_tree_row_reference_free ((GtkTreeRowReference *)r->data);
 		gtk_tree_path_free (path);
 	}
@@ -1128,17 +1117,13 @@ pdm_dialog_cookie_add (PdmActionInfo *info,
 	g_value_unset (&value[3]);
 }
 
-static gboolean
+static void
 pdm_dialog_cookie_remove (PdmActionInfo *info,
 			  gpointer data)
 {
 	SoupCookie *cookie = (SoupCookie *) data;
-	SoupCookieJar *jar;
-
-	jar = get_cookie_jar();
 
-	soup_cookie_jar_delete_cookie (jar, cookie);
-    return FALSE;
+	soup_cookie_jar_delete_cookie (get_cookie_jar(), cookie);
 }
 
 static void
@@ -1445,16 +1430,23 @@ out:
 	return;
 }
 
-static gboolean
+static void
+pdm_dialog_password_remove_dummy_cb (GnomeKeyringResult result,
+						gpointer data)
+{
+}
+
+static void
 pdm_dialog_password_remove (PdmActionInfo *info,
-			    gpointer data)
+                            gpointer data)
 {
 	EphyPasswordInfo *pinfo = (EphyPasswordInfo *) data;
-	GnomeKeyringResult result;
 
-	result = gnome_keyring_item_delete_sync (GNOME_KEYRING_DEFAULT,
-			pinfo->keyring_id);
-	return result == GNOME_KEYRING_RESULT_OK;
+	gnome_keyring_item_delete (GNOME_KEYRING_DEFAULT,
+				pinfo->keyring_id,
+				(GnomeKeyringOperationDoneCallback) pdm_dialog_password_remove_dummy_cb,
+				NULL,
+				NULL);
 }
 
 /* common routines */



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