summaryrefslogtreecommitdiffstats
path: root/debian/patches/keyboard-Update-filter-and-sort-when-the-display-name-cha.patch
blob: ba8d296e8a1d6803978f2da382d1112286e03e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From: Simon McVittie <smcv@debian.org>
Date: Sun, 5 Mar 2023 16:16:12 +0000
Subject: keyboard: Update filter and sort when the display name changes

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>
Bug-Debian: https://bugs.debian.org/1032382
Forwarded: https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/180
---
 gnome-initial-setup/pages/keyboard/cc-input-chooser.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
index ae8f2d7..b851ec6 100644
--- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
+++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
@@ -589,6 +589,7 @@ static void
 update_ibus_active_sources (CcInputChooser *chooser)
 {
         CcInputChooserPrivate *priv;
+        gboolean invalidate = FALSE;
         IBusEngineDesc *engine_desc;
         const gchar *type;
         const gchar *id;
@@ -615,9 +616,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