summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Sadiq <sadiq@sadiqpk.org>2020-12-17 17:17:12 +0530
committerRobert Ancell <robert.ancell@gmail.com>2021-01-08 02:54:14 +0000
commit08defd6ec53b5d6bff880423e28ab1c65abceae5 (patch)
tree9c313a5bbdbde706b72cac81be018e0606130726
parentc239521e9d2eecfc1270afb954fbde1df09246d3 (diff)
downloadgnome-control-center-08defd6ec53b5d6bff880423e28ab1c65abceae5.tar.gz
list-row: Add 'bold' property
So that we can set if title is bold or not
-rw-r--r--panels/common/cc-list-row.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/panels/common/cc-list-row.c b/panels/common/cc-list-row.c
index 20ee00260..a17aadd02 100644
--- a/panels/common/cc-list-row.c
+++ b/panels/common/cc-list-row.c
@@ -58,6 +58,7 @@ enum {
PROP_ICON_NAME,
PROP_SHOW_SWITCH,
PROP_ACTIVE,
+ PROP_BOLD,
PROP_USE_UNDERLINE,
N_PROPS
};
@@ -141,6 +142,8 @@ cc_list_row_set_property (GObject *object,
GParamSpec *pspec)
{
CcListRow *self = (CcListRow *)object;
+ PangoAttrList *attributes;
+ PangoAttribute *attribute;
gint margin;
switch (prop_id)
@@ -192,6 +195,24 @@ cc_list_row_set_property (GObject *object,
cc_list_row_switch_active_cb, self);
break;
+ case PROP_BOLD:
+ if (g_value_get_boolean (value))
+ attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+ else
+ attribute = pango_attr_weight_new (PANGO_WEIGHT_NORMAL);
+
+ attributes = gtk_label_get_attributes (self->title);
+
+ if (!attributes)
+ attributes = pango_attr_list_new ();
+ else
+ pango_attr_list_ref (attributes);
+
+ pango_attr_list_change (attributes, attribute);
+ gtk_label_set_attributes (self->title, attributes);
+ pango_attr_list_unref (attributes);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -248,6 +269,13 @@ cc_list_row_class_init (CcListRowClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ properties[PROP_BOLD] =
+ g_param_spec_boolean ("bold",
+ "Bold",
+ "Whether title is bold or not",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
properties[PROP_USE_UNDERLINE] =
g_param_spec_boolean ("use-underline",
"Use underline",