[dconf-editor] Use CSS for KeyListBoxRowEditable bold labels.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Use CSS for KeyListBoxRowEditable bold labels.
- Date: Tue, 2 Aug 2016 22:45:18 +0000 (UTC)
commit 569bc7fbb82ac71f6ea6e869ccad07726c0e7720
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Aug 3 00:45:08 2016 +0200
Use CSS for KeyListBoxRowEditable bold labels.
editor/key-list-box-row.vala | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 4aa1d98..c103da8 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -240,13 +240,15 @@ private class KeyListBoxRowEditable : KeyListBoxRow
{
public GSettingsKey key { get; private set; }
- private Pango.AttrList attr_list = new Pango.AttrList ();
+ private StyleContext name_context;
+ private StyleContext value_context;
public KeyListBoxRowEditable (GSettingsKey _key)
{
this.key = _key;
- key_value_label.set_attributes (attr_list);
+ name_context = key_name_label.get_style_context ();
+ value_context = key_value_label.get_style_context ();
update (); // sets key_name_label attributes and key_value_label label
key_name_label.label = key.name;
key_info_label.label = key.summary;
@@ -326,8 +328,16 @@ private class KeyListBoxRowEditable : KeyListBoxRow
private void update ()
{
- attr_list.change (Pango.attr_weight_new (key.is_default ? Pango.Weight.NORMAL : Pango.Weight.BOLD));
- key_name_label.set_attributes (attr_list);
+ if (key.is_default)
+ {
+ if (name_context.has_class ("bold-label")) name_context.remove_class ("bold-label");
+ if (value_context.has_class ("bold-label")) value_context.remove_class ("bold-label");
+ }
+ else
+ {
+ if (!name_context.has_class ("bold-label")) name_context.add_class ("bold-label");
+ if (!value_context.has_class ("bold-label")) value_context.add_class ("bold-label");
+ }
key_value_label.label = cool_text_value (key);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]