1 /* Copyright (c) 2006, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __MODEST_EMAIL_CLIPBOARD_H__
32 #define __MODEST_EMAIL_CLIPBOARD_H__
34 #include <glib-object.h>
35 #include <modest-conf.h>
36 #include <modest-defs.h>
37 #include <tny-folder.h>
41 /* convenience macros */
42 #define MODEST_TYPE_EMAIL_CLIPBOARD (modest_email_clipboard_get_type())
43 #define MODEST_EMAIL_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_EMAIL_CLIPBOARD,ModestEmailClipboard))
44 #define MODEST_EMAIL_CLIPBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_EMAIL_CLIPBOARD,ModestEmailClipboardClass))
45 #define MODEST_IS_EMAIL_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_EMAIL_CLIPBOARD))
46 #define MODEST_IS_EMAIL_CLIPBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_EMAIL_CLIPBOARD))
47 #define MODEST_EMAIL_CLIPBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_EMAIL_CLIPBOARD,ModestEmailClipboardClass))
49 typedef struct _ModestEmailClipboard ModestEmailClipboard;
50 typedef struct _ModestEmailClipboardClass ModestEmailClipboardClass;
52 struct _ModestEmailClipboard {
56 struct _ModestEmailClipboardClass {
57 GObjectClass parent_class;
62 * modest_email_clipboard_get_type:
64 * get the GType for #ModestEmailClipboard
68 GType modest_email_clipboard_get_type (void) G_GNUC_CONST;
72 * modest_email_clipboard_new:
74 * Returns: a new #ModestEmailClipboard, or NULL in case of error
76 ModestEmailClipboard* modest_email_clipboard_new (void);
80 * modest_email_clipboard_get_data:
81 * @self: a #ModestEmailClipboard singlenton instance.
82 * @src_folder: a #TnyFolder instance which is the source of selection data.
83 * @data: a #TnyList of objects to manage.
84 * @delete: determines whether data will be removed after copy them.
86 * Gets data from clipboard to manage them with copy, cut and paste operations.
87 * Currently imementation allows #TnyFolder or #TnyHeader objects.
89 * After getting data, clipboard will be cleared.
92 modest_email_clipboard_get_data (ModestEmailClipboard *self,
93 TnyFolder **src_folder,
98 * modest_email_clipboard_set_data:
99 * @self: a #ModestEmailClipboard singlenton instance.
100 * @src_folder: a #TnyFolder instance which is the source of selection data.
101 * @data: a #TnyList of objects to manage.
102 * @delete: determines whether data will be removed after copy them.
104 * Sets data on clipboard to manage them wiht copy, cut and paste operations.
105 * Currently imementation allows #TnyFolder or #TnyHeader objects.
108 void modest_email_clipboard_set_data (ModestEmailClipboard *self,
109 TnyFolder *src_folder,
115 * modest_email_clipboard_clear:
116 * @self: a #ModestEmailClipboard singlenton instance.
118 * Clear all data stored inside clipboard.
120 void modest_email_clipboard_clear (ModestEmailClipboard *self);
124 * modest_email_clipboard_cleared:
125 * @self: a #ModestEmailClipboard singlenton instance.
127 * Determines if clipboard is clreared, no seleciton data is stored.
129 * returns TRUE, if clipboard is cleared, FALSE otherwise.
131 gboolean modest_email_clipboard_cleared (ModestEmailClipboard *self);
135 * modest_email_clipboard_cleared:
136 * @self: a #ModestEmailClipboard singlenton instance.
137 * @folder: a #TnyFolder instance to compare.
139 * Determines if source folder stored on clipboard is the
140 * same as @folder, passed as argument.
142 * returns TRUE, if clipboard is cleared, FALSE otherwise.
145 modest_email_clipboard_check_source_folder (ModestEmailClipboard *self,
146 const TnyFolder *folder);
149 * modest_email_clipboard_set_data:
150 * @self: a #ModestEmailClipboard singlenton instance.
151 * @n_selected: the number of items copied and marked to delete.
153 * Returns the string array of item identifiers stored on clipboard.
155 * returns TRUE, if clipboard is cleared, FALSE otherwise.
157 const gchar **modest_email_clipboard_get_hidding_ids (ModestEmailClipboard *self,
161 * modest_email_clipboard_get_folder_name:
162 * @self: a #ModestEmailClipboard singlenton instance.
164 * Gets the source folder name.
166 * returns a const string with folder name, or NULL if data are not valid.
168 const gchar *modest_email_clipboard_get_folder_name (ModestEmailClipboard *self);
172 * modest_email_clipboard_headers_copied:
173 * @self: a #ModestEmailClipboard singlenton instance.
175 * Checks if clipboard has headers stored.
177 * returns TRUE, if clipboard stores headers, FALSE otherwise.
179 gboolean modest_email_clipboard_headers_copied (ModestEmailClipboard *self);
182 * modest_email_clipboard_headers_copied:
183 * @self: a #ModestEmailClipboard singlenton instance.
185 * Checks if clipboard has one folder stored.
187 * returns TRUE, if clipboard stores one folder, FALSE otherwise.
189 gboolean modest_email_clipboard_folder_copied (ModestEmailClipboard *self);
193 #endif /* __MODEST_EMAIL_CLIPBOARD_H__ */