Compare commits

...

1 Commits

Author SHA1 Message Date
Nelson Benítez León
c8bcc8d01f CcDefaultAppsRow: avoid "notify::selected-item" initial firing
When connecting to "notify::selected-item" signal of a
CcDefaultAppsRow widget, an unsolicited initial firing of
that signal happens just after the widget is constructed.

To prevent that, so we can avoid the undesired consequences
of it described in #2626 and #2683, we connect it in an
idle handler, so at that time the widget has already been
constructed and the initial firing already took place
when no signal handler was connected.

Fixes #2626
Fixes #2683
2023-10-23 00:34:06 +01:00

View File

@@ -157,6 +157,13 @@ cc_default_apps_row_set_property (GObject *object,
}
}
static void
idle_connect_notify_selected_item (CcDefaultAppsRow *self)
{
g_signal_connect (self, "notify::selected-item",
G_CALLBACK (notify_selected_item_cb), NULL);
}
static void
cc_default_apps_row_constructed (GObject *object)
{
@@ -187,9 +194,8 @@ cc_default_apps_row_constructed (GObject *object)
adw_combo_row_set_model (ADW_COMBO_ROW (self), G_LIST_MODEL (self->model));
g_signal_connect (self,
"notify::selected-item",
G_CALLBACK (notify_selected_item_cb), NULL);
/* Prevent unsolicited "notify::selected-item" firing. Fixes #2626 #2683 */
g_idle_add_once ((GSourceOnceFunc) idle_connect_notify_selected_item, self);
name_expr = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,