Merged with latest code
[apps/core/preloaded/email.git] / viewer / include / email-viewer-utils.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
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
7  *
8  *    http://www.tizenopensource.org/license
9  *
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.
15  */
16
17 #ifndef __DEF_email_viewer_utils_H__
18 #define __DEF_email_viewer_utils_H__
19
20 #include <glib.h>
21 #include <glib/gprintf.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25
26 #include <Elementary.h>
27 #include "email-viewer.h"
28
29 #undef STR_VALID
30 #define STR_VALID(str) \
31         ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
32
33 #undef STR_INVALID
34 #define STR_INVALID(str) \
35         ((str == NULL || strlen(str) == 0) ? TRUE : FALSE)
36
37 #undef STR_LEN
38 #define STR_LEN(str) \
39         ({ char *s = str; (s) ? strlen(s) : 0; })
40
41 /* GList iterator */
42 #define LIST_ITER_START(i, list) \
43         for (i = 0; i < g_list_length(list); ++i)
44
45 #define LIST_ITER_START_REVERSE(i, list) \
46         for (i = (g_list_length(list) - 1); i >= 0; --i)
47
48 #define LIST_ITER_GET(i, list) \
49         g_list_nth(list, i)
50
51 #define LIST_ITER_GET_DATA(i, list) \
52         g_list_nth_data(list, i)
53
54 typedef void (*popup_cb) (void *data, Evas_Object *obj, void *event_info);
55
56 Evas_Object *viewer_make_thumbnail(char *path, Evas_Object *parent);
57 void _create_notify(EmailViewerUGD *ug_data, char *header, char *content,
58                                                 int btn_num, char *btn1_lb, popup_cb resp_cb1,
59                                                 char *btn2_lb, popup_cb resp_cb2, popup_cb resp_block_cb);
60 void _create_notify_3btn(EmailViewerUGD *ug_data, char *header, char *content,
61                                                 int btn_num, char *btn1_lb, popup_cb resp_cb1, char *btn2_lb, popup_cb resp_cb2,
62                                                 char *btn3_lb, popup_cb resp_cb3, popup_cb resp_block_cb);
63
64 int _find_folder_id_using_folder_type(EmailViewerUGD *ug_data, email_mailbox_type_e mailbox_type);
65
66 int _move_email(EmailViewerUGD *ug_data, int dest_folder_id, gboolean is_delete);
67 int _delete_email(EmailViewerUGD *ug_data);
68 void _notify_mailbox_size(EmailViewerUGD *ug_data, char *size);
69
70 int viewer_get_filepath_from_path(char *default_path, char *origin_path, char *new_path, Eina_Bool get_new_path);
71 Eina_Bool viewer_save_file(const gchar *path, const gchar *buf, gsize len); // for saving images
72
73 #endif  /* __DEF_email_viewer_utils_H__ */
74
75 /* EOF */