summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIckhee Woo <ickhee.woo@samsung.com>2016-09-05 14:36:33 +0900
committerIckhee Woo <ickhee.woo@samsung.com>2016-09-05 14:36:33 +0900
commit53ddf66144189cf0c4be689c7a57752b98f77627 (patch)
treeaf8b7ac00dd2485c3eeccc731d390aebaedf9ec3
parent65bb060bfcf72c12df29253c8c5ee645cc8c8c7c (diff)
downloadmy-account-53ddf66144189cf0c4be689c7a57752b98f77627.tar.gz
my-account-53ddf66144189cf0c4be689c7a57752b98f77627.tar.bz2
my-account-53ddf66144189cf0c4be689c7a57752b98f77627.zip
- add "Accounts" view for showing registered accounts list - add "ADD" button for entering to "Add Accounts" view - add "Add Accounts" view for showing account providers - modify code for coding convention Change-Id: Ie9860d1d7df47d76911569c0217a0c70f925848e
-rw-r--r--wearable/app/CMakeLists.txt1
-rw-r--r--wearable/app/include/my-account-main.h15
-rw-r--r--wearable/app/include/my-account-popup.h51
-rw-r--r--wearable/app/include/my-account-string.h54
-rw-r--r--wearable/app/include/my-account-ui-widget.h6
-rw-r--r--wearable/app/include/my-account-util.h15
-rw-r--r--wearable/app/include/my-account-view.h3
-rwxr-xr-xwearable/app/src/my-account-main.c60
-rwxr-xr-xwearable/app/src/my-account-popup.c152
-rwxr-xr-xwearable/app/src/my-account-ui-widget.c18
-rwxr-xr-xwearable/app/src/my-account-view-main.c379
-rwxr-xr-xwearable/org.tizen.my-account.xml2
12 files changed, 226 insertions, 530 deletions
diff --git a/wearable/app/CMakeLists.txt b/wearable/app/CMakeLists.txt
index 25b70f9..2dfa95c 100644
--- a/wearable/app/CMakeLists.txt
+++ b/wearable/app/CMakeLists.txt
@@ -3,7 +3,6 @@ PROJECT(my-account C)
SET(SRCS
src/my-account-main.c
-src/my-account-popup.c
src/my-account-ui-widget.c
src/my-account-view-main.c
)
diff --git a/wearable/app/include/my-account-main.h b/wearable/app/include/my-account-main.h
index abc15b8..e2fefce 100644
--- a/wearable/app/include/my-account-main.h
+++ b/wearable/app/include/my-account-main.h
@@ -45,8 +45,8 @@ extern "C"
#define MA_UG_NAME "setting-myaccount-efl"
enum {
- V_MAIN = 0,
- V_TAP_N_PAY
+ VIEW_MAIN = 0,
+ VIEW_ADD_ACCOUNTS
};
typedef enum {
@@ -55,11 +55,6 @@ typedef enum {
} myaccount_mode_e;
typedef struct {
- char *appid;
- int aid_count;
-} wallet_info_t;
-
-typedef struct {
Evas_Object *main_win;
Evas_Object *main_layout;
Evas_Object *main_bg;
@@ -68,6 +63,7 @@ typedef struct {
Evas_Object *popup;
Evas_Object *navi_frame;
+ Evas_Object *add_button;
int current_view;
myaccount_mode_e mode;
@@ -79,13 +75,8 @@ typedef struct {
GList *item_list_account;
GList *item_list_account_app;
Elm_Object_Item *item_no_content;
- char *payment_handler;
Elm_Object_Item *on_off;
- Elm_Object_Item *tap_n_pay;
Evas_Object *main_genlist;
-
- int payment_wallet_cnt;
- GArray *payment_wallet_list;
Evas_Object *radio_main;
} appdata;
diff --git a/wearable/app/include/my-account-popup.h b/wearable/app/include/my-account-popup.h
deleted file mode 100644
index e05bf64..0000000
--- a/wearable/app/include/my-account-popup.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * PROPRIETARY/CONFIDENTIAL
- *
- * This software is the confidential and proprietary information of
- * SAMSUNG ELECTRONICS ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with SAMSUNG ELECTRONICS.
- * SAMSUNG make no representations or warranties about the suitability
- * of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for
- * a particular purpose, or non-infringement.
- * SAMSUNG shall not be liable for any damages suffered by licensee as
- * a result of using, modifying or distributing this software or its derivatives.
-
- */
-
-
-#ifndef __MY_ACCOUNT_POPUP_H__
-#define __MY_ACCOUNT_POPUP_H__
-
-#include <Elementary.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef void (*_POPUP_USER_RESP_CB)(void *data, Evas_Object *obj,
- void *event_info);
-
-
-/************************** API **************************/
-Evas_Object *myaccount_create_popup_text_1button(
- Evas_Object *parent,
- const char *text,
- const char *btn1_image_path,
- _POPUP_USER_RESP_CB response_cb,
- void *data);
-
-Evas_Object *myaccount_create_toast_popup(Evas_Object *parent,
- const char *text);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __MY_ACCOUNT_POPUP_H__ */
-
diff --git a/wearable/app/include/my-account-string.h b/wearable/app/include/my-account-string.h
deleted file mode 100644
index 0a180f9..0000000
--- a/wearable/app/include/my-account-string.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * PROPRIETARY/CONFIDENTIAL
- *
- * This software is the confidential and proprietary information of
- * SAMSUNG ELECTRONICS ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with SAMSUNG ELECTRONICS.
- * SAMSUNG make no representations or warranties about the suitability
- * of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for
- * a particular purpose, or non-infringement.
- * SAMSUNG shall not be liable for any damages suffered by licensee as
- * a result of using, modifying or distributing this software or its derivatives.
-
- */
-
-
-#ifndef __MY_ACCOUNT_STRING_H__
-#define __MY_ACCOUNT_STRING_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/* Buffer length for Text */
-#define POPUP_TEXT_SIZE 1024
-#define LABEL_TEXT_SIZE 1024
-
-/////////////////////////////////////////////////////////////////////////////
-// NFC SETTING START ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-/* Registered string in STMS NFC */
-#define IDS_NFC_NFC \
- _("WDS_ST_MBODY_NFC_ABB")
-#define IDS_TAP_AND_PAY \
- _("WDS_ST_MBODY_TAP_AND_PAY_ABB")
-#define IDS_NO_INSTALLED_PAYMENT_APPS \
- _("WDS_ST_NPBODY_NO_INSTALLED_PAYMENT_APPS_ABB")
-#define IDS_UNABLE_TO_SELECT_PAYMENT_APP_WITH_MORE_THAN_50_REGISTERED_CARDS \
- _("WDS_ST_POP_UNABLE_TO_SELECT_PAYMENT_APP_WITH_MORE_THAN_50_REGISTERED_CARDS")
-#define IDS_ONE_OF_THE_CARDS_REGISTERED_IN_P1SS_WAS_ALREADY_REGISTERED_IN_P2SS_THIS_CARD_CANNOT_BE_USED_IN_P3SS \
- _("WDS_ST_POP_ONE_OF_THE_CARDS_REGISTERED_IN_P1SS_WAS_ALREADY_REGISTERED_IN_P2SS_THIS_CARD_CANNOT_BE_USED_IN_P3SS")
-#define IDS_SECURITY_POLICY_PREVENTS_USE_OF_NFC_ABB \
- _("WDS_ST_TPOP_SECURITY_POLICY_PREVENTS_USE_OF_NFC_ABB")
-
-#ifdef __cplusplus
-}
-#endif
-#endif /*__MY_ACCOUNT_STRING_H__*/
diff --git a/wearable/app/include/my-account-ui-widget.h b/wearable/app/include/my-account-ui-widget.h
index 17bcfe6..862ba39 100644
--- a/wearable/app/include/my-account-ui-widget.h
+++ b/wearable/app/include/my-account-ui-widget.h
@@ -30,11 +30,11 @@ extern "C"
#endif /* __cplusplus */
/************************** API **************************/
-Evas_Object* myaccount_create_main_win(const char *name);
+Evas_Object *myaccount_create_main_win(const char *name);
Evas_Object *myaccount_create_main_layout(Evas_Object *parent);
Evas_Object *myaccount_create_bg(Evas_Object *parent);
-Evas_Object* myaccount_create_conformant(Evas_Object *parent);
-Evas_Object* myaccount_create_edj_layout(Evas_Object* parent, char *edc_path);
+Evas_Object *myaccount_create_conformant(Evas_Object *parent);
+Evas_Object *myaccount_create_edj_layout(Evas_Object* parent, char *edc_path);
#ifdef __cplusplus
}
diff --git a/wearable/app/include/my-account-util.h b/wearable/app/include/my-account-util.h
index 5fb7411..d97fc4c 100644
--- a/wearable/app/include/my-account-util.h
+++ b/wearable/app/include/my-account-util.h
@@ -70,18 +70,17 @@ extern "C"
} \
} while (0)
-#define MA_STRNCPY(dest,src,size) \
+#define MA_STRNCPY(dest, src, size) \
do { \
- if(src != NULL && dest != NULL && size > 0) \
- { \
- strncpy(dest,src,size-1); \
+ if (src != NULL && dest != NULL && size > 0) { \
+ strncpy(dest, src, size-1); \
} \
- }while(0);
+ } while (0);
-#define MA_SNPRINTF(dest,size,format,arg...) \
+#define MA_SNPRINTF(dest, size, format, arg...) \
do { \
- snprintf(dest,size-1,format,##arg); \
- }while(0)
+ snprintf(dest, size-1, format, ##arg); \
+ } while (0)
#define MA_MEM_MEMDUP(ptr, src, buf_size) \
do { \
diff --git a/wearable/app/include/my-account-view.h b/wearable/app/include/my-account-view.h
index f0849da..5ab4693 100644
--- a/wearable/app/include/my-account-view.h
+++ b/wearable/app/include/my-account-view.h
@@ -62,6 +62,9 @@ typedef struct {
} myaccount_account_app_info;
bool _myaccount_view_main_create(void *data);
+int _myaccount_get_accounts_total_count(void);
+
+int previous_cnt;
#ifdef __cplusplus
}
diff --git a/wearable/app/src/my-account-main.c b/wearable/app/src/my-account-main.c
index 43df4cf..4a8cc14 100755
--- a/wearable/app/src/my-account-main.c
+++ b/wearable/app/src/my-account-main.c
@@ -24,7 +24,7 @@
#include "my-account-debug.h"
#include "my-account-util.h"
#include "my-account-ui-widget.h"
-#include "my-account-popup.h"
+
static void __back_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
@@ -33,38 +33,12 @@ static void __back_clicked_cb(void *data, Evas_Object *obj, void *event_info)
elm_naviframe_item_pop(ad->navi_frame);
- if (ad->current_view == V_TAP_N_PAY) {
- Evas_Object *circle_obj;
-
- /* release Tap & Pay view */
- if (ad->payment_wallet_list != NULL) {
- int i;
- MA_DEBUG_ERR("wallet count is %d", ad->payment_wallet_cnt);
- for (i = 0; i < ad->payment_wallet_cnt; i++) {
- wallet_info_t *winfo = NULL;
-
- winfo = g_array_index(ad->payment_wallet_list, wallet_info_t *, i);
- MA_MEM_FREE(winfo->appid);
- MA_MEM_FREE(winfo);
- }
-
- g_array_free(ad->payment_wallet_list, FALSE);
- ad->payment_wallet_list = NULL;
- }
-
- ad->payment_wallet_cnt = 0;
- ad->radio_main = NULL;
- ad->current_view = V_MAIN;
-
- circle_obj = eext_circle_object_genlist_add(ad->main_genlist, ad->circle_surface);
- eext_circle_object_genlist_scroller_policy_set(circle_obj,
- ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE);
- } else if (ad->current_view == V_MAIN) {
+ if (ad->current_view == VIEW_MAIN) {
/* release Main view and exit application */
- MA_MEM_FREE(ad->payment_handler);
-
ui_app_exit();
+ } else if (ad->current_view == VIEW_ADD_ACCOUNTS) {
+ ad->current_view = VIEW_MAIN;
+ ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
}
}
@@ -105,6 +79,8 @@ bool _create_gui(appdata *ad)
evas_object_show(ad->navi_frame);
eext_object_event_callback_add(ad->navi_frame, EEXT_CALLBACK_BACK, __back_clicked_cb, ad);
+ evas_object_show(ad->main_win);
+
return true;
}
@@ -129,14 +105,14 @@ bool _myaccount_main_app_create(void *user_data)
}
if (account_cnt > 0) {
- ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
MA_DEBUG("myaccount account_cnt > 0, count = [%d]", account_cnt);
+ ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
} else {
MA_DEBUG("myaccount account_cnt <= 0, count = [%d]", account_cnt);
ad->mode = MYACCOUNT_ADD_ACCOUNT_MODE;
}
- if(!_create_gui(ad)) {
+ if (!_create_gui(ad)) {
MA_DEBUG("_create_gui() fail");
return false;
}
@@ -150,22 +126,10 @@ void _myaccount_main_app_resume(void *user_data)
{
MA_DEBUG("_myaccount_main_app_resume start");
appdata *ad = user_data;
- int account_cnt;
-
- int ret = account_get_total_count_from_db_ex(&account_cnt);
- if (ret != ACCOUNT_ERROR_NONE) {
- MA_DEBUG_ERR("myaccount account_get_total_count_from_db_ex fail error=[%d]", ret);
- return;
- }
- if (account_cnt > 0 && ad->mode == MYACCOUNT_ADD_ACCOUNT_MODE) {
- ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
- MA_DEBUG("myaccount account_cnt > 0, count = [%d]", account_cnt);
- _myaccount_view_main_create(ad);
- elm_win_activate(ad->main_win);
- } else if (account_cnt <= 0 && ad->mode == MYACCOUNT_ACCOUNT_LIST_MODE) {
- MA_DEBUG("myaccount account_cnt <= 0, count = [%d]", account_cnt);
- ad->mode = MYACCOUNT_ADD_ACCOUNT_MODE;
+ int account_cnt = _myaccount_get_accounts_total_count();
+ if (account_cnt != previous_cnt) {
+ MA_DEBUG("account_cnt is changed from [%d]", previous_cnt);
_myaccount_view_main_create(ad);
elm_win_activate(ad->main_win);
}
diff --git a/wearable/app/src/my-account-popup.c b/wearable/app/src/my-account-popup.c
deleted file mode 100755
index 98e48d5..0000000
--- a/wearable/app/src/my-account-popup.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * PROPRIETARY/CONFIDENTIAL
- *
- * This software is the confidential and proprietary information of
- * SAMSUNG ELECTRONICS ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with SAMSUNG ELECTRONICS.
- * SAMSUNG make no representations or warranties about the suitability
- * of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for
- * a particular purpose, or non-infringement.
- * SAMSUNG shall not be liable for any damages suffered by licensee as
- * a result of using, modifying or distributing this software or its derivatives.
-
- */
-
-
-#include <efl_extension.h>
-#include "my-account-popup.h"
-#include "my-account-debug.h"
-
-#define POPUP_AUTO_TIMEOUT_SEC 3.0
-
-static void __popup_block_clicked_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- ret_if(obj == NULL);
-
- elm_popup_dismiss(obj);
-}
-
-static void __popup_hide_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- ret_if(obj == NULL);
-
- elm_popup_dismiss(obj);
-}
-
-static void __popup_hide_finished_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- ret_if(obj == NULL);
-
- evas_object_del(obj);
-}
-
-static void __popup_timeout_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- ret_if(obj == NULL);
-
- evas_object_del(obj);
-}
-
-Evas_Object *myaccount_create_popup_text_1button(
- Evas_Object *parent,
- const char *text,
- const char *btn1_image_path,
- _POPUP_USER_RESP_CB response_cb,
- void *data)
-{
- Evas_Object *popup;
- Evas_Object *btn;
- Evas_Object *icon;
- Evas_Object *layout;
-
- retv_if(parent == NULL, NULL);
- retv_if(text == NULL, NULL);
- retv_if(btn1_image_path == NULL, NULL);
- retv_if(response_cb == NULL, NULL);
-
- popup = elm_popup_add(parent);
- retv_if(popup == NULL, NULL);
- elm_object_style_set(popup, "circle");
-
-// uxt_popup_set_rotary_event_enabled(popup, EINA_TRUE);
-
- 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);
-
- layout = elm_layout_add(popup);
- retv_if(layout == NULL, NULL);
- elm_layout_theme_set(layout, "layout", "popup",
- "content/circle/buttons1");
-
- elm_object_part_text_set(layout, "elm.text", text);
- elm_object_content_set(popup, layout);
-
- btn = elm_button_add(popup);
- retv_if(btn == NULL, NULL);
- elm_object_style_set(btn, "popup/circle");
- evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_access_info_set(btn, ELM_ACCESS_INFO, "Cancel");
- elm_object_part_content_set(popup, "button1", btn);
- evas_object_smart_callback_add(btn, "clicked", response_cb, data);
-
- icon = elm_image_add(btn);
- retv_if(icon == NULL, NULL);
- elm_image_file_set(icon, btn1_image_path, NULL);
- evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_object_part_content_set(btn, "elm.swallow.content", icon);
- evas_object_show(icon);
-
- evas_object_show(popup);
-
- return popup;
-}
-
-Evas_Object *myaccount_create_toast_popup(Evas_Object *parent,
- const char *text)
-{
- Evas_Object *toast;
-
- MA_BEGIN();
-
- toast = elm_popup_add(parent);
- retv_if(toast == NULL, NULL);
-
- elm_object_style_set(toast, "toast/circle");
- elm_popup_orient_set(toast, ELM_POPUP_ORIENT_BOTTOM);
- evas_object_size_hint_weight_set(toast, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- eext_object_event_callback_add(toast, EEXT_CALLBACK_BACK,
- __popup_hide_cb, NULL);
- evas_object_smart_callback_add(toast, "dismissed",
- __popup_hide_finished_cb, NULL);
- elm_object_part_text_set(toast, "elm.text", text);
-
- evas_object_smart_callback_add(toast, "block,clicked",
- __popup_block_clicked_cb, NULL);
-
- elm_popup_timeout_set(toast, 2.0);
- evas_object_smart_callback_add(toast, "timeout", __popup_timeout_cb,
- NULL);
-
- evas_object_show(toast);
- MA_END();
-
- return toast;
-}
-
-
diff --git a/wearable/app/src/my-account-ui-widget.c b/wearable/app/src/my-account-ui-widget.c
index f6c9eba..c4a9a3a 100755
--- a/wearable/app/src/my-account-ui-widget.c
+++ b/wearable/app/src/my-account-ui-widget.c
@@ -67,8 +67,7 @@ Evas_Object *myaccount_create_main_layout(Evas_Object *parent)
elm_object_focus_set(layout, EINA_FALSE);
elm_layout_theme_set(layout, "layout", "application", "default");
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(layout);
@@ -91,8 +90,7 @@ Evas_Object *myaccount_create_bg(Evas_Object *parent)
retv_if(bg == NULL, NULL);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(parent, bg);
evas_object_show(bg);
@@ -114,8 +112,7 @@ Evas_Object *myaccount_create_conformant(Evas_Object *parent)
retv_if(conform == NULL, NULL);
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(parent, conform);
evas_object_show(conform);
@@ -125,8 +122,7 @@ Evas_Object *myaccount_create_conformant(Evas_Object *parent)
return conform;
}
-Evas_Object* myaccount_create_edj_layout(Evas_Object* parent,
- char *edc_path)
+Evas_Object* myaccount_create_edj_layout(Evas_Object* parent, char *edc_path)
{
Evas_Object *layout;
@@ -139,11 +135,10 @@ Evas_Object* myaccount_create_edj_layout(Evas_Object* parent,
elm_object_focus_set(layout, EINA_FALSE);
- if(edc_path != NULL)
+ if (edc_path != NULL)
elm_layout_file_set(layout, EDJ_FILE, edc_path);
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(layout);
@@ -152,4 +147,3 @@ Evas_Object* myaccount_create_edj_layout(Evas_Object* parent,
return layout;
}
-
diff --git a/wearable/app/src/my-account-view-main.c b/wearable/app/src/my-account-view-main.c
index 8fd505c..cc4b418 100755
--- a/wearable/app/src/my-account-view-main.c
+++ b/wearable/app/src/my-account-view-main.c
@@ -14,7 +14,6 @@
* a particular purpose, or non-infringement.
* SAMSUNG shall not be liable for any damages suffered by licensee as
* a result of using, modifying or distributing this software or its derivatives.
-
*/
@@ -24,13 +23,12 @@
#include <account.h>
#include <account-types.h>
#include <account-error.h>
+#include <account_internal.h>
#include "my-account-view.h"
#include "my-account-main.h"
#include "my-account-debug.h"
#include "my-account-util.h"
#include "my-account-ui-widget.h"
-#include "my-account-popup.h"
-#include "my-account-string.h"
static void lang_changed(appdata *ad)
{
@@ -42,22 +40,22 @@ static void lang_changed(appdata *ad)
char* language = NULL;
language = vconf_get_str(VCONFKEY_LANGSET);
- if(language) {
- char tmp_buf[6]={0,};
+ if (language) {
+ char tmp_buf[6] = {0,};
MA_STRNCPY(tmp_buf, language, 6);
MA_MEM_FREE(ad->current_language);
MA_MEM_STRNDUP(ad->current_language, tmp_buf, 6);
}
MA_MEM_FREE(language);
- //To Do: refresh account items
-// elm_object_item_text_set (ad->nf_it, dgettext(MA_UG_NAME, "IDS_MA_HEADER_ACCOUNTS"));
-// myaccount_list_refresh_item_list(ugd);
+ /* To Do: refresh account items */
+ /* elm_object_item_text_set (ad->nf_it, dgettext(MA_UG_NAME, "IDS_MA_HEADER_ACCOUNTS"));
+ myaccount_list_refresh_item_list(ugd); */
if (ad->main_genlist) {
- // To Do: title text update
-// elm_object_item_text_set (ugd->add_nf_it, dgettext(MA_UG_NAME, "IDS_MA_HEADER_ADD_ACCOUNT"));
-// myaccount_addaccount_refresh_item_list(ugd);
+ /* To Do: title text update */
+ /* elm_object_item_text_set (ugd->add_nf_it, dgettext(MA_UG_NAME, "IDS_MA_HEADER_ADD_ACCOUNT"));
+ myaccount_addaccount_refresh_item_list(ugd); */
} else {
MA_DEBUG("lang_changed ### ugd->main_genlist is NULL\n");
}
@@ -67,7 +65,7 @@ static void __gl_account_list_clicked_cb(void *data, Evas_Object *obj, void *eve
{
MA_DEBUG("__gl_account_list_clicked_cb start");
- char id_buf[64] = {0, };
+ char id_buf[64] = { 0, };
app_control_h service = NULL;
myaccount_account_info *account_info = (myaccount_account_info *)data;
@@ -83,7 +81,7 @@ static void __gl_account_list_clicked_cb(void *data, Evas_Object *obj, void *eve
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- app_control_create(&service);
+ app_control_create(&service);
app_control_set_app_id(service, account_info->package_name);
MA_SNPRINTF(id_buf, sizeof(id_buf), "%d", account_info->account_id);
app_control_add_extra_data(service, ACCOUNT_DATA_ID, id_buf);
@@ -91,17 +89,17 @@ static void __gl_account_list_clicked_cb(void *data, Evas_Object *obj, void *eve
app_control_add_extra_data(service, ACCOUNT_DATA_USERNAME, account_info->user_name);
app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
int ret = app_control_send_launch_request(service, NULL, NULL);
- if ( ret != APP_CONTROL_ERROR_NONE ) {
+ if (ret != APP_CONTROL_ERROR_NONE)
MA_DEBUG_ERR("app_control_send_launch_request fail, ret = %d\n", ret);
- }
+
app_control_destroy(service);
MA_DEBUG("__gl_account_list_clicked_cb end");
}
/* for item class */
-static Evas_Object *__gl_content_get_account_list(void *data, Evas_Object *obj,
- const char *part)
+/*
+static Evas_Object *__gl_content_get_account_list(void *data, Evas_Object *obj, const char *part)
{
if (!strcmp(part, "elm.icon")) {
Evas_Object *check;
@@ -120,9 +118,10 @@ static Evas_Object *__gl_content_get_account_list(void *data, Evas_Object *obj,
return NULL;
}
}
+*/
+
/*
-static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj,
- const char *part)
+static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj, const char *part)
{
if (!strcmp(part, "elm.icon")) {
Evas_Object *check;
@@ -149,21 +148,10 @@ static Evas_Object *__gl_content_get_on_off(void *data, Evas_Object *obj,
}
*/
-static char *__gl_text_get_account_list_title(void *data, Evas_Object *obj,
- const char *part)
-{
- if (!strcmp(part, "elm.text")) {
-// return dgettext(MA_UG_NAME, "IDS_MA_HEADER_ACCOUNTS");
- return strdup("Account list");
- } else
- return NULL;
-}
-
-static char *__gl_text_get_account_list_label(void *data,
- Evas_Object *obj, const char *part)
+static char *__gl_text_get_account_list_label(void *data, Evas_Object *obj, const char *part)
{
myaccount_account_info *account_info = (myaccount_account_info *)data;
-// char domain_name_lower[128] = {0,};
+ /* char domain_name_lower[128] = {0,}; */
MA_DEBUG("__gl_text_get_account_list_label start");
if (!account_info) {
@@ -172,7 +160,7 @@ static char *__gl_text_get_account_list_label(void *data,
}
if (!strcmp(part, "elm.text")) {
-// myaccount_common_lowercase(account_info->domain_name, domain_name_lower);
+ /* myaccount_common_lowercase(account_info->domain_name, domain_name_lower); */
MA_DEBUG("__gl_text_get_account_list_label elm.text");
if (strlen(account_info->display_name) > 0)
return strdup(account_info->display_name);
@@ -186,13 +174,15 @@ static char *__gl_text_get_account_list_label(void *data,
MA_DEBUG("__gl_text_get_account_list_labeli elm.text.1");
if (strlen(account_info->service_name) > 0)
return strdup(account_info->service_name);
-// else if (strlen(account_info->capability) > 0)
-// return strdup(account_info->capability);
+ /*else if (strlen(account_info->capability) > 0)
+ return strdup(account_info->capability);
+ else
+ return strdup(dgettext(MA_UG_NAME, "IDS_MA_BODY_SIGNED_IN")); */
else
-// return strdup(dgettext(MA_UG_NAME, "IDS_MA_BODY_SIGNED_IN"));
return strdup("Signed in.");
- } else
+ } else {
return NULL;
+ }
}
int _myaccount_release_capability_data(myaccount_capability_data *data)
@@ -248,24 +238,24 @@ static char *__myaccount_get_capablity_string_value(const char* capability_type)
return dgettext(MA_UG_NAME, "IDS_PB_TAB_CONTACTS");
else if (!strcmp(capability_type, "http://tizen.org/account/capability/calendar"))
return dgettext("sys_string", "IDS_COM_BODY_S_PLANNER");
- else if (!strcmp(capability_type ,"http://tizen.org/account/capability/photo"))
+ else if (!strcmp(capability_type, "http://tizen.org/account/capability/photo"))
return dgettext(MA_UG_NAME, "IDS_COM_BODY_GALLERY");
- else if (!strcmp(capability_type ,"http://tizen.org/account/capability/video"))
+ else if (!strcmp(capability_type, "http://tizen.org/account/capability/video"))
return dgettext(MA_UG_NAME, "IDS_ST_BODY_VIDEOS");
- else if (!strcmp(capability_type ,"http://tizen.org/account/capability/email"))
+ else if (!strcmp(capability_type, "http://tizen.org/account/capability/email"))
return dgettext(MA_UG_NAME, "IDS_COM_BODY_EMAIL");
- else if (!strcmp(capability_type ,"http://tizen.org/account/capability/music"))
+ else if (!strcmp(capability_type, "http://tizen.org/account/capability/music"))
return dgettext("sys_string", "IDS_COM_BODY_MUSIC");
- else if (!strcmp(capability_type ,"http://tizen.org/account/capability/message"))
+ else if (!strcmp(capability_type, "http://tizen.org/account/capability/message"))
return dgettext(MA_UG_NAME, "IDS_COM_BODY_MESSAGES");
else
- return NULL;//return dgettext(MA_UG_NAME, "IDS_COM_POP_UNKNOWN");
+ return NULL; /* return dgettext(MA_UG_NAME, "IDS_COM_POP_UNKNOWN"); */
}
static myaccount_account_info* __myaccount_create_account_info()
{
myaccount_account_info* account_info = NULL;
- account_info = (myaccount_account_info*)calloc(1,sizeof(myaccount_account_info));
+ account_info = (myaccount_account_info*)calloc(1, sizeof(myaccount_account_info));
retv_if(!account_info, NULL);
return account_info;
}
@@ -281,7 +271,7 @@ void myaccount_common_lowercase(char *src, char *dest)
}
src_len = strlen(src);
- for(i=0; i<src_len; i++)
+ for (i = 0; i < src_len; i++)
dest[i] = tolower(src[i]);
dest[i] = '\0';
@@ -293,7 +283,7 @@ void myaccount_common_get_icon_by_name(char *domain_name, char *icon_path)
MA_DEBUG_ERR("\n !!! domain_name is NULL \n");
return;
}
- char tmp_domain_name[64] = {0, };
+ char tmp_domain_name[64] = { 0, };
myaccount_common_lowercase(domain_name, tmp_domain_name);
if (!icon_path) {
MA_DEBUG_ERR("\n !!! icon_path is NULL \n");
@@ -303,8 +293,7 @@ void myaccount_common_get_icon_by_name(char *domain_name, char *icon_path)
MA_SNPRINTF(icon_path, 1024, "%s", "A01_2_Icon_default.png");
}
-bool __myaccount_get_capablity_cb(const char* capability_type,
- account_capability_state_e capability_state, void *user_data)
+bool __myaccount_get_capablity_cb(const char* capability_type, account_capability_state_e capability_state, void *user_data)
{
myaccount_account_info *account_info = (myaccount_account_info*)user_data;
@@ -350,13 +339,12 @@ void myaccount_accountlist_set_service_name(myaccount_account_info* account_info
return;
GList* iter;
- for(iter=ad->account_app_list; iter!=NULL; iter=g_list_next(iter)) {
+ for (iter = ad->account_app_list; iter != NULL; iter = g_list_next(iter)) {
myaccount_account_app_info* account_app_info = (myaccount_account_app_info*)iter->data;
MA_DEBUG("iter start");
- if(!strcmp(account_app_info->package_name, account_info->package_name)) {
+ if (!strcmp(account_app_info->package_name, account_info->package_name)) {
MA_DEBUG("find same package_name");
- MA_STRNCPY(account_info->service_name, account_app_info->service_name,
- sizeof(account_info->service_name));
+ MA_STRNCPY(account_info->service_name, account_app_info->service_name, sizeof(account_info->service_name));
break;
}
@@ -370,7 +358,7 @@ bool __myaccount_get_account_list_info_cb(account_h account, void *user_data)
int ret = -1;
int id = -1;
appdata *ad = (appdata *)user_data;
-// GList **account_info_list = (GList **)user_data;
+ /* GList **account_info_list = (GList **)user_data; */
myaccount_account_info *account_info = NULL;
char *tmp_str = NULL;
account_secrecy_state_e secret = -1;
@@ -383,42 +371,37 @@ bool __myaccount_get_account_list_info_cb(account_h account, void *user_data)
retv_if(!account_info, false);
ret = account_get_account_id(account, &id);
- if (ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_account_id: Failed \n");
- } else if (id > 0) {
+ else if (id > 0)
account_info->account_id = id;
- }
ret = account_get_user_name(account, &tmp_str);
- if (ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_user_name: Failed \n");
- } else if (tmp_str && strlen(tmp_str)) {
+ else if (tmp_str && strlen(tmp_str))
MA_STRNCPY(account_info->user_name, tmp_str, sizeof(account_info->user_name));
- }
MA_MEM_FREE(tmp_str);
ret = account_get_display_name(account, &tmp_str);
- if (ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_display_name: Failed \n");
- } else if (tmp_str && strlen(tmp_str)) {
+ else if (tmp_str && strlen(tmp_str))
MA_STRNCPY(account_info->display_name, tmp_str, sizeof(account_info->display_name));
- }
MA_MEM_FREE(tmp_str);
ret = account_get_email_address(account, &tmp_str);
- if (ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_email_address: Failed \n");
- } else if (tmp_str && strlen(tmp_str)) {
+ else if (tmp_str && strlen(tmp_str))
MA_STRNCPY(account_info->email_address, tmp_str, sizeof(account_info->email_address));
- }
MA_MEM_FREE(tmp_str);
ret = account_get_package_name(account, &tmp_str);
- if (ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_package_name: Failed \n");
- } else if (tmp_str && strlen(tmp_str)) {
+ else if (tmp_str && strlen(tmp_str))
MA_STRNCPY(account_info->package_name, tmp_str, sizeof(account_info->package_name));
- }
MA_MEM_FREE(tmp_str);
ret = account_get_secret(account, &secret);
@@ -430,11 +413,10 @@ bool __myaccount_get_account_list_info_cb(account_h account, void *user_data)
account_info->secret = ACCOUNT_SECRECY_INVALID;
ret = account_get_domain_name(account, &tmp_str);
- if (ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_domain_name: Failed \n");
- } else if (tmp_str && strlen(tmp_str)) {
+ else if (tmp_str && strlen(tmp_str))
MA_STRNCPY(account_info->domain_name, tmp_str, sizeof(account_info->domain_name));
- }
MA_MEM_FREE(tmp_str);
ret = account_get_icon_path(account, &tmp_str);
@@ -467,15 +449,14 @@ bool __myaccount_get_account_list_info_cb(account_h account, void *user_data)
}
MA_MEM_FREE(tmp_str);
- if(!strlen(account_info->icon_path))
+ if (!strlen(account_info->icon_path))
myaccount_common_get_icon_by_name(account_info->domain_name , account_info->icon_path);
ret = account_get_sync_support(account, (account_sync_state_e *)&(account_info->sync_status));
if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_sync_support: Failed \n");
- ret = account_get_capability_all(account,
- __myaccount_get_capablity_cb, (void *)account_info);
+ ret = account_get_capability_all(account, __myaccount_get_capablity_cb, (void *)account_info);
if (ret != ACCOUNT_ERROR_NONE)
MA_DEBUG_ERR("account_get_capability: Failed \n");
@@ -483,7 +464,7 @@ bool __myaccount_get_account_list_info_cb(account_h account, void *user_data)
/* No need to sort, sort as the order user register */
/* Left below sorting value(service_sname) for future use */
-// MA_SNPRINTF(account_info->service_sname, sizeof(account_info->service_sname), "%s", "3_");
+ /* MA_SNPRINTF(account_info->service_sname, sizeof(account_info->service_sname), "%s", "3_"); */
ad->account_list = g_list_append(ad->account_list, (void*)account_info);
@@ -495,7 +476,7 @@ void __myaccount_genlist_account_list_item_append(appdata *ad, Evas_Object *genl
{
MA_DEBUG("__myaccount_genlist_account_list_item_append() start");
GList* iter;
- for(iter=ad->account_list; iter!=NULL; iter=g_list_next(iter)) {
+ for (iter = ad->account_list; iter != NULL; iter = g_list_next(iter)) {
myaccount_account_info* tmp = (myaccount_account_info*)iter->data;
MA_DEBUG("iter start");
if (tmp->secret == ACCOUNT_SECRECY_VISIBLE) {
@@ -506,9 +487,7 @@ void __myaccount_genlist_account_list_item_append(appdata *ad, Evas_Object *genl
itc_account->item_style = "2text";
itc_account->func.text_get = __gl_text_get_account_list_label;
itc_account->func.del = __gl_account_list_del;
-// itc_account->func.content_get = __gl_content_get_on_off;
- item_account = elm_genlist_item_append(genlist, itc_account,
- tmp, NULL, ELM_GENLIST_ITEM_NONE, __gl_account_list_clicked_cb, tmp);
+ item_account = elm_genlist_item_append(genlist, itc_account, tmp, NULL, ELM_GENLIST_ITEM_NONE, __gl_account_list_clicked_cb, tmp);
ad->item_list_account = g_list_append(ad->item_list_account, (void*)item_account);
elm_genlist_item_class_free(itc_account);
}
@@ -517,72 +496,26 @@ void __myaccount_genlist_account_list_item_append(appdata *ad, Evas_Object *genl
MA_DEBUG("__myaccount_genlist_account_list_item_append() end");
}
-static bool __myaccount_get_account_app_info_cb(account_type_h account_type, void *user_data);
-
-static Evas_Object *__create_genlist_account_list(void *data)
+static char *__gl_text_get_registered_account_list_title(void *data, Evas_Object *obj, const char *part)
{
- appdata *ad = data;
-
- Evas_Object *genlist;
- Evas_Object *circle_obj;
- Elm_Genlist_Item_Class *itc_title, *itc_padding;
-
- retv_if(ad == NULL, NULL);
-
- /* make genlist */
- genlist = elm_genlist_add(ad->navi_frame);
- retv_if(genlist == NULL, NULL);
-
- /* set genlist property */
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
-
- circle_obj = eext_circle_object_genlist_add(genlist, ad->circle_surface);
- eext_circle_object_genlist_scroller_policy_set(circle_obj,
- ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE);
-
- /* create genlist class */
- itc_title = elm_genlist_item_class_new();
- itc_title->item_style = "title";
- itc_title->func.text_get = __gl_text_get_account_list_title;
- elm_genlist_item_append(genlist, itc_title,
- NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_class_free(itc_title);
-
- /* get account app info */
- account_type_foreach_account_type_from_db(__myaccount_get_account_app_info_cb, ad);
- //To Do : free account_list
- ad->account_list = NULL;
- account_foreach_account_from_db(__myaccount_get_account_list_info_cb, ad);
- __myaccount_genlist_account_list_item_append(ad, genlist);
-
- itc_padding = elm_genlist_item_class_new();
- itc_padding->item_style = "padding";
- elm_genlist_item_append(genlist, itc_padding,
- NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_class_free(itc_padding);
-
- evas_object_show(genlist);
-
- return genlist;
+ if (!strcmp(part, "elm.text"))
+ return strdup("Accounts");
+ else
+ return NULL;
}
-static char *__gl_text_get_add_account_title(void *data, Evas_Object *obj,
- const char *part)
+static char *__gl_text_get_add_account_title(void *data, Evas_Object *obj, const char *part)
{
- if (!strcmp(part, "elm.text")) {
-// return dgettext(MA_UG_NAME, "IDS_MA_HEADER_ADD_ACCOUNT");
- return strdup("Add Account");
- } else {
+ if (!strcmp(part, "elm.text"))
+ return strdup("Add Accounts");
+ else
return NULL;
- }
}
-static char *__gl_text_get_add_account_label(void *data,
- Evas_Object *obj, const char *part)
+static char *__gl_text_get_add_account_label(void *data, Evas_Object *obj, const char *part)
{
myaccount_account_app_info *account_app_info = (myaccount_account_app_info *)data;
-// char domain_name_lower[128] = {0,};
+ /* char domain_name_lower[128] = {0,}; */
MA_DEBUG("__gl_text_get_add_account_label start");
if (!account_app_info) {
@@ -591,7 +524,7 @@ static char *__gl_text_get_add_account_label(void *data,
}
if (!strcmp(part, "elm.text")) {
-// myaccount_common_lowercase(account_info->domain_name, domain_name_lower);
+ /* myaccount_common_lowercase(account_info->domain_name, domain_name_lower); */
MA_DEBUG("__gl_text_get_add_account_label elm.text");
return elm_entry_utf8_to_markup(account_app_info->service_name);
} else
@@ -604,7 +537,7 @@ static void __gl_add_account_del(void *data, Evas_Object *obj)
MA_MEM_FREE(account_app);
- //To Do : ad->account_app_list = NULL;
+ /* To Do : ad->account_app_list = NULL; */
}
static void __gl_add_account_clicked_cb(void *data, Evas_Object *obj, void *event_info)
@@ -626,14 +559,14 @@ static void __gl_add_account_clicked_cb(void *data, Evas_Object *obj, void *even
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
- app_control_create(&service);
+ app_control_create(&service);
app_control_set_app_id(service, account_app_info->package_name);
app_control_set_operation(service, ACCOUNT_OPERATION_SIGNIN);
app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
int ret = app_control_send_launch_request(service, NULL, NULL);
- if ( ret != APP_CONTROL_ERROR_NONE ) {
+ if (ret != APP_CONTROL_ERROR_NONE)
MA_DEBUG_ERR("app_control_send_launch_request fail, ret = %d\n", ret);
- }
+
app_control_destroy(service);
MA_DEBUG("__gl_add_account_clicked_cb end");
@@ -643,7 +576,7 @@ void __myaccount_genlist_add_account_item_append(appdata *ad, Evas_Object *genli
{
MA_DEBUG("__myaccount_genlist_add_account_item_append() start");
GList* iter;
- for(iter=ad->account_app_list; iter!=NULL; iter=g_list_next(iter)) {
+ for (iter = ad->account_app_list; iter != NULL; iter = g_list_next(iter)) {
myaccount_account_app_info* tmp = (myaccount_account_app_info*)iter->data;
MA_DEBUG("iter start");
Elm_Genlist_Item_Class *itc_account_app = NULL;
@@ -652,8 +585,7 @@ void __myaccount_genlist_add_account_item_append(appdata *ad, Evas_Object *genli
itc_account_app->item_style = "1text";
itc_account_app->func.text_get = __gl_text_get_add_account_label;
itc_account_app->func.del = __gl_add_account_del;
- item_account_app = elm_genlist_item_append(genlist, itc_account_app,
- tmp, NULL, ELM_GENLIST_ITEM_NONE, __gl_add_account_clicked_cb, tmp);
+ item_account_app = elm_genlist_item_append(genlist, itc_account_app, tmp, NULL, ELM_GENLIST_ITEM_NONE, __gl_add_account_clicked_cb, tmp);
ad->item_list_account = g_list_append(ad->item_list_account, (void*)item_account_app);
elm_genlist_item_class_free(itc_account_app);
MA_DEBUG("iter end");
@@ -673,7 +605,7 @@ static myaccount_account_app_info* __myaccount_create_account_app_info()
bool myaccount_add_account_by_package_name_cb(account_h account, void *user_data)
{
- return false;
+ return false;
}
static bool __myaccount_get_account_app_info_cb(account_type_h account_type, void *user_data)
@@ -683,9 +615,8 @@ static bool __myaccount_get_account_app_info_cb(account_type_h account_type, voi
int type_int = -1, ret = -1;
myaccount_account_app_info* app_info = NULL;
- if(ad == NULL){
+ if (ad == NULL)
MA_DEBUG_ERR("app data is null\n");
- }
if (account_type == NULL) {
MA_DEBUG_ERR(" account type handle is NULL \n");
@@ -700,10 +631,9 @@ static bool __myaccount_get_account_app_info_cb(account_type_h account_type, voi
}
ret = account_type_get_app_id(account_type, &type_buf);
- if (ret == ACCOUNT_ERROR_NONE ) {
+ if (ret == ACCOUNT_ERROR_NONE) {
if (type_buf) {
- MA_STRNCPY(app_info->package_name, type_buf,
- sizeof(app_info->package_name));
+ MA_STRNCPY(app_info->package_name, type_buf, sizeof(app_info->package_name));
} else {
MA_DEBUG_ERR("No appid available\n");
}
@@ -714,7 +644,7 @@ static bool __myaccount_get_account_app_info_cb(account_type_h account_type, voi
ret = account_type_get_icon_path(account_type, &type_buf);
if (ret == ACCOUNT_ERROR_NONE) {
- if(type_buf) {
+ if (type_buf) {
MA_STRNCPY(app_info->icon_path, type_buf, sizeof(app_info->icon_path));
} else {
MA_DEBUG_ERR("No icon path available\n");
@@ -727,11 +657,10 @@ static bool __myaccount_get_account_app_info_cb(account_type_h account_type, voi
char* provider_name = NULL;
if (ad && ad->current_language) {
- if (!strcmp(ad->current_language, "en_US")) {
+ if (!strcmp(ad->current_language, "en_US"))
ret = account_type_get_label_by_locale(account_type, "en_GB", &provider_name);
- } else {
+ else
ret = account_type_get_label_by_locale(account_type, ad->current_language, &provider_name);
- }
}
if (ret != ACCOUNT_ERROR_NONE) {
@@ -744,13 +673,12 @@ static bool __myaccount_get_account_app_info_cb(account_type_h account_type, voi
}
}
- MA_STRNCPY(app_info->service_name, provider_name,
- sizeof(app_info->service_name));
+ MA_STRNCPY(app_info->service_name, provider_name, sizeof(app_info->service_name));
MA_MEM_FREE(provider_name);
/* Left below sorting value(service_sname) for future use */
-// MA_SNPRINTF(app_info->service_sname, sizeof(app_info->service_sname), "%s%s", SORT_PRIOR_3, app_info->service_name);
+ /* MA_SNPRINTF(app_info->service_sname, sizeof(app_info->service_sname), "%s%s", SORT_PRIOR_3, app_info->service_name); */
account_type_get_multiple_account_support(account_type, &type_int);
app_info->multiple_account_support = type_int;
@@ -766,17 +694,15 @@ static bool __myaccount_get_account_app_info_cb(account_type_h account_type, voi
return TRUE;
}
-static char *__gl_text_get_no_content_label(void *data,
- Evas_Object *obj, const char *part)
+static char *__gl_text_get_no_content_label(void *data, Evas_Object *obj, const char *part)
{
MA_DEBUG("__gl_text_get_no_content_label start");
if (!strcmp(part, "elm.text")) {
-// myaccount_common_lowercase(account_info->domain_name, domain_name_lower);
MA_DEBUG("__gl_text_get_no_content_label elm.text");
return strdup("No Account Provider");
-// return dgettext(MA_UG_NAME, "IDS_MA_NPBODY_NO_ACCOUNT_PROVIDER_APPS_INSTALLED");
- } else
+ } else {
return NULL;
+ }
MA_DEBUG("__gl_text_get_no_content_label end");
}
@@ -788,44 +714,72 @@ void __myaccount_genlist_no_content_item_append(appdata *ad, Evas_Object *genlis
itc_no_content = elm_genlist_item_class_new();
itc_no_content->item_style = "1text";
itc_no_content->func.text_get = __gl_text_get_no_content_label;
- item_no_content = elm_genlist_item_append(genlist, itc_no_content,
- NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ item_no_content = elm_genlist_item_append(genlist, itc_no_content, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(itc_no_content);
ad->item_no_content = item_no_content;
MA_DEBUG("__myaccount_genlist_no_content_item_append() end");
}
-static Evas_Object *__create_genlist_add_account(void *data)
+int _myaccount_get_accounts_total_count(void)
+{
+ int account_cnt = -1;
+ int ret = account_get_total_count_from_db_ex(&account_cnt);
+ if (ret != ACCOUNT_ERROR_NONE) {
+ MA_DEBUG_ERR("myaccount account_get_total_count_from_db_ex fail error=[%d]", ret);
+ } else {
+ if (account_cnt > 0)
+ MA_DEBUG("myaccount account_cnt > 0, count = [%d]", account_cnt);
+ else if (account_cnt <= 0)
+ MA_DEBUG("myaccount account_cnt <= 0, count = [%d]", account_cnt);
+ }
+
+ return account_cnt;
+}
+
+static Eina_Bool naviframe_pop_cb(void *data, Elm_Object_Item *it)
+{
+ appdata *ad = data;
+
+ int account_cnt = _myaccount_get_accounts_total_count();
+ if (account_cnt != previous_cnt) {
+ MA_DEBUG("account_cnt is changed from [%d]", previous_cnt);
+ _myaccount_view_main_create(ad);
+ elm_win_activate(ad->main_win);
+ }
+
+ return EINA_TRUE;
+}
+
+void __create_genlist_add_account(void *data, Evas_Object *obj, void *event_info)
{
appdata *ad = data;
+ /* set account mode as adding accounts */
+ ad->current_view = VIEW_ADD_ACCOUNTS;
+ ad->mode = MYACCOUNT_ADD_ACCOUNT_MODE;
+
Evas_Object *genlist;
Evas_Object *circle_obj;
Elm_Genlist_Item_Class *itc_title, *itc_padding;
- retv_if(ad == NULL, NULL);
-
/* make genlist */
genlist = elm_genlist_add(ad->navi_frame);
- retv_if(genlist == NULL, NULL);
/* set genlist property */
elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
circle_obj = eext_circle_object_genlist_add(genlist, ad->circle_surface);
- eext_circle_object_genlist_scroller_policy_set(circle_obj,
- ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_circle_object_genlist_scroller_policy_set(circle_obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE);
/* create genlist class + */
itc_title = elm_genlist_item_class_new();
itc_title->item_style = "title";
itc_title->func.text_get = __gl_text_get_add_account_title;
- elm_genlist_item_append(genlist, itc_title,
- NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_append(genlist, itc_title, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(itc_title);
- //To Do : free account_app_list
+ /* To Do : free account_app_list */
ad->account_app_list = NULL;
account_type_foreach_account_type_from_db(__myaccount_get_account_app_info_cb, ad);
if (ad->account_app_list == NULL)
@@ -835,12 +789,70 @@ static Evas_Object *__create_genlist_add_account(void *data)
itc_padding = elm_genlist_item_class_new();
itc_padding->item_style = "padding";
- elm_genlist_item_append(genlist, itc_padding,
- NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_append(genlist, itc_padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(itc_padding);
evas_object_show(genlist);
+ elm_naviframe_item_push(ad->navi_frame, "Add Accounts", NULL, NULL, genlist, "empty");
+ elm_naviframe_item_pop_cb_set(ad->navi_frame, naviframe_pop_cb, ad);
+}
+
+static Evas_Object *__create_genlist_account_list(void *data)
+{
+ appdata *ad = data;
+
+ /* set account mode as showing account list */
+ ad->current_view = VIEW_MAIN;
+ ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
+
+ Evas_Object *genlist;
+ Evas_Object *circle_obj;
+ Evas_Object *add_button;
+ Elm_Genlist_Item_Class *itc_title, *itc_padding;
+
+ /* make genlist */
+ genlist = elm_genlist_add(ad->navi_frame);
+
+ /* set genlist property */
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+
+ circle_obj = eext_circle_object_genlist_add(genlist, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_obj, EINA_TRUE);
+
+ /* create genlist class */
+ itc_title = elm_genlist_item_class_new();
+ itc_title->item_style = "title";
+ itc_title->func.text_get = __gl_text_get_registered_account_list_title;
+ elm_genlist_item_append(genlist, itc_title, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_class_free(itc_title);
+
+ /* get account app info */
+ account_type_foreach_account_type_from_db(__myaccount_get_account_app_info_cb, ad);
+ /* To Do : free account_list */
+ ad->account_list = NULL;
+ account_foreach_account_from_db(__myaccount_get_account_list_info_cb, ad);
+ __myaccount_genlist_account_list_item_append(ad, genlist);
+
+ itc_padding = elm_genlist_item_class_new();
+ itc_padding->item_style = "padding";
+ elm_genlist_item_append(genlist, itc_padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_class_free(itc_padding);
+
+ /* add button "ADD" */
+ elm_layout_theme_set(genlist, "layout", "bottom_button", "default");
+ add_button = elm_button_add(genlist);
+ elm_object_style_set(add_button, "bottom");
+ elm_object_text_set(add_button, "ADD");
+ elm_object_part_content_set(genlist, "elm.swallow.button", add_button);
+ evas_object_smart_callback_add(add_button, "clicked", __create_genlist_add_account, ad);
+
+ evas_object_show(genlist);
+ evas_object_show(add_button);
+
+ previous_cnt = _myaccount_get_accounts_total_count();
+
return genlist;
}
@@ -851,20 +863,11 @@ bool _myaccount_view_main_create(void *data)
retv_if(!(ad->mode == MYACCOUNT_ADD_ACCOUNT_MODE || ad->mode == MYACCOUNT_ACCOUNT_LIST_MODE), false);
lang_changed(ad);
+
/* Draw UI */
- if (ad->mode == MYACCOUNT_ACCOUNT_LIST_MODE) {
- ad->main_genlist = __create_genlist_account_list(ad);
- } else {
- ad->main_genlist = __create_genlist_add_account(ad);
- }
+ ad->main_genlist = __create_genlist_account_list(ad);
+
+ elm_naviframe_item_push(ad->navi_frame, "Accounts", NULL, NULL, ad->main_genlist, "empty");
- elm_naviframe_item_push(ad->navi_frame, NULL, NULL, NULL, ad->main_genlist, "empty");
- ad->current_view = V_MAIN;
-/*
- if (VCONF_OK != vconf_notify_key_changed(VCONFKEY_NFC_PAYMENT_HANDLERS,
- __payment_handler_vconf_key_changed, ad)) {
- MA_DEBUG_ERR("vconf_notify_key_changed error");
- }
-*/
return true;
}
diff --git a/wearable/org.tizen.my-account.xml b/wearable/org.tizen.my-account.xml
index 2730cf4..20da2db 100755
--- a/wearable/org.tizen.my-account.xml
+++ b/wearable/org.tizen.my-account.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.my-account" version="0.0.1" install-location="internal-only" api-version="2.3.1">
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.my-account" version="0.0.1" install-location="internal-only" api-version="3.0">
<label>Accounts</label>
<author email="jiseob.jang@samsung.com" href="www.samsung.com">Jiseob Jang</author>
<description>Account Setting App</description>