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




commit 8ed34e6351013765d409b6b5bcdb55274a4d1f69
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 e9cc6bf4..96e84b35 100644
--- a/src/hdy-combo-row.c
+++ b/src/hdy-combo-row.c
@@ -235,8 +235,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) */
@@ -251,6 +253,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]