[gtk/deprecations: 1/2] Stop using deprecated style context api



commit b3a04ebfe146c3cb04aa7b850ed632af87a9b2bf
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 31 15:03:57 2019 -0400

    Stop using deprecated style context api
    
    Use the non-deprecated one it wraps, instead.
    Yes, this is cheating...

 gtk/gtkflowbox.c      |  4 +---
 gtk/gtkpopover.c      |  4 +---
 gtk/gtkstylecontext.c |  4 +---
 gtk/gtktextdisplay.c  | 10 +++-------
 gtk/gtktextutil.c     |  4 +---
 gtk/gtktextview.c     |  4 +---
 6 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 65c491fe4b..015a48e8ab 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2382,9 +2382,7 @@ gtk_flow_box_snapshot (GtkWidget   *widget,
           cairo_append_path (cr, path);
           cairo_path_destroy (path);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-          gtk_style_context_get_border_color (context, &border_color);
-G_GNUC_END_IGNORE_DEPRECATIONS
+          gtk_style_context_get (context, "border-color", &border_color, NULL);
           gtk_style_context_get_border (context, &border);
 
           cairo_set_line_width (cr, border.left);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index a39270c5a7..dba89e511c 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1310,10 +1310,8 @@ gtk_popover_snapshot (GtkWidget   *widget,
   if (border.bottom > 0)
     {
       GdkRGBA border_color;
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      gtk_style_context_get_border_color (context, &border_color);
-G_GNUC_END_IGNORE_DEPRECATIONS
 
+      gtk_style_context_get (context, "border-color", &border_color, NULL);
       gtk_popover_apply_tail_path (popover, cr);
       gdk_cairo_set_source_rgba (cr, &border_color);
 
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index e765c852dc..81384cc0c9 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1992,9 +1992,7 @@ _gtk_style_context_get_attributes (AtkAttributeSet *attributes,
   GdkRGBA color;
   gchar *value;
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_style_context_get_background_color (context, &color);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_style_context_get (context, "background-color", &color, NULL);
   value = g_strdup_printf ("%u,%u,%u",
                            (guint) ceil (color.red * 65536 - color.red),
                            (guint) ceil (color.green * 65536 - color.green),
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 4e6c49fd16..3f38112c88 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -580,11 +580,9 @@ render_para (GtkTextRenderer    *text_renderer,
   selection_node = gtk_text_view_get_selection_node ((GtkTextView*)text_renderer->widget);
   gtk_style_context_save_to_node (context, selection_node);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_style_context_get_background_color (context, &selection);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_style_context_get (context, "background-color", &selection, NULL);
 
- gtk_style_context_restore (context);
+  gtk_style_context_restore (context);
 
   do
     {
@@ -775,9 +773,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
                 {
                   GdkRGBA color;
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-                  gtk_style_context_get_background_color (context, &color);
-G_GNUC_END_IGNORE_DEPRECATIONS
+                  gtk_style_context_get (context, "background-color", &color, NULL);
 
                   gdk_cairo_set_source_rgba (cr, &color);
 
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 9858bec5ad..651b92abd9 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -250,9 +250,7 @@ set_attributes_from_style (GtkStyleContext   *context,
   if (!values->appearance.fg_rgba)
     values->appearance.fg_rgba = gdk_rgba_copy (&black);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_style_context_get_background_color (context, values->appearance.bg_rgba);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_style_context_get (context, "background-color", values->appearance.bg_rgba, NULL);
   gtk_style_context_get_color (context, values->appearance.fg_rgba);
 
   if (values->font)
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 0f378211e8..f0b3c3aeb5 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7310,9 +7310,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
 
   context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_style_context_get_background_color (context, values->appearance.bg_rgba);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_style_context_get (context, "background-color", values->appearance.bg_rgba);
   gtk_style_context_get_color (context, values->appearance.fg_rgba);
 
   if (values->font)


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