[gtk/style-context-redux: 26/27] filechooser: Stop using gtk_style_context_get
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/style-context-redux: 26/27] filechooser: Stop using gtk_style_context_get
- Date: Mon, 27 Jan 2020 16:17:25 +0000 (UTC)
commit 7f1dda7d9cae9678a7e9a21b8abcfa744857e7be
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 | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 4aecc911c7..024391034a 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,14 @@ find_good_size_from_style (GtkWidget *widget,
gint *width,
gint *height)
{
- GtkStyleContext *context;
double font_size;
double resolution;
+ GtkCssStyle *style;
- context = gtk_widget_get_style_context (widget);
+ style = gtk_css_node_get_style (gtk_widget_get_css_node (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;
+ resolution = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_DPI), 100);
+ 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]