aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2009-07-29 18:07:22 +0800
committerPriit Laes <plaes@plaes.org>2009-07-29 18:07:22 +0800
commit249e515bfe808343063735f86e4999813865b56c (patch)
tree86bc5ff1aa3ff2988523786cfe668b15b3dc40ba /src
parenta957f0f635dcb49afcebfc4a60097a8fca0bbf9f (diff)
downloadgsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.tar
gsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.tar.gz
gsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.tar.bz2
gsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.tar.lz
gsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.tar.xz
gsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.tar.zst
gsoc2013-epiphany-249e515bfe808343063735f86e4999813865b56c.zip
Revert "Password removal is now async :)"
This reverts commit 689820485d8060c85760cd54d8b370f4e108d6dd.
Diffstat (limited to 'src')
-rw-r--r--src/pdm-dialog.c104
1 files changed, 42 insertions, 62 deletions
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index cb8849997..575aab9fd 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);
- void (* remove) (PdmActionInfo *info,
+ gboolean (* remove) (PdmActionInfo *info,
gpointer data);
void (* scroll_to) (PdmActionInfo *info);
@@ -141,7 +141,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 void pdm_dialog_password_remove (PdmActionInfo *info, gpointer data);
+static gboolean pdm_dialog_password_remove (PdmActionInfo *info, gpointer data);
G_DEFINE_TYPE (PdmDialog, pdm_dialog, EPHY_TYPE_DIALOG)
@@ -216,8 +216,8 @@ clear_all_cookies (SoupCookieJar *jar)
}
static void
-pdm_dialog_password_remove_cb (GnomeKeyringResult result,
- gpointer data)
+clear_all_passwords_async_cb (GnomeKeyringResult result,
+ gpointer data)
{
GtkTreeRowReference *rowref = (GtkTreeRowReference *)data;
@@ -259,10 +259,11 @@ clear_all_passwords (GtkTreeModel *model,
gnome_keyring_item_delete (GNOME_KEYRING_DEFAULT,
info->keyring_id,
- (GnomeKeyringOperationDoneCallback) pdm_dialog_password_remove_cb,
+ (GnomeKeyringOperationDoneCallback) clear_all_passwords_async_cb,
row,
(GDestroyNotify) gtk_tree_row_reference_free);
g_value_unset (&val);
+
return FALSE;
}
@@ -541,8 +542,30 @@ pdm_cmd_delete_selection (PdmActionInfo *action)
gtk_tree_path_free (path);
/* Removal */
+
for (r = rlist; r != NULL; r = r->next)
- action->remove (action, (GtkTreeRowReference *)r->data);
+ {
+ GValue val = { 0, };
+ gboolean remove;
+
+ 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));
+ 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_tree_row_reference_free ((GtkTreeRowReference *)r->data);
+ gtk_tree_path_free (path);
+ }
g_list_foreach (llist, (GFunc)gtk_tree_path_free, NULL);
g_list_free (llist);
@@ -1109,39 +1132,17 @@ pdm_dialog_cookie_add (PdmActionInfo *info,
g_value_unset (&value[3]);
}
-static void
+static gboolean
pdm_dialog_cookie_remove (PdmActionInfo *info,
gpointer data)
{
- GtkTreeRowReference *rowref = (GtkTreeRowReference *)data;
-
- if (gtk_tree_row_reference_valid (rowref)) {
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeModel *model;
-
- path = gtk_tree_row_reference_get_path (rowref);
- model = gtk_tree_row_reference_get_model (rowref);
-
- if (path != NULL && gtk_tree_model_get_iter (model, &iter, path)) {
- SoupCookie *cookie;
- SoupCookieJar *jar;
- GValue val = { 0, };
-
- gtk_tree_model_get_value (model, &iter, COL_PASSWORDS_DATA, &val);
-
- cookie = (SoupCookie *) g_value_get_boxed (&val);
-
- g_value_unset (&val);
+ SoupCookie *cookie = (SoupCookie *) data;
+ SoupCookieJar *jar;
- jar = get_cookie_jar();
- soup_cookie_jar_delete_cookie (jar, cookie);
+ jar = get_cookie_jar();
- gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
- gtk_tree_path_free (path);
- }
- gtk_tree_row_reference_free (rowref);
- }
+ soup_cookie_jar_delete_cookie (jar, cookie);
+ return FALSE;
}
static void
@@ -1448,37 +1449,16 @@ out:
return;
}
-static void
+static gboolean
pdm_dialog_password_remove (PdmActionInfo *info,
- gpointer data)
+ gpointer data)
{
- GtkTreeRowReference *rowref = (GtkTreeRowReference *)data;
-
- if (gtk_tree_row_reference_valid (rowref)) {
- EphyPasswordInfo *pinfo;
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeModel *model;
- GValue val = { 0, };
-
- path = gtk_tree_row_reference_get_path (rowref);
- model = gtk_tree_row_reference_get_model (rowref);
-
- if (path != NULL && gtk_tree_model_get_iter (model, &iter, path)) {
-
- gtk_tree_model_get_value (model, &iter,
- COL_PASSWORDS_DATA, &val);
- pinfo = g_value_get_boxed (&val);
+ EphyPasswordInfo *pinfo = (EphyPasswordInfo *) data;
+ GnomeKeyringResult result;
- gnome_keyring_item_delete (GNOME_KEYRING_DEFAULT,
- pinfo->keyring_id,
- (GnomeKeyringOperationDoneCallback) pdm_dialog_password_remove_cb,
- rowref,
- (GDestroyNotify) gtk_tree_row_reference_free);
- g_value_unset (&val);
- gtk_tree_path_free (path);
- }
- }
+ result = gnome_keyring_item_delete_sync (GNOME_KEYRING_DEFAULT,
+ pinfo->keyring_id);
+ return result == GNOME_KEYRING_RESULT_OK;
}
/* common routines */