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 GtkWindow ModestWindowParent;
50 typedef GtkWindowClass ModestWindowParentClass;
52 #if MODEST_HILDON_API == 0
53 #include <hildon-widgets/hildon-window.h>
55 #ifdef MODEST_TOOLKIT_HILDON2
56 #include <hildon/hildon-stackable-window.h>
58 #include <hildon/hildon-window.h>
60 #endif /*MODEST_HILDON_API == 0*/
61 #ifdef MODEST_TOOLKIT_HILDON2
62 typedef HildonStackableWindow ModestWindowParent;
63 typedef HildonStackableWindowClass ModestWindowParentClass;
65 typedef HildonWindow ModestWindowParent;
66 typedef HildonWindowClass ModestWindowParentClass;
69 #ifndef GTK_STOCK_FULLSCREEN
70 #define GTK_STOCK_FULLSCREEN ""
71 #endif /*GTK_STOCK_FULLSCREEN*/
73 #endif /*!MODEST_TOOLKIT_GTK */
75 /* Dimmed state variables */
76 typedef struct _DimmedState {
78 guint already_opened_msg;
79 gboolean any_marked_as_deleted;
80 gboolean all_marked_as_deleted;
81 gboolean any_marked_as_seen;
82 gboolean all_marked_as_seen;
83 gboolean any_marked_as_cached;
84 gboolean all_marked_as_cached;
85 gboolean any_has_attachments;
86 gboolean all_has_attachments;
87 gboolean sent_in_progress;
88 gboolean all_selected;
91 /* convenience macros */
92 #define MODEST_TYPE_WINDOW (modest_window_get_type())
93 #define MODEST_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW,ModestWindow))
94 #define MODEST_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW,GObject))
95 #define MODEST_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW))
96 #define MODEST_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW))
97 #define MODEST_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW,ModestWindowClass))
99 typedef struct _ModestWindow ModestWindow;
100 typedef struct _ModestWindowClass ModestWindowClass;
102 struct _ModestWindow {
103 ModestWindowParent parent;
106 struct _ModestWindowClass {
107 ModestWindowParentClass parent_class;
109 /* virtual methods */
110 void (*set_zoom_func) (ModestWindow *self, gdouble zoom);
111 gdouble (*get_zoom_func) (ModestWindow *self);
112 gboolean (*zoom_plus_func) (ModestWindow *self);
113 gboolean (*zoom_minus_func) (ModestWindow *self);
114 void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar);
115 void (*save_state_func) (ModestWindow *self);
116 void (*disconnect_signals_func) (ModestWindow *self);
120 * modest_window_get_type:
122 * get the #GType for #ModestWindow
126 GType modest_window_get_type (void) G_GNUC_CONST;
130 * modest_window_get_active_account:
131 * @self: a modest window instance
133 * get the name of the active account
135 * Returns: the active account name as a constant string
137 const gchar* modest_window_get_active_account (ModestWindow *self);
142 * modest_window_set_active_account:
143 * @self: a modest window instance
144 * @active_account: a new active account name for this window
146 * set the active account for this window.
147 * NOTE: this must be a valid, non-pseudo account.
150 void modest_window_set_active_account (ModestWindow *self, const gchar *active_account);
153 * modest_window_get_active_mailbox:
154 * @self: a modest window instance
156 * get the name of the active mailbox
158 * Returns: the active mailbox as a constant string
160 const gchar* modest_window_get_active_mailbox (ModestWindow *self);
165 * modest_window_set_active_account:
166 * @self: a modest window instance
167 * @active_mailbox: a new active mailbox name for this window
169 * set the active mailbox for this window.
172 void modest_window_set_active_mailbox (ModestWindow *self, const gchar *active_mailbox);
175 * modest_window_set_zoom:
176 * @window: a #ModestWindow instance
177 * @zoom: the zoom level (1.0 is no zoom)
179 * sets the zoom level of the window
181 void modest_window_set_zoom (ModestWindow *window,
185 * modest_window_get_zoom:
186 * @window: a #ModestWindow instance
188 * gets the zoom of the window
190 * Returns: the current zoom value (1.0 is no zoom)
192 gdouble modest_window_get_zoom (ModestWindow *window);
195 * modest_window_zoom_plus:
196 * @window: a #ModestWindow
198 * increases one level the zoom.
200 * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
202 gboolean modest_window_zoom_plus (ModestWindow *window);
205 * modest_window_zoom_minus:
206 * @window: a #ModestWindow
208 * decreases one level the zoom.
210 * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
212 gboolean modest_window_zoom_minus (ModestWindow *window);
216 * modest_window_show_toolbar:
218 * @view_toolbar: whether or not the toolbar should be shown
220 * shows/hides the window toolbar
222 void modest_window_show_toolbar (ModestWindow *window,
223 gboolean show_toolbar);
226 * modest_window_save_state:
229 * Ask the window to save its settings for loading again later.
230 * This actually invokes the save_setting_func vfunc, which
231 * derived windows should implement.
233 void modest_window_save_state (ModestWindow *window);
237 * modest_window_set_dimming_state:
238 * @window: a #ModestWindow instance object
239 * @state: the #DimmedState state at specific time
241 * Set basic dimming variables from selected headers at
245 modest_window_set_dimming_state (ModestWindow *window,
249 * modest_window_set_dimming_state:
250 * @window: a #ModestWindow instance object
252 * Set basic dimming variables from selected headers at
255 * @Returns: a #DimmedState state saved previously.
258 modest_window_get_dimming_state (ModestWindow *window);
262 * modest_window_get_action:
263 * @window: a #ModestWindow instance object
264 * @action_path: the full path of required action.
266 * Get an action from ui manager, using @action_path parameter,
267 * which represent the full path to the required action into UIManager
270 GtkAction * modest_window_get_action (ModestWindow *window, const gchar *action_path);
273 * modest_window_get_action_widget:
274 * @window: a #ModestWindow instance object
275 * @action_path: the full path of required action.
277 * Get action widget from ui manager, using @action_path parameter,
278 * which represent the full path to the required action into UIManager
281 GtkWidget *modest_window_get_action_widget (ModestWindow *window,
282 const gchar *action_path);
285 * modest_window_check_dimming_rules:
286 * @self: a #ModestWindow instance object
288 * Calls UI Dimming Manager of @self window to check all dimming rules.
291 void modest_window_check_dimming_rules (ModestWindow *self);
294 * modest_window_check_dimming_rules:
295 * @self: a #ModestWindow instance object
296 * @group: a #ModestWindow instance object
298 * Calls UI Dimming Manager of @self window to check @group_name specific
302 void modest_window_check_dimming_rules_group (ModestWindow *self,
303 const gchar *group_name);
307 * modest_window_enable_dimming:
308 * @self: a #ModestWindow instance object
310 * Enables UI dimming rules checking.
313 void modest_window_enable_dimming (ModestWindow *self);
317 * modest_window_disable_dimming:
318 * @self: a #ModestWindow instance object
320 * Disables UI dimming rules checking.
323 void modest_window_disable_dimming (ModestWindow *self);
326 void modest_window_disconnect_signals (ModestWindow *self);
331 #endif /* __MODEST_WINDOW_H__ */