* listen to updates in the account store, and refresh
[modest] / src / modest-editor-window.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 /* modest-editor-window.h */
32
33 #ifndef __MODEST_EDITOR_WINDOW_H__
34 #define __MODEST_EDITOR_WINDOW_H__
35
36 #include <glib-object.h>
37 #include <gtk/gtkwindow.h>
38
39 #include "modest-ui.h"
40 #include "modest-tny-attachment.h"
41
42 G_BEGIN_DECLS
43
44 /* convenience macros */
45 #define MODEST_TYPE_EDITOR_WINDOW             (modest_editor_window_get_type())
46 #define MODEST_EDITOR_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_EDITOR_WINDOW,ModestEditorWindow))
47 #define MODEST_EDITOR_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_EDITOR_WINDOW,GtkWindow))
48 #define MODEST_IS_EDITOR_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_EDITOR_WINDOW))
49 #define MODEST_IS_EDITOR_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_EDITOR_WINDOW))
50 #define MODEST_EDITOR_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_EDITOR_WINDOW,ModestEditorWindowClass))
51
52 typedef struct _ModestEditorWindow      ModestEditorWindow;
53 typedef struct _ModestEditorWindowClass ModestEditorWindowClass;
54
55 struct _ModestEditorWindow {
56          GObject parent;
57          GtkWindow *window;
58         /* insert public members, if any */
59 };
60
61 struct _ModestEditorWindowClass {
62         GtkWindowClass parent_class;
63 };
64
65 /* member functions */
66 GType        modest_editor_window_get_type    (void) G_GNUC_CONST;
67
68
69 /**
70  * modest_editor_window_new:
71  * @ui: a ModestUI instance
72  *
73  * Creates a new editor window instance which is a subclass of GtkWindow and
74  * lives in the ModestUI context *ui
75  * It uses an interface function modest_ui_new_editor_window() to create the
76  * the actual window contents (see its documentation for the interface specification)
77  *
78  * Returns: a GtkWindow* to show and populate
79  */
80 GObject *modest_editor_window_new         (ModestUI *ui);
81
82 /**
83  * modest_editor_window_get_data:
84  * @edit_win: a ModestEditorWindow instance
85  *
86  * Retrieves the generic data pointer from the ModestEditorWindow (which
87  * the UI interface code can use to store arbitrary (state-)data in the
88  * ModestEditorWindow widget.
89  *
90  * Returns: a gpointer to the ModestEditorWindow's data store
91  */
92 gpointer modest_editor_window_get_data(ModestEditorWindow *edit_win);
93
94 /**
95  * modest_editor_window_set_modified:
96  * @edit_win: a ModestEditorWindow instance
97  * @modified: the modified flag for this instance
98  *
99  * Set/reset the modified flag for the instance. This flag can be used to store
100  * information whether the contents of the editor window was modified by the
101  * user or not. If it was modified (see also modest_editor_window_get_modified())
102  * a dialog can be presented to ask the user for confirmation.
103  *
104  * Returns: gboolean the new state of the modified flag
105  */
106 gboolean modest_editor_window_set_modified(ModestEditorWindow *edit_win, gboolean modified);
107
108 /**
109  * modest_editor_window_get_modified:
110  * @edit_win: a ModestEditorWindow instance
111  *
112  * Gets the state of the modified-flag of this instance. This flag can be used to store
113  * information whether the contents of the editor window was modified by the
114  * user or not. If it was modified (see also modest_editor_window_set_modified())
115  * a dialog can be presented to ask the user for confirmation.
116  *
117  * Returns: gboolean the new state of the modified flag
118  */
119 gboolean modest_editor_window_get_modified(ModestEditorWindow *edit_win);
120
121 /**
122  * modest_editor_window_set_to_header:
123  * @edit_win: a ModestEditorWindow instance
124  * @to: The "To:" header string for this editor instance
125  *
126  * Sets the "To:" header to the string *to
127  *
128  * Returns: TRUE on success, FALSE otherwise
129  */
130 gboolean modest_editor_window_set_to_header(ModestEditorWindow *edit_win, const gchar *to);
131
132 /**
133  * modest_editor_window_set_cc_header:
134  * @edit_win: a ModestEditorWindow instance
135  * @cc: The "CC:" header string for this editor instance
136  *
137  * Sets the "CC:" header to the string *cc
138  *
139  * Returns: TRUE on success, FALSE otherwise
140  */
141 gboolean modest_editor_window_set_cc_header(ModestEditorWindow *edit_win, const gchar *cc);
142
143 /**
144  * modest_editor_window_set_bcc_header:
145  * @edit_win: a ModestEditorWindow instance
146  * @bcc: The "BCC:" header string for this editor instance
147  *
148  * Sets the "BCC:" header to the string *bcc
149  *
150  * Returns: TRUE on success, FALSE otherwise
151  */
152 gboolean modest_editor_window_set_bcc_header(ModestEditorWindow *edit_win, const gchar *bcc);
153
154 /**
155  * modest_editor_window_set_subject_header:
156  * @edit_win: a ModestEditorWindow instance
157  * @subject: The "Subject:" header string for this editor instance
158  *
159  * Sets the "Subject:" header to the string *subject
160  *
161  * Returns: TRUE on success, FALSE otherwise
162  */
163 gboolean modest_editor_window_set_subject_header(ModestEditorWindow *edit_win, const gchar *subject);
164
165 /**
166  * modest_editor_window_set_body:
167  * @edit_win: a ModestEditorWindow instance
168  * @body: The message body string for this editor instance
169  *
170  * Sets the message body to the string *body
171  *
172  * Returns: TRUE on success, FALSE otherwise
173  */
174 gboolean modest_editor_window_set_body(ModestEditorWindow *edit_win, const gchar *body);
175
176 /**
177  * modest_editor_window_attach_file:
178  * @edit_win: a ModestEditorWindow instance
179  * @filename: The name of the file to attach
180  *
181  * Attaches the file "filename" to the message contents
182  *
183  * Returns: TRUE on success, FALSE otherwise
184  */
185 gboolean modest_editor_window_attach_file(ModestEditorWindow *edit_win, ModestTnyAttachment *attachment);
186
187 /**
188  * modest_editor_window_set_attachments:
189  * @edit_win: a ModestEditorWindow instance
190  * @attachments: a list of attachments
191  *
192  * Frees the current attachments, then sets the list of attachments to *attachments
193  *
194  * Returns: The new GList* of attachments.
195  */
196 GList * modest_editor_window_set_attachments(ModestEditorWindow *edit_win, const GList* attachments);
197
198 /**
199  * modest_editor_window_get_attachments:
200  * @edit_win: a ModestEditorWindow instance
201  *
202  * Gets the GList* of attachments of this instance
203  *
204  * Returns: The GList* of attachments of this instance
205  */
206 GList * modest_editor_window_get_attachments(ModestEditorWindow *edit_win);
207
208 void modest_editor_window_set_identity(ModestEditorWindow *edit_win, const gchar *identity);
209 const gchar * modest_editor_window_get_identity(ModestEditorWindow *edit_win);
210
211 void modest_editor_window_set_transport(ModestEditorWindow *edit_win, const gchar *transport);
212 const gchar * modest_editor_window_get_transport(ModestEditorWindow *edit_win);
213 G_END_DECLS
214
215 #endif /* __MODEST_EDITOR_WINDOW_H__ */