Should probably be transformed on a GObject.
champlain-zoom-level.h \
champlain-enum-types.h \
champlain-tile.h \
- champlain-map-source.h
+ champlain-map-source.h \
+ champlain-settings.h
libchamplain_0_3_la_SOURCES = \
champlain-map.c \
champlain-zoom-level.c \
champlain-tile.c \
- champlain-map-source.c
+ champlain-map-source.c \
+ champlain-settings.c
noinst_HEADERS = \
champlain-debug.h \
champlain-map-source.h \
champlain-tile.h \
champlain-zoom-level.h \
- champlain-marker.h
+ champlain-marker.h \
+ champlain-settings.h
libchamplain_0_3_la_LIBADD = $(DEPS_LIBS) ../tidy/libtidy-1.0.la
#include "champlain-map-source.h"
#include "champlain-marshal.h"
#include "champlain-private.h"
+#include "champlain-settings.h"
#include "champlain-zoom-level.h"
#include <errno.h>
g_object_unref (tile);
g_object_unref (zoom_level);
}
- else /* if (!offline) */
+ else if (champlain_settings_is_online ())
{
SoupMessage *msg;
gchar *uri;
}
void
-map_load_visible_tiles (Map *map, ChamplainView *view, ChamplainMapSource *source, ChamplainRectangle viewport, gboolean offline)
+map_load_visible_tiles (Map *map, ChamplainView *view, ChamplainMapSource *source, ChamplainRectangle viewport)
{
gint size;
Map *map_new ();
-void map_load_visible_tiles (Map *map, ChamplainView * view, ChamplainMapSource *source, ChamplainRectangle viewport, gboolean offline);
+void map_load_visible_tiles (Map *map, ChamplainView * view, ChamplainMapSource *source, ChamplainRectangle viewport);
void map_free (Map *map);
typedef struct _Map Map;
-typedef struct
+typedef struct
{
gint x;
gint y;
gdouble lat;
};
-typedef struct
+typedef struct
{
gint x;
gint y;
gint height;
} ChamplainRectangle;
-
#endif
--- /dev/null
+
+/*
+ * Copyright (C) 2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "champlain-settings.h"
+
+static gboolean global_offline = TRUE;
+
+gboolean
+champlain_settings_is_online ()
+{
+ return global_offline;
+}
+
+gboolean
+champlain_settings_set_online (gboolean value)
+{
+ global_offline = value;
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if !defined (__CHAMPLAIN_CHAMPLAIN_H_INSIDE__) && !defined (CHAMPLAIN_COMPILATION)
+#error "Only <champlain/champlain.h> can be included directly."
+#endif
+
+#ifndef CHAMPLAIN_SETTINGS_H
+#define CHAMPLAIN_SETTINGS_H
+
+#include <glib.h>
+
+gboolean champlain_settings_is_online ();
+gboolean champlain_settings_set_online (gboolean value);
+
+#endif
Map *map;
- gboolean offline;
gboolean keep_center_on_resize;
gboolean show_license;
};
g_value_set_enum (value, priv->scroll_mode);
break;
case PROP_OFFLINE:
- g_value_set_boolean (value, priv->offline);
+ g_value_set_boolean (value, !champlain_settings_is_online ());
break;
case PROP_DECEL_RATE:
{
priv->scroll_mode, NULL);
break;
case PROP_OFFLINE:
- priv->offline = g_value_get_boolean (value);
+ champlain_settings_set_online (!g_value_get_boolean (value));
break;
case PROP_DECEL_RATE:
{
priv->map_source = champlain_map_source_new_osm_mapnik ();
priv->zoom_level = 0;
- priv->offline = FALSE;
priv->keep_center_on_resize = TRUE;
priv->show_license = TRUE;
priv->license_actor = NULL;
viewport.x += priv->anchor.x;
viewport.y += priv->anchor.y;
- map_load_visible_tiles (priv->map, view, priv->map_source, viewport, priv->offline);
+ map_load_visible_tiles (priv->map, view, priv->map_source, viewport);
}
static void
#include "champlain/champlain-view.h"
#include "champlain/champlain-enum-types.h"
#include "champlain/champlain-map-source.h"
+#include "champlain/champlain-settings.h"
#undef __CHAMPLAIN_CHAMPLAIN_H_INSIDE__