tizen 2.4 release
[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 <glib.h>
33
34 #define ENABLE_NOTI
35
36 typedef enum {
37         MYACCOUNT_TYPE_EXCHANGE = 0,
38         MYACCOUNT_TYPE_GOOGLE,
39 //      MYACCOUNT_TYPE_MSN,
40 //      MYACCOUNT_TYPE_FACEBOOK,
41         MYACCOUNT_TYPE_PICASA,
42         MYACCOUNT_TYPE_YOUTUBE,
43         MYACCOUNT_TYPE_OTHER,
44         MYACCOUNT_TYPE_SAMSUNG,
45         MYACCOUNT_TYPE_CSC,
46         MYACCOUNT_TYPE_TIZEN,
47         MYACCOUNT_TYPE_UNKNOWN
48 }MyAccountProviderType;
49
50 typedef enum {
51         MYACCOUNT_REQUEST_SIGNIN = 0,
52         MYACCOUNT_REQUEST_VIEW
53 }MyAccountRequestViewType;
54
55 void *myaccount_init_appdata();
56
57 void myaccount_destroy_appdata();
58
59 void *myaccount_get_appdata();
60
61 void myaccount_common_set_item_selected_state(bool val);
62
63 bool myaccount_common_get_item_selected_state();
64
65 void myaccount_common_get_icon_by_name(char *account_name,
66                                                                                         char *icon_path);
67
68 MyAccountProviderType myaccount_common_get_provider_type(
69                                                                                                 char *package_name);
70
71 void myaccount_common_lowercase(char* src, char* dest);
72
73 Evas_Object *myaccount_common_progress_add(Evas_Object *parent);
74
75 void myaccount_common_delete_modal_popup(Evas_Object *popup);
76
77 Eina_Bool myaccount_common_modal_popup_timer_cb(gpointer data);
78
79 bool myaccount_samsung_callback(char* result_code, char* user_id, void *user_data);
80
81
82 int myaccount_common_launch_application(MyAccountRequestViewType
83                                                                                                         request_type,
84                                                                                                         char *package_name,
85                                                                                                         char *username,
86                                                                                                         char *email_sp,
87                                                                                                         int account_id,
88                                                                                                         MyAccountProviderType sp_type,
89                                                                                                         void *data );
90
91 int myaccount_common_get_all_account_cnt(int *count, bool include_secret);
92
93 int myaccount_common_get_account_cnt_by_capability(const char* capability_type, int *count);
94
95 int myaccount_common_get_account_cnt_by_appid(const char* appid, int *count);
96
97 void myaccount_common_handle_notification(const char* event_type);
98
99 void myaccount_common_listen_pkgmgr_for_pkg_uninstall();
100
101 int myaccount_common_get_csc_sp_count(const char* capability_filter);
102
103 int myaccount_common_get_account_type_count(const char* capability_filter);
104
105
106 #define MA_UG_NAME "setting-myaccount-efl"
107
108 #define MA_IMAGE_EDJ_NAME "/usr/apps/setting-myaccount-efl/res/edje/setting-myaccount-efl/myaccount_edc_images.edj"
109
110 #define MA_NO_ACCOUNT_EDJ_NAME "/usr/apps/setting-myaccount-efl/res/edje/setting-myaccount-efl/myaccount_nocontent.edj"
111
112 #define BUFSIZE 1024
113
114 #define MA_SNPRINTF(dest,size,format,arg...)    \
115         do { \
116                         snprintf(dest,size-1,format,##arg); \
117         }while(0)
118         /*      If the same pointer is passed to free twice,    known as a double free. To avoid this, set pointers to
119 NULL after passing      them to free: free(NULL) is safe (it does nothing).
120          */
121
122 #define MA_STRNCPY(dest,src,size)       \
123                 do { \
124                         if(src != NULL && dest != NULL && size > 0) \
125                         {       \
126                                 strncpy(dest,src,size-1); \
127                         }       \
128                 }while(0);
129
130 #define MA_MEMFREE(ptr) \
131                 if (ptr != NULL) {      \
132                         free(ptr);      \
133                         ptr = NULL; \
134                 }       \
135
136 #endif /* _MYACCOUNT_UG_COMMON_H_ */
137