bf64969ef8644a7469657bc9ed5123d8c26c884a
[modest] / src / modest-email-clipboard.h
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
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.
16  *
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.
28  */
29
30
31 #ifndef __MODEST_EMAIL_CLIPBOARD_H__
32 #define __MODEST_EMAIL_CLIPBOARD_H__
33
34 #include <glib-object.h>
35 #include <modest-conf.h>
36 #include <modest-defs.h>
37 #include <tny-folder.h>
38
39 G_BEGIN_DECLS
40
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))
48
49 typedef struct _ModestEmailClipboard      ModestEmailClipboard;
50 typedef struct _ModestEmailClipboardClass ModestEmailClipboardClass;
51
52 struct _ModestEmailClipboard {
53          GObject parent;
54 };
55
56 struct _ModestEmailClipboardClass {
57         GObjectClass parent_class;
58
59 };
60
61 /**
62  * modest_email_clipboard_get_type:
63  * 
64  * get the GType for #ModestEmailClipboard
65  *  
66  * Returns: the GType
67  */
68 GType           modest_email_clipboard_get_type       (void) G_GNUC_CONST;
69
70
71 /**
72  * modest_email_clipboard_new:
73  *  
74  * Returns: a new #ModestEmailClipboard, or NULL in case of error
75  */
76 ModestEmailClipboard*        modest_email_clipboard_new (void);
77
78
79 /**
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.
85  *  
86  * Gets data from clipboard to manage them with copy, cut and paste operations.
87  * Currently imementation allows #TnyFolder or #TnyHeader objects.
88  *
89  * After getting data, clipboard will be cleared.
90  */
91 void
92 modest_email_clipboard_get_data (ModestEmailClipboard *self,
93                                  TnyFolder **src_folder,
94                                  TnyList **data,
95                                  gboolean *delete);
96
97 /**
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.
103  *  
104  * Sets data on clipboard to manage them wiht copy, cut and paste operations.
105  * Currently imementation allows #TnyFolder or #TnyHeader objects.
106  *
107  */
108 void modest_email_clipboard_set_data (ModestEmailClipboard *self,
109                                       TnyFolder *src_folder, 
110                                       TnyList *data,
111                                       gboolean delete);
112
113
114 /**
115  * modest_email_clipboard_clear:
116  * @self: a #ModestEmailClipboard singlenton instance.   
117  *  
118  * Clear all data stored inside clipboard.
119  */
120 void modest_email_clipboard_clear (ModestEmailClipboard *self);
121
122
123 /**
124  * modest_email_clipboard_cleared:
125  * @self: a #ModestEmailClipboard singlenton instance.   
126  * 
127  * Determines if clipboard is clreared, no seleciton data is stored.
128  *  
129  * returns TRUE, if clipboard is cleared, FALSE otherwise.
130  */
131 gboolean modest_email_clipboard_cleared (ModestEmailClipboard *self);
132
133
134 /**
135  * modest_email_clipboard_cleared:
136  * @self: a #ModestEmailClipboard singlenton instance.   
137  * @folder: a #TnyFolder instance to compare.
138  * 
139  * Determines if source folder stored on clipboard is the 
140  * same as @folder, passed as argument. 
141  *  
142  * returns TRUE, if clipboard is cleared, FALSE otherwise.
143  */
144 gboolean 
145 modest_email_clipboard_check_source_folder (ModestEmailClipboard *self,
146                                             const TnyFolder *folder);
147
148 /**
149  * modest_email_clipboard_set_data:
150  * @self: a #ModestEmailClipboard singlenton instance.   
151  * @n_selected: the number of items copied and marked to delete.
152  * 
153  * Returns the string array of item identifiers stored on clipboard.
154  * 
155  * returns TRUE, if clipboard is cleared, FALSE otherwise.
156  */
157 const gchar **modest_email_clipboard_get_hidding_ids (ModestEmailClipboard *self,
158                                                       guint *n_selected);
159
160 /**
161  * modest_email_clipboard_get_folder_name:
162  * @self: a #ModestEmailClipboard singlenton instance.   
163  * 
164  * Gets the source folder name.
165  * 
166  * returns a const string with folder name, or NULL if data are not valid.
167  */
168 const gchar *modest_email_clipboard_get_folder_name (ModestEmailClipboard *self);
169
170
171 /**
172  * modest_email_clipboard_headers_copied:
173  * @self: a #ModestEmailClipboard singlenton instance.   
174  *
175  * Checks if clipboard has headers stored.
176  * 
177  * returns TRUE, if clipboard stores headers, FALSE otherwise.
178  */
179 gboolean modest_email_clipboard_headers_copied (ModestEmailClipboard *self);
180
181 /**
182  * modest_email_clipboard_headers_copied:
183  * @self: a #ModestEmailClipboard singlenton instance.   
184  *
185  * Checks if clipboard has one folder stored.
186  * 
187  * returns TRUE, if clipboard stores one folder, FALSE otherwise.
188  */
189 gboolean modest_email_clipboard_folder_copied (ModestEmailClipboard *self);
190
191 G_END_DECLS
192
193 #endif /* __MODEST_EMAIL_CLIPBOARD_H__ */