Add code for checking profile to support TV profile
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index 270adce..4576c70 100755 (executable)
@@ -23,6 +23,7 @@
 #include <vconf.h>
 #include <vconf-keys.h>
 #include <stdint.h>
+#include <system_info.h>
 
 #include "w-input-selector.h"
 #include "w-input-template.h"
@@ -48,6 +49,41 @@ static unsigned int g_template_item_size = 0;                /* Current Template item size */
 
 Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary
 
+tizen_profile_t _get_tizen_profile()
+{
+   static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+   if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+     return profile;
+
+   char *profileName;
+   system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+   switch (*profileName)
+     {
+      case 'm':
+      case 'M':
+         profile = TIZEN_PROFILE_MOBILE;
+         break;
+      case 'w':
+      case 'W':
+         profile = TIZEN_PROFILE_WEARABLE;
+         break;
+      case 't':
+      case 'T':
+         profile = TIZEN_PROFILE_TV;
+         break;
+      case 'i':
+      case 'I':
+         profile = TIZEN_PROFILE_IVI;
+         break;
+      default: // common or unknown ==> ALL ARE COMMON.
+         profile = TIZEN_PROFILE_COMMON;
+     }
+   free(profileName);
+
+   return profile;
+}
+
+
 void _init_app_data(App_Data* app_data);
 static void _app_language_changed(app_event_info_h event_info, void *user_data);
 
@@ -525,10 +561,10 @@ void _back_to_genlist_for_selector()
                reply_to_sender_by_callback(NULL, NULL);
                elm_exit();
        }
-
+#ifdef _WEARABLE
        Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
-
        eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+#endif
 }
 
 static void _item_realized(void *data, Evas_Object *obj, void *event_info) //called when list scrolled
@@ -543,12 +579,12 @@ Evas_Object* _create_genlist(Evas_Object* navi)
                return NULL;
 
        elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
-
+#ifdef _WEARABLE
        Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, app_data->circle_surface);
        eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
        evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
        eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
-
+#endif
        evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
@@ -791,8 +827,9 @@ bool _app_create(void* user_data)
        Evas_Object* conform = NULL;
        Evas_Object* bg = NULL;
        Evas_Object* window = NULL;
+#ifdef _WEARABLE
        Eext_Circle_Surface *surface;
-
+#endif
        if (!user_data) {
                return false;
        }
@@ -827,7 +864,9 @@ bool _app_create(void* user_data)
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
        conform = elm_conformant_add(window);
+#ifdef _WEARABLE
        surface = eext_circle_surface_conformant_add(conform);
+#endif
        evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
 
@@ -840,7 +879,9 @@ bool _app_create(void* user_data)
        app_data->win_main = window;
        app_data->conform = conform;
        app_data->layout_main = layout;
+#ifdef _WEARABLE
        app_data->circle_surface = surface;
+#endif
        app_data->app_type = APP_TYPE_SELECT_MODE;
 
        Evas_Object *naviframe = elm_naviframe_add(layout);