[libadwaita/ebassi/tagged-entry: 20/20] Use AdwTag:name as a CSS class




commit cd7af23bcb3c7124320a301b6f1492a885bd1929
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 14 18:17:52 2022 +0000

    Use AdwTag:name as a CSS class
    
    This way it's possible to style AdwTagWidget using the tag name.

 src/adw-tag-widget.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/adw-tag-widget.c b/src/adw-tag-widget.c
index 9b44e94b..2ebaa67b 100644
--- a/src/adw-tag-widget.c
+++ b/src/adw-tag-widget.c
@@ -102,6 +102,10 @@ adw_tag_widget_set_tag (AdwTagWidget *self,
                                 self);
 
       update_tag_icon (self);
+
+      const char *tag_name = adw_tag_get_name (self->tag);
+      if (tag_name != NULL)
+        gtk_widget_add_css_class (GTK_WIDGET (self), tag_name);
     }
 
     g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TAG]);


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