[gtk] filechooser: Stop using gtk_style_context_get



commit 997186f640e60841afeaeec124f67180bba15aa1
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 27 09:10:47 2020 -0500

    filechooser: Stop using gtk_style_context_get
    
    Just go to the css style directly.

 gtk/gtkfilechooserwidget.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 4aecc911c7..f6d5c1b2e6 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -83,6 +83,7 @@
 #include "gtkentryprivate.h"
 #include "gtkroot.h"
 #include "gtkbinlayout.h"
+#include "gtkwidgetprivate.h"
 
 #include <cairo-gobject.h>
 
@@ -6178,20 +6179,11 @@ find_good_size_from_style (GtkWidget *widget,
                            gint      *width,
                            gint      *height)
 {
-  GtkStyleContext *context;
+  GtkCssStyle *style;
   double font_size;
-  double resolution;
 
-  context = gtk_widget_get_style_context (widget);
-
-  resolution = _gtk_css_number_value_get (_gtk_style_context_peek_property (context,
-                                                                            GTK_CSS_PROPERTY_DPI),
-                                          100);
-
-  gtk_style_context_get (context,
-                         "font-size", &font_size,
-                         NULL);
-  font_size = font_size * resolution / 72.0 + 0.5;
+  style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
+  font_size = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
 
   *width = font_size * NUM_CHARS;
   *height = font_size * NUM_LINES;


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