Permalink
Browse files

Adapt to autotools cleanups, max compiler warnings

  • Loading branch information...
1 parent 37fd50d commit 21ad885d8a3858eede05c89436bd37294c9e54de @nzjrs committed May 28, 2010
Showing with 46 additions and 22 deletions.
  1. +26 −17 src/osm-gps-map-types.h
  2. +19 −5 src/osm-gps-map-widget.c
  3. +1 −0 src/osm-gps-map.h
View
@@ -24,9 +24,9 @@
#ifndef _OSM_GPS_MAP_TYPES_H_
#define _OSM_GPS_MAP_TYPES_H_
-#include "config.h"
-
+#include <glib.h>
#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#if USE_LIBSOUP22
#include <libsoup/soup.h>
#endif
@@ -64,21 +64,7 @@
/* equatorial radius in meters */
#define OSM_EQ_RADIUS (6378137.0)
-typedef struct {
- /* The details of the tile to download */
- char *uri;
- char *folder;
- char *filename;
- OsmGpsMap *map;
- /* whether to redraw the map when the tile arrives */
- gboolean redraw;
-#if USE_LIBSOUP22
- SoupSession *session;
-#endif
-} tile_download_t;
-
-/* strcmp0 was introduced with glib 2.16 */
-#if ! GLIB_CHECK_VERSION (2, 16, 0)
+#if !GLIB_CHECK_VERSION (2, 16, 0)
int g_strcmp0(const char *str1, const char *str2)
{
if( str1 == NULL && str2 == NULL ) return 0;
@@ -88,4 +74,27 @@ int g_strcmp0(const char *str1, const char *str2)
}
#endif
+#if !GTK_CHECK_VERSION (2, 20, 0)
+#define gtk_widget_get_realized(widget) (GTK_WIDGET_REALIZED (widget))
+#define gtk_widget_get_mapped(widget) (GTK_WIDGET_MAPPED (widget))
+#endif /* GTK < 2.20.0 */
+
+#if !GTK_CHECK_VERSION (2, 18, 0)
+#define gtk_cell_renderer_get_alignment(cell, xalign, yalign) g_object_get (cell, "xalign", xalign, "yalign", yalign, NULL);
+#define gtk_cell_renderer_get_padding(cell, xpad, ypad) g_object_get (cell, "xpad", xpad, "ypad", ypad, NULL);
+#define gtk_cell_renderer_set_padding(cell, xpad, ypad) g_object_set (cell, "xpad", xpad, "ypad", ypad, NULL);
+#define gtk_widget_get_allocation(widget, alloc) (*(alloc) = (widget)->allocation)
+#define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation = *(alloc))
+#define gtk_widget_get_app_paintable(widget) (GTK_WIDGET_APP_PAINTABLE (widget))
+#define gtk_widget_set_can_default(widget, can_default) ((can_default) ? (GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_DEFAULT)))
+#define gtk_widget_set_can_focus(widget, can_focus) ((can_focus) ? (GTK_WIDGET_SET_FLAGS (w, GTK_CAN_FOCUS)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS)))
+#define gtk_widget_set_double_buffered(widget, double_buffered) ((double_buffered) ? (GTK_WIDGET_SET_FLAGS (w, GTK_DOUBLE_BUFFERED)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_DOUBLE_BUFFERED)))
+#define gtk_widget_is_drawable(widget) (GTK_WIDGET_DRAWABLE (widget))
+#define gtk_widget_has_focus(widget) (GTK_WIDGET_HAS_FOCUS (widget))
+#define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW (widget))
+#define gtk_widget_get_state(widget) ((widget)->state)
+#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE (widget))
+#define gtk_widget_set_window(widget, _window) ((widget)->window = _window)
+#endif /* GTK+ < 2.18.0 */
+
#endif /* _OSM_GPS_MAP_TYPES_H_ */
View
@@ -159,6 +159,19 @@ typedef struct
guint redraw_cycle;
} OsmCachedTile;
+typedef struct {
+ /* The details of the tile to download */
+ char *uri;
+ char *folder;
+ char *filename;
+ OsmGpsMap *map;
+ /* whether to redraw the map when the tile arrives */
+ gboolean redraw;
+#if USE_LIBSOUP22
+ SoupSession *session;
+#endif
+} OsmTileDownload;
+
enum
{
PROP_0,
@@ -632,7 +645,7 @@ osm_gps_map_tile_download_complete (SoupSession *session, SoupMessage *msg, gpoi
#endif
{
FILE *file;
- tile_download_t *dl = (tile_download_t *)user_data;
+ OsmTileDownload *dl = (OsmTileDownload *)user_data;
OsmGpsMap *map = OSM_GPS_MAP(dl->map);
OsmGpsMapPrivate *priv = map->priv;
gboolean file_saved = FALSE;
@@ -758,7 +771,7 @@ osm_gps_map_download_tile (OsmGpsMap *map, int zoom, int x, int y, gboolean redr
{
SoupMessage *msg;
OsmGpsMapPrivate *priv = map->priv;
- tile_download_t *dl = g_new0(tile_download_t,1);
+ OsmTileDownload *dl = g_new0(OsmTileDownload,1);
//calculate the uri to download
dl->uri = replace_map_uri(map, priv->repo_uri, zoom, x, y);
@@ -1998,11 +2011,12 @@ osm_gps_map_expose (GtkWidget *widget, GdkEventExpose *event)
#else
GdkDrawable *drawable = widget->window;
#endif
+ GtkStateType state = gtk_widget_get_state (widget);
if (!priv->drag_mouse_dx && !priv->drag_mouse_dy && event)
{
gdk_draw_drawable (drawable,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ widget->style->fg_gc[state],
priv->pixmap,
event->area.x + EXTRA_BORDER, event->area.y + EXTRA_BORDER,
event->area.x, event->area.y,
@@ -2011,7 +2025,7 @@ osm_gps_map_expose (GtkWidget *widget, GdkEventExpose *event)
else
{
gdk_draw_drawable (drawable,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ widget->style->fg_gc[state],
priv->pixmap,
0,0,
priv->drag_mouse_dx - EXTRA_BORDER,
@@ -2064,7 +2078,7 @@ osm_gps_map_expose (GtkWidget *widget, GdkEventExpose *event)
osm_gps_map_layer_draw(layer, map, drawable);
#ifdef OSD_DOUBLE_BUFFER
gdk_draw_drawable (widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ widget->style->fg_gc[state],
priv->dbuf_pixmap,
0,0,0,0,-1,-1);
#endif
View
@@ -5,6 +5,7 @@
#include <osm-gps-map-layer.h>
#include <osm-gps-map-track.h>
#include <osm-gps-map-point.h>
+#include <osm-gps-map-image.h>
#include <osm-gps-map-source.h>
#include <osm-gps-map-widget.h>
#include <osm-gps-map-compat.h>

0 comments on commit 21ad885

Please sign in to comment.