[libhandy/benzea/fix-hdy-combo-row-model-updates] combo-row: update widget after changes to bound model




commit 7460021df0b98e64d99a3e93bc2f3b31e419486a
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Aug 27 13:58:59 2020 +0200

    combo-row: update widget after changes to bound model
    
    When the model is changed to add/remove elements, the widget state may
    need to be updated. Call update() to ensure that this happens.
    
    This fixes issues in the display panel where HdyComboRow widgets cannot
    be interacted with.

 src/hdy-combo-row.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-combo-row.c b/src/hdy-combo-row.c
index cde5e9c1..cdaca3b9 100644
--- a/src/hdy-combo-row.c
+++ b/src/hdy-combo-row.c
@@ -170,8 +170,10 @@ bound_model_changed (GListModel *list,
   HdyComboRowPrivate *priv = hdy_combo_row_get_instance_private (self);
 
   /* Selection is in front of insertion/removal point, nothing to do */
-  if (priv->selected_index > 0 && priv->selected_index < index)
+  if (priv->selected_index > 0 && priv->selected_index < index) {
+    update (self);
     return;
+  }
 
   if (priv->selected_index < index + removed) {
     /* The item selected item was removed (or none is selected) */
@@ -186,6 +188,8 @@ bound_model_changed (GListModel *list,
     new_idx = 0;
 
   hdy_combo_row_set_selected_index (self, new_idx);
+
+  update (self);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]