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.
30 #ifndef __MODEST_EDITOR_WINDOW_H__
31 #define __MODEST_EDITOR_WINDOW_H__
33 #include <glib-object.h>
34 #include <gtk/gtkwindow.h>
36 #include "modest-ui.h"
37 #include "modest-tny-attachment.h"
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))
49 typedef struct _ModestEditorWindow ModestEditorWindow;
50 typedef struct _ModestEditorWindowClass ModestEditorWindowClass;
52 struct _ModestEditorWindow {
55 /* insert public members, if any */
58 struct _ModestEditorWindowClass {
59 GtkWindowClass parent_class;
62 /* member functions */
63 GType modest_editor_window_get_type (void) G_GNUC_CONST;
67 * modest_editor_window_new:
68 * @ui: a ModestUI instance
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)
75 * Returns: a GtkWindow* to show and populate
77 GObject *modest_editor_window_new (ModestUI *ui);
80 * modest_editor_window_get_data:
81 * @edit_win: a ModestEditorWindow instance
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.
87 * Returns: a gpointer to the ModestEditorWindow's data store
89 gpointer modest_editor_window_get_data(ModestEditorWindow *edit_win);
92 * modest_editor_window_set_modified:
93 * @edit_win: a ModestEditorWindow instance
94 * @modified: the modified flag for this instance
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.
101 * Returns: gboolean the new state of the modified flag
103 gboolean modest_editor_window_set_modified(ModestEditorWindow *edit_win, gboolean modified);
106 * modest_editor_window_get_modified:
107 * @edit_win: a ModestEditorWindow instance
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.
114 * Returns: gboolean the new state of the modified flag
116 gboolean modest_editor_window_get_modified(ModestEditorWindow *edit_win);
119 * modest_editor_window_set_to_header:
120 * @edit_win: a ModestEditorWindow instance
121 * @to: The "To:" header string for this editor instance
123 * Sets the "To:" header to the string *to
125 * Returns: TRUE on success, FALSE otherwise
127 gboolean modest_editor_window_set_to_header(ModestEditorWindow *edit_win, const gchar *to);
130 * modest_editor_window_set_cc_header:
131 * @edit_win: a ModestEditorWindow instance
132 * @cc: The "CC:" header string for this editor instance
134 * Sets the "CC:" header to the string *cc
136 * Returns: TRUE on success, FALSE otherwise
138 gboolean modest_editor_window_set_cc_header(ModestEditorWindow *edit_win, const gchar *cc);
141 * modest_editor_window_set_bcc_header:
142 * @edit_win: a ModestEditorWindow instance
143 * @bcc: The "BCC:" header string for this editor instance
145 * Sets the "BCC:" header to the string *bcc
147 * Returns: TRUE on success, FALSE otherwise
149 gboolean modest_editor_window_set_bcc_header(ModestEditorWindow *edit_win, const gchar *bcc);
152 * modest_editor_window_set_subject_header:
153 * @edit_win: a ModestEditorWindow instance
154 * @subject: The "Subject:" header string for this editor instance
156 * Sets the "Subject:" header to the string *subject
158 * Returns: TRUE on success, FALSE otherwise
160 gboolean modest_editor_window_set_subject_header(ModestEditorWindow *edit_win, const gchar *subject);
163 * modest_editor_window_set_body:
164 * @edit_win: a ModestEditorWindow instance
165 * @body: The message body string for this editor instance
167 * Sets the message body to the string *body
169 * Returns: TRUE on success, FALSE otherwise
171 gboolean modest_editor_window_set_body(ModestEditorWindow *edit_win, const gchar *body);
174 * modest_editor_window_attach_file:
175 * @edit_win: a ModestEditorWindow instance
176 * @filename: The name of the file to attach
178 * Attaches the file "filename" to the message contents
180 * Returns: TRUE on success, FALSE otherwise
182 gboolean modest_editor_window_attach_file(ModestEditorWindow *edit_win, ModestTnyAttachment *attachment);
185 * modest_editor_window_set_attachments:
186 * @edit_win: a ModestEditorWindow instance
187 * @attachments: a list of attachments
189 * Frees the current attachments, then sets the list of attachments to *attachments
191 * Returns: The new GList* of attachments.
193 GList * modest_editor_window_set_attachments(ModestEditorWindow *edit_win, const GList* attachments);
196 * modest_editor_window_get_attachments:
197 * @edit_win: a ModestEditorWindow instance
199 * Gets the GList* of attachments of this instance
201 * Returns: The GList* of attachments of this instance
203 GList * modest_editor_window_get_attachments(ModestEditorWindow *edit_win);
205 void modest_editor_window_set_identity(ModestEditorWindow *edit_win, const gchar *identity);
206 const gchar * modest_editor_window_get_identity(ModestEditorWindow *edit_win);
208 void modest_editor_window_set_transport(ModestEditorWindow *edit_win, const gchar *transport);
209 const gchar * modest_editor_window_get_transport(ModestEditorWindow *edit_win);
214 #endif /* __MODEST_EDITOR_WINDOW_H__ */