gtkxpaned: Remove write-only variables.
[pspp] / lib / gtk-contrib / gtkxpaned.c
index f653f93c92346a7ddae2df6743f8045577d63948..e5382f3c3e6710489260aecd28bfaebdc280835c 100644 (file)
@@ -3,7 +3,7 @@
  **      10        20        30        40        50        60        70        80
  **
  **  library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+
- **  Copyright (C) 2012 Free Software Foundation, Inc.
+ **  Copyright (C) 2012, 2013 Free Software Foundation, Inc.
  **  Copyright (C) 2005-2006 Mirco "MacSlow" Müller <macslow@bangang.de>
  **
  **  This library is free software; you can redistribute it and/or
@@ -75,6 +75,30 @@ static void gtk_xpaned_init (GtkXPaned * xpaned);
 static void gtk_xpaned_size_request (GtkWidget * widget,
                                      GtkRequisition * requisition);
 
+static void
+gtk_xpaned_get_preferred_width (GtkWidget *widget,
+                               gint      *minimal_width,
+                               gint      *natural_width)
+{
+  GtkRequisition requisition;
+
+  gtk_xpaned_size_request (widget, &requisition);
+
+  *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+gtk_xpaned_get_preferred_height (GtkWidget *widget,
+                                gint      *minimal_height,
+                                gint      *natural_height)
+{
+  GtkRequisition requisition;
+
+  gtk_xpaned_size_request (widget, &requisition);
+
+  *minimal_height = *natural_height = requisition.height;
+}
+
 static void gtk_xpaned_size_allocate (GtkWidget * widget,
                                       GtkAllocation * allocation);
 
@@ -275,7 +299,9 @@ gtk_xpaned_class_init (GtkXPanedClass * class)
   widget_class->button_press_event = gtk_xpaned_button_press;
   widget_class->button_release_event = gtk_xpaned_button_release;
   widget_class->motion_notify_event = gtk_xpaned_motion;
-  widget_class->size_request = gtk_xpaned_size_request;
+  widget_class->get_preferred_width  = gtk_xpaned_get_preferred_width;
+  widget_class->get_preferred_height = gtk_xpaned_get_preferred_height;
+
   widget_class->size_allocate = gtk_xpaned_size_allocate;
 
   container_class->add = gtk_xpaned_add;
@@ -1370,8 +1396,6 @@ gtk_xpaned_draw (GtkWidget * widget, cairo_t *cr)
 {
   GtkXPaned *xpaned = GTK_XPANED (widget);
   gint handle_size;
-  GdkRectangle horizontalClipArea;
-  GdkRectangle verticalClipArea;
 
   /* determine size of handle(s) */
   gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
@@ -1398,20 +1422,6 @@ gtk_xpaned_draw (GtkWidget * widget, cairo_t *cr)
       else
         state = gtk_widget_get_state (widget);
 
-      horizontalClipArea.x = xpaned->handle_pos_west.x;
-      horizontalClipArea.y = xpaned->handle_pos_west.y;
-      horizontalClipArea.width =
-        xpaned->handle_pos_west.width + handle_size +
-        xpaned->handle_pos_east.width;
-      horizontalClipArea.height = handle_size;
-
-      verticalClipArea.x = xpaned->handle_pos_north.x;
-      verticalClipArea.y = xpaned->handle_pos_north.y;
-      verticalClipArea.width = handle_size;
-      verticalClipArea.height =
-        xpaned->handle_pos_north.height + handle_size +
-        xpaned->handle_pos_south.height;
-
       gtk_paint_handle (gtk_widget_get_style (widget),
                         cr,
                         state,