1 /* 2 * e-attachment-store.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_STORE_H 26 #define E_ATTACHMENT_STORE_H 27 28 #include <gtk/gtk.h> 29 #include <e-util/e-attachment.h> 30 31 /* Standard GObject macros */ 32 #define E_TYPE_ATTACHMENT_STORE \ 33 (e_attachment_store_get_type ()) 34 #define E_ATTACHMENT_STORE(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST \ 36 ((obj), E_TYPE_ATTACHMENT_STORE, EAttachmentStore)) 37 #define E_ATTACHMENT_STORE_CLASS(cls) \ 38 (G_TYPE_CHECK_CLASS_CAST \ 39 ((cls), E_TYPE_ATTACHMENT_STORE, EAttachmentStoreClass)) 40 #define E_IS_ATTACHMENT_STORE(obj) \ 41 (G_TYPE_CHECK_INSTANCE_TYPE \ 42 ((obj), E_TYPE_ATTACHMENT_STORE)) 43 #define E_IS_ATTACHMENT_STORE_CLASS(cls) \ 44 (G_TYPE_CHECK_CLASS_TYPE \ 45 ((cls), E_TYPE_ATTACHMENT_STORE)) 46 #define E_ATTACHMENT_STORE_GET_CLASS(obj) \ 47 (G_TYPE_INSTANCE_GET_CLASS \ 48 ((obj), E_TYPE_ATTACHMENT_STORE, EAttachmentStoreClass)) 49 50 G_BEGIN_DECLS 51 52 typedef struct _EAttachmentStore EAttachmentStore; 53 typedef struct _EAttachmentStoreClass EAttachmentStoreClass; 54 typedef struct _EAttachmentStorePrivate EAttachmentStorePrivate; 55 56 struct _EAttachmentStore { 57 GtkListStore parent; 58 EAttachmentStorePrivate *priv; 59 }; 60 61 struct _EAttachmentStoreClass { 62 GtkListStoreClass parent_class; 63 64 /* Signals */ 65 void (* attachment_added) (EAttachmentStore *store, 66 EAttachment *attachment); 67 void (* attachment_removed) (EAttachmentStore *store, 68 EAttachment *attachment); 69 }; 70 71 enum { 72 E_ATTACHMENT_STORE_COLUMN_ATTACHMENT, /* E_TYPE_ATTACHMENT */ 73 E_ATTACHMENT_STORE_COLUMN_CAPTION, /* G_TYPE_STRING */ 74 E_ATTACHMENT_STORE_COLUMN_CONTENT_TYPE, /* G_TYPE_STRING */ 75 E_ATTACHMENT_STORE_COLUMN_DESCRIPTION, /* G_TYPE_STRING */ 76 E_ATTACHMENT_STORE_COLUMN_ICON, /* G_TYPE_ICON */ 77 E_ATTACHMENT_STORE_COLUMN_LOADING, /* G_TYPE_BOOLEAN */ 78 E_ATTACHMENT_STORE_COLUMN_PERCENT, /* G_TYPE_INT */ 79 E_ATTACHMENT_STORE_COLUMN_SAVING, /* G_TYPE_BOOLEAN */ 80 E_ATTACHMENT_STORE_COLUMN_SIZE, /* G_TYPE_UINT64 */ 81 E_ATTACHMENT_STORE_NUM_COLUMNS 82 }; 83 84 GType e_attachment_store_get_type (void) G_GNUC_CONST; 85 GtkTreeModel * e_attachment_store_new (void); 86 void e_attachment_store_add_attachment 87 (EAttachmentStore *store, 88 EAttachment *attachment); 89 gboolean e_attachment_store_remove_attachment 90 (EAttachmentStore *store, 91 EAttachment *attachment); 92 void e_attachment_store_remove_all (EAttachmentStore *store); 93 void e_attachment_store_add_to_multipart 94 (EAttachmentStore *store, 95 CamelMultipart *multipart, 96 const gchar *default_charset); 97 GList * e_attachment_store_get_attachments 98 (EAttachmentStore *store); 99 guint e_attachment_store_get_num_attachments 100 (EAttachmentStore *store); 101 guint e_attachment_store_get_num_loading 102 (EAttachmentStore *store); 103 goffset e_attachment_store_get_total_size 104 (EAttachmentStore *store); 105 void e_attachment_store_run_load_dialog 106 (EAttachmentStore *store, 107 GtkWindow *parent); 108 GFile * e_attachment_store_run_save_dialog 109 (EAttachmentStore *store, 110 GList *attachment_list, 111 GtkWindow *parent); 112 113 gboolean e_attachment_store_transform_num_attachments_to_visible_boolean 114 (GBinding *binding, 115 const GValue *from_value, 116 GValue *to_value, 117 gpointer user_data); 118 gboolean e_attachment_store_find_attachment_iter 119 (EAttachmentStore *store, 120 EAttachment *attachment, 121 GtkTreeIter *out_iter); 122 /* Asynchronous Operations */ 123 void e_attachment_store_get_uris_async 124 (EAttachmentStore *store, 125 GList *attachment_list, 126 GAsyncReadyCallback callback, 127 gpointer user_data); 128 gchar ** e_attachment_store_get_uris_finish 129 (EAttachmentStore *store, 130 GAsyncResult *result, 131 GError **error); 132 void e_attachment_store_load_async (EAttachmentStore *store, 133 GList *attachment_list, 134 GAsyncReadyCallback callback, 135 gpointer user_data); 136 gboolean e_attachment_store_load_finish (EAttachmentStore *store, 137 GAsyncResult *result, 138 GError **error); 139 void e_attachment_store_save_async (EAttachmentStore *store, 140 GFile *destination, 141 const gchar *filename_prefix, 142 GAsyncReadyCallback callback, 143 gpointer user_data); 144 gchar ** e_attachment_store_save_finish (EAttachmentStore *store, 145 GAsyncResult *result, 146 GError **error); 147 148 G_END_DECLS 149 150 #endif /* E_ATTACHMENT_STORE_H */ 151 152