[gimp/gtk3-port: 90/228] plug-ins: port the print preview to the new size request API



commit 2dca71405544ba7167d4fe9eb9ba06aed7c3226e
Author: Michael Natterer <mitch gimp org>
Date:   Thu Oct 28 14:56:09 2010 +0200

    plug-ins: port the print preview to the new size request API

 plug-ins/print/print-preview.c |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/print/print-preview.c b/plug-ins/print/print-preview.c
index fb27667..47b0650 100644
--- a/plug-ins/print/print-preview.c
+++ b/plug-ins/print/print-preview.c
@@ -76,8 +76,12 @@ static void      print_preview_finalize             (GObject          *object);
 
 static void      print_preview_realize              (GtkWidget        *widget);
 static void      print_preview_unrealize            (GtkWidget        *widget);
-static void      print_preview_size_request         (GtkWidget        *widget,
-                                                     GtkRequisition   *requisition);
+static void      print_preview_get_preferred_width  (GtkWidget        *widget,
+                                                     gint             *minimum_width,
+                                                     gint             *natural_width);
+static void      print_preview_get_preferred_height (GtkWidget        *widget,
+                                                     gint             *minimum_height,
+                                                     gint             *natural_height);
 static void      print_preview_size_allocate        (GtkWidget        *widget,
                                                      GtkAllocation    *allocation);
 static gboolean  print_preview_draw                 (GtkWidget        *widget,
@@ -180,7 +184,8 @@ print_preview_class_init (PrintPreviewClass *klass)
 
   widget_class->realize              = print_preview_realize;
   widget_class->unrealize            = print_preview_unrealize;
-  widget_class->size_request         = print_preview_size_request;
+  widget_class->get_preferred_width  = print_preview_get_preferred_width;
+  widget_class->get_preferred_height = print_preview_get_preferred_height;
   widget_class->size_allocate        = print_preview_size_allocate;
   widget_class->draw                 = print_preview_draw;
   widget_class->button_press_event   = print_preview_button_press_event;
@@ -282,6 +287,30 @@ print_preview_size_request (GtkWidget      *widget,
 }
 
 static void
+print_preview_get_preferred_width (GtkWidget *widget,
+                                   gint      *minimum_width,
+                                   gint      *natural_width)
+{
+  GtkRequisition requisition;
+
+  print_preview_size_request (widget, &requisition);
+
+  *minimum_width = *natural_width = requisition.width;
+}
+
+static void
+print_preview_get_preferred_height (GtkWidget *widget,
+                                    gint      *minimum_height,
+                                    gint      *natural_height)
+{
+  GtkRequisition requisition;
+
+  print_preview_size_request (widget, &requisition);
+
+  *minimum_height = *natural_height = requisition.height;
+}
+
+static void
 print_preview_size_allocate (GtkWidget     *widget,
                              GtkAllocation *allocation)
 {



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