[evince] libview: Remove the use of size_request



commit c1ea6511cf4ae6ade13ed85c8f351b9411ded809
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 31 16:53:19 2010 +0100

    libview: Remove the use of size_request

 libview/ev-view-presentation.c |   19 ++++++++++++++-----
 libview/ev-view.c              |   29 +++++++++++++++++++++++++++--
 2 files changed, 41 insertions(+), 7 deletions(-)
---
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index fa79f10..9697718 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -949,11 +949,19 @@ ev_view_presentation_dispose (GObject *object)
 }
 
 static void
-ev_view_presentation_size_request (GtkWidget      *widget,
-				   GtkRequisition *requisition)
+ev_view_presentation_get_preferred_width (GtkWidget *widget,
+                                          gint      *minimum,
+                                          gint      *natural)
 {
-	requisition->width = 0;
-	requisition->height = 0;
+        *minimum = *natural = 0;
+}
+
+static void
+ev_view_presentation_get_preferred_height (GtkWidget *widget,
+                                           gint      *minimum,
+                                           gint      *natural)
+{
+        *minimum = *natural = 0;
 }
 
 static void
@@ -1375,7 +1383,8 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
 
         gobject_class->dispose = ev_view_presentation_dispose;
 
-	widget_class->size_request = ev_view_presentation_size_request;
+	widget_class->get_preferred_width = ev_view_presentation_get_preferred_width;
+	widget_class->get_preferred_height = ev_view_presentation_get_preferred_height;
 	widget_class->realize = ev_view_presentation_realize;
         widget_class->draw = ev_view_presentation_draw;
 	widget_class->key_press_event = ev_view_presentation_key_press_event;
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 5edf89a..d0fdb10 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3135,6 +3135,30 @@ ev_view_size_request (GtkWidget      *widget,
 }
 
 static void
+ev_view_get_preferred_width (GtkWidget *widget,
+                             gint      *minimum,
+                             gint      *natural)
+{
+        GtkRequisition requisition;
+
+        ev_view_size_request (widget, &requisition);
+
+        *minimum = *natural = requisition.width;
+}
+
+static void
+ev_view_get_preferred_height (GtkWidget *widget,
+                              gint      *minimum,
+                              gint      *natural)
+{
+        GtkRequisition requisition;
+
+        ev_view_size_request (widget, &requisition);
+
+        *minimum = *natural = requisition.height;
+}
+
+static void
 ev_view_size_allocate (GtkWidget      *widget,
 		       GtkAllocation  *allocation)
 {
@@ -3189,7 +3213,7 @@ ev_view_size_allocate (GtkWidget      *widget,
 					       form_field_mapping,
 					       field, &view_area);
 
-		gtk_widget_size_request (child, &child_requisition);
+		gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 		if (child_requisition.width != view_area.width ||
 		    child_requisition.height != view_area.height)
 			gtk_widget_set_size_request (child, view_area.width, view_area.height);
@@ -4664,7 +4688,8 @@ ev_view_class_init (EvViewClass *class)
 	widget_class->focus_in_event = ev_view_focus_in;
 	widget_class->focus_out_event = ev_view_focus_out;
  	widget_class->get_accessible = ev_view_get_accessible;
-	widget_class->size_request = ev_view_size_request;
+	widget_class->get_preferred_width = ev_view_get_preferred_width;
+	widget_class->get_preferred_height = ev_view_get_preferred_height;
 	widget_class->size_allocate = ev_view_size_allocate;
 	widget_class->scroll_event = ev_view_scroll_event;
 	widget_class->enter_notify_event = ev_view_enter_notify_event;



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