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://www.tizenopensource.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.
17 #ifndef __DEF_email_viewer_utils_H__
18 #define __DEF_email_viewer_utils_H__
21 #include <glib/gprintf.h>
26 #include <Elementary.h>
27 #include "email-viewer.h"
30 #define STR_VALID(str) \
31 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
34 #define STR_INVALID(str) \
35 ((str == NULL || strlen(str) == 0) ? TRUE : FALSE)
38 #define STR_LEN(str) \
39 ({ char *s = str; (s) ? strlen(s) : 0; })
42 #define LIST_ITER_START(i, list) \
43 for (i = 0; i < g_list_length(list); ++i)
45 #define LIST_ITER_START_REVERSE(i, list) \
46 for (i = (g_list_length(list) - 1); i >= 0; --i)
48 #define LIST_ITER_GET(i, list) \
51 #define LIST_ITER_GET_DATA(i, list) \
52 g_list_nth_data(list, i)
54 typedef void (*popup_cb) (void *data, Evas_Object *obj, void *event_info);
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);
64 int _find_folder_id_using_folder_type(EmailViewerUGD *ug_data, email_mailbox_type_e mailbox_type);
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);
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
73 #endif /* __DEF_email_viewer_utils_H__ */