diff options
author | Mark McLoughlin <mark@skynet.ie> | 2003-11-17 14:53:06 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@src.gnome.org> | 2003-11-17 14:53:06 +0000 |
commit | 835d755b9c456a8dab5fd2c831c4b439f7f042e2 (patch) | |
tree | d312bed2d25d124166aa3a382f039d8d70848b96 /gtk/gtkexpander.c | |
parent | 04c21b2c9ba82a39293c76b6e0a99abaeac8f21d (diff) | |
download | gdk-pixbuf-835d755b9c456a8dab5fd2c831c4b439f7f042e2.tar.gz |
Patch from Jaiserca <jaiserca@inf.upv.es> to add a "use_markup" property.
2003-11-17 Mark McLoughlin <mark@skynet.ie>
Patch from Jaiserca <jaiserca@inf.upv.es> to add a
"use_markup" property. See bug #124449.
* gtk/gtkexpander.c:
(gtk_expander_class_init),
(gtk_expander_init), (gtk_expander_set_property),
(gtk_expander_get_property), (gtk_expander_set_label),
(gtk_expander_set_use_markup), (gtk_expander_get_use_markup):
Add a "use_markup" property and use it when creating the
child label.
Diffstat (limited to 'gtk/gtkexpander.c')
-rw-r--r-- | gtk/gtkexpander.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 8f739f027..f8cc5c7bd 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -44,6 +44,7 @@ enum PROP_EXPANDED, PROP_LABEL, PROP_USE_UNDERLINE, + PROP_USE_MARKUP, PROP_PADDING, PROP_LABEL_WIDGET }; @@ -59,6 +60,7 @@ struct _GtkExpanderPrivate guint expanded : 1; guint use_underline : 1; + guint use_markup : 1; guint button_down : 1; guint prelight : 1; }; @@ -211,6 +213,14 @@ gtk_expander_class_init (GtkExpanderClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (gobject_class, + PROP_USE_MARKUP, + g_param_spec_boolean ("use_markup", + _("Use markup"), + _("The text of the label includes XML markup. See pango_parse_markup()"), + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + g_object_class_install_property (gobject_class, PROP_PADDING, g_param_spec_int ("spacing", _("Spacing"), @@ -275,6 +285,7 @@ gtk_expander_init (GtkExpander *expander) priv->expanded = FALSE; priv->use_underline = FALSE; + priv->use_markup = FALSE; priv->button_down = FALSE; priv->prelight = FALSE; } @@ -298,6 +309,9 @@ gtk_expander_set_property (GObject *object, case PROP_USE_UNDERLINE: gtk_expander_set_use_underline (expander, g_value_get_boolean (value)); break; + case PROP_USE_MARKUP: + gtk_expander_set_use_markup (expander, g_value_get_boolean (value)); + break; case PROP_PADDING: gtk_expander_set_spacing (expander, g_value_get_int (value)); break; @@ -330,6 +344,9 @@ gtk_expander_get_property (GObject *object, case PROP_USE_UNDERLINE: g_value_set_boolean (value, priv->use_underline); break; + case PROP_USE_MARKUP: + g_value_set_boolean (value, priv->use_markup); + break; case PROP_PADDING: g_value_set_int (value, priv->spacing); break; @@ -1339,6 +1356,7 @@ gtk_expander_set_label (GtkExpander *expander, child = gtk_label_new (label); gtk_label_set_use_underline (GTK_LABEL (child), expander->priv->use_underline); + gtk_label_set_use_markup (GTK_LABEL (child), expander->priv->use_markup); gtk_widget_show (child); gtk_expander_set_label_widget (expander, child); @@ -1431,6 +1449,60 @@ gtk_expander_get_use_underline (GtkExpander *expander) } /** + * gtk_expander_set_use_markup: + * @expander: a #GtkExpander + * @use_markup: %TRUE if the label's text should be parsed for markup + * + * Sets whether the text of the label contains markup in <link + * linkend="PangoMarkupFormat">Pango's text markup + * language</link>. See gtk_label_set_markup(). + * + * Since: 2.4 + **/ +void +gtk_expander_set_use_markup (GtkExpander *expander, + gboolean use_markup) +{ + GtkExpanderPrivate *priv; + + g_return_if_fail (GTK_IS_EXPANDER (expander)); + + priv = expander->priv; + + use_markup = use_markup != FALSE; + + if (priv->use_markup != use_markup) + { + priv->use_markup = use_markup; + + if (priv->label_widget && GTK_IS_LABEL (priv->label_widget)) + gtk_label_set_use_markup (GTK_LABEL (priv->label_widget), use_markup); + + g_object_notify (G_OBJECT (expander), "use_markup"); + } +} + +/** + * gtk_expander_get_use_markup: + * @expander: a #GtkExpander + * + * Returns whether the label's text is interpreted as marked up with + * the <link linkend="PangoMarkupFormat">Pango text markup + * language</link>. See gtk_expander_set_use_markup (). + * + * Return value: %TRUE if the label's text will be parsed for markup + * + * Since: 2.4 + **/ +gboolean +gtk_expander_get_use_markup (GtkExpander *expander) +{ + g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE); + + return expander->priv->use_markup; +} + +/** * gtk_expander_set_label_widget: * @expander: a #GtkExpander * @label_widget: the new label widget |