diff options
author | Simon McVittie <smcv@debian.org> | 2023-03-05 16:16:12 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2023-03-06 23:08:18 +0000 |
commit | be66eb8af619e3785a90b83b48c4d187b7eb433c (patch) | |
tree | bcdeea287da0bc767031fb2a6cf27078e6dacbb4 | |
parent | 6d359e49d8ffa3df516a19d35596a7b742d2db79 (diff) | |
download | gnome-initial-setup-wip/smcv/issue180.tar.gz |
keyboard: Update filter and sort when the display name changeswip/smcv/issue180
The display name in `InputWidget.name` can affect `sort_inputs()`
and `input_visible()`, so we should update it when we replace the
placeholder display name with the real one, and tell GTK to update its
state accordingly.
Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r-- | gnome-initial-setup/pages/keyboard/cc-input-chooser.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c index d2bd984..6bf39ed 100644 --- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c +++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c @@ -585,6 +585,7 @@ static void update_ibus_active_sources (CcInputChooser *chooser) { CcInputChooserPrivate *priv; + gboolean invalidate = FALSE; IBusEngineDesc *engine_desc; const gchar *type; const gchar *id; @@ -611,9 +612,16 @@ update_ibus_active_sources (CcInputChooser *chooser) if (engine_desc) { name = engine_get_display_name (engine_desc); gtk_label_set_text (GTK_LABEL (row->label), name); - g_free (name); + g_clear_pointer (&row->name, g_free); + row->name = g_steal_pointer (&name); + invalidate = TRUE; } } + + if (invalidate) { + gtk_list_box_invalidate_sort (GTK_LIST_BOX (priv->input_list)); + gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->input_list)); + } } static void |