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 {
53 struct _ModestWindowMgrClass {
54 GObjectClass parent_class;
58 /* member functions */
59 GType modest_window_mgr_get_type (void) G_GNUC_CONST;
61 /* typical parameter-less _new function */
62 ModestWindowMgr* modest_window_mgr_new (void);
66 * modest_window_mgr_register_window:
67 * @self: the #ModestWindowMgr
68 * @window: a #ModestWindow
70 * Registers a new window in the window manager. The window manager
71 * will keep a reference.
73 void modest_window_mgr_register_window (ModestWindowMgr *self,
74 ModestWindow *window);
77 * modest_window_mgr_unregister_window:
78 * @self: the #ModestWindowMgr
79 * @window: a #ModestWindow
81 * Unregisters a given window from the window manager. The window
82 * manager will free its reference to it.
84 void modest_window_mgr_unregister_window (ModestWindowMgr *self,
85 ModestWindow *window);
90 * modest_window_mgr_set_fullscreen_mode:
91 * @self: a #ModestWindowMgr
94 * sets/unsets the application windows in fullscreen mode
96 void modest_window_mgr_set_fullscreen_mode (ModestWindowMgr *self,
100 * modest_window_mgr_get_fullscreen_mode:
101 * @self: a #ModestWindowMgr
103 * gets the application current fullscreen mode
105 * Return value: TRUE is the application is in fullscrenn mode,
108 gboolean modest_window_mgr_get_fullscreen_mode (ModestWindowMgr *self);
112 * modest_window_mgr_show_toolbars:
113 * @self: a #ModestWindowMgr
114 * @show_toolbar: whether or not the toolbars should be shown
115 * @fullscreen: TRUE/FALSE for show/hide in fullscreen mode, otherwise
116 * it applies to normal mode
118 * shows or hides the toolbars of the registered windows. Note that if
119 * the #fullscreen attribute is TRUE and the application is in normal
120 * mode, you will not see the changes until the application switches
121 * to fullscreen mode and viceversa
123 void modest_window_mgr_show_toolbars (ModestWindowMgr *self,
124 gboolean show_toolbars,
125 gboolean fullscreen);
127 * modest_window_mgr_get_main_window:
128 * @self: a #ModestWindowMgr
130 * get the main window, or create if it's not there. don't destroy
133 * Returns: the main window or NULL in case of error
135 ModestWindow* modest_window_mgr_get_main_window (ModestWindowMgr *self);
139 * modest_window_mgr_get_easysetup_dialog:
140 * @self: a #ModestWindowMgr
142 * get the easysetup dialog; if it's NULL, there's no active dialog
144 * Returns: the easy setup dialog or NULL
146 GtkDialog* modest_window_mgr_get_easysetup_dialog (ModestWindowMgr *self);
150 * modest_window_mgr_get_easysetup_dialog:
151 * @self: a #ModestWindowMgr
153 * set the easysetup dialog; set it to NULL after destroying the dialog
155 * Returns: the easy setup dialog just set
157 GtkDialog* modest_window_mgr_set_easysetup_dialog (ModestWindowMgr *self,
162 * modest_window_mgr_prevent_hibernation_while_window_is_shown:
163 * @self: a #ModestWindowMgr
164 * @window: The window that should prevent hibernation while it is shown.
166 * Call this if hibernation should not be allowed because
167 * windows are open whose state cannot sensible be saved, such as Account
169 * This causes modest_window_mgr_get_hibernation_is_prevented() to return TRUE
170 * until all such windows have been closed. That means, until the windows have
171 * been hidden - window destruction or other memory management is not relevant.
173 void modest_window_mgr_prevent_hibernation_while_window_is_shown (ModestWindowMgr *self,
178 * modest_window_mgr_find_registered_header
179 * @self: a #ModestWindowMgr
180 * @header: a valid #TnyHeader
182 * search for the given uid in both the list of preregistered uids and in the window list;
183 * if it's available in the window list, fill the *win out-param
185 * returns TRUE if found, FALSE otherwise
187 gboolean modest_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHeader *header,
192 * modest_window_mgr_register_header
193 * @self: a #ModestWindowMgr
194 * @header: a valid #TnyHeader
196 * register the uid, even before the window is created. thus, we know when
197 * some window creation might already be underway. the uid will automatically be
198 * removed when the window itself will registered
201 void modest_window_mgr_register_header (ModestWindowMgr *self, TnyHeader *header);
205 * modest_window_mgr_unregister_header
206 * @self: a #ModestWindowMgr
207 * @header: a valid #TnyHeader
209 * unregister the uid. We could need to do that if there is any error
210 * retrieving a message. In that case the window will not be
211 * registered and thus the header will not be removed, so we must do
214 void modest_window_mgr_unregister_header (ModestWindowMgr *self, TnyHeader *header);
217 * modest_window_mgr_get_hibernation_is_prevented:
218 * @self: a #ModestWindowMgr
219 * @result: Whether any windows are currently preventing hibernation.
221 * Use this to discover whether hibernation should not be allowed because
222 * windows are open whose state cannot sensible be saved, such as Account
223 * Settings dialogs. This function will return true after someone has called
224 * modest_window_mgr_prevent_hibernation_while_window_is_shown() and before
225 * that window has been closed.
227 gboolean modest_window_mgr_get_hibernation_is_prevented (ModestWindowMgr *self);
230 * modest_window_mgr_save_state_for_all_windows:
231 * @self: a #ModestWindowMgr
233 * Save any state for all windows. For instance, call this before allowing
234 * application hibernation.
236 void modest_window_mgr_save_state_for_all_windows (ModestWindowMgr *self);
240 #endif /* __MODEST_WINDOW_MGR_H__ */