summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvanadiae <vanadiae35@gmail.com>2021-02-03 15:22:13 +0100
committerMichael Catanzaro <mcatanzaro@gnome.org>2021-02-08 15:02:14 +0000
commit132270a88806f29749cec214882efb44e2b0f12b (patch)
treec4a423c72c11765a660402edb7f10a37a90f67c6 /src
parent4d96c753613f81b2ff08b859c07bac1d5e2bc8fd (diff)
downloadepiphany-132270a88806f29749cec214882efb44e2b0f12b.tar.gz
prefs: Fix setting the default search engine
Currently when setting an engine as the default one, it isn't always kept once the preferences are reopened. This is because when creating each row in the UI, the "active" property of each radio button is default-initialized to NULL when constructing it, but since we're already connected to the "clicked" signal it somehow sends it for this FALSE state even though it didn't go to TRUE first. So this commit makes sure that the clicked signal is a real click, by checking for active state TRUE. Fixes #1430
Diffstat (limited to 'src')
-rw-r--r--src/preferences/ephy-search-engine-row.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/preferences/ephy-search-engine-row.c b/src/preferences/ephy-search-engine-row.c
index d3bb9f769..f4432bbce 100644
--- a/src/preferences/ephy-search-engine-row.c
+++ b/src/preferences/ephy-search-engine-row.c
@@ -444,7 +444,12 @@ static void
on_radio_button_clicked_cb (EphySearchEngineRow *row,
GtkButton *button)
{
- ephy_search_engine_manager_set_default_engine (row->manager, row->saved_name);
+ /* This avoids having some random engines being set as default when adding a new row,
+ * since when it default initialize the "active" property to %FALSE on object construction,
+ * it records a "clicked" signal
+ */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+ ephy_search_engine_manager_set_default_engine (row->manager, row->saved_name);
}
static void
@@ -537,7 +542,7 @@ on_ephy_search_engine_row_constructed (GObject *object)
/* Tick the radio button if it's the default search engine. */
if (g_strcmp0 (self->saved_name, default_search_engine_name) == 0)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->radio_button), TRUE);
+ ephy_search_engine_row_set_as_default (self);
g_signal_connect_object (self->name_entry, "notify::text", G_CALLBACK (on_name_entry_text_changed_cb), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->address_entry, "notify::text", G_CALLBACK (on_address_entry_text_changed_cb), self, G_CONNECT_SWAPPED);