2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (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;
481 MYACCOUNT_ERROR("__myaccount_ug_launch_signin_view : account info NULL\n");
485 ret = service_create(&service);
487 ret = myaccount_common_launch_application(MYACCOUNT_REQUEST_VIEW,
488 strdup(account->package_name),
489 strdup(account->username),
495 service_destroy(service);
498 static void __myaccount_account_list_gl_sel(void *data,
499 Evas_Object *obj, void *event_info)
501 myaccount_appdata *ad = myaccount_get_appdata();
502 if(ad->item_selected_state) {
503 elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
506 ad->item_selected_state = true;
507 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
509 MYACCOUNT_VERBOSE("__myaccount_account_list_gl_sel data=%p, obj=%p, event_info=%p\n",
510 data, obj, event_info);
511 myaccount_list_priv *account = (myaccount_list_priv*)data;
512 MYACCOUNT_DBUG("__myaccount_account_list_gl_sel : account name : %s\n",
513 account->domain_name);
516 elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
518 __myaccount_ug_launch_signin_view((myaccount_appdata*)ad, account);
520 MYACCOUNT_VERBOSE("END of __myaccount_account_list_gl_sel\n");
525 static void __myaccount_account_list_item_selected(void *data,
526 Evas_Object *obj, void *event_info)
528 MYACCOUNT_VERBOSE("__myaccount_account_list_item_selected \n");
531 static void __myaccount_account_list_append_genlist(myaccount_appdata *ad,
534 MYACCOUNT_DBUG ("\n count received in __myaccount_account_list_append_genlist = %d \n",
538 bool supported = false;
541 it = elm_genlist_item_append(ad->account_genlist,
542 &account_list_itc_sep, NULL, NULL,
543 ELM_GENLIST_ITEM_NONE, NULL, NULL);
544 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
545 it = elm_genlist_item_append(ad->account_genlist,
546 &account_list_title_itc, NULL, NULL,
547 ELM_GENLIST_ITEM_NONE, NULL, NULL);
548 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
550 for (index = 0; index < count; index++) {
552 if (account_info[index].secret == ACCOUNT_SECRECY_VISIBLE) {
553 if (ad->capability_filter) {
555 myaccount_list_priv *acc_info = NULL;
556 acc_info = &account_info[index];
557 for (iter = acc_info->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
558 myaccount_capability_data *cap_data = (myaccount_capability_data*)iter->data;
559 if (!strcmp(cap_data->type, ad->capability_filter)) {
565 it = elm_genlist_item_append(ad->account_genlist,
567 (void *)&account_info[index], NULL,
568 ELM_GENLIST_ITEM_NONE,
569 __myaccount_account_list_gl_sel,
570 (void *)&account_info[index]);
572 MYACCOUNT_VERBOSE("genlist item(%p)\n", it);
575 it = elm_genlist_item_append(ad->account_genlist,
577 (void *)&account_info[index], NULL,
578 ELM_GENLIST_ITEM_NONE,
579 __myaccount_account_list_gl_sel,
580 (void *)&account_info[index]);
581 MYACCOUNT_VERBOSE("genlist item(%p)\n", it);
586 it = elm_genlist_item_append(ad->account_genlist,
587 &account_list_itc_sep_end, NULL, NULL,
588 ELM_GENLIST_ITEM_NONE, NULL, NULL);
589 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
591 myaccount_addaccount_create_view(ad);
597 static void _myaccount_ug_account_gl_realized(void *data, Evas_Object *obj, void *ei)
599 Elm_Object_Item *it = NULL;
604 char bufdomain[2048]={0,};
607 MYACCOUNT_ERROR("Realized event info is NULL!!! \n");
611 it = (Elm_Object_Item *)ei;
613 total_count = elm_genlist_items_count(obj);
614 index = elm_genlist_item_index_get(it);
616 MYACCOUNT_VERBOSE("Total genlist item count(%d)!!! \n", total_count);
617 if(index > 2 && index < total_count)
619 /*Add account items. index 1 and last are the seperators*/
620 myaccount_list_priv *account_info_item = (myaccount_list_priv*)elm_object_item_data_get(it);
622 if(account_info_item){
623 memset(buf, 0, 2048);
624 memset(bufdomain, 0, 2048);
626 if (strlen(account_info_item->domain_name) > 0)
627 g_snprintf(bufdomain, 1024, "Logged into %s with user id ", account_info_item->domain_name);
629 g_snprintf(bufdomain, 1024, "Service unknown user id ");
631 if (strlen(account_info_item->display_name) > 0)
632 g_snprintf(buf, 1024, "%s%s", bufdomain, account_info_item->display_name);
633 else if (strlen(account_info_item->email_address) > 0)
634 g_snprintf(buf, 1024, "%s%s", bufdomain, account_info_item->email_address);
635 else if (strlen(account_info_item->username) > 0)
636 g_snprintf(buf, 1024, "%s%s", bufdomain, account_info_item->username);
638 g_snprintf(buf, 1024, "%sUnknown", account_info_item->domain_name);
640 ao = elm_object_item_access_object_get(it);
641 elm_access_info_set(ao, ELM_ACCESS_INFO, buf);
644 /*Remove access for seperators*/
645 elm_object_item_access_unregister(ei);
650 MYACCOUNT_INFO("DO NOTHING only one account exist, total_count(%d) index(%d) !!! \n", total_count, index);
653 MYACCOUNT_VERBOSE("DO NOTHING realized (%d) !!! \n", index);
654 } else if (index == 2) {
655 MYACCOUNT_VERBOSE("TOP realized (%d) !!! \n", index);
656 elm_object_item_signal_emit(ei, "elm,state,top", "");
657 } else if (index == (total_count-2)) {
658 MYACCOUNT_VERBOSE("BOTTOM realized (%d) item count (%d) !!! \n", index, total_count);
659 elm_object_item_signal_emit(ei, "elm,state,bottom", "");
661 MYACCOUNT_VERBOSE("CENTER realized (%d) !!! \n", index);
662 elm_object_item_signal_emit(ei, "elm,state,center", "");
667 static Evas_Object *__myaccount_account_list_create_genlist(
668 myaccount_appdata *ad)
670 Evas_Object *genlist;
673 MYACCOUNT_ERROR("__myaccount_account_list_create_genlist returns NULL\n");
677 int account_count = 0;
678 account_count = __myaccount_account_list_populate_account_info();
680 account_list_itc.item_style = "dialogue/2text.2icon.3";
681 account_list_itc.func.text_get = __myaccount_account_list_gl_label_get;
682 account_list_itc.func.content_get = __myaccount_account_list_gl_icon_get;
683 account_list_itc.func.state_get = NULL;
684 account_list_itc.func.del = NULL;
686 account_list_title_itc.item_style = "dialogue/title";
687 account_list_title_itc.func.text_get = __myaccount_account_list_title_get;
688 account_list_title_itc.func.content_get = NULL;
689 account_list_title_itc.func.state_get = NULL;
690 account_list_title_itc.func.del = NULL;
692 /*to add 40 pixel separator*/
693 account_list_itc_sep.item_style = "dialogue/separator";
694 account_list_itc_sep.func.text_get = NULL;
695 account_list_itc_sep.func.content_get = NULL;
696 account_list_itc_sep.func.state_get = NULL;
697 account_list_itc_sep.func.del = NULL;
699 /*to add 40 pixel list end separator*/
700 account_list_itc_sep_end.item_style = "dialogue/separator/end";
701 account_list_itc_sep_end.func.text_get = NULL;
702 account_list_itc_sep_end.func.content_get = NULL;
703 account_list_itc_sep_end.func.state_get = NULL;
704 account_list_itc_sep_end.func.del = NULL;
706 ad->account_genlist = genlist = elm_genlist_add(ad->navi_bar);
707 evas_object_smart_callback_add(genlist, "realized", _myaccount_ug_account_gl_realized, NULL);
708 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
709 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
710 elm_genlist_mode_set(genlist, EINA_TRUE);
712 evas_object_smart_callback_add(genlist, "selected",
713 __myaccount_account_list_item_selected,
714 (myaccount_appdata*) ad);
716 MYACCOUNT_VERBOSE("\n account count = %d\n", account_count);
718 __myaccount_account_list_append_genlist(ad, account_count);
720 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_genlist\n");
724 void myaccount_ug_account_list_create(void *data)
726 MYACCOUNT_VERBOSE("\n myaccount_ug_account_list_create called !!\n");
727 myaccount_appdata *ad = data;
728 Evas_Object *genlist = NULL;
730 Evas_Object *l_button;
734 MYACCOUNT_ERROR("myaccount_ug_account_list_create myaccount_appdata is null\n");
738 layout = elm_layout_add(ad->navi_bar);
739 elm_layout_file_set(layout,
740 "/usr/ug/res/edje/ug-setting-myaccount-efl/myaccount.edj",
742 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
743 evas_object_size_hint_align_set( layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
744 edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
745 //edje_object_signal_emit(_EDJ(layout), "elm,bg,show,group_list", "elm");
746 elm_object_style_set(ad->bg, "group_list");
747 evas_object_show(layout);
749 genlist = __myaccount_account_list_create_genlist(ad);
751 elm_object_part_content_set (layout, "accountlist.genlist", genlist);
752 ad->l_title_sk = l_button = elm_button_add(ad->navi_bar);
753 evas_object_smart_callback_add(l_button, "clicked",
754 myaccount_account_list_quit_cb,
756 elm_object_style_set(l_button , "naviframe/back_btn/default");
757 ad->navi_it = elm_naviframe_item_push(ad->navi_bar,
759 "IDS_ST_HEADER_ACCOUNTS_AND_SYNC"),
760 l_button, NULL, layout, NULL);
761 btn = elm_button_add(ad->navi_bar);
763 MYACCOUNT_ERROR("myaccount_ug_account_list_create elm_button_add FAIL\n");
766 elm_object_style_set(btn, "naviframe/toolbar/default");
767 elm_object_text_set(btn, dgettext(MA_UG_NAME,
768 "IDS_COM_SK_ADD_LITE"));
769 evas_object_smart_callback_add(btn, "clicked",
770 __myaccount_account_list_addaccount_cb,
773 elm_object_item_part_content_set(ad->navi_it, "toolbar_button1", btn);
775 MYACCOUNT_VERBOSE("END of myaccount_ug_account_list_create\n");
778 static Evas_Object *__myaccount_account_list_create_bg(Evas_Object *parent)
780 MYACCOUNT_VERBOSE("START of __myaccount_account_list_create_bg ");
781 Evas_Object *bg = elm_bg_add(parent);
782 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
783 elm_win_resize_object_add(parent, bg);
784 evas_object_show(bg);
785 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_bg ");
789 static Evas_Object *__myaccount_account_list_create_main_layout(
794 MYACCOUNT_VERBOSE("START of __myaccount_account_list_create_main_layout ");
796 layout = elm_layout_add(parent);
797 elm_layout_theme_set(layout, "layout", "application", "default");
798 evas_object_size_hint_weight_set( layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
799 edje_object_signal_emit(_EDJ(layout), "elm,state,show,indicator", "elm");
800 edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
801 elm_object_part_content_set ( layout, "elm.swallow.bg", bg);
802 evas_object_show( layout );
803 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_main_layout ");
808 static Evas_Object *__myaccount_account_list_create_navi_layout(
811 Evas_Object *navi_bar;
812 MYACCOUNT_VERBOSE("START of __myaccount_account_list_create_navi_layout ");
814 navi_bar = elm_naviframe_add(parent);
815 elm_object_part_content_set ( parent, "elm.swallow.content", navi_bar );
816 evas_object_show(navi_bar);
817 MYACCOUNT_VERBOSE("END of __myaccount_account_list_create_navi_layout ");
822 static void __myaccount_account_list_init_main_view(myaccount_appdata *ad)
824 elm_win_indicator_mode_set(ad->win_main, ELM_WIN_INDICATOR_SHOW);
825 ad->bg = __myaccount_account_list_create_bg(ad->win_main);
826 ad->layout_main = __myaccount_account_list_create_main_layout(ad->win_main,
828 ad->base = ad->layout_main;
829 ad->navi_bar = __myaccount_account_list_create_navi_layout(ad->layout_main);
831 MYACCOUNT_VERBOSE("END of __myaccount_account_list_init_main_view : %p\n",
835 void myaccount_list_view_create(myaccount_appdata *priv)
837 /*struct ug_cbs cbs = {0,};*/
838 __attribute__((__unused__)) struct ug_cbs cbs = {0,};
839 cbs.layout_cb = _myaccount_ug_account_list_layout_cb;
840 cbs.result_cb = _myaccount_ug_account_list_result_cb;
841 cbs.destroy_cb = _myaccount_ug_account_list_destroy_cb;
842 cbs.priv = (void *)priv;
844 MYACCOUNT_VERBOSE("\n !!!!! myaccount_list_view_create !!!!! \n");
846 __myaccount_account_list_init_main_view(priv);
849 void myaccount_list_refresh_item_list(myaccount_appdata *ad)
853 MYACCOUNT_DBUG("START\n");
856 MYACCOUNT_FATAL("no appdata!\n");
860 elm_genlist_clear(ad->account_genlist);
862 MYACCOUNT_DBUG("Account list removed completely!\n");
864 if (account_info->capablity_list) {
865 g_slist_free(account_info->capablity_list);
866 account_info->capablity_list = NULL;
869 MA_MEMFREE(account_info);
871 count = __myaccount_account_list_populate_account_info();
873 __myaccount_account_list_append_genlist(ad, count);