[libadwaita/ebassi/tagged-entry] Keep the tag widget's icon in sync with the model



commit d0b5eebf9ffc758791fc8c4131ccb87eec2cbba6
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Mar 6 18:40:03 2022 +0000

    Keep the tag widget's icon in sync with the model
    
    The AdwTag can change its icon, so we need to ensure that
    the AdwTagWidget will be updated when that happens.

 src/adw-tag-widget.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/adw-tag-widget.c b/src/adw-tag-widget.c
index 74006075..e5451a02 100644
--- a/src/adw-tag-widget.c
+++ b/src/adw-tag-widget.c
@@ -93,6 +93,14 @@ adw_tag_widget_set_tag (AdwTagWidget *self,
                               self->label, "label",
                               G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
 
+      /* We cannot use a simple property binding, because AdwTag has
+       * multiple ways to provide an icon for the widget to display
+       */
+      g_signal_connect_swapped (self->tag,
+                                "notify::has-icon",
+                                G_CALLBACK (update_tag_icon),
+                                self);
+
       update_tag_icon (self);
     }
 


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