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_ICON_NAME,
|
||||||
PROP_SHOW_SWITCH,
|
PROP_SHOW_SWITCH,
|
||||||
PROP_ACTIVE,
|
PROP_ACTIVE,
|
||||||
|
PROP_BOLD,
|
||||||
PROP_USE_UNDERLINE,
|
PROP_USE_UNDERLINE,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
|
@ -141,6 +142,8 @@ cc_list_row_set_property (GObject *object,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
CcListRow *self = (CcListRow *)object;
|
CcListRow *self = (CcListRow *)object;
|
||||||
|
PangoAttrList *attributes;
|
||||||
|
PangoAttribute *attribute;
|
||||||
gint margin;
|
gint margin;
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
|
@ -192,6 +195,24 @@ cc_list_row_set_property (GObject *object,
|
||||||
cc_list_row_switch_active_cb, self);
|
cc_list_row_switch_active_cb, self);
|
||||||
break;
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
@ -248,6 +269,13 @@ cc_list_row_class_init (CcListRowClass *klass)
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
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] =
|
properties[PROP_USE_UNDERLINE] =
|
||||||
g_param_spec_boolean ("use-underline",
|
g_param_spec_boolean ("use-underline",
|
||||||
"Use underline",
|
"Use underline",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue