diff options
author | Priit Laes <plaes@plaes.org> | 2009-07-29 18:07:48 +0800 |
---|---|---|
committer | Priit Laes <plaes@plaes.org> | 2009-07-29 18:07:48 +0800 |
commit | 5f3b345a7c55a6491d3dd60637f304ab746e9656 (patch) | |
tree | 3235c12dc625a1884383fc3f803b733a66c4b93e /src | |
parent | d614cb33983cac3070dff987729eae9b64ee7584 (diff) | |
download | gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.tar gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.tar.gz gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.tar.bz2 gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.tar.lz gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.tar.xz gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.tar.zst gsoc2013-epiphany-5f3b345a7c55a6491d3dd60637f304ab746e9656.zip |
Revert "Make password loading/showing asynchronous."
This reverts commit dfbf90543edbb12a4c467db02f60214de3d07d83.
Diffstat (limited to 'src')
-rw-r--r-- | src/pdm-dialog.c | 109 |
1 files changed, 37 insertions, 72 deletions
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 20612b7fb..c4c28b1cf 100644 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -1137,68 +1137,38 @@ pdm_dialog_cookie_scroll_to (PdmActionInfo *info) /* "Passwords" tab */ static void -passwords_data_func_get_item_cb (GnomeKeyringResult result, - GnomeKeyringItemInfo *info, - gpointer data) -{ - GtkTreeRowReference *rowref = (GtkTreeRowReference *)data; - - if (result == GNOME_KEYRING_RESULT_OK) { - GtkTreeIter iter; - GtkTreePath *path; - GtkTreeModel *model; - - if (!gtk_tree_row_reference_valid (rowref)) - return; - - 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)) { - EphyPasswordInfo *epinfo; - GValue val = {0, }; - - gtk_tree_model_get_value (model, &iter, COL_PASSWORDS_DATA, &val); - epinfo = g_value_get_boxed (&val); - epinfo->secret = gnome_keyring_memory_strdup (gnome_keyring_item_info_get_secret (info)); - - gtk_list_store_set (GTK_LIST_STORE (model), &iter, - COL_PASSWORDS_DATA, epinfo, - COL_PASSWORDS_PASS, epinfo->secret, -1); - g_value_unset (&val); - } - } -} - -static void passwords_data_func (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { - GValue val = { 0, }; - EphyPasswordInfo *info; - - if (!gtk_tree_view_column_get_visible (tree_column)) - return; - - gtk_tree_model_get_value (model, iter, COL_PASSWORDS_DATA, &val); - info = g_value_get_boxed (&val); - - if (info->secret == NULL) { - GtkTreePath *path; - GtkTreeRowReference *rowref; - - path = gtk_tree_model_get_path (model, iter); - rowref = gtk_tree_row_reference_new (model, path); - - gnome_keyring_item_get_info_full (GNOME_KEYRING_DEFAULT, - info->keyring_id, - GNOME_KEYRING_ITEM_INFO_SECRET, - (GnomeKeyringOperationGetItemInfoCallback) passwords_data_func_get_item_cb, - rowref, - (GDestroyNotify) gtk_tree_row_reference_free); - gtk_tree_path_free (path); - } - g_value_unset (&val); + EphyPasswordInfo *info; + GValue val = { 0, }; + + if (!gtk_tree_view_column_get_visible (tree_column)) + return; + + gtk_tree_model_get_value (model, iter, COL_PASSWORDS_DATA, &val); + info = g_value_get_boxed (&val); + + /* get the password and store it */ + if (info->secret == NULL) { + GnomeKeyringResult result; + GnomeKeyringItemInfo *kinfo; + result = gnome_keyring_item_get_info_full_sync (GNOME_KEYRING_DEFAULT, + info->keyring_id, + GNOME_KEYRING_ITEM_INFO_SECRET, + &kinfo); + + /* FIXME: get_secret makes insecure copy... */ + if (result == GNOME_KEYRING_RESULT_OK) { + info->secret = gnome_keyring_memory_strdup ( + gnome_keyring_item_info_get_secret (kinfo)); + gnome_keyring_item_info_free (kinfo); + } + + /* eek, this will do a strdup in GtkCellRendererText... */ + g_object_set (cell, "text", info->secret, NULL); + g_value_unset(&val); + } } static void @@ -1281,20 +1251,15 @@ pdm_dialog_passwords_construct (PdmActionInfo *info) gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_column_set_sort_column_id (column, COL_PASSWORDS_USER); - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (treeview, - COL_PASSWORDS_PASS, - _("User Password"), - renderer, - "text", COL_PASSWORDS_PASS, - NULL); - column = gtk_tree_view_get_column (treeview, COL_PASSWORDS_PASS); - gtk_tree_view_column_set_cell_data_func (column, - renderer, - passwords_data_func, - info, - NULL); /* Initially shown as hidden colum */ + gtk_tree_view_insert_column_with_data_func (treeview, + COL_PASSWORDS_PASS, + _("User Password"), + renderer, + passwords_data_func, + info, + NULL); + column = gtk_tree_view_get_column (treeview, COL_PASSWORDS_PASS); gtk_tree_view_column_set_visible (column, FALSE); gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_reorderable (column, TRUE); |