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 #include <gtk/gtkwindow.h>
50 typedef GtkWindow ModestWindowParent;
51 typedef GtkWindowClass ModestWindowParentClass;
53 #if MODEST_HILDON_API == 0
54 #include <hildon-widgets/hildon-window.h>
56 #ifdef MODEST_TOOLKIT_HILDON2
57 #include <hildon/hildon-stackable-window.h>
59 #include <hildon/hildon-window.h>
61 #endif /*MODEST_HILDON_API == 0*/
62 #ifdef MODEST_TOOLKIT_HILDON2
63 typedef HildonStackableWindow ModestWindowParent;
64 typedef HildonStackableWindowClass ModestWindowParentClass;
66 typedef HildonWindow ModestWindowParent;
67 typedef HildonWindowClass ModestWindowParentClass;
70 #ifndef GTK_STOCK_FULLSCREEN
71 #define GTK_STOCK_FULLSCREEN ""
72 #endif /*GTK_STOCK_FULLSCREEN*/
74 #endif /*!MODEST_TOOLKIT_GTK */
76 /* Dimmed state variables */
77 typedef struct _DimmedState {
79 guint already_opened_msg;
80 gboolean any_marked_as_deleted;
81 gboolean all_marked_as_deleted;
82 gboolean any_marked_as_seen;
83 gboolean all_marked_as_seen;
84 gboolean any_marked_as_cached;
85 gboolean all_marked_as_cached;
86 gboolean any_has_attachments;
87 gboolean all_has_attachments;
88 gboolean sent_in_progress;
89 gboolean all_selected;
92 /* convenience macros */
93 #define MODEST_TYPE_WINDOW (modest_window_get_type())
94 #define MODEST_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW,ModestWindow))
95 #define MODEST_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW,GObject))
96 #define MODEST_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW))
97 #define MODEST_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW))
98 #define MODEST_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW,ModestWindowClass))
100 typedef struct _ModestWindow ModestWindow;
101 typedef struct _ModestWindowClass ModestWindowClass;
103 struct _ModestWindow {
104 ModestWindowParent parent;
107 struct _ModestWindowClass {
108 ModestWindowParentClass parent_class;
110 /* virtual methods */
111 void (*set_zoom_func) (ModestWindow *self, gdouble zoom);
112 gdouble (*get_zoom_func) (ModestWindow *self);
113 gboolean (*zoom_plus_func) (ModestWindow *self);
114 gboolean (*zoom_minus_func) (ModestWindow *self);
115 void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar);
116 void (*save_state_func) (ModestWindow *self);
117 void (*disconnect_signals_func) (ModestWindow *self);
121 * modest_window_get_type:
123 * get the #GType for #ModestWindow
127 GType modest_window_get_type (void) G_GNUC_CONST;
131 * modest_window_get_active_account:
132 * @self: a modest window instance
134 * get the name of the active account
136 * Returns: the active account name as a constant string
138 const gchar* modest_window_get_active_account (ModestWindow *self);
143 * modest_window_set_active_account:
144 * @self: a modest window instance
145 * @active_account: a new active account name for this window
147 * set the active account for this window.
148 * NOTE: this must be a valid, non-pseudo account.
151 void modest_window_set_active_account (ModestWindow *self, const gchar *active_account);
154 * modest_window_set_zoom:
155 * @window: a #ModestWindow instance
156 * @zoom: the zoom level (1.0 is no zoom)
158 * sets the zoom level of the window
160 void modest_window_set_zoom (ModestWindow *window,
164 * modest_window_get_zoom:
165 * @window: a #ModestWindow instance
167 * gets the zoom of the window
169 * Returns: the current zoom value (1.0 is no zoom)
171 gdouble modest_window_get_zoom (ModestWindow *window);
174 * modest_window_zoom_plus:
175 * @window: a #ModestWindow
177 * increases one level the zoom.
179 * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
181 gboolean modest_window_zoom_plus (ModestWindow *window);
184 * modest_window_zoom_minus:
185 * @window: a #ModestWindow
187 * decreases one level the zoom.
189 * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
191 gboolean modest_window_zoom_minus (ModestWindow *window);
195 * modest_window_show_toolbar:
197 * @view_toolbar: whether or not the toolbar should be shown
199 * shows/hides the window toolbar
201 void modest_window_show_toolbar (ModestWindow *window,
202 gboolean show_toolbar);
205 * modest_window_save_state:
208 * Ask the window to save its settings for loading again later.
209 * This actually invokes the save_setting_func vfunc, which
210 * derived windows should implement.
212 void modest_window_save_state (ModestWindow *window);
216 * modest_window_set_dimming_state:
217 * @window: a #ModestWindow instance object
218 * @state: the #DimmedState state at specific time
220 * Set basic dimming variables from selected headers at
224 modest_window_set_dimming_state (ModestWindow *window,
228 * modest_window_set_dimming_state:
229 * @window: a #ModestWindow instance object
231 * Set basic dimming variables from selected headers at
234 * @Returns: a #DimmedState state saved previously.
237 modest_window_get_dimming_state (ModestWindow *window);
241 * modest_window_get_action:
242 * @window: a #ModestWindow instance object
243 * @action_path: the full path of required action.
245 * Get an action from ui manager, using @action_path parameter,
246 * which represent the full path to the required action into UIManager
249 GtkAction * modest_window_get_action (ModestWindow *window, const gchar *action_path);
252 * modest_window_get_action_widget:
253 * @window: a #ModestWindow instance object
254 * @action_path: the full path of required action.
256 * Get action widget from ui manager, using @action_path parameter,
257 * which represent the full path to the required action into UIManager
260 GtkWidget *modest_window_get_action_widget (ModestWindow *window,
261 const gchar *action_path);
264 * modest_window_check_dimming_rules:
265 * @self: a #ModestWindow instance object
267 * Calls UI Dimming Manager of @self window to check all dimming rules.
270 void modest_window_check_dimming_rules (ModestWindow *self);
273 * modest_window_check_dimming_rules:
274 * @self: a #ModestWindow instance object
275 * @group: a #ModestWindow instance object
277 * Calls UI Dimming Manager of @self window to check @group_name specific
281 void modest_window_check_dimming_rules_group (ModestWindow *self,
282 const gchar *group_name);
286 * modest_window_enable_dimming:
287 * @self: a #ModestWindow instance object
289 * Enables UI dimming rules checking.
292 void modest_window_enable_dimming (ModestWindow *self);
296 * modest_window_disable_dimming:
297 * @self: a #ModestWindow instance object
299 * Disables UI dimming rules checking.
302 void modest_window_disable_dimming (ModestWindow *self);
305 void modest_window_disconnect_signals (ModestWindow *self);
310 #endif /* __MODEST_WINDOW_H__ */