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