[Debian-on-mobile-maintainers] [Git][DebianOnMobile-team/libhandy-1][debian/master] 2 commits: Backport combo-row checkmark fixes

Arnaud Ferraris gitlab at salsa.debian.org
Tue Feb 9 01:07:32 GMT 2021



Arnaud Ferraris pushed to branch debian/master at Debian On Mobile / libhandy-1


Commits:
f4820777 by Guido Günther at 2021-02-06T13:01:26+01:00
Backport combo-row checkmark fixes

Closes: #981574

- - - - -
5050e86e by Arnaud Ferraris at 2021-02-09T01:07:23+00:00
Merge branch 'combo-fix' into 'debian/master'

Backport combo-row checkmark fixes

See merge request DebianOnMobile-team/libhandy-1!10
- - - - -


3 changed files:

- + debian/patches/combo-row-Improve-checkmark-visibility-update-routine.patch
- + debian/patches/combo-row-Only-update-selection-after-widget-is-synced.patch
- debian/patches/series


Changes:

=====================================
debian/patches/combo-row-Improve-checkmark-visibility-update-routine.patch
=====================================
@@ -0,0 +1,50 @@
+From: Benjamin Berg <bberg at redhat.com>
+Date: Thu, 21 Jan 2021 17:29:49 +0100
+Subject: combo-row: Improve checkmark visibility update routine
+
+Going through the children of a list box is not a good idea. It may
+insert e.g. separators and similar that we don't know about.
+
+Simplify the code to use gtk_list_box_get_row_at_index instead.
+
+(cherry picked from commit d400bd184ecb424206e62409620e8bb5ca22c6df)
+---
+ src/hdy-combo-row.c | 17 ++++++-----------
+ 1 file changed, 6 insertions(+), 11 deletions(-)
+
+diff --git a/src/hdy-combo-row.c b/src/hdy-combo-row.c
+index c90cace..2851840 100644
+--- a/src/hdy-combo-row.c
++++ b/src/hdy-combo-row.c
+@@ -181,6 +181,7 @@ update (HdyComboRow *self)
+   g_autofree gchar *name = NULL;
+   GtkWidget *widget;
+   guint n_items = priv->bound_model ? g_list_model_get_n_items (priv->bound_model) : 0;
++  gint i;
+ 
+   gtk_widget_set_visible (GTK_WIDGET (priv->current), !priv->use_subtitle);
+   gtk_container_foreach (GTK_CONTAINER (priv->current), (GtkCallback) gtk_widget_destroy, NULL);
+@@ -197,18 +198,12 @@ update (HdyComboRow *self)
+ 
+   g_assert (priv->selected_index >= 0 && priv->selected_index <= n_items);
+ 
+-  {
+-    g_autoptr (GList) rows = gtk_container_get_children (GTK_CONTAINER (priv->list));
+-    GList *l;
+-    int i = 0;
++  for (i = 0; i < n_items; i++) {
++    GtkListBoxRow *row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (priv->list), i);
++    GtkWidget *box = gtk_bin_get_child (GTK_BIN (row));
+ 
+-    for (l = rows; l; l = l->next) {
+-      GtkWidget *row = GTK_WIDGET (l->data);
+-      GtkWidget *box = gtk_bin_get_child (GTK_BIN (row));
+-
+-      gtk_widget_set_opacity (GTK_WIDGET (g_object_get_data (G_OBJECT (box), "checkmark")),
+-                              (priv->selected_index == i++) ? 1 : 0);
+-    }
++    gtk_widget_set_opacity (GTK_WIDGET (g_object_get_data (G_OBJECT (box), "checkmark")),
++                            (priv->selected_index == i) ? 1 : 0);
+   }
+ 
+   item = g_list_model_get_item (priv->bound_model, priv->selected_index);


=====================================
debian/patches/combo-row-Only-update-selection-after-widget-is-synced.patch
=====================================
@@ -0,0 +1,29 @@
+From: Benjamin Berg <bberg at redhat.com>
+Date: Thu, 21 Jan 2021 17:45:08 +0100
+Subject: combo-row: Only update selection after widget is synced
+
+We need the signal for "items-changed" of the bound model to be
+processed only after the underlying widget is changed. Do so by changing
+it to use g_signal_connect_after.
+
+This fixes an issue where the wrong item is marked as selected in the
+model.
+
+(cherry picked from commit 1264af580c072768a45059970bcdbe505a1aed98)
+---
+ src/hdy-combo-row.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/hdy-combo-row.c b/src/hdy-combo-row.c
+index 2851840..b40b9aa 100644
+--- a/src/hdy-combo-row.c
++++ b/src/hdy-combo-row.c
+@@ -558,7 +558,7 @@ hdy_combo_row_bind_model (HdyComboRow                *self,
+   priv->create_widget_func_data = user_data;
+   priv->create_widget_func_data_free_func = user_data_free_func;
+ 
+-  g_signal_connect (priv->bound_model, "items-changed", G_CALLBACK (bound_model_changed), self);
++  g_signal_connect_after (priv->bound_model, "items-changed", G_CALLBACK (bound_model_changed), self);
+ 
+   if (g_list_model_get_n_items (priv->bound_model) > 0)
+     priv->selected_index = 0;


=====================================
debian/patches/series
=====================================
@@ -1 +1,3 @@
 Disable-atk-during-tests.patch
+combo-row-Improve-checkmark-visibility-update-routine.patch
+combo-row-Only-update-selection-after-widget-is-synced.patch



View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/libhandy-1/-/compare/1d6b93d51a0e5dee08a7b26d0fba577d9f6bac81...5050e86eeaf723f8abdf26dd6a3ec40edc8b463e

-- 
View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/libhandy-1/-/compare/1d6b93d51a0e5dee08a7b26d0fba577d9f6bac81...5050e86eeaf723f8abdf26dd6a3ec40edc8b463e
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-on-mobile-maintainers/attachments/20210209/aa06d055/attachment-0001.html>


More information about the Debian-on-mobile-maintainers mailing list