Merge "[Copy&Paste] remove "Paste" button when CBHM has no item"
[framework/uifw/elementary.git] / src / edje_externals / elm_map.c
index 3077cf2..d6ad0e0 100644 (file)
@@ -4,6 +4,7 @@
 
 typedef struct _Elm_Params_Map
 {
+   Elm_Params base;
    const char *map_source;
    const char *zoom_mode;
    double zoom;
@@ -13,9 +14,7 @@ typedef struct _Elm_Params_Map
 static const char *zoom_choices[] = {"manual", "auto fit", "auto fill", NULL};
 
 static const char *source_choices[] =
-  {"Mapnik", "Osmarender", "Cycle Map", "Maplint",
-   "Custom 1", "Custom 2", "Custom 3", "Custom 4",
-   "Custom 5", "Custom 6", "Custom 7"};
+  {"Mapnik", "Osmarender", "CycleMap", "Maplint"};
 
 static Elm_Map_Zoom_Mode
 _zoom_mode_get(const char *map_src)
@@ -25,26 +24,12 @@ _zoom_mode_get(const char *map_src)
    assert(sizeof(zoom_choices)/sizeof(zoom_choices[0]) ==
          ELM_MAP_ZOOM_MODE_LAST + 1);
 
-   for (i = 0; i < sizeof(zoom_choices); i++)
-     if (strcmp(map_src, zoom_choices[i]) == 0) return i;
+   for (i = 0; i < ELM_MAP_ZOOM_MODE_LAST; i++)
+     if (!strcmp(map_src, zoom_choices[i])) return i;
 
    return ELM_MAP_ZOOM_MODE_LAST;
 }
 
-static Elm_Map_Sources
-_map_source_get(const char *map_src)
-{
-   unsigned int i;
-
-   assert(sizeof(source_choices)/sizeof(source_choices[0]) ==
-         ELM_MAP_SOURCE_LAST);
-
-   for (i = 0; i < sizeof(source_choices); i++)
-     if (strcmp(map_src, source_choices[i]) == 0) return i;
-
-   return ELM_MAP_SOURCE_LAST;
-}
-
 static void
 external_map_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
 {
@@ -56,9 +41,7 @@ external_map_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from
 
    if (p->map_source)
      {
-       Elm_Map_Sources set = _map_source_get(p->map_source);
-       if (set == ELM_MAP_SOURCE_LAST) return;
-       elm_map_source_set(obj, set);
+       elm_map_source_name_set(obj, p->map_source);
      }
    if (p->zoom_mode)
      {
@@ -76,9 +59,7 @@ external_map_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Exter
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
          {
-            Elm_Map_Sources set = _map_source_get(param->s);
-            if (set == ELM_MAP_SOURCE_LAST) return EINA_FALSE;
-            elm_map_source_set(obj, set);
+            elm_map_source_name_set(obj, param->s);
             return EINA_TRUE;
          }
      }
@@ -114,9 +95,8 @@ external_map_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Exter
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
          {
-            Elm_Map_Sources set = elm_map_source_get(obj);
-            if (set == ELM_MAP_SOURCE_LAST) return EINA_FALSE;
-            param->s = source_choices[set];
+            const char *set = elm_map_source_name_get(obj);
+            param->s = set;
             return EINA_TRUE;
          }
      }
@@ -173,9 +153,9 @@ external_map_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, co
 }
 
 static Evas_Object *external_map_content_get(void *data __UNUSED__,
-               const Evas_Object *obj, const char *content)
+               const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
 {
-       ERR("so content");
+       ERR("No content.");
        return NULL;
 }
 
@@ -193,8 +173,8 @@ external_map_params_free(void *params)
 
 static Edje_External_Param_Info external_map_params[] =
   {
-    EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("map source", "Mapnik",
-                                        source_choices),
+    DEFINE_EXTERNAL_COMMON_PARAMS,
+    EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("map source", "Mapnik", source_choices),
     EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("zoom mode", "manual", zoom_choices),
     EDJE_EXTERNAL_PARAM_INFO_DOUBLE("zoom level"),
     EDJE_EXTERNAL_PARAM_INFO_SENTINEL