[dconf-editor] Use CSS instead of markup.



commit 41e0e9d8420020f4c8137a2a60377c0d83dd8c61
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jun 23 01:25:23 2016 +0200

    Use CSS instead of markup.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767869

 editor/dconf-editor.css      |   12 ++++++++++++
 editor/key-list-box-row.vala |   21 ++++++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index df37aea..4abd19f 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -172,3 +172,15 @@ list.properties-list > row > grid > :first-child {
 }
 list.properties-list:dir(ltr) > row > grid > label { padding-right:1em; }
 list.properties-list:dir(rtl) > row > grid > label { padding-left:1em; }
+
+/*\
+* * text formating
+\*/
+
+.italic-label {
+  font-style:italic;
+}
+
+.bold-label {
+  font-weight:bold;
+}
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 9030f5d..001be5f 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -121,7 +121,8 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
         this.key = _key;
 
         update ();
-        key_info_label.set_markup ("<i>" + _("No Schema Found") + "</i>");
+        key_info_label.get_style_context ().add_class ("italic-label");
+        key_info_label.set_label (_("No Schema Found"));
 
         key.value_changed.connect (() => {
                 update ();
@@ -131,16 +132,26 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
 
     private void update ()
     {
+        StyleContext context = key_value_label.get_style_context ();
         if (key.is_ghost)
         {
-            key_name_label.set_markup (key.name);
-            key_value_label.set_markup ("<i>" + _("Key erased.") + "</i>");
+            if (!context.has_class ("italic-label")) context.add_class ("italic-label");
+            if (context.has_class ("bold-label")) context.remove_class ("bold-label");
+            key_value_label.set_label (_("Key erased."));
+
+            context = key_name_label.get_style_context ();
+            if (context.has_class ("bold-label")) context.remove_class ("bold-label");
         }
         else
         {
-            key_name_label.set_markup ("<b>" + key.name + "</b>");
-            key_value_label.set_markup ("<b>" + cool_text_value (key) + "</b>");
+            if (context.has_class ("italic-label")) context.remove_class ("italic-label");
+            if (!context.has_class ("bold-label")) context.add_class ("bold-label");
+            key_value_label.set_label (cool_text_value (key));
+
+            context = key_name_label.get_style_context ();
+            if (!context.has_class ("bold-label")) context.add_class ("bold-label");
         }
+        key_name_label.set_label (key.name);
     }
 
     protected override string get_text ()


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