[gtk/deprecate-render: 16/43] printunixdialog: Port to the gtk_css_style_snapshot api




commit c2c46a7036d716dc06f8f67e690928a0341b9356
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 8 13:48:19 2022 -0400

    printunixdialog: Port to the gtk_css_style_snapshot api
    
    The gtk_snapshot_render api is deprecated, so avoid using it.

 gtk/gtkprintunixdialog.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 575b2091bd..fb5f8a11d8 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -46,7 +46,9 @@
 #include "gtkbuildable.h"
 #include "gtkmessagedialog.h"
 #include "gtkbutton.h"
-#include "deprecated/gtkrender.h"
+#include "gtksnapshot.h"
+#include "gtkrenderbackgroundprivate.h"
+#include "gtkrenderborderprivate.h"
 #include <glib/gi18n-lib.h>
 #include "gtkprivate.h"
 #include "gtktypebuiltins.h"
@@ -1956,6 +1958,7 @@ paint_page (GtkPrintUnixDialog *dialog,
   GdkRGBA color;
   GtkSnapshot *snapshot;
   GskRenderNode *node;
+  GtkCssBoxes boxes;
 
   width = 20;
   height = 26;
@@ -1965,10 +1968,12 @@ paint_page (GtkPrintUnixDialog *dialog,
   gtk_style_context_save_to_node (context, dialog->collate_paper_node);
 
   snapshot = gtk_snapshot_new ();
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_snapshot_render_background (snapshot, context, x, y, width, height);
-  gtk_snapshot_render_frame (snapshot, context, x, y, width, height);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_css_boxes_init_border_box (&boxes,
+                                 gtk_style_context_lookup_style (context),
+                                 x, y, width, height);
+  gtk_css_style_snapshot_background (&boxes, snapshot);
+  gtk_css_style_snapshot_border (&boxes, snapshot);
+
   node = gtk_snapshot_free_to_node (snapshot);
   if (node)
     {
@@ -2405,6 +2410,7 @@ draw_page (GtkDrawingArea *da,
   int pages_per_sheet;
   gboolean ltr = TRUE;
   GtkSnapshot *snapshot;
+  GtkCssBoxes boxes;
   GskRenderNode *node;
 
   orientation = gtk_page_setup_get_orientation (dialog->page_setup);
@@ -2501,10 +2507,12 @@ draw_page (GtkDrawingArea *da,
   cairo_translate (cr, pos_x, pos_y);
 
   snapshot = gtk_snapshot_new ();
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_snapshot_render_background (snapshot, context, 1, 1, w, h);
-  gtk_snapshot_render_frame (snapshot, context, 1, 1, w, h);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_css_boxes_init_border_box (&boxes,
+                                 gtk_style_context_lookup_style (context),
+                                 1, 1, w, h);
+  gtk_css_style_snapshot_background (&boxes, snapshot);
+  gtk_css_style_snapshot_border (&boxes, snapshot);
+
   node = gtk_snapshot_free_to_node (snapshot);
   if (node)
     {


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