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 /* modest-editor-window.h */
33 #ifndef __MODEST_EDITOR_WINDOW_H__
34 #define __MODEST_EDITOR_WINDOW_H__
36 #include <glib-object.h>
37 #include <gtk/gtkwindow.h>
39 #include "modest-ui.h"
40 #include "modest-tny-attachment.h"
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))
52 typedef struct _ModestEditorWindow ModestEditorWindow;
53 typedef struct _ModestEditorWindowClass ModestEditorWindowClass;
55 struct _ModestEditorWindow {
58 /* insert public members, if any */
61 struct _ModestEditorWindowClass {
62 GtkWindowClass parent_class;
65 /* member functions */
66 GType modest_editor_window_get_type (void) G_GNUC_CONST;
70 * modest_editor_window_new:
71 * @ui: a ModestUI instance
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)
78 * Returns: a GtkWindow* to show and populate
80 GObject *modest_editor_window_new (ModestUI *ui);
83 * modest_editor_window_get_data:
84 * @edit_win: a ModestEditorWindow instance
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.
90 * Returns: a gpointer to the ModestEditorWindow's data store
92 gpointer modest_editor_window_get_data(ModestEditorWindow *edit_win);
95 * modest_editor_window_set_modified:
96 * @edit_win: a ModestEditorWindow instance
97 * @modified: the modified flag for this instance
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.
104 * Returns: gboolean the new state of the modified flag
106 gboolean modest_editor_window_set_modified(ModestEditorWindow *edit_win, gboolean modified);
109 * modest_editor_window_get_modified:
110 * @edit_win: a ModestEditorWindow instance
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.
117 * Returns: gboolean the new state of the modified flag
119 gboolean modest_editor_window_get_modified(ModestEditorWindow *edit_win);
122 * modest_editor_window_set_to_header:
123 * @edit_win: a ModestEditorWindow instance
124 * @to: The "To:" header string for this editor instance
126 * Sets the "To:" header to the string *to
128 * Returns: TRUE on success, FALSE otherwise
130 gboolean modest_editor_window_set_to_header(ModestEditorWindow *edit_win, const gchar *to);
133 * modest_editor_window_set_cc_header:
134 * @edit_win: a ModestEditorWindow instance
135 * @cc: The "CC:" header string for this editor instance
137 * Sets the "CC:" header to the string *cc
139 * Returns: TRUE on success, FALSE otherwise
141 gboolean modest_editor_window_set_cc_header(ModestEditorWindow *edit_win, const gchar *cc);
144 * modest_editor_window_set_bcc_header:
145 * @edit_win: a ModestEditorWindow instance
146 * @bcc: The "BCC:" header string for this editor instance
148 * Sets the "BCC:" header to the string *bcc
150 * Returns: TRUE on success, FALSE otherwise
152 gboolean modest_editor_window_set_bcc_header(ModestEditorWindow *edit_win, const gchar *bcc);
155 * modest_editor_window_set_subject_header:
156 * @edit_win: a ModestEditorWindow instance
157 * @subject: The "Subject:" header string for this editor instance
159 * Sets the "Subject:" header to the string *subject
161 * Returns: TRUE on success, FALSE otherwise
163 gboolean modest_editor_window_set_subject_header(ModestEditorWindow *edit_win, const gchar *subject);
166 * modest_editor_window_set_body:
167 * @edit_win: a ModestEditorWindow instance
168 * @body: The message body string for this editor instance
170 * Sets the message body to the string *body
172 * Returns: TRUE on success, FALSE otherwise
174 gboolean modest_editor_window_set_body(ModestEditorWindow *edit_win, const gchar *body);
177 * modest_editor_window_attach_file:
178 * @edit_win: a ModestEditorWindow instance
179 * @filename: The name of the file to attach
181 * Attaches the file "filename" to the message contents
183 * Returns: TRUE on success, FALSE otherwise
185 gboolean modest_editor_window_attach_file(ModestEditorWindow *edit_win, ModestTnyAttachment *attachment);
188 * modest_editor_window_set_attachments:
189 * @edit_win: a ModestEditorWindow instance
190 * @attachments: a list of attachments
192 * Frees the current attachments, then sets the list of attachments to *attachments
194 * Returns: The new GList* of attachments.
196 GList * modest_editor_window_set_attachments(ModestEditorWindow *edit_win, const GList* attachments);
199 * modest_editor_window_get_attachments:
200 * @edit_win: a ModestEditorWindow instance
202 * Gets the GList* of attachments of this instance
204 * Returns: The GList* of attachments of this instance
206 GList * modest_editor_window_get_attachments(ModestEditorWindow *edit_win);
208 void modest_editor_window_set_identity(ModestEditorWindow *edit_win, const gchar *identity);
209 const gchar * modest_editor_window_get_identity(ModestEditorWindow *edit_win);
211 void modest_editor_window_set_transport(ModestEditorWindow *edit_win, const gchar *transport);
212 const gchar * modest_editor_window_get_transport(ModestEditorWindow *edit_win);
215 #endif /* __MODEST_EDITOR_WINDOW_H__ */