list-row: Add 'bold' property
So that we can set if title is bold or not
This commit is contained in:
parent
c239521e9d
commit
08defd6ec5
1 changed files with 28 additions and 0 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue