summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsegwon <segwon.han@samsung.com>2016-12-09 21:26:32 +0900
committersegwon <segwon.han@samsung.com>2016-12-09 21:28:25 +0900
commitefd736ee72bc3d3873e31a64d8df47ab80d53acf (patch)
tree11070cb38cbd865cb8ca77dd6f51fc6ac2152005 /src
parent5c7676e891535d389104eb660c446bd3bbbd1292 (diff)
downloadd2d-conv-setting-efd736ee72bc3d3873e31a64d8df47ab80d53acf.tar.gz
d2d-conv-setting-efd736ee72bc3d3873e31a64d8df47ab80d53acf.tar.bz2
d2d-conv-setting-efd736ee72bc3d3873e31a64d8df47ab80d53acf.zip
Signed-off-by: segwon <segwon.han@samsung.com> Change-Id: Iff26492fc193c4da28fe4aae14a9511bee803c3a
Diffstat (limited to 'src')
-rw-r--r--src/main.c57
-rw-r--r--src/ui/setting_home.c226
-rw-r--r--src/ui/setting_item_allowed_device_list.c281
-rw-r--r--src/ui/setting_item_denied_device_list.c281
-rw-r--r--src/ui/setting_item_device_list.c109
-rw-r--r--src/ui/setting_item_discovery.c340
-rw-r--r--src/ui/setting_item_sign.c62
7 files changed, 608 insertions, 748 deletions
diff --git a/src/main.c b/src/main.c
index 5e92872..255fd67 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,36 +16,54 @@
#include "main.h"
+static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ui_app_exit();
+}
+
static bool app_create(void *data)
{
/* Window */
ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
elm_win_conformant_set(ad->win, EINA_TRUE);
elm_win_autodel_set(ad->win, EINA_TRUE);
+
if (elm_win_wm_rotation_supported_get(ad->win)) {
int rots[4] = { 0, 90, 180, 270 };
elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
}
- evas_object_show(ad->win);
-
- /* Conformant */
- ad->conform = elm_conformant_add(ad->win);
- evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(ad->win, ad->conform);
- evas_object_show(ad->conform);
- /* Circle Surface */
- ad->circle_surface = eext_circle_surface_conformant_add(ad->conform);
-
- /* Naviframe */
- ad->nf = elm_naviframe_add(ad->conform);
- eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
- evas_object_size_hint_weight_set(ad->nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_content_set(ad->conform, ad->nf);
- evas_object_show(ad->nf);
+ evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+ {
+ /* Conformant */
+ ad->conform = elm_conformant_add(ad->win);
+ evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win, ad->conform);
+ {
+ /* Circle Surface */
+ ad->circle_surface = eext_circle_surface_conformant_add(ad->conform);
- /* Setting Menu */
- show_setting_menu(ad->nf);
+ /* Base Layout */
+ ad->layout = elm_layout_add(ad->conform);
+ evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_layout_theme_set(ad->layout, "layout", "application", "default");
+ {
+ /* Naviframe */
+ ad->nf = elm_naviframe_add(ad->layout);
+ eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ {
+ /* Setting Menu */
+ show_setting_home();
+ }
+ elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
+ evas_object_show(ad->nf);
+ }
+ elm_object_content_set(ad->conform, ad->layout);
+ evas_object_show(ad->layout);
+ }
+ evas_object_show(ad->conform);
+ }
+ evas_object_show(ad->win);
return true;
}
@@ -76,8 +94,9 @@ static void init_appdata()
{
ad->win = NULL;
ad->conform = NULL;
- ad->nf = NULL;
ad->circle_surface = NULL;
+ ad->layout = NULL;
+ ad->nf = NULL;
}
}
diff --git a/src/ui/setting_home.c b/src/ui/setting_home.c
index ac5b3a8..e141063 100644
--- a/src/ui/setting_home.c
+++ b/src/ui/setting_home.c
@@ -16,148 +16,186 @@
#include "main.h"
-#define MENU_SIZE 3
+static int tizen_connect_power_state = 0;
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+static Evas_Object *power_switch = NULL;
+static Elm_Object_Item *power_item = NULL;
+static Elm_Object_Item *notice_item = NULL;
+static Elm_Object_Item *acl_item_allowed = NULL;
+static Elm_Object_Item *acl_item_denied = NULL;
+static Elm_Object_Item *acl_item_available = NULL;
+
+static void notice_disable(Eina_Bool flag)
{
- do_haptic(50);
- ui_app_exit();
- return EINA_FALSE;
+ elm_object_item_disabled_set(notice_item, flag);
+}
+
+static void acl_list_disable(Eina_Bool flag)
+{
+ elm_object_item_disabled_set(acl_item_allowed, flag);
+ elm_object_item_disabled_set(acl_item_denied, flag);
+ elm_object_item_disabled_set(acl_item_available, flag);
}
-static void convergence_power_on()
+static void tizen_connect_power_on()
{
- int ret = conv_internal_set_activation_state(1);
+ acl_list_disable(EINA_FALSE);
+ notice_disable(EINA_TRUE);
+
+ tizen_connect_power_state = 1;
+ int ret = conv_internal_set_activation_state(tizen_connect_power_state);
if (ret != CONV_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "convergence_power_on error. ret = %d", ret);
+ dlog_print(DLOG_ERROR, LOG_TAG, "tizen_connect_power_on error. ret = %d", ret);
}
}
-static void convergence_power_off()
+static void tizen_connect_power_off()
{
+ acl_list_disable(EINA_TRUE);
+ notice_disable(EINA_FALSE);
+
+ tizen_connect_power_state = 0;
int ret = conv_internal_set_activation_state(0);
if (ret != CONV_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "convergence_power_off error. ret = %d", ret);
+ dlog_print(DLOG_ERROR, LOG_TAG, "tizen_connect_power_off error. ret = %d", ret);
}
}
-extern int get_convergence_power_state()
+static int get_tizen_connect_power_state()
{
int state = 0;
int ret = conv_internal_get_activation_state(&state);
if (ret != CONV_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "get_convergence_power_state error. ret = %d", ret);
+ dlog_print(DLOG_ERROR, LOG_TAG, "get_tizen_connect_power_state error. ret = %d", ret);
}
return state;
}
-typedef struct menu_info {
- int index;
- Elm_Object_Item *item;
- char *text;
- char *subtext;
-} menu_info_s;
-
-static menu_info_s **menu_info = NULL;
+static void power_switch_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ dlog_print(DLOG_INFO, LOG_TAG, "power_switch_clicked_cb()");
+
+ switch (get_tizen_connect_power_state()) {
+ case 0 :
+ tizen_connect_power_on();
+ break;
+ case 1 :
+ tizen_connect_power_off();
+ break;
+ }
+}
-static char *text_get_cb(void *data, Evas_Object *obj, const char *part)
+static Evas_Object *power_state_check_get(void *data, Evas_Object *obj, const char *part)
{
- int index = *(int*)data;
-
- if (!strcmp(part, "elm.text")) {
- if (menu_info[index]->text == NULL){
- return NULL;
- }
- return strdup((char*)menu_info[index]->text);
-
- } else if (!strcmp(part, "elm.text.1")) {
-
- if (get_convergence_power_state() == 0) {
- menu_info[index]->subtext = "off";
- } else {
- menu_info[index]->subtext = "on";
- }
- return strdup((char*)menu_info[index]->subtext);
+ if (strcmp(part, "elm.swallow.center_check")) {
+ power_switch = elm_check_add(obj);
+ elm_check_state_set(power_switch, EINA_FALSE);
+ evas_object_smart_callback_add(power_switch, "changed", power_switch_clicked_cb, NULL);
+ evas_object_show(power_switch);
+ return power_switch;
}
return NULL;
}
-static void menu_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
+static char *menu_text_get(void *data, Evas_Object *obj, const char *part)
{
- int index = *(int*)data;
-
- if(index == 3) {
- return;
- }
+ char *text = (char *)data;
+ return strdup(text);
+}
+static void menu_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
do_haptic(50);
- if (index == 0) {
- if (get_convergence_power_state() == 0) {
- convergence_power_on();
- } else {
- convergence_power_off();
- }
- elm_genlist_item_update(menu_info[index]->item);
-
- } else if (index == 1) {
- show_setting_item_device_list();
-
- } else if (index == 2) {
+ char *item = (char *) data;
+ if (!strcmp(item, NOTICE_TITLE_TEXT)) {
show_setting_item_sign();
- }
+ } else if (!strcmp(item, DEVICE_LIST_TEXT_ALLOWED)) {
+ show_setting_item_allowed_device_list();
+ } else if (!strcmp(item, DEVICE_LIST_TEXT_DENIED)) {
+ show_setting_item_denied_device_list();
+ } else if (!strcmp(item, DEVICE_LIST_TEXT_AVAILABLE)) {
+ show_setting_item_discovery();
+ }
}
-static void menu_item_append(Elm_Genlist_Item_Class *item_builder, Evas_Object *genlist, char *text, int index)
+static void gl_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
- menu_info[index] = (menu_info_s *)calloc(sizeof(menu_info_s), 1);
- {
- menu_info[index]->index = index;
- menu_info[index]->text = text;
- menu_info[index]->item = elm_genlist_item_append(genlist, item_builder, &(menu_info[index]->index), NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, &(menu_info[index]->index));
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+}
+
+static void gl_realized_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ dlog_print(DLOG_INFO, LOG_TAG, "gl_realized_cb");
+
+ switch (tizen_connect_power_state) {
+ case 0 :
+ elm_check_state_set(power_switch, EINA_FALSE);
+ acl_list_disable(EINA_TRUE);
+ notice_disable(EINA_FALSE);
+ break;
+ case 1 :
+ elm_check_state_set(power_switch, EINA_TRUE);
+ acl_list_disable(EINA_FALSE);
+ notice_disable(EINA_TRUE);
+ break;
}
}
-extern void show_setting_menu()
+static Eina_Bool show_setting_home_pop_cb(void *data, Elm_Object_Item *it)
+{
+ ui_app_exit();
+ return EINA_FALSE;
+}
+
+extern void show_setting_home()
{
- menu_info = (menu_info_s **)calloc(sizeof(menu_info_s *), MENU_SIZE);
+ tizen_connect_power_state = get_tizen_connect_power_state();
- Evas_Object *menu = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(menu, ELM_LIST_COMPRESS);
+ Evas_Object *genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(genlist, "select", gl_selected_cb, NULL);
+ evas_object_smart_callback_add(genlist, "realized", gl_realized_cb, NULL);
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(menu, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
{
- Elm_Genlist_Item_Class *style_1text_item_builder = elm_genlist_item_class_new();
- {
- style_1text_item_builder->item_style = "1text";
- style_1text_item_builder->func.text_get = text_get_cb;
- }
-
- Elm_Genlist_Item_Class *style_2text_item_builder = elm_genlist_item_class_new();
- {
- style_2text_item_builder->item_style = "2text";
- style_2text_item_builder->func.text_get = text_get_cb;
- }
-
- if(get_convergence_power_state() == 0){
- menu_item_append(style_2text_item_builder, menu, "Power", 0);
- } else {
- menu_item_append(style_2text_item_builder, menu, "Power", 0);
- }
-
- menu_item_append(style_1text_item_builder, menu, ACCESS_CONTROL_TEXT, 1);
- menu_item_append(style_1text_item_builder, menu, NOTICE_TEXT, 2);
- menu_item_append(style_1text_item_builder, menu, NULL, 3);
-
- elm_genlist_item_class_free(style_1text_item_builder);
- elm_genlist_item_class_free(style_2text_item_builder);
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(genlist, menu_title_item_builder, TITLE_TEXT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ elm_genlist_item_class_free(menu_title_item_builder);
+ /* power_menu_item */
+ Elm_Genlist_Item_Class *power_state_item_builder = elm_genlist_item_class_new();
+ {
+ power_state_item_builder->item_style = "1text.1icon.1";
+ power_state_item_builder->func.text_get = menu_text_get;
+ power_state_item_builder->func.content_get = power_state_check_get;
+ power_item = elm_genlist_item_append(genlist, power_state_item_builder, TITLE_TEXT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(power_item, ELM_OBJECT_SELECT_MODE_NONE);
+ }
+ elm_genlist_item_class_free(power_state_item_builder);
+
+ /* menu_item */
+ Elm_Genlist_Item_Class *menu_item_builder = elm_genlist_item_class_new();
+ {
+ menu_item_builder->item_style = "1text";
+ menu_item_builder->func.text_get = menu_text_get;
+ notice_item = elm_genlist_item_append(genlist, menu_item_builder, NOTICE_TITLE_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, NOTICE_TITLE_TEXT);
+ acl_item_allowed = elm_genlist_item_append(genlist, menu_item_builder, DEVICE_LIST_TEXT_ALLOWED, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, DEVICE_LIST_TEXT_ALLOWED);
+ acl_item_denied = elm_genlist_item_append(genlist, menu_item_builder, DEVICE_LIST_TEXT_DENIED, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, DEVICE_LIST_TEXT_DENIED);
+ acl_item_available = elm_genlist_item_append(genlist, menu_item_builder, DEVICE_LIST_TEXT_AVAILABLE, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, DEVICE_LIST_TEXT_AVAILABLE);
+ elm_genlist_item_append(genlist, menu_item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); // For bottom space
}
- evas_object_show(menu);
+ elm_genlist_item_class_free(menu_item_builder);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, menu, NULL);
- elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, show_setting_home_pop_cb, NULL);
} \ No newline at end of file
diff --git a/src/ui/setting_item_allowed_device_list.c b/src/ui/setting_item_allowed_device_list.c
index 03b412d..262a521 100644
--- a/src/ui/setting_item_allowed_device_list.c
+++ b/src/ui/setting_item_allowed_device_list.c
@@ -16,148 +16,144 @@
#include "main.h"
-static Elm_Genlist_Item_Class *item_builder = NULL;
-static Evas_Object *allowed_list = NULL;
+static Evas_Object *genlist = NULL;
+static Elm_Genlist_Item_Class *device_list_item_builder = NULL;
+static Elm_Object_Item *title_item = NULL;
-static int allowed_devices_index = -1;
-static device_info_s **allowed_devices_info = NULL;
-
-static Evas_Object *allowed_deivce_selected_menu = NULL;
+static int devices_index = -1;
+static device_info_s **devices_info = NULL;
static device_info_s *selected_device = NULL;
-static Evas_Object *popup = NULL;
-
-static void cancel_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+static void device_info_free()
{
- evas_object_del(popup);
-}
+ devices_index = -1;
-static void ok_btn_click_event(void *data, Evas_Object *obj, void *event_info)
-{
- do_haptic(50);
-
- char *type = (char *)data;
- if (!strcmp("Remove", type)) {
- conv_internal_remove_acl_device(selected_device->mac_address);
- } else if (!strcmp("Deny", type)) {
- conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ int index;
+ if (devices_info != NULL) {
+ for (index = 0; index < STORAGE_SIZE; index++) {
+ if(devices_info[index] == NULL) break;
+ free(devices_info[index]);
+ devices_info[index] = NULL;
+ }
+ free(devices_info);
+ devices_info = NULL;
}
+}
- evas_object_del(popup);
+static void selected_device_free()
+{
+ free(selected_device);
+ selected_device = NULL;
}
-static void show_popup(char *type)
+static char *menu_text_get(void *data, Evas_Object *obj, const char *part)
{
- popup = elm_popup_add(ad->win);
- elm_object_style_set(popup, "circle");
- evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *layout = elm_layout_add(popup);
- elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2");
- {
- elm_object_part_text_set(layout, "elm.text.title", "Access Control");
-
- char text[1000];
- if (!strcmp("Remove", type)) {
- snprintf(text, sizeof(text), "%s '%s'?", REMOVE_SELECT_POPUP_TEXT, selected_device->name);
- } else if (!strcmp("Deny", type)) {
- snprintf(text, sizeof(text), "%s '%s'?", DENY_SELECT_POPUP_TEXT, selected_device->name);
- }
-
- elm_object_part_text_set(layout, "elm.text", text);
- elm_object_content_set(popup, layout);
- }
+ char *text = (char *)data;
+ return strdup(text);
+}
- Evas_Object *cancel_btn = elm_button_add(popup);
- elm_object_style_set(cancel_btn, "popup/circle/left");
- evas_object_size_hint_weight_set(cancel_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *cancel_btn_icon = elm_image_add(cancel_btn);
- elm_image_file_set(cancel_btn_icon, ICON_DIR"/popup_btn_cancel.png", NULL);
- evas_object_size_hint_weight_set(cancel_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(cancel_btn, "elm.swallow.content", cancel_btn_icon);
- evas_object_show(cancel_btn_icon);
- }
- elm_object_part_content_set(popup, "button1", cancel_btn);
- evas_object_smart_callback_add(cancel_btn, "clicked", cancel_btn_click_event, type);
-
- Evas_Object *ok_btn = elm_button_add(popup);
- elm_object_style_set(ok_btn, "popup/circle/right");
- evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *ok_btn_icon = elm_image_add(ok_btn);
- elm_image_file_set(ok_btn_icon, ICON_DIR"/popup_btn_check.png", NULL);
- evas_object_size_hint_weight_set(ok_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(ok_btn, "elm.swallow.content", ok_btn_icon);
- evas_object_show(ok_btn_icon);
- }
- elm_object_part_content_set(popup, "button2", ok_btn);
- evas_object_smart_callback_add(ok_btn, "clicked", ok_btn_click_event, type);
- }
- evas_object_show(popup);
+static void gl_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
}
static void set_acl_device_list();
-
-static Eina_Bool allowed_deivce_selected_menu_popup_cb(void *data, Elm_Object_Item *it)
+static void genlist_init();
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
{
do_haptic(50);
- elm_genlist_clear(allowed_list);
- set_acl_device_list();
+
+ char *type = (char *)data;
+ if (!strcmp(type, NAVI_FRAME_PARENT)) {
+ device_info_free();
+ } else if (!strcmp(type, NAVI_FRAME_CHILD)) {
+ selected_device_free();
+ genlist_init();
+ set_acl_device_list();
+ }
return EINA_TRUE;
}
-static void allowed_deivce_selected_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
+static void acl_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
- do_haptic(50);
char *type = (char *)data;
- show_popup(type);
+ if (!strcmp(type, ACL_REMOVE)) {
+ conv_internal_remove_acl_device(selected_device->mac_address);
+ } else if (!strcmp(type, ACL_DENY)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ }
+ elm_naviframe_item_pop(ad->nf);
}
-static char *selected_menu_text_get_cb(void *data, Evas_Object *obj, const char *part)
+static void show_acl_menu(void *data, Evas_Object *obj, void *event_info)
{
- if((char*)data == NULL) return NULL;
- return strdup((char*)data);
-}
+ do_haptic(50);
-static void show_allowed_device_selected_popup(void *data, Evas_Object *obj, void *event_info)
-{
device_info_s *info = (device_info_s *)data;
selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
selected_device->index = info->index;
- selected_device->list_type = info->list_type;
selected_device->name = info->name;
selected_device->type = info->type;
selected_device->mac_address = info->mac_address;
- allowed_deivce_selected_menu = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(allowed_deivce_selected_menu, ELM_LIST_COMPRESS);
+ Evas_Object *inner_genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(inner_genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(inner_genlist, "select", gl_selected_cb, NULL);
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(allowed_deivce_selected_menu, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(inner_genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
{
- Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "1text";
- item_builder->func.text_get = selected_menu_text_get_cb;
- }
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(inner_genlist, menu_title_item_builder, POPUP_TITLE_TEXT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ elm_genlist_item_class_free(menu_title_item_builder);
- elm_genlist_item_append(allowed_deivce_selected_menu, item_builder, REMOVE_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, allowed_deivce_selected_menu_selected_cb, "Remove");
- elm_genlist_item_append(allowed_deivce_selected_menu, item_builder, DENY_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, allowed_deivce_selected_menu_selected_cb, "Deny");
- elm_genlist_item_class_free(item_builder);
+ /* acl menu */
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_REMOVE, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_REMOVE);
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_DENY, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_DENY);
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_CANCEL, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_CANCEL);
+ elm_genlist_item_append(inner_genlist, item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
- evas_object_show(allowed_deivce_selected_menu);
+ elm_genlist_item_class_free(item_builder);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ACCESS_CONTROL_TEXT, NULL, NULL, allowed_deivce_selected_menu, NULL);
- elm_naviframe_item_pop_cb_set(it, allowed_deivce_selected_menu_popup_cb, NULL);
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, inner_genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NAVI_FRAME_CHILD);
}
-static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
+static void get_acl_list_foreach_cb(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "text_get_cb part = %s", part);
+ if(access_control_state == 0) {
+ int index = ++devices_index;
+ devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ devices_info[index]->index = index;
+ devices_info[index]->name = strdup(device_name);
+ devices_info[index]->type = strdup(device_type);
+ devices_info[index]->mac_address = strdup(mac_address);
+ elm_genlist_item_insert_after(genlist, device_list_item_builder, devices_info[index], NULL, title_item, ELM_GENLIST_ITEM_NONE, show_acl_menu, devices_info[index]);
+ }
+}
+
+static void set_acl_device_list()
+{
+ device_info_free();
+ devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
+
+ conv_internal_get_acl_list(get_acl_list_foreach_cb, NULL);
+}
+static char* device_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
device_info_s *info = (device_info_s *)data;
if (!strcmp(part, "elm.text")) {
@@ -171,10 +167,8 @@ static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
return NULL;
}
-static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
+static Evas_Object* device_icon_get_cb(void *data, Evas_Object *obj, const char *part)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "content_get_cb part = %s", part);
-
device_info_s *info = (device_info_s *)data;
if (!strcmp(part, "elm.icon")) {
@@ -203,72 +197,53 @@ static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *par
}
}
-static void acl_device_info(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data)
+static void genlist_init()
{
- if(access_control_state == 0) {
- int index = ++allowed_devices_index;
- allowed_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
- allowed_devices_info[index]->list_type = LIST_TYPE_PERMITTED;
- allowed_devices_info[index]->index = index;
- allowed_devices_info[index]->name = strdup(device_name);
- allowed_devices_info[index]->type = strdup(device_type);
- allowed_devices_info[index]->mac_address = strdup(mac_address);
-
- elm_genlist_item_append(allowed_list, item_builder, allowed_devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_allowed_device_selected_popup, allowed_devices_info[index]);
- }
-}
-
-static void set_acl_device_list()
-{
- int index;
+ if (genlist == NULL) return;
- if (allowed_devices_info != NULL) {
+ elm_genlist_clear(genlist);
- for (index = 0; index < STORAGE_SIZE; index++) {
- if(allowed_devices_info[index] == NULL) break;
- free(allowed_devices_info[index]);
- allowed_devices_info[index] = NULL;
- }
-
- free(allowed_devices_info);
- allowed_devices_info = NULL;
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
+ {
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ title_item = elm_genlist_item_append(genlist, menu_title_item_builder, DEVICE_LIST_TEXT_ALLOWED, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
-
- allowed_devices_index = -1;
- allowed_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
-
- conv_internal_get_acl_list(acl_device_info, NULL);
-}
+ elm_genlist_item_class_free(menu_title_item_builder);
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
-{
- do_haptic(50);
- return EINA_TRUE;
+ /* empty space menu */
+ Elm_Genlist_Item_Class *empty_space_item_builder = elm_genlist_item_class_new();
+ {
+ empty_space_item_builder->item_style = "1text";
+ empty_space_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(genlist, empty_space_item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ elm_genlist_item_class_free(empty_space_item_builder);
}
extern void show_setting_item_allowed_device_list()
{
- selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(genlist, "select", gl_selected_cb, NULL);
- allowed_list = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(allowed_list, ELM_LIST_COMPRESS);
-
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(allowed_list, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+
+ genlist_init();
+
+ /* device list */
+ device_list_item_builder = elm_genlist_item_class_new();
{
- item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "2text.1icon.divider";
- item_builder->func.text_get = text_get_cb;
- item_builder->func.content_get = content_get_cb;
- }
+ device_list_item_builder->item_style = "2text.1icon.divider";
+ device_list_item_builder->func.text_get = device_text_get_cb;
+ device_list_item_builder->func.content_get = device_icon_get_cb;
}
- evas_object_show(allowed_list);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ALLOWED_DEVICE_LIST_TEXT, NULL, NULL, allowed_list, NULL);
- elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NAVI_FRAME_PARENT);
set_acl_device_list();
-}
-
+} \ No newline at end of file
diff --git a/src/ui/setting_item_denied_device_list.c b/src/ui/setting_item_denied_device_list.c
index 21852c2..d317985 100644
--- a/src/ui/setting_item_denied_device_list.c
+++ b/src/ui/setting_item_denied_device_list.c
@@ -16,148 +16,144 @@
#include "main.h"
-static Elm_Genlist_Item_Class *item_builder = NULL;
-static Evas_Object *denied_list = NULL;
+static Evas_Object *genlist = NULL;
+static Elm_Genlist_Item_Class *device_list_item_builder = NULL;
+static Elm_Object_Item *title_item = NULL;
-static int denied_devices_index = -1;
-static device_info_s **denied_devices_info = NULL;
-
-static Evas_Object *denied_deivce_selected_menu = NULL;
+static int devices_index = -1;
+static device_info_s **devices_info = NULL;
static device_info_s *selected_device = NULL;
-static Evas_Object *popup = NULL;
-
-static void cancel_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+static void device_info_free()
{
- evas_object_del(popup);
-}
+ devices_index = -1;
-static void ok_btn_click_event(void *data, Evas_Object *obj, void *event_info)
-{
- do_haptic(50);
-
- char *type = (char *)data;
- if (!strcmp("Remove", type)) {
- conv_internal_remove_acl_device(selected_device->mac_address);
- } else if (!strcmp("Allow", type)) {
- conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ int index;
+ if (devices_info != NULL) {
+ for (index = 0; index < STORAGE_SIZE; index++) {
+ if(devices_info[index] == NULL) break;
+ free(devices_info[index]);
+ devices_info[index] = NULL;
+ }
+ free(devices_info);
+ devices_info = NULL;
}
+}
- evas_object_del(popup);
+static void selected_device_free()
+{
+ free(selected_device);
+ selected_device = NULL;
}
-static void show_popup(char *type)
+static char *menu_text_get(void *data, Evas_Object *obj, const char *part)
{
- popup = elm_popup_add(ad->win);
- elm_object_style_set(popup, "circle");
- evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *layout = elm_layout_add(popup);
- elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2");
- {
- elm_object_part_text_set(layout, "elm.text.title", "Access Control");
-
- char text[1000];
- if (!strcmp("Remove", type)) {
- snprintf(text, sizeof(text), "%s '%s'?", REMOVE_SELECT_POPUP_TEXT, selected_device->name);
- } else if (!strcmp("Allow", type)) {
- snprintf(text, sizeof(text), "%s '%s'?", ALLOW_SELECT_POPUP_TEXT, selected_device->name);
- }
-
- elm_object_part_text_set(layout, "elm.text", text);
- elm_object_content_set(popup, layout);
- }
+ char *text = (char *)data;
+ return strdup(text);
+}
- Evas_Object *cancel_btn = elm_button_add(popup);
- elm_object_style_set(cancel_btn, "popup/circle/left");
- evas_object_size_hint_weight_set(cancel_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *cancel_btn_icon = elm_image_add(cancel_btn);
- elm_image_file_set(cancel_btn_icon, ICON_DIR"/popup_btn_cancel.png", NULL);
- evas_object_size_hint_weight_set(cancel_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(cancel_btn, "elm.swallow.content", cancel_btn_icon);
- evas_object_show(cancel_btn_icon);
- }
- elm_object_part_content_set(popup, "button1", cancel_btn);
- evas_object_smart_callback_add(cancel_btn, "clicked", cancel_btn_click_event, type);
-
- Evas_Object *ok_btn = elm_button_add(popup);
- elm_object_style_set(ok_btn, "popup/circle/right");
- evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *ok_btn_icon = elm_image_add(ok_btn);
- elm_image_file_set(ok_btn_icon, ICON_DIR"/popup_btn_check.png", NULL);
- evas_object_size_hint_weight_set(ok_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(ok_btn, "elm.swallow.content", ok_btn_icon);
- evas_object_show(ok_btn_icon);
- }
- elm_object_part_content_set(popup, "button2", ok_btn);
- evas_object_smart_callback_add(ok_btn, "clicked", ok_btn_click_event, type);
- }
- evas_object_show(popup);
+static void gl_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
}
static void set_acl_device_list();
-
-static Eina_Bool denied_deivce_selected_menu_popup_cb(void *data, Elm_Object_Item *it)
+static void genlist_init();
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
{
do_haptic(50);
- elm_genlist_clear(denied_list);
- set_acl_device_list();
+
+ char *type = (char *)data;
+ if (!strcmp(type, NAVI_FRAME_PARENT)) {
+ device_info_free();
+ } else if (!strcmp(type, NAVI_FRAME_CHILD)) {
+ selected_device_free();
+ genlist_init();
+ set_acl_device_list();
+ }
return EINA_TRUE;
}
-static void denied_deivce_selected_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
+static void acl_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
- do_haptic(50);
char *type = (char *)data;
- show_popup(type);
+ if (!strcmp(type, ACL_REMOVE)) {
+ conv_internal_remove_acl_device(selected_device->mac_address);
+ } else if (!strcmp(type, ACL_ALLOW)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 0);
+ }
+ elm_naviframe_item_pop(ad->nf);
}
-static char *selected_menu_text_get_cb(void *data, Evas_Object *obj, const char *part)
+static void show_acl_menu(void *data, Evas_Object *obj, void *event_info)
{
- if((char*)data == NULL) return NULL;
- return strdup((char*)data);
-}
+ do_haptic(50);
-static void show_denied_device_selected_popup(void *data, Evas_Object *obj, void *event_info)
-{
device_info_s *info = (device_info_s *)data;
selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
selected_device->index = info->index;
- selected_device->list_type = info->list_type;
selected_device->name = info->name;
selected_device->type = info->type;
selected_device->mac_address = info->mac_address;
- denied_deivce_selected_menu = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(denied_deivce_selected_menu, ELM_LIST_COMPRESS);
+ Evas_Object *inner_genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(inner_genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(inner_genlist, "select", gl_selected_cb, NULL);
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(denied_deivce_selected_menu, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(inner_genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
{
- Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "1text";
- item_builder->func.text_get = selected_menu_text_get_cb;
- }
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(inner_genlist, menu_title_item_builder, POPUP_TITLE_TEXT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ elm_genlist_item_class_free(menu_title_item_builder);
- elm_genlist_item_append(denied_deivce_selected_menu, item_builder, REMOVE_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, denied_deivce_selected_menu_selected_cb, "Remove");
- elm_genlist_item_append(denied_deivce_selected_menu, item_builder, ALLOW_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, denied_deivce_selected_menu_selected_cb, "Allow");
- elm_genlist_item_class_free(item_builder);
+ /* acl menu */
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_REMOVE, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_REMOVE);
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_ALLOW, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_ALLOW);
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_CANCEL, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_CANCEL);
+ elm_genlist_item_append(inner_genlist, item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
- evas_object_show(denied_deivce_selected_menu);
+ elm_genlist_item_class_free(item_builder);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ACCESS_CONTROL_TEXT, NULL, NULL, denied_deivce_selected_menu, NULL);
- elm_naviframe_item_pop_cb_set(it, denied_deivce_selected_menu_popup_cb, NULL);
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, inner_genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NAVI_FRAME_CHILD);
}
-static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
+static void get_acl_list_foreach_cb(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "text_get_cb part = %s", part);
+ if(access_control_state == 1) {
+ int index = ++devices_index;
+ devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ devices_info[index]->index = index;
+ devices_info[index]->name = strdup(device_name);
+ devices_info[index]->type = strdup(device_type);
+ devices_info[index]->mac_address = strdup(mac_address);
+ elm_genlist_item_insert_after(genlist, device_list_item_builder, devices_info[index], NULL, title_item, ELM_GENLIST_ITEM_NONE, show_acl_menu, devices_info[index]);
+ }
+}
+
+static void set_acl_device_list()
+{
+ device_info_free();
+ devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
+
+ conv_internal_get_acl_list(get_acl_list_foreach_cb, NULL);
+}
+static char* device_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
device_info_s *info = (device_info_s *)data;
if (!strcmp(part, "elm.text")) {
@@ -171,10 +167,8 @@ static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
return NULL;
}
-static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
+static Evas_Object* device_icon_get_cb(void *data, Evas_Object *obj, const char *part)
{
- dlog_print(DLOG_ERROR, LOG_TAG, "content_get_cb part = %s", part);
-
device_info_s *info = (device_info_s *)data;
if (!strcmp(part, "elm.icon")) {
@@ -203,72 +197,53 @@ static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *par
}
}
-static void acl_device_info(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data)
+static void genlist_init()
{
- if(access_control_state == 1) {
- int index = ++denied_devices_index;
- denied_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
- denied_devices_info[index]->list_type = LIST_TYPE_DENIED;
- denied_devices_info[index]->index = index;
- denied_devices_info[index]->name = strdup(device_name);
- denied_devices_info[index]->type = strdup(device_type);
- denied_devices_info[index]->mac_address = strdup(mac_address);
-
- elm_genlist_item_append(denied_list, item_builder, denied_devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_denied_device_selected_popup, denied_devices_info[index]);
- }
-}
+ if (genlist == NULL) return;
-static void set_acl_device_list()
-{
- int index;
+ elm_genlist_clear(genlist);
- if (denied_devices_info != NULL) {
-
- for (index = 0; index < STORAGE_SIZE; index++) {
- if(denied_devices_info[index] == NULL) break;
- free(denied_devices_info[index]);
- denied_devices_info[index] = NULL;
- }
-
- free(denied_devices_info);
- denied_devices_info = NULL;
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
+ {
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ title_item = elm_genlist_item_append(genlist, menu_title_item_builder, DEVICE_LIST_TEXT_DENIED, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
-
- denied_devices_index = -1;
- denied_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
-
- conv_internal_get_acl_list(acl_device_info, NULL);
-}
+ elm_genlist_item_class_free(menu_title_item_builder);
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
-{
- do_haptic(50);
- return EINA_TRUE;
+ /* empty space menu */
+ Elm_Genlist_Item_Class *empty_space_item_builder = elm_genlist_item_class_new();
+ {
+ empty_space_item_builder->item_style = "1text";
+ empty_space_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(genlist, empty_space_item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ elm_genlist_item_class_free(empty_space_item_builder);
}
extern void show_setting_item_denied_device_list()
{
- selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(genlist, "select", gl_selected_cb, NULL);
- denied_list = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(denied_list, ELM_LIST_COMPRESS);
-
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(denied_list, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+
+ genlist_init();
+
+ /* device list */
+ device_list_item_builder = elm_genlist_item_class_new();
{
- item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "2text.1icon.divider";
- item_builder->func.text_get = text_get_cb;
- item_builder->func.content_get = content_get_cb;
- }
+ device_list_item_builder->item_style = "2text.1icon.divider";
+ device_list_item_builder->func.text_get = device_text_get_cb;
+ device_list_item_builder->func.content_get = device_icon_get_cb;
}
- evas_object_show(denied_list);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, DENIED_DEVICE_LIST_TEXT, NULL, NULL, denied_list, NULL);
- elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NAVI_FRAME_PARENT);
set_acl_device_list();
-}
-
+} \ No newline at end of file
diff --git a/src/ui/setting_item_device_list.c b/src/ui/setting_item_device_list.c
deleted file mode 100644
index 0c78567..0000000
--- a/src/ui/setting_item_device_list.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "main.h"
-
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
-{
- do_haptic(50);
- return EINA_TRUE;
-}
-
-static char *text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- if((char*)data == NULL) return NULL;
- return strdup((char*)data);
-}
-
-static void menu_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
-{
- char *menu = (char*)data;
-
- if(menu == NULL) return;
-
- do_haptic(50);
-
- if (!strcmp(ALLOWED_DEVICE_LIST_TEXT, menu)) {
- show_setting_item_allowed_device_list();
- } else if (!strcmp(DENIED_DEVICE_LIST_TEXT, menu)) {
- show_setting_item_denied_device_list();
- } else if (!strcmp(AVAILABLE_DEVICE_LIST_TEXT, menu)) {
- show_setting_item_discovery();
- }
-}
-
-extern void show_setting_item_device_list()
-{
- Elm_Object_Item *it = NULL;
-
- if(get_convergence_power_state() == 0){
-
- Evas_Object *box = elm_box_add(ad->nf);
- elm_box_horizontal_set(box, EINA_FALSE);
- {
- Evas_Object *scroller = elm_scroller_add(box);
- evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_object_style_set(scroller, "effect");
- {
- char buf[1024];
- snprintf(buf, sizeof(buf), "<align=center><br>%s<br></align>", TURN_ON_THE_POWER_TEXT);
-
- Evas_Object *sign_item = elm_label_add(scroller);
- elm_object_text_set(sign_item, buf);
- evas_object_size_hint_weight_set(sign_item, 0.5, 0.5);
- elm_label_line_wrap_set(sign_item, ELM_WRAP_WORD);
- // elm_label_wrap_width_set(sign_item, 200);
- // evas_object_size_hint_min_set(sign_item, 100, 100);
- elm_object_content_set(scroller, sign_item);
- }
- evas_object_show(scroller);
- elm_box_pack_end(box, scroller);
- }
- evas_object_show(box);
-
- it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, box, NULL);
-
- } else {
-
- Evas_Object *menu = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(menu, ELM_LIST_COMPRESS);
-
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(menu, ad->circle_surface);
- eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
- {
- Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "1text";
- item_builder->func.text_get = text_get_cb;
- }
-
- elm_genlist_item_append(menu, item_builder, ALLOWED_DEVICE_LIST_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, ALLOWED_DEVICE_LIST_TEXT);
- elm_genlist_item_append(menu, item_builder, DENIED_DEVICE_LIST_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, DENIED_DEVICE_LIST_TEXT);
- elm_genlist_item_append(menu, item_builder, AVAILABLE_DEVICE_LIST_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, AVAILABLE_DEVICE_LIST_TEXT);
- elm_genlist_item_append(menu, item_builder, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
-
- elm_genlist_item_class_free(item_builder);
- }
- evas_object_show(menu);
-
- it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, menu, NULL);
- }
-
- elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
-}
diff --git a/src/ui/setting_item_discovery.c b/src/ui/setting_item_discovery.c
index 45e911d..fe8d1a2 100644
--- a/src/ui/setting_item_discovery.c
+++ b/src/ui/setting_item_discovery.c
@@ -20,107 +20,82 @@
static conv_h conv_handle = NULL;
-static Elm_Genlist_Item_Class *item_builder = NULL;
-static Evas_Object *discovered_list = NULL;
+static Evas_Object *genlist = NULL;
+static Elm_Genlist_Item_Class *device_list_item_builder = NULL;
+static Elm_Object_Item *title_item = NULL;
-static int discovered_devices_index = -1;
-static device_info_s **discovered_devices_info = NULL;
-
-static Evas_Object *discovery_deivce_selected_menu = NULL;
+static int devices_index = -1;
+static device_info_s **devices_info = NULL;
static device_info_s *selected_device = NULL;
-static Evas_Object *popup = NULL;
-
-static void cancel_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+static void device_info_free()
{
- evas_object_del(popup);
+ devices_index = -1;
+
+ int index;
+ if (devices_info != NULL) {
+ for (index = 0; index < STORAGE_SIZE; index++) {
+ if(devices_info[index] == NULL) break;
+ free(devices_info[index]);
+ devices_info[index] = NULL;
+ }
+ free(devices_info);
+ devices_info = NULL;
+ }
}
-static void ok_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+static void selected_device_free()
{
- do_haptic(50);
-
- char *type = (char *)data;
- if (!strcmp("Allow", type)) {
- conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 0);
- } else if (!strcmp("Deny", type)) {
- conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
- }
-
- evas_object_del(popup);
+ free(selected_device);
+ selected_device = NULL;
}
-static void show_popup(char *type)
+static char *menu_text_get(void *data, Evas_Object *obj, const char *part)
{
- popup = elm_popup_add(ad->win);
- elm_object_style_set(popup, "circle");
- evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *layout = elm_layout_add(popup);
- elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2");
- {
- elm_object_part_text_set(layout, "elm.text.title", ACCESS_CONTROL_TEXT);
-
- char text[1000];
- if (!strcmp("Allow", type)) {
- snprintf(text, sizeof(text), "%s '%s'?", ALLOW_SELECT_POPUP_TEXT, selected_device->name);
- } else if (!strcmp("Deny", type)) {
- snprintf(text, sizeof(text), "%s '%s'?", DENY_SELECT_POPUP_TEXT, selected_device->name);
- }
-
- elm_object_part_text_set(layout, "elm.text", text);
- elm_object_content_set(popup, layout);
- }
+ char *text = (char *)data;
+ return strdup(text);
+}
- Evas_Object *cancel_btn = elm_button_add(popup);
- elm_object_style_set(cancel_btn, "popup/circle/left");
- evas_object_size_hint_weight_set(cancel_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *cancel_btn_icon = elm_image_add(cancel_btn);
- elm_image_file_set(cancel_btn_icon, ICON_DIR"/popup_btn_cancel.png", NULL);
- evas_object_size_hint_weight_set(cancel_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(cancel_btn, "elm.swallow.content", cancel_btn_icon);
- evas_object_show(cancel_btn_icon);
- }
- elm_object_part_content_set(popup, "button1", cancel_btn);
- evas_object_smart_callback_add(cancel_btn, "clicked", cancel_btn_click_event, type);
-
- Evas_Object *ok_btn = elm_button_add(popup);
- elm_object_style_set(ok_btn, "popup/circle/right");
- evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- {
- Evas_Object *ok_btn_icon = elm_image_add(ok_btn);
- elm_image_file_set(ok_btn_icon, ICON_DIR"/popup_btn_check.png", NULL);
- evas_object_size_hint_weight_set(ok_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_part_content_set(ok_btn, "elm.swallow.content", ok_btn_icon);
- evas_object_show(ok_btn_icon);
- }
- elm_object_part_content_set(popup, "button2", ok_btn);
- evas_object_smart_callback_add(ok_btn, "clicked", ok_btn_click_event, type);
- }
- evas_object_show(popup);
+static void gl_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
}
-static Eina_Bool discovery_deivce_selected_menu_popup_cb(void *data, Elm_Object_Item *it)
+static void discovery_stop()
{
- do_haptic(50);
- return EINA_TRUE;
+ if (conv_handle != NULL) {
+ conv_discovery_stop(conv_handle);
+ }
}
-static void discovery_deivce_selected_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
{
do_haptic(50);
+
char *type = (char *)data;
- show_popup(type);
+ if (!strcmp(type, NAVI_FRAME_PARENT)) {
+ device_info_free();
+ discovery_stop();
+ } else if (!strcmp(type, NAVI_FRAME_CHILD)) {
+ selected_device_free();
+ }
+
+ return EINA_TRUE;
}
-static char *selected_menu_text_get_cb(void *data, Evas_Object *obj, const char *part)
+static void acl_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
- if((char*)data == NULL) return NULL;
- return strdup((char*)data);
+ char *type = (char *)data;
+ if (!strcmp(type, ACL_ALLOW)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 0);
+ } else if (!strcmp(type, ACL_DENY)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ }
+ elm_naviframe_item_pop(ad->nf);
}
-static void show_discovery_deivce_selected_menu(void *data, Evas_Object *obj, void *event_info)
+static void show_acl_menu(void *data, Evas_Object *obj, void *event_info)
{
do_haptic(50);
@@ -128,77 +103,41 @@ static void show_discovery_deivce_selected_menu(void *data, Evas_Object *obj, vo
selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
selected_device->index = info->index;
- selected_device->list_type = info->list_type;
selected_device->name = info->name;
selected_device->type = info->type;
selected_device->mac_address = info->mac_address;
- discovery_deivce_selected_menu = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(discovery_deivce_selected_menu, ELM_LIST_COMPRESS);
+ Evas_Object *inner_genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(inner_genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(inner_genlist, "select", gl_selected_cb, NULL);
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(discovery_deivce_selected_menu, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(inner_genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
- {
- Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "1text";
- item_builder->func.text_get = selected_menu_text_get_cb;
- }
- elm_genlist_item_append(discovery_deivce_selected_menu, item_builder, ALLOW_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, discovery_deivce_selected_menu_selected_cb, "Allow");
- elm_genlist_item_append(discovery_deivce_selected_menu, item_builder, DENY_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, discovery_deivce_selected_menu_selected_cb, "Deny");
- elm_genlist_item_class_free(item_builder);
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
+ {
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(inner_genlist, menu_title_item_builder, POPUP_TITLE_TEXT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
- evas_object_show(discovery_deivce_selected_menu);
+ elm_genlist_item_class_free(menu_title_item_builder);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ACCESS_CONTROL_TEXT, NULL, NULL, discovery_deivce_selected_menu, NULL);
- elm_naviframe_item_pop_cb_set(it, discovery_deivce_selected_menu_popup_cb, NULL);
-}
-
-static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- device_info_s *info = (device_info_s *)data;
-
- if (!strcmp(part, "elm.text")) {
- if (info->name == NULL) return NULL;
- return strdup((char*)info->name);
- } else if (!strcmp(part, "elm.text.1")) {
- if (info->mac_address == NULL) return NULL;
- return strdup((char*)info->mac_address);
+ /* acl menu */
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_ALLOW, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_ALLOW);
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_DENY, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_DENY);
+ elm_genlist_item_append(inner_genlist, item_builder, POPUP_BUTTON_TEXT_CANCEL, NULL, ELM_GENLIST_ITEM_NONE, acl_menu_selected_cb, ACL_CANCEL);
+ elm_genlist_item_append(inner_genlist, item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
+ elm_genlist_item_class_free(item_builder);
- return NULL;
-}
-
-static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- device_info_s *info = (device_info_s *)data;
-
- if (!strcmp(part, "elm.icon")) {
-
- Evas_Object *img = elm_image_add(obj);
-
- if (info->type != NULL) {
- if (!strcmp(DEVICE_TYPE_MOBILE, info->type)) {
- elm_image_file_set(img, ICON_DIR"/device_type_icon_mobilephone.png", NULL);
- } else if (!strcmp(DEVICE_TYPE_TV, info->type)) {
- elm_image_file_set(img, ICON_DIR"/device_type_icon_display.png", NULL);
- } else if (!strcmp(DEVICE_TYPE_WEARABLE, info->type)) {
- elm_image_file_set(img, ICON_DIR"/device_type_icon_wrist.png", NULL);
- } else {
- elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
- }
-
- } else {
- elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
- }
-
- return img;
-
- } else {
- return NULL;
- }
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, inner_genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NAVI_FRAME_CHILD);
}
static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
@@ -226,15 +165,15 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
conv_device_get_property_string(device_h, CONV_DEVICE_NAME, &device_name);
conv_device_get_property_string(device_h, CONV_DEVICE_TYPE, &device_type);
- int index = ++discovered_devices_index;
- discovered_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
- discovered_devices_info[index]->list_type = LIST_TYPE_DISCOVERED;
- discovered_devices_info[index]->index = index;
- discovered_devices_info[index]->name = device_name;
- discovered_devices_info[index]->type = device_type;
- discovered_devices_info[index]->mac_address = device_id;
+ int index = ++devices_index;
+ devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ devices_info[index]->index = index;
+ devices_info[index]->name = device_name;
+ devices_info[index]->type = device_type;
+ devices_info[index]->mac_address = device_id;
- elm_genlist_item_append(discovered_list, item_builder, discovered_devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_discovery_deivce_selected_menu, discovered_devices_info[index]);
+ //elm_genlist_item_append(discovered_list, item_builder, devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_discovery_deivce_selected_menu, devices_info[index]);
+ elm_genlist_item_insert_after(genlist, device_list_item_builder, devices_info[index], NULL, title_item, ELM_GENLIST_ITEM_NONE, show_acl_menu, devices_info[index]);
break;
@@ -247,66 +186,97 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
static void discovery_start()
{
- if(conv_handle == NULL) {
-
- int index;
-
- if(discovered_devices_info != NULL) {
-
- for (index = 0; index < STORAGE_SIZE; index++) {
- if(discovered_devices_info[index] == NULL) break;
- free(discovered_devices_info[index]);
- discovered_devices_info[index] = NULL;
- }
-
- free(discovered_devices_info);
- discovered_devices_info = NULL;
- }
-
- discovered_devices_index = -1;
- discovered_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
-
+ if (conv_handle == NULL) {
+ device_info_free();
+ devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
conv_create(&conv_handle);
conv_discovery_start(conv_handle, DISCOVERY_TIME, discovery_foreach_cb, NULL);
}
}
-static void discovery_stop()
+static char* device_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
- if (conv_handle != NULL) {
- conv_discovery_stop(conv_handle);
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.text")) {
+ if (info->name == NULL) return NULL;
+ return strdup((char*)info->name);
+ } else if (!strcmp(part, "elm.text.1")) {
+ if (info->mac_address == NULL) return NULL;
+ return strdup((char*)info->mac_address);
}
+
+ return NULL;
}
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+static Evas_Object* device_icon_get_cb(void *data, Evas_Object *obj, const char *part)
{
- discovery_stop();
- do_haptic(50);
- return EINA_TRUE;
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.icon")) {
+
+ Evas_Object *img = elm_image_add(obj);
+
+ if (info->type != NULL) {
+ if (!strcmp(DEVICE_TYPE_MOBILE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_mobilephone.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_TV, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_display.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_WEARABLE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_wrist.png", NULL);
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ return img;
+
+ } else {
+ return NULL;
+ }
}
extern void show_setting_item_discovery()
{
- selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ genlist = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(genlist, "select", gl_selected_cb, NULL);
- discovered_list = elm_genlist_add(ad->nf);
- elm_genlist_mode_set(discovered_list, ELM_LIST_COMPRESS);
-
- Evas_Object *circle_genlist = eext_circle_object_genlist_add(discovered_list, ad->circle_surface);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+
+ /* title */
+ Elm_Genlist_Item_Class *menu_title_item_builder = elm_genlist_item_class_new();
{
- item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "2text.1icon.divider";
- item_builder->func.text_get = text_get_cb;
- item_builder->func.content_get = content_get_cb;
- }
+ menu_title_item_builder->item_style = "title";
+ menu_title_item_builder->func.text_get = menu_text_get;
+ title_item = elm_genlist_item_append(genlist, menu_title_item_builder, DEVICE_LIST_TEXT_AVAILABLE, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+ elm_genlist_item_class_free(menu_title_item_builder);
+
+ /* empty space menu */
+ Elm_Genlist_Item_Class *empty_space_item_builder = elm_genlist_item_class_new();
+ {
+ empty_space_item_builder->item_style = "1text";
+ empty_space_item_builder->func.text_get = menu_text_get;
+ elm_genlist_item_append(genlist, empty_space_item_builder, "", NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
- evas_object_show(discovered_list);
+ elm_genlist_item_class_free(empty_space_item_builder);
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ALLOWED_DEVICE_LIST_TEXT, NULL, NULL, discovered_list, NULL);
- elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+ /* device list */
+ device_list_item_builder = elm_genlist_item_class_new();
+ {
+ device_list_item_builder->item_style = "2text.1icon.divider";
+ device_list_item_builder->func.text_get = device_text_get_cb;
+ device_list_item_builder->func.content_get = device_icon_get_cb;
+ }
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NAVI_FRAME_PARENT);
discovery_start();
-}
+} \ No newline at end of file
diff --git a/src/ui/setting_item_sign.c b/src/ui/setting_item_sign.c
index 669f2a7..b650e0a 100644
--- a/src/ui/setting_item_sign.c
+++ b/src/ui/setting_item_sign.c
@@ -16,44 +16,36 @@
#include "main.h"
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+static void popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
{
- do_haptic(50);
- return EINA_TRUE;
+ if(!obj) return;
+ elm_popup_dismiss(obj);
+}
+
+static void popup_hide_finished_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if(!obj) return;
+ evas_object_del(obj);
}
extern void show_setting_item_sign()
{
- Evas_Object *box = elm_box_add(ad->nf);
- elm_box_horizontal_set(box, EINA_FALSE);
- {
- Evas_Object *scroller = elm_scroller_add(box);
- evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_object_style_set(scroller, "effect");
- {
- char buf[1024];
- if (get_convergence_power_state() == 0) {
- snprintf(buf, sizeof(buf), "<align=center><br>[%s]<br><br>%s</align>", NOTICE_TEXT, POWER_OFF_NOTICE_TEXT);
- } else {
- snprintf(buf, sizeof(buf), "<align=center><br>[%s]<br><br>%s</align>", NOTICE_TEXT, POWER_ON_NOTICE_TEXT);
- }
-
- Evas_Object *sign_item = elm_label_add(scroller);
- elm_object_text_set(sign_item, buf);
- evas_object_size_hint_weight_set(sign_item, 0.5, 0.5);
- elm_label_line_wrap_set(sign_item, ELM_WRAP_WORD);
- // elm_label_wrap_width_set(sign_item, 200);
- // evas_object_size_hint_min_set(sign_item, 100, 100);
- elm_object_content_set(scroller, sign_item);
- }
-
- evas_object_show(scroller);
- elm_box_pack_end(box, scroller);
- }
- evas_object_show(box);
-
- Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, box, NULL);
- elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+ Evas_Object *popup = elm_popup_add(ad->win);
+ elm_object_style_set(popup, "circle");
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
+ evas_object_smart_callback_add(popup, "dismissed", popup_hide_finished_cb, NULL);
+
+ Evas_Object *layout = elm_layout_add(popup);
+ elm_layout_theme_set(layout, "layout", "popup", "content/circle");
+
+ elm_object_part_text_set(layout, "elm.text.title", NOTICE_TITLE_TEXT);
+
+ char buf[1024];
+ snprintf(buf, sizeof(buf), "<align=center>%s</align>", NOTICE_TEXT_POWER_OFF);
+
+ elm_object_part_text_set(layout, "elm.text", buf);
+ elm_object_content_set(popup, layout);
+
+ evas_object_show(popup);
}