[gnome-system-tools/rendering-cleanup: 7/21] e-map: pass width and height to set_scroll_area() directly



commit 19e983f853101da59dbe4cadd73d3b71322a084a
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 4 18:08:26 2010 +0200

    e-map: pass width and height to set_scroll_area() directly

 src/time/e-map/e-map.c |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)
---
diff --git a/src/time/e-map/e-map.c b/src/time/e-map/e-map.c
index ddcb829..52be093 100644
--- a/src/time/e-map/e-map.c
+++ b/src/time/e-map/e-map.c
@@ -95,7 +95,7 @@ static gint e_map_key_press (GtkWidget *widget, GdkEventKey *event);
 static void e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj, GtkAdjustment *vadj);
 
 static void update_render_pixbuf (EMap *map, GdkInterpType interp, gboolean render_overlays);
-static void set_scroll_area (EMap *view);
+static void set_scroll_area (EMap *view, int width, int height);
 static void center_at (EMap *map, gint x, gint y);
 static void smooth_center_at (EMap *map, gint x, gint y);
 static void scroll_to (EMap *view, gint x, gint y);
@@ -986,7 +986,7 @@ update_render_pixbuf (EMap *map,
 
 	/* Compute image offsets with respect to window */
 
-	set_scroll_area (map);
+	set_scroll_area (map, width, height);
 }
 
 /* Queues a repaint of the specified area in window coordinates */
@@ -1514,11 +1514,10 @@ adjustment_changed_cb (GtkAdjustment *adj, gpointer data)
 }
 
 static void
-set_scroll_area (EMap *view)
+set_scroll_area (EMap *view, int width, int height)
 {
 	EMapPrivate *priv;
 	GtkAllocation allocation;
-	gint upper, page_size;
 
 	priv = view->priv;
 
@@ -1543,27 +1542,16 @@ set_scroll_area (EMap *view)
 	/* Set scroll bounds and new offsets */
 
 	gtk_adjustment_set_lower (priv->hadj, 0);
-	if (priv->map_render_pixbuf) {
-		gint width = gdk_pixbuf_get_width (priv->map_render_pixbuf);
-		gtk_adjustment_set_upper (priv->hadj, width);
-	}
+	gtk_adjustment_set_upper (priv->hadj, width);
 
 	gtk_adjustment_set_lower (priv->vadj, 0);
-	if (priv->map_render_pixbuf) {
-		gint height = gdk_pixbuf_get_height (priv->map_render_pixbuf);
-		gtk_adjustment_set_upper (priv->vadj, height);
-	}
+	gtk_adjustment_set_upper (priv->vadj, height);
 
 	g_object_thaw_notify (G_OBJECT (priv->hadj));
 	g_object_thaw_notify (G_OBJECT (priv->vadj));
 
-	upper = gtk_adjustment_get_upper (priv->hadj);
-	page_size = gtk_adjustment_get_page_size (priv->hadj);
-	priv->xofs = CLAMP (priv->xofs, 0, upper - page_size);
-
-	upper = gtk_adjustment_get_upper (priv->vadj);
-	page_size = gtk_adjustment_get_page_size (priv->vadj);
-	priv->yofs = CLAMP (priv->yofs, 0, upper - page_size);
+	priv->xofs = CLAMP (priv->xofs, 0, width - allocation.width);
+	priv->yofs = CLAMP (priv->yofs, 0, height - allocation.height);
 
 	gtk_adjustment_set_value (priv->hadj, priv->xofs);
 	gtk_adjustment_set_value (priv->vadj, priv->yofs);



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