ModelButton: Add 'use-markup' property
Binds this property to the button's label, allowing a model button to have text with markup. This will be convenient for buttons like 'Online Accounts <sup>↗</sup>'.
This commit is contained in:
@ -174,6 +174,7 @@ enum
|
|||||||
PROP_ROLE,
|
PROP_ROLE,
|
||||||
PROP_ICON,
|
PROP_ICON,
|
||||||
PROP_TEXT,
|
PROP_TEXT,
|
||||||
|
PROP_USE_MARKUP,
|
||||||
PROP_ACTIVE,
|
PROP_ACTIVE,
|
||||||
PROP_MENU_NAME,
|
PROP_MENU_NAME,
|
||||||
PROP_INVERTED,
|
PROP_INVERTED,
|
||||||
@ -396,6 +397,19 @@ gtk_model_button_set_text (GtkModelButton *button,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
|
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_model_button_set_use_markup (GtkModelButton *button,
|
||||||
|
gboolean use_markup)
|
||||||
|
{
|
||||||
|
use_markup = !!use_markup;
|
||||||
|
if (gtk_label_get_use_markup (GTK_LABEL (button->label)) == use_markup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_label_set_use_markup (GTK_LABEL (button->label), use_markup);
|
||||||
|
update_visibility (button);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_USE_MARKUP]);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_model_button_set_active (GtkModelButton *button,
|
gtk_model_button_set_active (GtkModelButton *button,
|
||||||
gboolean active)
|
gboolean active)
|
||||||
@ -518,6 +532,10 @@ gtk_model_button_get_property (GObject *object,
|
|||||||
g_value_set_string (value, gtk_label_get_text (GTK_LABEL (button->label)));
|
g_value_set_string (value, gtk_label_get_text (GTK_LABEL (button->label)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_USE_MARKUP:
|
||||||
|
g_value_set_boolean (value, gtk_label_get_use_markup (GTK_LABEL (button->label)));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_ACTIVE:
|
case PROP_ACTIVE:
|
||||||
g_value_set_boolean (value, button->active);
|
g_value_set_boolean (value, button->active);
|
||||||
break;
|
break;
|
||||||
@ -566,6 +584,10 @@ gtk_model_button_set_property (GObject *object,
|
|||||||
gtk_model_button_set_text (button, g_value_get_string (value));
|
gtk_model_button_set_text (button, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_USE_MARKUP:
|
||||||
|
gtk_model_button_set_use_markup (button, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_ACTIVE:
|
case PROP_ACTIVE:
|
||||||
gtk_model_button_set_active (button, g_value_get_boolean (value));
|
gtk_model_button_set_active (button, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
@ -1138,6 +1160,20 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
|
|||||||
"",
|
"",
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkModelButton:use-markup:
|
||||||
|
*
|
||||||
|
* If %TRUE, XML tags in the text of the button are interpreted as by
|
||||||
|
* pango_parse_markup() to format the enclosed spans of text. If %FALSE, the
|
||||||
|
* text will be displayed verbatim.
|
||||||
|
*/
|
||||||
|
properties[PROP_USE_MARKUP] =
|
||||||
|
g_param_spec_boolean ("use-markup",
|
||||||
|
P_("Use markup"),
|
||||||
|
P_("The text of the button includes XML markup. See pango_parse_markup()"),
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkModelButton:active:
|
* GtkModelButton:active:
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user