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_WINDOW_H__
31 #define __MODEST_WINDOW_H__
33 #include <glib-object.h>
34 #include <tny-account-store.h>
40 #endif /*HAVE_CONFIG_H*/
45 * admittedly, the ifdefs for gtk and maemo are rather ugly; still
46 * this way is probably the easiest to maintain
48 #ifdef MODEST_TOOLKIT_GTK
49 typedef GtkVBox ModestWindowParent;
50 typedef GtkVBoxClass ModestWindowParentClass;
52 #ifdef MODEST_TOOLKIT_HILDON2
53 #include <hildon/hildon-stackable-window.h>
54 typedef HildonStackableWindow ModestWindowParent;
55 typedef HildonStackableWindowClass ModestWindowParentClass;
57 #include <hildon/hildon-window.h>
58 typedef HildonWindow ModestWindowParent;
59 typedef HildonWindowClass ModestWindowParentClass;
62 #ifndef GTK_STOCK_FULLSCREEN
63 #define GTK_STOCK_FULLSCREEN ""
64 #endif /*GTK_STOCK_FULLSCREEN*/
66 #endif /*!MODEST_TOOLKIT_GTK */
68 /* Dimmed state variables */
69 typedef struct _DimmedState {
71 guint already_opened_msg;
72 gboolean any_marked_as_deleted;
73 gboolean all_marked_as_deleted;
74 gboolean any_marked_as_seen;
75 gboolean all_marked_as_seen;
76 gboolean any_marked_as_cached;
77 gboolean all_marked_as_cached;
78 gboolean any_has_attachments;
79 gboolean all_has_attachments;
80 gboolean sent_in_progress;
81 gboolean all_selected;
84 /* convenience macros */
85 #define MODEST_TYPE_WINDOW (modest_window_get_type())
86 #define MODEST_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW,ModestWindow))
87 #define MODEST_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW,GObject))
88 #define MODEST_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW))
89 #define MODEST_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW))
90 #define MODEST_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW,ModestWindowClass))
92 typedef struct _ModestWindow ModestWindow;
93 typedef struct _ModestWindowClass ModestWindowClass;
95 struct _ModestWindow {
96 ModestWindowParent parent;
99 struct _ModestWindowClass {
100 ModestWindowParentClass parent_class;
102 /* virtual methods */
103 void (*set_zoom_func) (ModestWindow *self, gdouble zoom);
104 gdouble (*get_zoom_func) (ModestWindow *self);
105 gboolean (*zoom_plus_func) (ModestWindow *self);
106 gboolean (*zoom_minus_func) (ModestWindow *self);
107 void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar);
108 void (*save_state_func) (ModestWindow *self);
109 void (*disconnect_signals_func) (ModestWindow *self);
110 void (*show_progress_func) (ModestWindow *self, gboolean show);
111 void (*add_toolbar_func) (ModestWindow *self, GtkToolbar *toolbar);
112 void (*set_title_func) (ModestWindow *self, const gchar *title);
116 * modest_window_get_type:
118 * get the #GType for #ModestWindow
122 GType modest_window_get_type (void) G_GNUC_CONST;
126 * modest_window_get_active_account:
127 * @self: a modest window instance
129 * get the name of the active account
131 * Returns: the active account name as a constant string
133 const gchar* modest_window_get_active_account (ModestWindow *self);
138 * modest_window_set_active_account:
139 * @self: a modest window instance
140 * @active_account: a new active account name for this window
142 * set the active account for this window.
143 * NOTE: this must be a valid, non-pseudo account.
146 void modest_window_set_active_account (ModestWindow *self, const gchar *active_account);
149 * modest_window_get_active_mailbox:
150 * @self: a modest window instance
152 * get the name of the active mailbox
154 * Returns: the active mailbox as a constant string
156 const gchar* modest_window_get_active_mailbox (ModestWindow *self);
161 * modest_window_set_active_account:
162 * @self: a modest window instance
163 * @active_mailbox: a new active mailbox name for this window
165 * set the active mailbox for this window.
168 void modest_window_set_active_mailbox (ModestWindow *self, const gchar *active_mailbox);
171 * modest_window_set_zoom:
172 * @window: a #ModestWindow instance
173 * @zoom: the zoom level (1.0 is no zoom)
175 * sets the zoom level of the window
177 void modest_window_set_zoom (ModestWindow *window,
181 * modest_window_get_zoom:
182 * @window: a #ModestWindow instance
184 * gets the zoom of the window
186 * Returns: the current zoom value (1.0 is no zoom)
188 gdouble modest_window_get_zoom (ModestWindow *window);
191 * modest_window_zoom_plus:
192 * @window: a #ModestWindow
194 * increases one level the zoom.
196 * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
198 gboolean modest_window_zoom_plus (ModestWindow *window);
201 * modest_window_zoom_minus:
202 * @window: a #ModestWindow
204 * decreases one level the zoom.
206 * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
208 gboolean modest_window_zoom_minus (ModestWindow *window);
212 * modest_window_show_toolbar:
214 * @view_toolbar: whether or not the toolbar should be shown
216 * shows/hides the window toolbar
218 void modest_window_show_toolbar (ModestWindow *window,
219 gboolean show_toolbar);
222 * modest_window_save_state:
225 * Ask the window to save its settings for loading again later.
226 * This actually invokes the save_setting_func vfunc, which
227 * derived windows should implement.
229 void modest_window_save_state (ModestWindow *window);
233 * modest_window_set_dimming_state:
234 * @window: a #ModestWindow instance object
235 * @state: the #DimmedState state at specific time
237 * Set basic dimming variables from selected headers at
241 modest_window_set_dimming_state (ModestWindow *window,
245 * modest_window_set_dimming_state:
246 * @window: a #ModestWindow instance object
248 * Set basic dimming variables from selected headers at
251 * @Returns: a #DimmedState state saved previously.
254 modest_window_get_dimming_state (ModestWindow *window);
258 * modest_window_get_action:
259 * @window: a #ModestWindow instance object
260 * @action_path: the full path of required action.
262 * Get an action from ui manager, using @action_path parameter,
263 * which represent the full path to the required action into UIManager
266 GtkAction * modest_window_get_action (ModestWindow *window, const gchar *action_path);
269 * modest_window_get_action_widget:
270 * @window: a #ModestWindow instance object
271 * @action_path: the full path of required action.
273 * Get action widget from ui manager, using @action_path parameter,
274 * which represent the full path to the required action into UIManager
277 GtkWidget *modest_window_get_action_widget (ModestWindow *window,
278 const gchar *action_path);
281 * modest_window_check_dimming_rules:
282 * @self: a #ModestWindow instance object
284 * Calls UI Dimming Manager of @self window to check all dimming rules.
287 void modest_window_check_dimming_rules (ModestWindow *self);
290 * modest_window_check_dimming_rules:
291 * @self: a #ModestWindow instance object
292 * @group: a #ModestWindow instance object
294 * Calls UI Dimming Manager of @self window to check @group_name specific
298 void modest_window_check_dimming_rules_group (ModestWindow *self,
299 const gchar *group_name);
303 * modest_window_enable_dimming:
304 * @self: a #ModestWindow instance object
306 * Enables UI dimming rules checking.
309 void modest_window_enable_dimming (ModestWindow *self);
313 * modest_window_disable_dimming:
314 * @self: a #ModestWindow instance object
316 * Disables UI dimming rules checking.
319 void modest_window_disable_dimming (ModestWindow *self);
322 void modest_window_disconnect_signals (ModestWindow *self);
324 void modest_window_show_progress (ModestWindow *self, gboolean show_progress);
326 void modest_window_add_toolbar (ModestWindow *self, GtkToolbar *toolbar);
328 void modest_window_set_title (ModestWindow *self, const gchar *title);
333 #endif /* __MODEST_WINDOW_H__ */