EAPI int elm_map_source_zoom_min_get(Elm_Map_Sources source);
EAPI int elm_map_source_zoom_max_get(Elm_Map_Sources source);
EAPI const char *elm_map_source_name_get(Elm_Map_Sources source);
+ EAPI void elm_map_user_agent_set(Evas_Object *obj, const char *user_agent) EINA_ARG_NONNULL(1, 2);
+ EAPI const char *elm_map_user_agent_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
/* smart callbacks called:
* "clicked" - when image clicked
* "press" - when mouse/finger held down initially on image
* @defgroup Map Map
* @ingroup Elementary
*
- * This is a widget specifically for displaying the free map OpenStreetMap.
+ * This is a widget specifically for displaying the map. It uses basically
+ * OpenStreetMap provider. but it can be added custom providers.
*
* Signals that you can add callbacks for are:
*
Eina_List *s_event_list;
int try_num;
int finish_num;
+
+ Eina_Hash *ua;
+ const char *user_agent;
};
struct _Mod_Api
else
{
DBG("DOWNLOAD %s \t in %s", source, buf2);
- ecore_file_download(source, buf2, _tile_downloaded, NULL, gi, &(gi->job));
+ ecore_file_download_full(source, buf2, _tile_downloaded, NULL, gi, &(gi->job), wd->ua);
if (!gi->job)
DBG("Can't start to download %s", buf);
else
if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator);
if (wd->long_timer) ecore_timer_del(wd->long_timer);
if ((wd->api) && (wd->api->obj_unhook)) wd->api->obj_unhook(obj);
+ if (wd->user_agent) eina_stringshare_del(wd->user_agent);
+ if (wd->ua) eina_hash_free(wd->ua);
free(wd);
}
return map_sources_tab[source].name;
}
+/**
+ * Set the user agent of the widget map.
+ *
+ * @param obj The map object
+ * @param user_agent the user agent of the widget map
+ *
+ * @ingroup Map
+ */
+EAPI void
+elm_map_user_agent_set(Evas_Object *obj, const char *user_agent)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if (!wd) return;
+ if (!wd->user_agent) wd->user_agent = eina_stringshare_add(user_agent);
+ else eina_stringshare_replace(&wd->user_agent, user_agent);
+
+ if (!wd->ua) wd->ua = eina_hash_string_small_new(NULL);
+ if (!eina_hash_find(wd->ua, "User-Agent")) eina_hash_add(wd->ua, "User-Agent", user_agent);
+ else eina_hash_set(wd->ua, "User-Agent", user_agent);
+}
+
+/**
+ * Get the user agent of the widget map.
+ *
+ * @param obj The map object
+ * @return The user agent of the widget map
+ *
+ * @ingroup Map
+ */
+EAPI const char *
+elm_map_user_agent_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if (!wd) return NULL;
+ return wd->user_agent;
+}
+
static char *
_mapnik_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom)