1 /* Copyright (c) 2006,2007 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_MGR_H__
31 #define __MODEST_WINDOW_MGR_H__
33 #include <glib-object.h>
34 #include "widgets/modest-msg-view-window.h"
38 /* convenience macros */
39 #define MODEST_TYPE_WINDOW_MGR (modest_window_mgr_get_type())
40 #define MODEST_WINDOW_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgr))
41 #define MODEST_WINDOW_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW_MGR,GObject))
42 #define MODEST_IS_WINDOW_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW_MGR))
43 #define MODEST_IS_WINDOW_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW_MGR))
44 #define MODEST_WINDOW_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgrClass))
46 typedef struct _ModestWindowMgr ModestWindowMgr;
47 typedef struct _ModestWindowMgrClass ModestWindowMgrClass;
49 struct _ModestWindowMgr {
51 /* insert public members, if any */
54 struct _ModestWindowMgrClass {
55 GObjectClass parent_class;
56 /* insert signal callback declarations, eg. */
57 /* void (* my_event) (ModestWindowMgr* obj); */
60 /* member functions */
61 GType modest_window_mgr_get_type (void) G_GNUC_CONST;
63 /* typical parameter-less _new function */
64 ModestWindowMgr* modest_window_mgr_new (void);
68 * modest_window_mgr_register_window:
69 * @self: the #ModestWindowMgr
70 * @window: a #ModestWindow
72 * Registers a new window in the window manager. The window manager
73 * will keep a reference.
75 void modest_window_mgr_register_window (ModestWindowMgr *self,
76 ModestWindow *window);
79 * modest_window_mgr_unregister_window:
80 * @self: the #ModestWindowMgr
81 * @window: a #ModestWindow
83 * Unregisters a given window from the window manager. The window
84 * manager will free its reference to it.
86 void modest_window_mgr_unregister_window (ModestWindowMgr *self,
87 ModestWindow *window);
92 * modest_window_mgr_set_fullscreen_mode:
93 * @self: a #ModestWindowMgr
96 * sets/unsets the application windows in fullscreen mode
98 void modest_window_mgr_set_fullscreen_mode (ModestWindowMgr *self,
102 * modest_window_mgr_get_fullscreen_mode:
103 * @self: a #ModestWindowMgr
105 * gets the application current fullscreen mode
107 * Return value: TRUE is the application is in fullscrenn mode,
110 gboolean modest_window_mgr_get_fullscreen_mode (ModestWindowMgr *self);
114 * modest_window_mgr_show_toolbars:
115 * @self: a #ModestWindowMgr
116 * @show_toolbar: whether or not the toolbars should be shown
117 * @fullscreen: TRUE/FALSE for show/hide in fullscreen mode, otherwise
118 * it applies to normal mode
120 * shows or hides the toolbars of the registered windows. Note that if
121 * the #fullscreen attribute is TRUE and the application is in normal
122 * mode, you will not see the changes until the application switches
123 * to fullscreen mode and viceversa
125 void modest_window_mgr_show_toolbars (ModestWindowMgr *self,
126 gboolean show_toolbars,
127 gboolean fullscreen);
129 * modest_window_mgr_get_main_window:
130 * @self: a #ModestWindowMgr
132 * get the main window, or create if it's not there. don't destroy
135 * Returns: the main window or NULL in case of error
137 ModestWindow* modest_window_mgr_get_main_window (ModestWindowMgr *self);
141 * modest_window_mgr_get_easysetup_dialog:
142 * @self: a #ModestWindowMgr
144 * get the easysetup dialog; if it's NULL, there's no active dialog
146 * Returns: the easy setup dialog or NULL
148 GtkDialog* modest_window_mgr_get_easysetup_dialog (ModestWindowMgr *self);
152 * modest_window_mgr_get_easysetup_dialog:
153 * @self: a #ModestWindowMgr
155 * set the easysetup dialog; set it to NULL after destroying the dialog
157 * Returns: the easy setup dialog just set
159 GtkDialog* modest_window_mgr_set_easysetup_dialog (ModestWindowMgr *self,
164 * modest_window_mgr_prevent_hibernation_while_window_is_shown:
165 * @self: a #ModestWindowMgr
166 * @window: The window that should prevent hibernation while it is shown.
168 * Call this if hibernation should not be allowed because
169 * windows are open whose state cannot sensible be saved, such as Account
171 * This causes modest_window_mgr_get_hibernation_is_prevented() to return TRUE
172 * until all such windows have been closed. That means, until the windows have
173 * been hidden - window destruction or other memory management is not relevant.
175 void modest_window_mgr_prevent_hibernation_while_window_is_shown (ModestWindowMgr *self,
180 * modest_window_mgr_find_registered_header
181 * @self: a #ModestWindowMgr
182 * @header: a valid #TnyHeader
184 * search for the given uid in both the list of preregistered uids and in the window list;
185 * if it's available in the window list, fill the *win out-param
187 * returns TRUE if found, FALSE otherwise
189 gboolean modest_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHeader *header,
194 * modest_window_mgr_register_header
195 * @self: a #ModestWindowMgr
196 * @header: a valid #TnyHeader
198 * register the uid, even before the window is created. thus, we know when
199 * some window creation might already be underway. the uid will automatically be
200 * removed when the window itself will registered
203 void modest_window_mgr_register_header (ModestWindowMgr *self, TnyHeader *header);
207 * modest_window_mgr_unregister_header
208 * @self: a #ModestWindowMgr
209 * @header: a valid #TnyHeader
211 * unregister the uid. We could need to do that if there is any error
212 * retrieving a message. In that case the window will not be
213 * registered and thus the header will not be removed, so we must do
216 void modest_window_mgr_unregister_header (ModestWindowMgr *self, TnyHeader *header);
219 * modest_window_mgr_get_hibernation_is_prevented:
220 * @self: a #ModestWindowMgr
221 * @result: Whether any windows are currently preventing hibernation.
223 * Use this to discover whether hibernation should not be allowed because
224 * windows are open whose state cannot sensible be saved, such as Account
225 * Settings dialogs. This function will return true after someone has called
226 * modest_window_mgr_prevent_hibernation_while_window_is_shown() and before
227 * that window has been closed.
229 gboolean modest_window_mgr_get_hibernation_is_prevented (ModestWindowMgr *self);
232 * modest_window_mgr_save_state_for_all_windows:
233 * @self: a #ModestWindowMgr
235 * Save any state for all windows. For instance, call this before allowing
236 * application hibernation.
238 void modest_window_mgr_save_state_for_all_windows (ModestWindowMgr *self);
242 #endif /* __MODEST_WINDOW_MGR_H__ */