If no connection is available and bs embedded image is not fetched, show
[modest] / src / widgets / modest-window.h
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
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.
16  *
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.
28  */
29
30 #ifndef __MODEST_WINDOW_H__
31 #define __MODEST_WINDOW_H__
32
33 #include <glib-object.h>
34 #include <tny-account-store.h>
35
36 G_BEGIN_DECLS
37
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif /*HAVE_CONFIG_H*/
41
42 #include <gtk/gtk.h>
43  
44 /* 
45  * admittedly, the ifdefs for gtk and maemo are rather ugly; still
46  * this way is probably the easiest to maintain
47  */
48 #ifdef MODEST_TOOLKIT_GTK
49 #include <gtk/gtkwindow.h>
50 typedef GtkWindow      ModestWindowParent;
51 typedef GtkWindowClass ModestWindowParentClass;
52 #else
53 #ifdef MODEST_TOOLKIT_HILDON2
54 #include <hildon/hildon-stackable-window.h>
55 typedef HildonStackableWindow      ModestWindowParent;
56 typedef HildonStackableWindowClass ModestWindowParentClass;
57 #else
58 #include <hildon/hildon-window.h>
59 typedef HildonWindow      ModestWindowParent;
60 typedef HildonWindowClass ModestWindowParentClass;
61 #endif
62
63 #ifndef GTK_STOCK_FULLSCREEN
64 #define GTK_STOCK_FULLSCREEN ""
65 #endif /*GTK_STOCK_FULLSCREEN*/
66
67 #endif /*!MODEST_TOOLKIT_GTK */
68
69 /* Dimmed state variables */
70 typedef struct _DimmedState {   
71         guint    n_selected;
72         guint    already_opened_msg;
73         gboolean any_marked_as_deleted;
74         gboolean all_marked_as_deleted;
75         gboolean any_marked_as_seen;
76         gboolean all_marked_as_seen;
77         gboolean any_marked_as_cached;
78         gboolean all_marked_as_cached;
79         gboolean any_has_attachments;
80         gboolean all_has_attachments;
81         gboolean sent_in_progress;
82         gboolean all_selected;
83 } DimmedState;
84
85 /* convenience macros */
86 #define MODEST_TYPE_WINDOW             (modest_window_get_type())
87 #define MODEST_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW,ModestWindow))
88 #define MODEST_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW,GObject))
89 #define MODEST_IS_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW))
90 #define MODEST_IS_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW))
91 #define MODEST_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW,ModestWindowClass))
92
93 typedef struct _ModestWindow      ModestWindow;
94 typedef struct _ModestWindowClass ModestWindowClass;
95
96 struct _ModestWindow {
97          ModestWindowParent parent;
98 };
99
100 struct _ModestWindowClass {
101         ModestWindowParentClass parent_class;
102
103         /* virtual methods */
104         void (*set_zoom_func) (ModestWindow *self, gdouble zoom);
105         gdouble (*get_zoom_func) (ModestWindow *self);
106         gboolean (*zoom_plus_func) (ModestWindow *self);
107         gboolean (*zoom_minus_func) (ModestWindow *self);
108         void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar);
109         void (*save_state_func) (ModestWindow *self);
110         void (*disconnect_signals_func) (ModestWindow *self);
111 };
112
113 /**
114  * modest_window_get_type:
115  *
116  * get the #GType for #ModestWindow
117  * 
118  * Returns: the type
119  */     
120 GType        modest_window_get_type    (void) G_GNUC_CONST;
121
122
123 /**
124  * modest_window_get_active_account:
125  * @self: a modest window instance
126  * 
127  * get the name of the active account
128  * 
129  * Returns: the active account name as a constant string
130  */     
131 const gchar* modest_window_get_active_account (ModestWindow *self);
132
133
134
135 /**
136  * modest_window_set_active_account:
137  * @self: a modest window instance
138  * @active_account: a new active account name for this window
139  * 
140  * set the active account for this window.
141  * NOTE: this must be a valid, non-pseudo account.
142  * 
143  */     
144 void modest_window_set_active_account (ModestWindow *self, const gchar *active_account);
145
146 /**
147  * modest_window_get_active_mailbox:
148  * @self: a modest window instance
149  * 
150  * get the name of the active mailbox
151  * 
152  * Returns: the active mailbox as a constant string
153  */     
154 const gchar* modest_window_get_active_mailbox (ModestWindow *self);
155
156
157
158 /**
159  * modest_window_set_active_account:
160  * @self: a modest window instance
161  * @active_mailbox: a new active mailbox name for this window
162  * 
163  * set the active mailbox for this window.
164  * 
165  */     
166 void modest_window_set_active_mailbox (ModestWindow *self, const gchar *active_mailbox);
167
168 /**
169  * modest_window_set_zoom:
170  * @window: a #ModestWindow instance
171  * @zoom: the zoom level (1.0 is no zoom)
172  *
173  * sets the zoom level of the window
174  */
175 void            modest_window_set_zoom    (ModestWindow *window,
176                                            gdouble value);
177
178 /**
179  * modest_window_get_zoom:
180  * @window: a #ModestWindow instance
181  *
182  * gets the zoom of the window
183  *
184  * Returns: the current zoom value (1.0 is no zoom)
185  */
186 gdouble         modest_window_get_zoom    (ModestWindow *window);
187
188 /**
189  * modest_window_zoom_plus:
190  * @window: a #ModestWindow
191  *
192  * increases one level the zoom.
193  *
194  * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
195  */
196 gboolean modest_window_zoom_plus (ModestWindow *window);
197
198 /**
199  * modest_window_zoom_minus:
200  * @window: a #ModestWindow
201  *
202  * decreases one level the zoom.
203  *
204  * Returns: %TRUE if successful, %FALSE if increasing zoom is not available
205  */
206 gboolean modest_window_zoom_minus (ModestWindow *window);
207
208
209 /**
210  * modest_window_show_toolbar:
211  * @window: 
212  * @view_toolbar: whether or not the toolbar should be shown
213  * 
214  * shows/hides the window toolbar
215  **/
216 void     modest_window_show_toolbar (ModestWindow *window, 
217                                      gboolean show_toolbar);
218                                      
219 /**
220  * modest_window_save_state:
221  * @window: 
222  * 
223  * Ask the window to save its settings for loading again later.
224  * This actually invokes the save_setting_func vfunc, which 
225  * derived windows should implement.
226  **/
227 void     modest_window_save_state (ModestWindow *window);
228
229
230 /**
231  * modest_window_set_dimming_state:
232  * @window: a #ModestWindow instance object
233  * @state: the #DimmedState state at specific time 
234  * 
235  * Set basic dimming variables from selected headers at
236  * specific moment.
237  **/
238 void
239 modest_window_set_dimming_state (ModestWindow *window,
240                                  DimmedState *state);
241
242 /**
243  * modest_window_set_dimming_state:
244  * @window: a #ModestWindow instance object
245  * 
246  * Set basic dimming variables from selected headers at
247  * specific moment.
248  * 
249  * @Returns: a  #DimmedState state saved previously. 
250  **/
251 const DimmedState *
252 modest_window_get_dimming_state (ModestWindow *window);
253                                 
254
255 /**
256  * modest_window_get_action:
257  * @window: a #ModestWindow instance object
258  * @action_path: the full path of required action.
259  * 
260  * Get an action from ui manager, using @action_path parameter,
261  * which represent the full path to the required action into UIManager 
262  * xml definition.
263  **/
264 GtkAction * modest_window_get_action (ModestWindow *window, const gchar *action_path); 
265
266 /**
267  * modest_window_get_action_widget:
268  * @window: a #ModestWindow instance object
269  * @action_path: the full path of required action.
270  * 
271  * Get action widget from ui manager, using @action_path parameter,
272  * which represent the full path to the required action into UIManager 
273  * xml definition.
274  **/
275 GtkWidget *modest_window_get_action_widget (ModestWindow *window, 
276                                             const gchar *action_path);
277
278 /**
279  * modest_window_check_dimming_rules:
280  * @self: a #ModestWindow instance object
281  * 
282  * Calls UI Dimming Manager of @self window to check all dimming rules.
283  * 
284  **/
285 void modest_window_check_dimming_rules (ModestWindow *self);
286
287 /**
288  * modest_window_check_dimming_rules:
289  * @self: a #ModestWindow instance object
290  * @group: a #ModestWindow instance object
291  * 
292  * Calls UI Dimming Manager of @self window to check @group_name specific
293  * dimming rules.
294  * 
295  **/
296 void modest_window_check_dimming_rules_group (ModestWindow *self,
297                                               const gchar *group_name);
298
299
300 /**
301  * modest_window_enable_dimming:
302  * @self: a #ModestWindow instance object
303  * 
304  * Enables UI dimming rules checking.
305  *
306  **/
307 void modest_window_enable_dimming (ModestWindow *self);
308
309
310 /**
311  * modest_window_disable_dimming:
312  * @self: a #ModestWindow instance object
313  * 
314  * Disables UI dimming rules checking.
315  *
316  **/
317 void modest_window_disable_dimming (ModestWindow *self);
318
319
320 void modest_window_disconnect_signals (ModestWindow *self);
321
322
323 G_END_DECLS
324
325 #endif /* __MODEST_WINDOW_H__ */