[epiphany] Fix crashes in import password dialog
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Fix crashes in import password dialog
- Date: Tue, 12 May 2020 18:03:14 +0000 (UTC)
commit d27e58c7d546f763e6a272c06259578d522980f3
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Tue May 12 08:57:54 2020 +0200
Fix crashes in import password dialog
- Set action button insensitive if no import option is available
- Propagate & display error message in case there is an issue during import
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1187
lib/sync/ephy-password-import.c | 8 +++++---
src/window-commands.c | 8 +++++++-
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/lib/sync/ephy-password-import.c b/lib/sync/ephy-password-import.c
index 591a7e289..29ea4eb04 100644
--- a/lib/sync/ephy-password-import.c
+++ b/lib/sync/ephy-password-import.c
@@ -237,12 +237,14 @@ ephy_password_import_from_chrome_thread_cb (GTask *task,
GCancellable *cancellable)
{
PasswordImportChromeData *data = task_data;
- g_autoptr (GError) error = NULL;
+ GError *error = NULL;
gboolean retval;
retval = ephy_password_import_from_chrome (data->manager, data->type, &error);
-
- g_task_return_boolean (task, retval);
+ if (error)
+ g_task_return_error (task, error);
+ else
+ g_task_return_boolean (task, retval);
}
void
diff --git a/src/window-commands.c b/src/window-commands.c
index 8221a66c6..3e278549d 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -798,7 +798,7 @@ window_cmd_import_passwords (GSimpleAction *action,
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
_("_Cancel"),
GTK_RESPONSE_CANCEL,
- _("Ch_oose File"),
+ _("I_mport"),
GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -815,6 +815,12 @@ window_cmd_import_passwords (GSimpleAction *action,
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
tree_model = create_import_passwords_tree_model ();
+
+ if (gtk_tree_model_iter_n_children (tree_model, NULL))
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
+ else
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
+
combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (tree_model));
g_object_unref (tree_model);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]