1 /*
2  * e-attachment.h
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
18  *
19  */
20 
21 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
22 #error "Only <e-util/e-util.h> should be included directly."
23 #endif
24 
25 #ifndef E_ATTACHMENT_H
26 #define E_ATTACHMENT_H
27 
28 #include <gtk/gtk.h>
29 #include <camel/camel.h>
30 
31 /* Standard GObject macros */
32 #define E_TYPE_ATTACHMENT \
33 	(e_attachment_get_type ())
34 #define E_ATTACHMENT(obj) \
35 	(G_TYPE_CHECK_INSTANCE_CAST \
36 	((obj), E_TYPE_ATTACHMENT, EAttachment))
37 #define E_ATTACHMENT_CLASS(cls) \
38 	(G_TYPE_CHECK_CLASS_CAST \
39 	((cls), E_TYPE_ATTACHMENT, EAttachmentClass))
40 #define E_IS_ATTACHMENT(obj) \
41 	(G_TYPE_CHECK_INSTANCE_TYPE \
42 	((obj), E_TYPE_ATTACHMENT))
43 #define E_IS_ATTACHMENT_CLASS(cls) \
44 	(G_TYPE_CHECK_CLASS_TYPE \
45 	((cls), E_TYPE_ATTACHMENT))
46 #define E_ATTACHMENT_GET_CLASS(obj) \
47 	(G_TYPE_INSTANCE_GET_CLASS \
48 	((obj), E_TYPE_ATTACHMENT, EAttachmentClass))
49 
50 G_BEGIN_DECLS
51 
52 typedef struct _EAttachment EAttachment;
53 typedef struct _EAttachmentClass EAttachmentClass;
54 typedef struct _EAttachmentPrivate EAttachmentPrivate;
55 
56 struct _EAttachment {
57 	GObject parent;
58 	EAttachmentPrivate *priv;
59 };
60 
61 struct _EAttachmentClass {
62 	GObjectClass parent_class;
63 
64 	/* Signals */
65 	void	(*update_file_info)		(EAttachment *attachment,
66 						 const gchar *caption,
67 						 const gchar *content_type,
68 						 const gchar *description,
69 						 gint64 size);
70 	void	(*update_icon)			(EAttachment *attachment,
71 						 GIcon *icon);
72 	void	(*update_progress)		(EAttachment *attachment,
73 						 gboolean loading,
74 						 gboolean saving,
75 						 gint percent);
76 	void	(*load_failed)			(EAttachment *attachment);
77 };
78 
79 GType		e_attachment_get_type		(void) G_GNUC_CONST;
80 EAttachment *	e_attachment_new		(void);
81 EAttachment *	e_attachment_new_for_path	(const gchar *path);
82 EAttachment *	e_attachment_new_for_uri	(const gchar *uri);
83 EAttachment *	e_attachment_new_for_message	(CamelMimeMessage *message);
84 void		e_attachment_add_to_multipart	(EAttachment *attachment,
85 						 CamelMultipart *multipart,
86 						 const gchar *default_charset);
87 void		e_attachment_cancel		(EAttachment *attachment);
88 gboolean	e_attachment_is_mail_note	(EAttachment *attachment);
89 gboolean	e_attachment_get_can_show	(EAttachment *attachment);
90 void		e_attachment_set_can_show	(EAttachment *attachment,
91 						 gboolean can_show);
92 const gchar *	e_attachment_get_disposition	(EAttachment *attachment);
93 gchar *		e_attachment_dup_disposition	(EAttachment *attachment);
94 void		e_attachment_set_disposition	(EAttachment *attachment,
95 						 const gchar *disposition);
96 GFile *		e_attachment_ref_file		(EAttachment *attachment);
97 void		e_attachment_set_file		(EAttachment *attachment,
98 						 GFile *file);
99 GFileInfo *	e_attachment_ref_file_info	(EAttachment *attachment);
100 void		e_attachment_set_file_info	(EAttachment *attachment,
101 						 GFileInfo *file_info);
102 gchar *		e_attachment_dup_mime_type	(EAttachment *attachment);
103 GIcon *		e_attachment_ref_icon		(EAttachment *attachment);
104 gboolean	e_attachment_get_loading	(EAttachment *attachment);
105 CamelMimePart *	e_attachment_ref_mime_part	(EAttachment *attachment);
106 void		e_attachment_set_mime_part	(EAttachment *attachment,
107 						 CamelMimePart *mime_part);
108 gint		e_attachment_get_percent	(EAttachment *attachment);
109 gboolean	e_attachment_get_saving		(EAttachment *attachment);
110 gboolean	e_attachment_get_initially_shown(EAttachment *attachment);
111 void		e_attachment_set_initially_shown(EAttachment *attachment,
112 						 gboolean initially_shown);
113 gboolean	e_attachment_get_save_self	(EAttachment *attachment);
114 void		e_attachment_set_save_self	(EAttachment *attachment,
115 						 gboolean save_self);
116 gboolean	e_attachment_get_save_extracted	(EAttachment *attachment);
117 void		e_attachment_set_save_extracted	(EAttachment *attachment,
118 						 gboolean save_extracted);
119 CamelCipherValidityEncrypt
120 		e_attachment_get_encrypted	(EAttachment *attachment);
121 void		e_attachment_set_encrypted	(EAttachment *attachment,
122 						 CamelCipherValidityEncrypt encrypted);
123 CamelCipherValiditySign
124 		e_attachment_get_signed		(EAttachment *attachment);
125 void		e_attachment_set_signed		(EAttachment *attachment,
126 						 CamelCipherValiditySign signed_);
127 gchar *		e_attachment_dup_description	(EAttachment *attachment);
128 gchar *		e_attachment_dup_thumbnail_path	(EAttachment *attachment);
129 gboolean	e_attachment_is_rfc822		(EAttachment *attachment);
130 GList *		e_attachment_list_apps		(EAttachment *attachment);
131 GAppInfo *	e_attachment_ref_default_app	(EAttachment *attachment);
132 void		e_attachment_update_store_columns
133 						(EAttachment *attachment);
134 
135 /* Asynchronous Operations */
136 void		e_attachment_load_async		(EAttachment *attachment,
137 						 GAsyncReadyCallback callback,
138 						 gpointer user_data);
139 gboolean	e_attachment_load_finish	(EAttachment *attachment,
140 						 GAsyncResult *result,
141 						 GError **error);
142 gboolean	e_attachment_load		(EAttachment *attachment,
143 						 GError **error);
144 void		e_attachment_open_async		(EAttachment *attachment,
145 						 GAppInfo *app_info,
146 						 GAsyncReadyCallback callback,
147 						 gpointer user_data);
148 gboolean	e_attachment_open_finish	(EAttachment *attachment,
149 						 GAsyncResult *result,
150 						 GError **error);
151 gboolean	e_attachment_open		(EAttachment *attachment,
152 						 GAppInfo *app_info,
153 						 GError **error);
154 void		e_attachment_save_async		(EAttachment *attachment,
155 						 GFile *destination,
156 						 GAsyncReadyCallback callback,
157 						 gpointer user_data);
158 GFile *		e_attachment_save_finish	(EAttachment *attachment,
159 						 GAsyncResult *result,
160 						 GError **error);
161 gboolean	e_attachment_save		(EAttachment *attachment,
162 						 GFile *in_destination,
163 						 GFile **out_destination,
164 						 GError **error);
165 
166 /* Handy GAsyncReadyCallback Functions */
167 void		e_attachment_load_handle_error	(EAttachment *attachment,
168 						 GAsyncResult *result,
169 						 GtkWindow *parent);
170 void		e_attachment_open_handle_error	(EAttachment *attachment,
171 						 GAsyncResult *result,
172 						 GtkWindow *parent);
173 void		e_attachment_save_handle_error	(EAttachment *attachment,
174 						 GAsyncResult *result,
175 						 GtkWindow *parent);
176 
177 G_END_DECLS
178 
179 #endif /* E_ATTACHMENT_H */
180