From b8b0566553af52a4fa2e590dc6574ae99a43e303 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 6 Jun 2008 18:25:21 +0300 Subject: [PATCH] MapWidget: add _get_center_mode, fix some warnings --- libs/libgtkmap/gtkmap.c | 21 ++++++++++++++++++--- libs/libgtkmap/gtkmap.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libs/libgtkmap/gtkmap.c b/libs/libgtkmap/gtkmap.c index 5681ab0..bfb0991 100644 --- a/libs/libgtkmap/gtkmap.c +++ b/libs/libgtkmap/gtkmap.c @@ -595,7 +595,7 @@ priv=GTK_MAP_GET_PRIVATE(map); switch (prop_id) { case PROP_CENTER_MODE: - gtk_map_set_center_mode(map, g_value_get_int(value)); + gtk_map_set_center_mode(GTK_WIDGET(map), g_value_get_int(value)); break; case PROP_SHOW_VELVEC: priv->show_velvec=g_value_get_boolean(value); @@ -1808,7 +1808,7 @@ if (tilex > priv->world_size_tiles || tiley > priv->world_size_tiles) return FALSE; for (zoff = (priv->curr_repo->double_size ? 1 : 0); !pixbuf && (priv->zoom + zoff) <= priv->max_zoom && zoff <= GTK_MAP_TILE_SIZE_P2; zoff += 1) { - pixbuf=gtk_map_tile_load(map, tilex, tiley, zoff, !fast_fail); + pixbuf=gtk_map_tile_load(GTK_WIDGET(map), tilex, tiley, zoff, !fast_fail); if (!pixbuf) { if (!fast_fail) fast_fail=TRUE; @@ -1843,6 +1843,20 @@ return TRUE; /******************************************************************************/ +GtkMapCenterMode +gtk_map_get_center_mode(GtkWidget *widget) +{ +GtkMap *map; +GtkMapPriv *priv; + +g_return_val_if_fail(GTK_IS_MAP(widget), CENTER_MANUAL); + +map=GTK_MAP(widget); +priv=GTK_MAP_GET_PRIVATE(map); + +return priv->center_mode; +} + /** * gtk_map_set_center_mode: * @mode: Centering mode @@ -2059,7 +2073,8 @@ gtk_map_rotate(GtkWidget *widget, gfloat angle) GtkMap *map; GtkMapPriv *priv; -g_return_if_fail(GTK_IS_MAP(widget)); +g_return_val_if_fail(GTK_IS_MAP(widget), FALSE); + map=GTK_MAP(widget); priv=GTK_MAP_GET_PRIVATE(map); diff --git a/libs/libgtkmap/gtkmap.h b/libs/libgtkmap/gtkmap.h index 755ca28..3c85199 100644 --- a/libs/libgtkmap/gtkmap.h +++ b/libs/libgtkmap/gtkmap.h @@ -146,6 +146,7 @@ void gtk_map_set_center_latlon(GtkWidget *map, gdouble lat, gdouble lon); void gtk_map_get_center_latlon(GtkWidget *map, gdouble *lat, gdouble *lon); gboolean gtk_map_set_center_mode(GtkWidget *widget, GtkMapCenterMode mode); +GtkMapCenterMode gtk_map_get_center_mode(GtkWidget *widget); void gtk_map_pan(GtkWidget *map, gint delta_unitx, gint delta_unity); -- 2.39.5