7d28f0c395fac2bc6e1866d08f994321b37366d0
[apps/home/my-account.git] / include / myaccount_ug_common.h
1 /*
2  *  my-account
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Tarun Kumar <tarun.kr@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef _MYACCOUNT_UG_COMMON_H_
23 #define _MYACCOUNT_UG_COMMON_H_
24
25 #include <Ecore_X.h>
26 #include <Evas.h>
27 #include <account.h>
28 #include <app.h>
29 #include <app_manager.h>
30 #include <vconf.h>
31 #include <package-manager.h>
32 #include <efl_assist.h>
33 #include <glib.h>
34
35 #define ENABLE_NOTI
36
37 typedef enum {
38         MYACCOUNT_TYPE_EXCHANGE = 0,
39         MYACCOUNT_TYPE_GOOGLE,
40 //      MYACCOUNT_TYPE_MSN,
41 //      MYACCOUNT_TYPE_FACEBOOK,
42         MYACCOUNT_TYPE_PICASA,
43         MYACCOUNT_TYPE_YOUTUBE,
44         MYACCOUNT_TYPE_OTHER,
45         MYACCOUNT_TYPE_SAMSUNG,
46         MYACCOUNT_TYPE_CSC,
47         MYACCOUNT_TYPE_TIZEN,
48         MYACCOUNT_TYPE_UNKNOWN
49 }MyAccountProviderType;
50
51 typedef enum {
52         MYACCOUNT_REQUEST_SIGNIN = 0,
53         MYACCOUNT_REQUEST_VIEW
54 }MyAccountRequestViewType;
55
56 void *myaccount_init_appdata();
57
58 void myaccount_destroy_appdata();
59
60 void *myaccount_get_appdata();
61
62 void myaccount_common_set_item_selected_state(bool val);
63
64 bool myaccount_common_get_item_selected_state();
65
66 void myaccount_common_get_icon_by_name(char *account_name,
67                                                                                         char *icon_path);
68
69 MyAccountProviderType myaccount_common_get_provider_type(
70                                                                                                 char *package_name);
71
72 void myaccount_common_lowercase(char* src, char* dest);
73
74 Evas_Object *myaccount_common_progress_add(Evas_Object *parent);
75
76 void myaccount_common_delete_modal_popup(Evas_Object *popup);
77
78 Eina_Bool myaccount_common_modal_popup_timer_cb(gpointer data);
79
80 bool myaccount_samsung_callback(char* result_code, char* user_id, void *user_data);
81
82
83 int myaccount_common_launch_application(MyAccountRequestViewType
84                                                                                                         request_type,
85                                                                                                         char *package_name,
86                                                                                                         char *username,
87                                                                                                         char *email_sp,
88                                                                                                         int account_id,
89                                                                                                         MyAccountProviderType sp_type,
90                                                                                                         void *data );
91
92 int myaccount_common_get_all_account_cnt(int *count);
93
94 int myaccount_common_get_account_cnt_by_capability(const char* capability_type, int *count);
95
96 int myaccount_common_get_account_cnt_by_appid(const char* appid, int *count);
97
98 void myaccount_common_handle_notification(const char* event_type);
99
100 void myaccount_common_listen_pkgmgr_for_pkg_uninstall();
101
102 int myaccount_common_get_csc_sp_count(const char* capability_filter);
103
104 int myaccount_common_get_account_type_count(const char* capability_filter);
105
106
107 #define MA_UG_NAME "setting-myaccount-efl"
108
109 #define MA_IMAGE_EDJ_NAME "/usr/apps/setting-myaccount-efl/res/edje/setting-myaccount-efl/myaccount_edc_images.edj"
110
111 #define MA_NO_ACCOUNT_EDJ_NAME "/usr/apps/setting-myaccount-efl/res/edje/setting-myaccount-efl/myaccount_nocontent.edj"
112
113 #define BUFSIZE 1024
114
115 #define MA_SNPRINTF(dest,size,format,arg...)    \
116         do { \
117                         snprintf(dest,size-1,format,##arg); \
118         }while(0)
119         /*      If the same pointer is passed to free twice,    known as a double free. To avoid this, set pointers to
120 NULL after passing      them to free: free(NULL) is safe (it does nothing).
121          */
122
123 #define MA_STRNCPY(dest,src,size)       \
124                 do { \
125                         if(src != NULL && dest != NULL && size > 0) \
126                         {       \
127                                 strncpy(dest,src,size-1); \
128                         }       \
129                 }while(0);
130
131 #define MA_MEMFREE(ptr) \
132                 if (ptr != NULL) {      \
133                         free(ptr);      \
134                         ptr = NULL; \
135                 }       \
136
137 #endif /* _MYACCOUNT_UG_COMMON_H_ */
138