diff options
author | Chris Lumens <clumens@redhat.com> | 2012-10-22 15:16:26 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2012-10-23 13:21:10 -0400 |
commit | e8cb49e67256c41e1700d862d05b58c16adc7293 (patch) | |
tree | 12a1acaacb01e13285edf0acf7df6adadff77215 /widgets | |
parent | d878b4fba24e4b4bb544469db35e16eaceb3afc4 (diff) | |
download | anaconda-e8cb49e67256c41e1700d862d05b58c16adc7293.tar.gz anaconda-e8cb49e67256c41e1700d862d05b58c16adc7293.tar.xz anaconda-e8cb49e67256c41e1700d862d05b58c16adc7293.zip |
Set the status text in the SpokeSelector widget differently now.
This is required by the previous patch. We are storing pango markup in the
language store now, and pango does not appear to support nested spans. So,
we need to set attrs instead. Also I've condensed things a bit here to make
sure the code is only in one place.
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/src/SpokeSelector.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/widgets/src/SpokeSelector.c b/widgets/src/SpokeSelector.c index b25fa1160..6783f478e 100644 --- a/widgets/src/SpokeSelector.c +++ b/widgets/src/SpokeSelector.c @@ -18,6 +18,7 @@ */ #include <gdk/gdk.h> +#include <pango/pango.h> #include "SpokeSelector.h" #include "intl.h" @@ -147,6 +148,19 @@ GtkWidget *anaconda_spoke_selector_new() { return g_object_new(ANACONDA_TYPE_SPOKE_SELECTOR, NULL); } +static void format_status_label(AnacondaSpokeSelector *spoke, const char *markup) { + PangoAttrList *attrs; + + attrs = pango_attr_list_new(); + pango_attr_list_insert(attrs, pango_attr_style_new(PANGO_STYLE_ITALIC)); + pango_attr_list_insert(attrs, pango_attr_scale_new(PANGO_SCALE_LARGE)); + + gtk_label_set_markup(GTK_LABEL(spoke->priv->status_label), markup); + gtk_label_set_attributes(GTK_LABEL(spoke->priv->status_label), attrs); + + pango_attr_list_unref(attrs); +} + static void anaconda_spoke_selector_init(AnacondaSpokeSelector *spoke) { char *markup; @@ -192,12 +206,10 @@ static void anaconda_spoke_selector_init(AnacondaSpokeSelector *spoke) { /* Create the status label. */ spoke->priv->status_label = gtk_label_new(NULL); - markup = g_markup_printf_escaped("<span style='italic' size='large'>%s</span>", _(DEFAULT_STATUS)); - gtk_label_set_markup(GTK_LABEL(spoke->priv->status_label), markup); + format_status_label(spoke, _(DEFAULT_STATUS)); gtk_misc_set_alignment(GTK_MISC(spoke->priv->status_label), 0, 0); gtk_label_set_ellipsize(GTK_LABEL(spoke->priv->status_label), PANGO_ELLIPSIZE_MIDDLE); gtk_label_set_max_width_chars(GTK_LABEL(spoke->priv->status_label), 45); - g_free(markup); spoke->priv->status_provider = gtk_css_provider_new(); gtk_css_provider_load_from_data(spoke->priv->status_provider, "GtkLabel { color: @text_color }", -1, NULL); @@ -246,11 +258,9 @@ static void anaconda_spoke_selector_set_property(GObject *object, guint prop_id, break; case PROP_STATUS: { - char *markup = g_markup_printf_escaped("<span style='italic' size='large'>%s</span>", g_value_get_string(value)); GtkStyleContext *context = gtk_widget_get_style_context(GTK_WIDGET(priv->status_label)); - gtk_label_set_markup(GTK_LABEL(priv->status_label), markup); - g_free(markup); + format_status_label(widget, g_value_get_string(value)); if (gtk_widget_get_sensitive(GTK_WIDGET(widget))) gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(priv->status_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |