2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "myaccount_ug_account_list.h"
20 #include "myaccount_ug_addaccount.h"
21 #include "myaccount_ug_common.h"
23 typedef struct __capability_data {
26 }myaccount_capability_data;
28 typedef struct __account_list_priv {
31 char display_name[256];
32 char email_address[256];
33 char package_name[256];
35 char icon_path[PATH_MAX];
40 GSList *capablity_list;
43 static Elm_Genlist_Item_Class account_list_itc;
44 static Elm_Genlist_Item_Class account_list_title_itc;
45 static Elm_Genlist_Item_Class account_list_itc_sep;
46 static Elm_Genlist_Item_Class account_list_itc_sep_end;
47 static myaccount_list_priv *account_info;
48 static int account_index = 0;
50 static void __myaccount_account_list_addaccount_cb( void *data,
51 Evas_Object *obj, void* event_info );
52 static void _myaccount_ug_account_list_layout_cb(ui_gadget_h ug,
53 enum ug_mode mode, void *priv);
54 static void _myaccount_ug_account_list_result_cb(ui_gadget_h ug,
55 service_h service, void *priv);
56 static void _myaccount_ug_account_list_destroy_cb(ui_gadget_h ug,
58 static void __myaccount_account_list_append_genlist(myaccount_appdata *ad,
61 static char *__myaccount_account_list_get_capablity_string_value(const char* capability_type)
63 if (!strcmp(capability_type, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT))
64 return dgettext(MA_UG_NAME, "IDS_MA_BODY_CONTACT");
65 else if (!strcmp(capability_type, ACCOUNT_SUPPORTS_CAPABILITY_CALENDAR))
66 return dgettext("sys_string", "IDS_COM_BODY_S_PLANNER");
67 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_PHOTO))
68 return dgettext(MA_UG_NAME, "IDS_PB_BODY_PHOTO");
69 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_VIDEO))
70 return dgettext(MA_UG_NAME, "IDS_ST_BODY_VIDEOS");
71 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_EMAIL))
72 return dgettext(MA_UG_NAME, "IDS_COM_BODY_EMAIL");
73 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_POST))
74 return dgettext(MA_UG_NAME, "IDS_TW_BODY_POST_TWITTER");
75 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_VOIP))
76 return dgettext(MA_UG_NAME, "IDS_COM_BODY_VOIP_CALL");
77 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS))
78 return dgettext(MA_UG_NAME, "IDS_COM_BODY_SAMSUNG_APPS_T_MAINMENU");
79 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER))
80 return dgettext(MA_UG_NAME, "IDS_ST_BODY_MOBILE_TRACKER");
81 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_TASK))
82 return dgettext(MA_UG_NAME, "IDS_COM_BODY_TASK");
83 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_MEMO))
84 return dgettext("sys_string", "IDS_COM_BODY_S_NOTE");
85 else if (!strcmp(capability_type ,ACCOUNT_SUPPORTS_CAPABILITY_MUSIC))
86 return dgettext("sys_string", "IDS_COM_BODY_MUSIC");
88 return NULL;//return dgettext(MA_UG_NAME, "IDS_COM_POP_UNKNOWN");
91 bool _myaccount_account_list_get_capablity_text(const char* capability_type,
92 account_capability_state_e capability_state,
95 /* get capabilities of the account*/
96 char *capability_string = NULL;
97 myaccount_list_priv *account_info = (myaccount_list_priv*)user_data;
98 char *capability_textbuf = account_info->capability;
100 myaccount_capability_data *cap_data = (myaccount_capability_data*)malloc(sizeof(myaccount_capability_data));
102 MYACCOUNT_FATAL("malloc failed\n");
105 memset(cap_data, 0, sizeof(myaccount_capability_data));
107 cap_data->type = strdup(capability_type);
108 cap_data->state = capability_state;
110 account_info->capablity_list = g_slist_append(account_info->capablity_list, (gpointer)cap_data);
112 if (capability_state == ACCOUNT_CAPABILITY_ENABLED) {
113 capability_string = __myaccount_account_list_get_capablity_string_value(
116 if (capability_string != NULL) {
117 MYACCOUNT_VERBOSE("capability_string = %s\n", capability_string);
118 if(strlen(capability_textbuf) > 0) {
119 char *temp2 = strdup(capability_textbuf);
121 MYACCOUNT_FATAL("strdup returns NULL\n");
124 MA_SNPRINTF(capability_textbuf, 127, "%s, %s", temp2, capability_string);
127 MA_SNPRINTF(capability_textbuf, 127, "%s%s", capability_textbuf,
133 MYACCOUNT_VERBOSE("capability_textbuf = %s \n", capability_textbuf);
137 bool _myaccount_account_list_account_info_cb(account_h account,
141 int j = account_index;
144 MYACCOUNT_ERROR("_myaccount_account_list_account_info_cb:account handle is NULL\n");
147 char *temptxt = NULL;
149 account_secrecy_state_e secret;
151 error_code = account_get_user_name(account, &temptxt);
152 if (error_code != ACCOUNT_ERROR_NONE) {
153 MYACCOUNT_ERROR("account_get_user_name: Failed \n");
154 } else if (temptxt && strlen(temptxt)) {
155 MA_STRNCPY(account_info[j].username, temptxt,
156 sizeof(account_info[j].username));
158 MYACCOUNT_DBUG("account_get_user_name: returned NULL \n");
161 error_code = account_get_display_name(account, &temptxt);
162 if (error_code != ACCOUNT_ERROR_NONE) {
163 MYACCOUNT_ERROR("account_get_display_name: Failed \n");
164 } else if (temptxt && strlen(temptxt)) {
165 MA_STRNCPY(account_info[j].display_name, temptxt,
166 sizeof(account_info[j].display_name));
168 MYACCOUNT_DBUG("account_get_display_name: returned NULL \n");
171 error_code = account_get_email_address(account, &temptxt);
172 if (error_code != ACCOUNT_ERROR_NONE) {
173 MYACCOUNT_ERROR("account_get_email_address: Failed \n");
174 } else if (temptxt && strlen(temptxt)) {
175 MA_STRNCPY(account_info[j].email_address, temptxt,
176 sizeof(account_info[j].email_address));
178 MYACCOUNT_DBUG("account_get_email_address: returned NULL \n");
181 error_code = account_get_package_name(account, &temptxt);
182 if (error_code != ACCOUNT_ERROR_NONE) {
183 MYACCOUNT_ERROR("account_get_package_name: Failed \n");
184 } else if (temptxt && strlen(temptxt)) {
185 MA_STRNCPY(account_info[j].package_name, temptxt,
186 sizeof(account_info[j].package_name));
188 MYACCOUNT_DBUG("account_get_package_name: returned NULL \n");
191 error_code = account_get_account_id(account, &id);
192 if (error_code != ACCOUNT_ERROR_NONE) {
193 MYACCOUNT_ERROR("account_get_account_id: Failed \n");
195 account_info[j].account_id = id;
197 MYACCOUNT_DBUG("account_get_account_id: returned 0 or -ve \n");
199 error_code = account_get_secret(account, &secret);
200 if (error_code != ACCOUNT_ERROR_NONE) {
201 MYACCOUNT_ERROR("account_get_secret: Failed \n");
203 account_info[j].secret = secret;
205 error_code = account_get_domain_name(account, &temptxt);
206 if (error_code != ACCOUNT_ERROR_NONE) {
207 MYACCOUNT_ERROR("account_get_domain_name: Failed \n");
208 } else if (temptxt && strlen(temptxt)) {
209 MA_STRNCPY(account_info[j].domain_name, temptxt,
210 sizeof(account_info[j].domain_name));
212 MYACCOUNT_DBUG("account_get_domain_name: returned NULL \n");
215 error_code = account_get_icon_path(account, &temptxt);
216 if (error_code != ACCOUNT_ERROR_NONE) {
217 MYACCOUNT_ERROR("account_get_icon_path: Failed \n");
218 } else if (temptxt && strlen(temptxt)) {
219 MA_STRNCPY(account_info[j].icon_path, temptxt,
220 sizeof(account_info[j].icon_path));
222 MYACCOUNT_DBUG("account_get_icon_path: returned NULL \n");
225 if(!strlen(account_info[j].icon_path))
226 myaccount_common_get_icon_by_name(account_info[j].domain_name ,
227 account_info[j].icon_path);
229 error_code = account_get_sync_support(account,
230 (account_sync_state_e *)&(account_info[j].sync_status));
231 if (error_code != ACCOUNT_ERROR_NONE) {
232 MYACCOUNT_ERROR("account_get_sync_support: Failed \n");
235 error_code = account_get_capability_all(account,
236 _myaccount_account_list_get_capablity_text,
237 (void *)&account_info[j]);
238 if (error_code != ACCOUNT_ERROR_NONE)
239 MYACCOUNT_ERROR("account_get_capability: Failed \n");
246 static int __myaccount_account_list_populate_account_info()
248 MYACCOUNT_VERBOSE("\n Inside __myaccount_account_list_populate_account_info !! \n");
252 error_code = account_connect();
253 if (error_code != ACCOUNT_ERROR_NONE)
254 MYACCOUNT_ERROR("account_connect: Failed \n");
256 error_code = account_get_total_count_from_db(&count);
257 if (error_code != ACCOUNT_ERROR_NONE)
258 MYACCOUNT_ERROR("account_get_total_count_from_db: Failed \n");
260 MYACCOUNT_DBUG("CURRENT account count is %d\n", count);
261 account_info = calloc(count, sizeof(myaccount_list_priv));
262 account_foreach_account_from_db(_myaccount_account_list_account_info_cb,
264 error_code = account_disconnect();
265 if (error_code != ACCOUNT_ERROR_NONE)
266 MYACCOUNT_ERROR("account_disconnect: Failed \n");
268 MYACCOUNT_VERBOSE("populate myacconut data END\n");
272 void myaccount_account_list_quit_cb( void *data,
273 Evas_Object *obj, void *event_info )
276 myaccount_appdata *priv = (myaccount_appdata*)data;
278 MYACCOUNT_VERBOSE("myaccount_account_list_quit_cb START\n");
281 MYACCOUNT_ERROR("myaccount_account_list_quit_cb callback user data is null!!!\n");
286 if (account_info->capablity_list) {
287 g_slist_free(account_info->capablity_list);
288 account_info->capablity_list = NULL;
291 MA_MEMFREE(account_info);
294 error_code = ug_destroy_me(priv->ug);
295 MYACCOUNT_INFO("myaccount_account_list_quit_cb callback : return = %d!!!\n",
298 MYACCOUNT_VERBOSE("myaccount_account_list_quit_cb END\n");
301 static void __myaccount_account_list_addaccount_cb( void *data,
302 Evas_Object *obj, void *event_info )
304 myaccount_appdata *priv = (myaccount_appdata*)data;
305 myaccount_addaccount_create_view(priv);
308 static char *__myaccount_account_list_gl_label_get(void *data,
309 Evas_Object *obj, const char *part)
311 myaccount_list_priv *account_info_item = (myaccount_list_priv*)data;
312 char domain_name_lower[128] = {0,};
313 MYACCOUNT_VERBOSE("__myaccount_account_list_gl_label_get START data=%p, part=%s\n",
316 if (!account_info_item) {
317 MYACCOUNT_ERROR(" __myaccount_account_list_gl_label_get: Data is NULL\n");
321 if (!strcmp(part, "elm.text") || !strcmp(part, "elm.text.1")) {
322 myaccount_common_lowercase(account_info_item->domain_name,
325 if (strlen(account_info_item->display_name) > 0)
326 return strdup(account_info_item->display_name);
327 else if (strlen(account_info_item->email_address) > 0)
328 return strdup(account_info_item->email_address);
329 else if (strlen(account_info_item->username) > 0)
330 return strdup(account_info_item->username);
332 return strdup("Unknown");
333 } else if (!strcmp(part, "elm.text.sub") || !strcmp(part, "elm.text.2")) {
334 if (strlen(account_info_item->capability) <=0 )
335 return strdup("Signed In");
337 return strdup(account_info_item->capability);
339 MYACCOUNT_DBUG("__myaccount_account_list_gl_label_get : UNKNOWN part name");
340 return strdup(account_info_item->domain_name);
343 MYACCOUNT_VERBOSE("END of __myaccount_account_list_gl_label_get \n");
347 static char *__myaccount_account_list_title_get(void *data,
348 Evas_Object *obj, const char *part)
350 if (!strcmp(part, "elm.text"))
351 return (strdup(dgettext(MA_UG_NAME, "IDS_EMAIL_SK3_ACCOUNT_LIST")));
356 static Evas_Object *__myaccount_account_list_gl_icon_get(void *data,
357 Evas_Object *obj, const char *part)
359 char tempbuf[PATH_MAX];
360 Evas_Object *icon = NULL;
361 myaccount_list_priv *account_info_item = (myaccount_list_priv*)data;
363 MYACCOUNT_VERBOSE("__myaccount_account_list_gl_icon_get START data=%p, obj = %p, part=%s\n",
366 if (!account_info_item) {
367 MYACCOUNT_ERROR("__myaccount_account_list_gl_icon_get: Data is NULL\n");
370 memset(tempbuf, 0, sizeof(char)*PATH_MAX);
371 if (!strcmp(part, "elm.icon.1")) {
372 MYACCOUNT_VERBOSE("__myaccount_account_list_gl_icon_get : current path %s\n",
373 account_info_item->icon_path);
374 if (strlen(account_info_item->icon_path) > 0) {
375 MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s", account_info_item->icon_path);
377 MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s", "99_email.png");
380 icon = elm_icon_add(obj);
381 if (strstr(tempbuf, "/"))
382 elm_image_file_set(icon, tempbuf, NULL);
384 elm_image_file_set(icon, MA_IMAGE_EDJ_NAME, tempbuf);
386 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
388 if (!strcmp(part, "elm.icon.2")) {
389 if (account_info_item->sync_status == ACCOUNT_SYNC_NOT_SUPPORT)
392 if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_IDLE
393 || account_info_item->sync_status == ACCOUNT_SYNC_STATUS_OFF ) {
394 MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
395 "66_myaccount_icon_push_deactivated.png");
396 } else if (account_info_item->sync_status == ACCOUNT_SYNC_STATUS_RUNNING){
397 MA_SNPRINTF(tempbuf, sizeof(tempbuf), "%s",
398 "66_myaccount_icon_push_press.png");
401 MYACCOUNT_DBUG("## icon path (%s)\n", tempbuf);
403 if(strlen(tempbuf) > 0) {
404 icon = elm_icon_add(obj);
405 if (strstr(tempbuf, "/"))
406 elm_image_file_set(icon, tempbuf, NULL);
408 elm_image_file_set(icon, MA_IMAGE_EDJ_NAME, tempbuf);
410 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
413 MYACCOUNT_VERBOSE("__myaccount_account_list_gl_icon_get :: END :: icon = %p\n",
418 static void _myaccount_ug_account_list_layout_cb(ui_gadget_h ug,
419 enum ug_mode mode, void *priv)
422 myaccount_appdata *ad;
425 MYACCOUNT_FATAL("layout cb error ug=%p, priv=%p\n", ug, priv);
428 ad = (myaccount_appdata*)priv;
429 base = ug_get_layout(ug);
431 MYACCOUNT_FATAL("layout cb base is null\n");
434 case UG_MODE_FRAMEVIEW:
435 elm_object_part_content_set (ad->layout_main, "content", base);
437 case UG_MODE_FULLVIEW:
438 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
440 elm_win_resize_object_add(ad->win_main, base);
441 evas_object_show(base);
448 static void _myaccount_ug_account_list_result_cb(ui_gadget_h ug,
449 service_h service, void *priv)
451 MYACCOUNT_VERBOSE("_myaccount_ug_account_list_result_cb\n");
454 static void _myaccount_ug_account_list_destroy_cb(ui_gadget_h ug,
457 MYACCOUNT_VERBOSE("_myaccount_ug_account_list_destroy_cb\n");
458 myaccount_appdata *mydata = (myaccount_appdata*)priv;
461 MYACCOUNT_ERROR("destroy cb error ug=%p, priv=%p\n", ug, mydata);
464 mydata->item_selected_state = false;
467 MYACCOUNT_VERBOSE("_myaccount_ug_account_list_destroy_cb : ug callee request kill layout_addaccount=%p\n",
468 mydata->layout_addaccount);
470 myaccount_common_handle_notification(NULL);
474 static void __myaccount_ug_launch_signin_view(void *data, myaccount_list_priv *account)
476 myaccount_appdata *ad = (myaccount_appdata*)data;
480 MYACCOUNT_ERROR("__myaccount_ug_launch_signin_view : account info NULL\n");
484 service_create(&service);
486 myaccount_common_launch_application(MYACCOUNT_REQUEST_VIEW,
487 strdup(account->package_name),
488 strdup(account->username),
494 service_destroy(service);
497 static void __myaccount_account_list_gl_sel(void *data,
498 Evas_Object *obj, void *event_info)
500 myaccount_appdata *ad = myaccount_get_appdata();
501 if(ad->item_selected_state) {
502 elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
505 ad->item_selected_state = true;
506 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
508 MYACCOUNT_VERBOSE("__myaccount_account_list_gl_sel data=%p, obj=%p, event_info=%p\n",
509 data, obj, event_info);
510 myaccount_list_priv *account = (myaccount_list_priv*)data;
511 MYACCOUNT_DBUG("__myaccount_account_list_gl_sel : account name : %s\n",
512 account->domain_name);
515 elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
517 __myaccount_ug_launch_signin_view((myaccount_appdata*)ad, account);
519 MYACCOUNT_VERBOSE("END of __myaccount_account_list_gl_sel\n");
524 static void __myaccount_account_list_item_selected(void *data,
525 Evas_Object *obj, void *event_info)
527 MYACCOUNT_VERBOSE("__myaccount_account_list_item_selected \n");
530 static void __myaccount_account_list_append_genlist(myaccount_appdata *ad,
533 MYACCOUNT_DBUG ("\n count received in __myaccount_account_list_append_genlist = %d \n",
537 bool supported = false;
540 it = elm_genlist_item_append(ad->account_genlist,
541 &account_list_itc_sep, NULL, NULL,
542 ELM_GENLIST_ITEM_NONE, NULL, NULL);
543 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
544 it = elm_genlist_item_append(ad->account_genlist,
545 &account_list_title_itc, NULL, NULL,
546 ELM_GENLIST_ITEM_NONE, NULL, NULL);
547 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
549 for (index = 0; index < count; index++) {
551 if (account_info[index].secret == ACCOUNT_SECRECY_VISIBLE) {
552 if (ad->capability_filter) {
554 myaccount_list_priv *acc_info = NULL;
555 acc_info = &account_info[index];
556 for (iter = acc_info->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
557 myaccount_capability_data *cap_data = (myaccount_capability_data*)iter->data;
558 if (!strcmp(cap_data->type, ad->capability_filter)) {
564 it = elm_genlist_item_append(ad->account_genlist,
566 (void *)&account_info[index], NULL,
567 ELM_GENLIST_ITEM_NONE,
568 __myaccount_account_list_gl_sel,
569 (void *)&account_info[index]);
571 MYACCOUNT_VERBOSE("genlist item(%p)\n", it);
574 it = elm_genlist_item_append(ad->account_genlist,
576 (void *)&account_info[index], NULL,
577 ELM_GENLIST_ITEM_NONE,
578 __myaccount_account_list_gl_sel,
579 (void *)&account_info[index]);
580 MYACCOUNT_VERBOSE("genlist item(%p)\n", it);
585 it = elm_genlist_item_append(ad->account_genlist,
586 &account_list_itc_sep_end, NULL, NULL,
587 ELM_GENLIST_ITEM_NONE, NULL, NULL);
588 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
590 myaccount_addaccount_create_view(ad);
596 static void _myaccount_ug_account_gl_realized(void *data, Evas_Object *obj, void *ei)
598 Elm_Object_Item *it = NULL;
603 char bufdomain[2048]={0,};
606 MYACCOUNT_ERROR("Realized event info is NULL!!! \n");
610 it = (Elm_Object_Item *)ei;
612 total_count = elm_genlist_items_count(obj);
613 index = elm_genlist_item_index_get(it);
615 MYACCOUNT_VERBOSE("Total genlist item count(%d)!!! \n", total_count);
616 if(index > 2 && index < total_count)
618 /*Add account items. index 1 and last are the seperators*/
619 myaccount_list_priv *account_info_item = (myaccount_list_priv*)elm_object_item_data_get(it);
621 if(account_info_item){
622 memset(buf, 0, 2048);
623 memset(bufdomain, 0, 2048);
625 if (strlen(account_info_item->domain_name) > 0)
626 g_snprintf(bufdomain, 1024, "Logged into %s with user id ", account_info_item->domain_name);
628 g_snprintf(bufdomain, 1024, "Service unknown user id ");
630 if (strlen(account_info_item->display_name) > 0)
631 g_snprintf(buf, 1024, "%s%s", bufdomain, account_info_item->display_name);
632 else if (strlen(account_info_item->email_address) > 0)
633 g_snprintf(buf, 1024, "%s%s", bufdomain, account_info_item->email_address);
634 else if (strlen(account_info_item->username) > 0)
635 g_snprintf(buf, 1024, "%s%s", bufdomain, account_info_item->username);
637 g_snprintf(buf, 1024, "%sUnknown", account_info_item->domain_name);
639 ao = elm_object_item_access_object_get(it);
640 elm_access_info_set(ao, ELM_ACCESS_INFO, buf);
643 /*Remove access for seperators*/
644 elm_object_item_access_unregister(ei);
649 MYACCOUNT_INFO("DO NOTHING only one account exist, total_count(%d) index(%d) !!! \n", total_count, index);
652 MYACCOUNT_VERBOSE("DO NOTHING realized (%d) !!! \n", index);
653 } else if (index == 2) {
654 MYACCOUNT_VERBOSE("TOP realized (%d) !!! \n", index);
655 elm_object_item_signal_emit(ei, "elm,state,top", "");
656 } else if (index == (total_count-2)) {
657 MYACCOUNT_VERBOSE("BOTTOM realized (%d) item count (%d) !!! \n", index, total_count);
658 elm_object_item_signal_emit(ei, "elm,state,bottom", "");
660 MYACCOUNT_VERBOSE("CENTER realized (%d) !!! \n", index);
661 elm_object_item_signal_emit(ei, "elm,state,center", "");
666 static Evas_Object *__myaccount_account_list_create_genlist(
667 myaccount_appdata *ad)
669 Evas_Object *genlist;
672 MYACCOUNT_ERROR("__myaccount_account_list_create_genlist returns NULL\n");
676 int account_count = 0;
677 account_count = __myaccount_account_list_populate_account_info();
679 account_list_itc.item_style = "dialogue/2text.2icon.3";
680 account_list_itc.func.text_get = __myaccount_account_list_gl_label_get;
681 account_list_itc.func.content_get = __myaccount_account_list_gl_icon_get;
682 account_list_itc.func.state_get = NULL;
683 account_list_itc.func.del = NULL;
685 account_list_title_itc.item_style = "dialogue/title";
686 account_list_title_itc.func.text_get = __myaccount_account_list_title_get;
687 account_list_title_itc.func.content_get = NULL;
688 account_list_title_itc.func.state_get = NULL;
689 account_list_title_itc.func.del = NULL;
691 /*to add 40 pixel separator*/
692 account_list_itc_sep.item_style = "dialogue/separator";
693 account_list_itc_sep.func.text_get = NULL;
694 account_list_itc_sep.func.content_get = NULL;
695 account_list_itc_sep.func.state_get = NULL;
696 account_list_itc_sep.func.del = NULL;
698 /*to add 40 pixel list end separator*/
699 account_list_itc_sep_end.item_style = "dialogue/separator/end";
700 account_list_itc_sep_end.func.text_get = NULL;
701 account_list_itc_sep_end.func.content_get = NULL;
702 account_list_itc_sep_end.func.state_get = NULL;
703 account_list_itc_sep_end.func.del = NULL;
705 ad->account_genlist = genlist = elm_genlist_add(ad->navi_bar);
706 evas_object_smart_callback_add(genlist, "realized", _myaccount_ug_account_gl_realized, NULL);
707 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
708 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
709 elm_genlist_mode_set(genlist, EINA_TRUE);
711 evas_object_smart_callback_add(genlist, "selected",
712 __myaccount_account_list_item_selected,
713 (myaccount_appdata*) ad);
715 MYACCOUNT_VERBOSE("\n account count = %d\n", account_count);
717 __myaccount_account_list_append_genlist(ad, account_count);
719 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_genlist\n");
723 void myaccount_ug_account_list_create(void *data)
725 MYACCOUNT_VERBOSE("\n myaccount_ug_account_list_create called !!\n");
726 myaccount_appdata *ad = data;
727 Evas_Object *genlist = NULL;
729 Evas_Object *l_button;
733 MYACCOUNT_ERROR("myaccount_ug_account_list_create myaccount_appdata is null\n");
737 layout = elm_layout_add(ad->navi_bar);
738 elm_layout_file_set(layout,
739 "/usr/ug/res/edje/ug-setting-myaccount-efl/myaccount.edj",
741 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
742 evas_object_size_hint_align_set( layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
743 edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
744 //edje_object_signal_emit(_EDJ(layout), "elm,bg,show,group_list", "elm");
745 elm_object_style_set(ad->bg, "group_list");
746 evas_object_show(layout);
748 genlist = __myaccount_account_list_create_genlist(ad);
750 elm_object_part_content_set (layout, "accountlist.genlist", genlist);
751 ad->l_title_sk = l_button = elm_button_add(ad->navi_bar);
752 evas_object_smart_callback_add(l_button, "clicked",
753 myaccount_account_list_quit_cb,
755 elm_object_style_set(l_button , "naviframe/back_btn/default");
756 ad->navi_it = elm_naviframe_item_push(ad->navi_bar,
758 "IDS_ST_HEADER_ACCOUNTS_AND_SYNC"),
759 l_button, NULL, layout, NULL);
760 btn = elm_button_add(ad->navi_bar);
762 MYACCOUNT_ERROR("myaccount_ug_account_list_create elm_button_add FAIL\n");
765 elm_object_style_set(btn, "naviframe/toolbar/default");
766 elm_object_text_set(btn, dgettext(MA_UG_NAME,
767 "IDS_COM_SK_ADD_LITE"));
768 evas_object_smart_callback_add(btn, "clicked",
769 __myaccount_account_list_addaccount_cb,
772 elm_object_item_part_content_set(ad->navi_it, "toolbar_button1", btn);
774 MYACCOUNT_VERBOSE("END of myaccount_ug_account_list_create\n");
777 static Evas_Object *__myaccount_account_list_create_bg(Evas_Object *parent)
779 MYACCOUNT_VERBOSE("START of __myaccount_account_list_create_bg ");
780 Evas_Object *bg = elm_bg_add(parent);
781 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
782 elm_win_resize_object_add(parent, bg);
783 evas_object_show(bg);
784 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_bg ");
788 static Evas_Object *__myaccount_account_list_create_main_layout(
793 MYACCOUNT_VERBOSE("START of __myaccount_account_list_create_main_layout ");
795 layout = elm_layout_add(parent);
796 elm_layout_theme_set(layout, "layout", "application", "default");
797 evas_object_size_hint_weight_set( layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
798 edje_object_signal_emit(_EDJ(layout), "elm,state,show,indicator", "elm");
799 edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
800 elm_object_part_content_set ( layout, "elm.swallow.bg", bg);
801 evas_object_show( layout );
802 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_main_layout ");
807 static Evas_Object *__myaccount_account_list_create_navi_layout(
810 Evas_Object *navi_bar;
811 MYACCOUNT_VERBOSE("START of __myaccount_account_list_create_navi_layout ");
813 navi_bar = elm_naviframe_add(parent);
814 elm_object_part_content_set ( parent, "elm.swallow.content", navi_bar );
815 evas_object_show(navi_bar);
816 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_navi_layout ");
821 static void __myaccount_account_list_init_main_view(myaccount_appdata *ad)
823 elm_win_indicator_mode_set(ad->win_main, ELM_WIN_INDICATOR_SHOW);
824 ad->bg = __myaccount_account_list_create_bg(ad->win_main);
825 ad->layout_main = __myaccount_account_list_create_main_layout(ad->win_main,
827 ad->base = ad->layout_main;
828 ad->navi_bar = __myaccount_account_list_create_navi_layout(ad->layout_main);
830 MYACCOUNT_VERBOSE("END of __myaccount_account_list_init_main_view : %p\n",
834 void myaccount_list_view_create(myaccount_appdata *priv)
836 /*struct ug_cbs cbs = {0,};*/
837 __attribute__((__unused__)) struct ug_cbs cbs = {0,};
838 cbs.layout_cb = _myaccount_ug_account_list_layout_cb;
839 cbs.result_cb = _myaccount_ug_account_list_result_cb;
840 cbs.destroy_cb = _myaccount_ug_account_list_destroy_cb;
841 cbs.priv = (void *)priv;
843 MYACCOUNT_VERBOSE("\n !!!!! myaccount_list_view_create !!!!! \n");
845 __myaccount_account_list_init_main_view(priv);
848 void myaccount_list_refresh_item_list(myaccount_appdata *ad)
852 MYACCOUNT_DBUG("START\n");
855 MYACCOUNT_FATAL("no appdata!\n");
859 elm_genlist_clear(ad->account_genlist);
861 MYACCOUNT_DBUG("Account list removed completely!\n");
863 if (account_info->capablity_list) {
864 g_slist_free(account_info->capablity_list);
865 account_info->capablity_list = NULL;
868 MA_MEMFREE(account_info);
870 count = __myaccount_account_list_populate_account_info();
872 __myaccount_account_list_append_genlist(ad, count);