[gimp] libgimpwidgets: undeprecate GimpNumberPairEntry and style the font with CSS



commit 080f7ae90921c6805444e62e2bc186170c550fa9
Author: Michael Natterer <mitch gimp org>
Date:   Mon May 21 19:31:15 2018 +0200

    libgimpwidgets: undeprecate GimpNumberPairEntry and style the font with CSS

 libgimpwidgets/gimpnumberpairentry.c |   18 ++++++------------
 themes/System/gimp.css               |    5 ++++-
 2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/libgimpwidgets/gimpnumberpairentry.c b/libgimpwidgets/gimpnumberpairentry.c
index 99b5e54..fa0d4e5 100644
--- a/libgimpwidgets/gimpnumberpairentry.c
+++ b/libgimpwidgets/gimpnumberpairentry.c
@@ -756,23 +756,17 @@ gimp_number_pair_entry_modify_font (GimpNumberPairEntry *entry,
                                     gboolean             italic)
 {
   GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
-  PangoContext               *context;
-  PangoFontDescription       *font_desc;
+  GtkStyleContext            *style;
 
   if (priv->font_italic == italic)
     return;
 
-  context = gtk_widget_get_pango_context (GTK_WIDGET (entry));
-  font_desc = pango_context_get_font_description (context);
-  font_desc = pango_font_description_copy (font_desc);
+  style = gtk_widget_get_style_context (GTK_WIDGET (entry));
 
-  pango_font_description_set_style (font_desc,
-                                    italic ?
-                                    PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
-
-  gtk_widget_override_font (GTK_WIDGET (entry), font_desc);
-
-  pango_font_description_free (font_desc);
+  if (italic)
+    gtk_style_context_add_class (style, "italic");
+  else
+    gtk_style_context_remove_class (style, "italic");
 
   gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
                                 GTK_ENTRY_ICON_SECONDARY,
diff --git a/themes/System/gimp.css b/themes/System/gimp.css
index 3126171..9d7dbc6 100644
--- a/themes/System/gimp.css
+++ b/themes/System/gimp.css
@@ -92,8 +92,11 @@ GimpColorFrame {
     -GimpColorFrame-number-color: lighter (@bg_color);
 }
 
+entry.italic {
+    font-style: italic;
+}
+
 .grid {
     /* why does this not work */
     color: rgba (1.0, 0.0, 0.0, 1.0);
 }
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]