aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-05 00:08:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:50:02 +0800
commitc52b0f748f7a3cfc6f81c30c07295c9e55472e3a (patch)
treeb8b420db74375c3fbaf2f38a56c29d8ae92d8ce0 /widgets/misc
parent791b5f68a12ac0444080cf2ef2f335ce1dd73075 (diff)
downloadgsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.tar
gsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.tar.gz
gsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.tar.bz2
gsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.tar.lz
gsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.tar.xz
gsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.tar.zst
gsoc2013-evolution-c52b0f748f7a3cfc6f81c30c07295c9e55472e3a.zip
e-map: pass width and height to set_scroll_area() directly
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-map.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index 83c7b953b3..0af34f972c 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -94,7 +94,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);
@@ -904,7 +904,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 */
@@ -1432,11 +1432,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;
@@ -1461,27 +1460,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);