static Elm_Genlist_Item_Class account_list_itc;
static Elm_Genlist_Item_Class account_list_title_itc;
-#ifdef ACCOUNT_SYNC_ALL
-static Elm_Genlist_Item_Class account_auto_sync_itc;
-#endif
static Elm_Genlist_Item_Class account_list_itc_sep;
static Elm_Genlist_Item_Class account_list_itc_sep_end;
static myaccount_list_priv *account_info;
myaccount_addaccount_create_view(priv);
}
-#ifdef ACCOUNT_SYNC_ALL
-static void __myaccount_check_sync_support_active_count(int *active_count)
-{
- int index = 0;
- int count = 0, tmp_count = 0;
-
- if (account_info && account_info->capablity_list) {
- g_slist_free(account_info->capablity_list);
- account_info->capablity_list = NULL;
- }
- MA_MEMFREE(account_info);
- account_index = 0;
- count = __myaccount_account_list_populate_account_info();
-
- for (index = 0; index < count; index++) {
- MYACCOUNT_VERBOSE("account_info[%d].sync_status = [%d]",
- index, account_info[index].sync_status);
- if (account_info[index].sync_status == ACCOUNT_SYNC_STATUS_RUNNING) {
- tmp_count++;
- }
- }
- *active_count = tmp_count;
-}
-
-static void __myaccount_account_list_refresh_btn_clicked_cb( void *data,
- Evas_Object *obj, void *event_info )
-{
- myaccount_appdata *ad = (myaccount_appdata*)data;
- int ret = -1;
- int sync_all_status = -1;
- MYACCOUNT_VERBOSE("__myaccount_account_list_refresh_btn_clicked_cb START");
- if (vconf_get_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, &sync_all_status) < 0) {
- MYACCOUNT_ERROR("Fail to get VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT\n");
- return;
- }
- if (sync_all_status == 0) {
- Evas_Object *tmp = elm_object_part_content_unset(ad->refresh_btn, "icon");
- evas_object_hide (tmp);
- elm_object_part_content_set(ad->refresh_btn, "icon", ad->cancel_sync_icon);
- evas_object_show (ad->cancel_sync_icon);
- ret = vconf_set_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, 1);
- if (ret == 0) {
- MYACCOUNT_DBUG("vconf_set_int Success %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- } else {
- MYACCOUNT_ERROR("vconf_set_int Failed!!! %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- }
- if (ad->account_genlist)
- myaccount_list_refresh_item_list(ad);
- } else if (sync_all_status == 1) {
- Evas_Object *tmp = elm_object_part_content_unset(ad->refresh_btn, "icon");
- evas_object_hide (tmp);
- elm_object_part_content_set(ad->refresh_btn, "icon", ad->refresh_icon);
- evas_object_show (ad->refresh_icon);
- ret = vconf_set_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, 0);
- if (ret == 0) {
- MYACCOUNT_DBUG("vconf_set_int Success %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- } else {
- MYACCOUNT_ERROR("vconf_set_int Failed!!! %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- }
- if (ad->account_genlist)
- myaccount_list_refresh_item_list(ad);
- } else {
- MYACCOUNT_INFO("Unkown sync all status(%d) \n", sync_all_status);
- }
-}
-#endif
-
static char *__myaccount_account_list_gl_label_get(void *data,
Evas_Object *obj, const char *part)
{
return NULL;
}
-#ifdef ACCOUNT_SYNC_ALL
-static char *__myaccount_account_auto_sync_gl_label_get(void *data,
- Evas_Object *obj, const char *part)
-{
- MYACCOUNT_VERBOSE("__myaccount_account_auto_sync_gl_label_get data=%p, obj = %p, part=%s\n",
- data, obj, part);
-
- if (!strcmp(part, "elm.text"))
- return (strdup(dgettext(MA_UG_NAME, "IDS_MA_MBODY_AUTO_SYNC")));
-
- return NULL;
-}
-
-static void __myaccount_account_auto_sync_gl_sel(void *data,
- Evas_Object *obj, void *event_info)
-{
- if (!data || !obj) {
- MYACCOUNT_ERROR("__myaccount_account_auto_sync_gl_sel : data or obj is NULL");
- return;
- }
- myaccount_appdata *ad = (myaccount_appdata*)data;
- int ret = -1;
-
- Eina_Bool state = elm_check_state_get(ad->auto_sync_check);
- MYACCOUNT_VERBOSE("__myaccount_account_auto_sync_gl_sel :check state= %d\n", state);
-
- if (state == 0) {
- elm_check_state_set(ad->auto_sync_check, EINA_TRUE);
- ret = vconf_set_int(VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, 1);
- } else {
- elm_check_state_set(ad->auto_sync_check, EINA_FALSE);
- ret = vconf_set_int(VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, 0);
- }
-
- if (ret == 0) {
- MYACCOUNT_DBUG("vconf_set_int Success %s : %d\n",
- VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, !state);
- if (ad->account_genlist)
- myaccount_list_refresh_item_list(ad);
- } else {
- MYACCOUNT_ERROR("vconf_set_int Failed!!! %s : %d\n",
- VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, !state);
- }
- elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
-}
-
-static void __myaccount_account_auto_sync_check_clicked_cb(void *data,
- Evas_Object *obj, void *event_info)
-{
- if (!obj || !data) {
- MYACCOUNT_ERROR("__myaccount_account_auto_sync_check_clicked_cb : data or obj is NULL");
- return;
- }
-
- myaccount_appdata *ad = (myaccount_appdata*)data;
-
- Eina_Bool state = elm_check_state_get(obj);
- MYACCOUNT_VERBOSE("__myaccount_account_auto_sync_check_clicked_cb : %d\n", state);
-
- int ret = vconf_set_int(VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, (const int)state);
- if (ret == 0) {
- MYACCOUNT_DBUG("vconf_set_int Success %s : %d\n",
- VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, state);
- if (ad->account_genlist)
- myaccount_list_refresh_item_list(ad);
- } else {
- MYACCOUNT_ERROR("vconf_set_int Failed!!! %s : %d\n",
- VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT, state);
- }
-
-}
-
-static Evas_Object *__myaccount_account_auto_sync_gl_icon_get(void *data,
- Evas_Object *obj, const char *part)
-{
- if (!obj || !data)
- return NULL;
-
- myaccount_appdata *ad = (myaccount_appdata*)data;
- int auto_sync_status = -1;
- MYACCOUNT_VERBOSE("__myaccount_account_auto_sync_gl_icon_get data=%p, obj = %p, part=%s\n",
- data, obj, part);
- if (!strcmp(part, "elm.icon")) {
- if (ad->auto_sync_check) {
- evas_object_del(ad->auto_sync_check);
- ad->auto_sync_check = NULL;
- }
- ad->auto_sync_check = elm_check_add(obj);
- if (vconf_get_int(VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT,
- &auto_sync_status) < 0) {
- MYACCOUNT_ERROR("Fail to getVCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT\n");
- }
- if (auto_sync_status == 0)
- elm_check_state_set(ad->auto_sync_check, EINA_FALSE);
- if (auto_sync_status == 1)
- elm_check_state_set(ad->auto_sync_check, EINA_TRUE);
- elm_object_part_content_set(obj, "elm.icon", ad->auto_sync_check);
- elm_object_style_set(ad->auto_sync_check, "on&off");
- evas_object_smart_callback_add(ad->auto_sync_check, "changed",
- __myaccount_account_auto_sync_check_clicked_cb,
- (void *)ad);
- evas_object_show(ad->auto_sync_check);
- return ad->auto_sync_check;
- }
- return NULL;
-}
-#endif
-
-
static Evas_Object *__myaccount_account_list_gl_icon_get(void *data,
Evas_Object *obj, const char *part)
{
char tempbuf[PATH_MAX];
Evas_Object *icon = NULL;
- int auto_sync_status = -1;
myaccount_list_priv *account_info_item = (myaccount_list_priv*)data;
MYACCOUNT_VERBOSE("__myaccount_account_list_gl_icon_get START data=%p, obj = %p, part=%s\n",
if (!strcmp(part, "elm.icon.2")) {
if (account_info_item->sync_status == ACCOUNT_SYNC_NOT_SUPPORT)
return NULL;
- if (vconf_get_int(VCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT,
- &auto_sync_status) < 0) {
- MYACCOUNT_ERROR("Fail to getVCONFKEY_ACCOUNT_AUTO_SYNC_STATUS_INT\n");
- }
- if ((strlen(account_info_item->capability) > 0 )
- && (auto_sync_status == 1)) {
- if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_IDLE) {
- MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
- "66_myaccount_icon_push.png");
- } else if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_OFF) {
- MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
- "66_myaccount_icon_push_deactivated.png");
- } else if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_RUNNING){
- MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
- "66_myaccount_icon_push_press.png");
- }
- } else {
- if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_IDLE
- || account_info_item->sync_status == ACCOUNT_SYNC_STATUS_OFF ) {
- MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
- "66_myaccount_icon_push_deactivated.png");
- } else if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_RUNNING){
- MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
- "66_myaccount_icon_push_press.png");
- }
+ if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_IDLE
+ || account_info_item->sync_status == ACCOUNT_SYNC_STATUS_OFF ) {
+ MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
+ "66_myaccount_icon_push_deactivated.png");
+ } else if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_RUNNING){
+ MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
+ "66_myaccount_icon_push_press.png");
}
MYACCOUNT_DBUG("## icon path (%s)\n", tempbuf);
return icon;
}
-static Evas_Object *__myaccount_account_list_title_progress_get(void *data,
- Evas_Object *obj, const char *part)
-{
- int sync_all_status;
-
- if (!obj)
- return NULL;
-
- if (vconf_get_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, &sync_all_status) < 0) {
- MYACCOUNT_ERROR("Fail to get VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT\n");
- return NULL;
- }
-
- if (!strcmp(part, "elm.icon") && (sync_all_status == 1)) {
- Evas_Object *progressbar = NULL;
- progressbar = elm_progressbar_add(obj);
- elm_object_style_set(progressbar, "list_process_small");
- evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
- evas_object_size_hint_weight_set(progressbar,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_show(progressbar);
- elm_progressbar_pulse(progressbar, EINA_TRUE);
- return progressbar;
- }
-
- return NULL;
-}
-
static void _myaccount_ug_account_list_layout_cb(ui_gadget_h ug,
enum ug_mode mode, void *priv)
{
&account_list_itc_sep, NULL, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-#ifdef ACCOUNT_SYNC_ALL
- elm_genlist_item_append(ad->account_genlist,
- &account_auto_sync_itc, (void *)ad, NULL,
- ELM_GENLIST_ITEM_NONE,
- __myaccount_account_auto_sync_gl_sel,
- (void *)ad);
-#endif
it = elm_genlist_item_append(ad->account_genlist,
&account_list_title_itc, NULL, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
index = elm_genlist_item_index_get(it);
MYACCOUNT_VERBOSE("Total genlist item count(%d)!!! \n", total_count);
-#ifdef ACCOUNT_SYNC_ALL
- if(index > 3 && index < total_count)
-#else
if(index > 2 && index < total_count)
-#endif
{
/*Add account items. index 1 and last are the seperators*/
myaccount_list_priv *account_info_item = (myaccount_list_priv*)elm_object_item_data_get(it);
ao = elm_object_item_access_object_get(it);
elm_access_info_set(ao, ELM_ACCESS_INFO, buf);
}
- } else if (index == 2) {
- ao = elm_object_item_access_object_get(it);
- elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, "Turn Auto Sync on or off");
- } else if (index == 3) {
- ao = elm_object_item_access_object_get(it);
- elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, "Below is the list of all logged in accounts");
- } else {
+ }else {
/*Remove access for seperators*/
elm_object_item_access_unregister(ei);
}
-#ifdef ACCOUNT_SYNC_ALL
- if(total_count <= 5)
-#else
if(total_count <= 4)
-#endif
{
MYACCOUNT_INFO("DO NOTHING only one account exist, total_count(%d) index(%d) !!! \n", total_count, index);
} else {
if (index == 1) {
MYACCOUNT_VERBOSE("DO NOTHING realized (%d) !!! \n", index);
-#ifdef ACCOUNT_SYNC_ALL
- } else if (index == 4) {
-#else
} else if (index == 2) {
-#endif
MYACCOUNT_VERBOSE("TOP realized (%d) !!! \n", index);
elm_object_item_signal_emit(ei, "elm,state,top", "");
} else if (index == (total_count-2)) {
account_list_title_itc.item_style = "dialogue/title";
account_list_title_itc.func.text_get = __myaccount_account_list_title_get;
- account_list_title_itc.func.content_get = __myaccount_account_list_title_progress_get;
+ account_list_title_itc.func.content_get = NULL;
account_list_title_itc.func.state_get = NULL;
account_list_title_itc.func.del = NULL;
-#ifdef ACCOUNT_SYNC_ALL
- account_auto_sync_itc.item_style = "dialogue/1text.1icon";
- account_auto_sync_itc.func.text_get = __myaccount_account_auto_sync_gl_label_get;
- account_auto_sync_itc.func.content_get = __myaccount_account_auto_sync_gl_icon_get;
- account_auto_sync_itc.func.state_get = NULL;
- account_auto_sync_itc.func.del = NULL;
-#endif
/*to add 40 pixel separator*/
account_list_itc_sep.item_style = "dialogue/separator";
Evas_Object *layout;
Evas_Object *l_button;
Evas_Object *btn;
-#ifdef ACCOUNT_SYNC_ALL
- int sync_all_status;
- int active_count = 0;
- int index = 0;
- int ret =-1;
- char buf[BUFSIZE]={0,};
-#endif
if (ad == NULL) {
MYACCOUNT_ERROR("myaccount_ug_account_list_create myaccount_appdata is null\n");
elm_object_style_set(ad->bg, "group_list");
evas_object_show(layout);
-#ifdef ACCOUNT_SYNC_ALL
- ad->refresh_btn = elm_button_add(ad->navi_bar);
- elm_object_style_set(ad->refresh_btn, "naviframe/title_icon");
-
- ad->refresh_icon = elm_icon_add(ad->navi_bar);
- MA_SNPRINTF(buf, BUFSIZE, "%s", "refresh.png");
- if (strstr(buf, "/"))
- elm_image_file_set(ad->refresh_icon, buf, NULL);
- else
- elm_image_file_set(ad->refresh_icon, MA_IMAGE_EDJ_NAME, buf);
- elm_image_no_scale_set(ad->refresh_icon, EINA_FALSE);
-
- ad->cancel_sync_icon = elm_icon_add(ad->navi_bar);
- MA_SNPRINTF(buf, BUFSIZE, "%s", "cancel_sync.png");
- if (strstr(buf, "/"))
- elm_image_file_set(ad->cancel_sync_icon, buf, NULL);
- else
- elm_image_file_set(ad->cancel_sync_icon, MA_IMAGE_EDJ_NAME, buf);
- elm_image_no_scale_set(ad->cancel_sync_icon, EINA_FALSE);
-#endif
-
genlist = __myaccount_account_list_create_genlist(ad);
-#ifdef ACCOUNT_SYNC_ALL
-
- if (vconf_get_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, &sync_all_status) < 0) {
- MYACCOUNT_ERROR("Fail to get VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT\n");
- return;
- }
- if (sync_all_status == 0) {
- elm_object_part_content_set(ad->refresh_btn, "icon", ad->refresh_icon);
- } else {
- for (index = 0; index < account_index; index++) {
- if (account_info[index].sync_status == ACCOUNT_SYNC_STATUS_RUNNING)
- active_count++;
- }
- if (active_count == 0) {
- elm_object_part_content_set(ad->refresh_btn, "icon", ad->refresh_icon);
- ret = vconf_set_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, 0);
- if (ret == 0) {
- MYACCOUNT_VERBOSE("vconf_set_int Success %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- } else {
- MYACCOUNT_ERROR("vconf_set_int Failed!!! %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- }
- } else {
- elm_object_part_content_set(ad->refresh_btn, "icon", ad->cancel_sync_icon);
- }
- }
- evas_object_smart_callback_add(ad->refresh_btn,
- "clicked", __myaccount_account_list_refresh_btn_clicked_cb, ad);
-#endif
-
elm_object_part_content_set (layout, "accountlist.genlist", genlist);
ad->l_title_sk = l_button = elm_button_add(ad->navi_bar);
evas_object_smart_callback_add(l_button, "clicked",
dgettext(MA_UG_NAME,
"IDS_ST_HEADER_ACCOUNTS_AND_SYNC"),
l_button, NULL, layout, NULL);
-#ifdef ACCOUNT_SYNC_ALL
- elm_object_item_part_content_set(ad->navi_it,
- "title_right_btn", ad->refresh_btn);
-#endif
btn = elm_button_add(ad->navi_bar);
if (!btn) {
MYACCOUNT_ERROR("myaccount_ug_account_list_create elm_button_add FAIL\n");
return;
}
-#ifdef ACCOUNT_SYNC_ALL
-void myaccount_check_syncall_finish(myaccount_appdata *ad)
-{
- int ret = -1;
- int active_count = -1;
- int sync_all_status = -1;
-
- MYACCOUNT_VERBOSE("myaccount_check_syncall_finish START\n");
- if (vconf_get_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, &sync_all_status) < 0) {
- MYACCOUNT_ERROR("Fail to get VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT\n");
- return;
- }
- if (sync_all_status == 1) {
- __myaccount_check_sync_support_active_count(&active_count);
- MYACCOUNT_DBUG("sync_all_status[1], active_count[%d]\n", active_count);
-
- if ( active_count == 0 ) {
- Evas_Object *tmp = elm_object_part_content_unset(ad->refresh_btn, "icon");
- evas_object_hide (tmp);
- elm_object_part_content_set(ad->refresh_btn, "icon", ad->refresh_icon);
- evas_object_show (ad->refresh_icon);
-
- ret = vconf_set_int(VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT, 0);
- if (ret == 0) {
- MYACCOUNT_DBUG("vconf_set_int Success %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- } else {
- MYACCOUNT_ERROR("vconf_set_int Failed!!! %s \n",
- VCONFKEY_ACCOUNT_SYNC_ALL_STATUS_INT);
- }
- }
- }
-}
-#endif
-