[gimp] app: create pango font description of statusbar zoom field only once...
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: create pango font description of statusbar zoom field only once...
- Date: Sat, 6 Feb 2016 00:20:18 +0000 (UTC)
commit 6878b494917d258d069fb29db1847068ee10d8c3
Author: Jehan <jehan girinstud io>
Date: Sat Feb 6 01:14:19 2016 +0100
app: create pango font description of statusbar zoom field only once...
... instead of recreating it all the time the same.
Small improvement of commit 3f2889e.
app/display/gimpscalecombobox.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/app/display/gimpscalecombobox.c b/app/display/gimpscalecombobox.c
index 29e3158..29a7dc0 100644
--- a/app/display/gimpscalecombobox.c
+++ b/app/display/gimpscalecombobox.c
@@ -212,32 +212,33 @@ static void
gimp_scale_combo_box_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
- GtkWidget *entry;
- GtkRcStyle *rc_style;
- PangoContext *context;
- PangoFontDescription *font_desc;
- gint font_size;
- gdouble label_scale;
+ GtkWidget *entry;
+ GtkRcStyle *rc_style;
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
- gtk_widget_style_get (widget, "label-scale", &label_scale, NULL);
-
entry = gtk_bin_get_child (GTK_BIN (widget));
rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (entry));
- if (rc_style->font_desc)
- pango_font_description_free (rc_style->font_desc);
+ if (! rc_style->font_desc)
+ {
+ PangoContext *context;
+ PangoFontDescription *font_desc;
+ gint font_size;
+ gdouble label_scale;
+
+ gtk_widget_style_get (widget, "label-scale", &label_scale, NULL);
- context = gtk_widget_get_pango_context (widget);
- font_desc = pango_context_get_font_description (context);
- rc_style->font_desc = pango_font_description_copy (font_desc);
+ context = gtk_widget_get_pango_context (widget);
+ font_desc = pango_context_get_font_description (context);
+ rc_style->font_desc = pango_font_description_copy (font_desc);
- font_size = pango_font_description_get_size (rc_style->font_desc);
- pango_font_description_set_size (rc_style->font_desc, label_scale * font_size);
+ font_size = pango_font_description_get_size (rc_style->font_desc);
+ pango_font_description_set_size (rc_style->font_desc, label_scale * font_size);
- gtk_widget_modify_style (GTK_WIDGET (entry), rc_style);
+ gtk_widget_modify_style (GTK_WIDGET (entry), rc_style);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]