* src/modest-tny-store-actions.h
[modest] / src / modest-widget-factory.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_WIDGET_FACTORY_H__
31 #define __MODEST_WIDGET_FACTORY_H__
32
33 #include "modest-account-mgr.h"
34 #include "modest-tny-account-store.h"
35 #include "widgets/modest-header-view.h"
36 #include "widgets/modest-folder-view.h"
37 #include "widgets/modest-msg-view.h"
38 #include "widgets/modest-account-view.h"
39 #include "widgets/modest-toolbar.h"
40 #include "widgets/modest-combo-box.h"
41
42 G_BEGIN_DECLS
43
44 /* convenience macros */
45 #define MODEST_TYPE_WIDGET_FACTORY             (modest_widget_factory_get_type())
46 #define MODEST_WIDGET_FACTORY(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WIDGET_FACTORY,ModestWidgetFactory))
47 #define MODEST_WIDGET_FACTORY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WIDGET_FACTORY,GObject))
48 #define MODEST_IS_WIDGET_FACTORY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WIDGET_FACTORY))
49 #define MODEST_IS_WIDGET_FACTORY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WIDGET_FACTORY))
50 #define MODEST_WIDGET_FACTORY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WIDGET_FACTORY,ModestWidgetFactoryClass))
51
52 typedef struct _ModestWidgetFactory      ModestWidgetFactory;
53 typedef struct _ModestWidgetFactoryClass ModestWidgetFactoryClass;
54
55 struct _ModestWidgetFactory {
56          GObject parent;
57         /* insert public members, if any */
58 };
59
60 struct _ModestWidgetFactoryClass {
61         GObjectClass parent_class;
62         /* insert signal callback declarations, eg. */
63         /* void (* my_event) (ModestWidgetFactory* obj); */
64 };
65
66
67 enum _ModestComboBoxType {
68         MODEST_COMBO_BOX_TYPE_STORE_PROTOS,
69         MODEST_COMBO_BOX_TYPE_TRANSPORT_PROTOS,
70         MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS,
71         MODEST_COMBO_BOX_TYPE_AUTH_PROTOS,
72         MODEST_COMBO_BOX_TYPE_TRANSPORTS
73 };
74 typedef enum _ModestComboBoxType ModestComboBoxType;
75
76
77 /**
78  * modest_widget_factory_get_type
79  *
80  * get the GType for ModestWidgetFactory
81  *
82  * Returns: the GType
83  */
84 GType        modest_widget_factory_get_type    (void) G_GNUC_CONST;
85
86
87 /**
88  * modest_widget_factory_new
89  * @conf: a modest conf instance
90  * @acc_store: a modest account store instance
91  * @acc_mgr: a modest account mgr instance
92  *
93  * instantiates a ModestWidgetFactory
94  *
95  * Returns: a new ModestWidgetFactory, or NULL in case of error
96  */
97 ModestWidgetFactory*      modest_widget_factory_new   (void);
98 /**
99  * modest_widget_factory_get_folder_view
100  * @self: a ModestWidgetFactory instance
101  * 
102  * return the folder tree widget (ie. the widget with the list of folders);
103  *
104  * This factory will always return the
105  * same widget, and takes care of its lifetime - users should *not* destroy it.
106  *
107  * Returns: a folder tree view, or NULL in case of error
108  */
109 ModestFolderView*    modest_widget_factory_get_folder_view (ModestWidgetFactory *self);
110
111
112 /**
113  * modest_widget_factory_get_header_view
114  * @self: a ModestWidgetFactory instance
115  * 
116  * return the header tree widget (ie. the widget with the list of headers);
117  *
118  * This factory will always return the
119  * same widget, and takes care of its lifetime - users should *not* destroy it.
120  *
121  * Returns: a header tree view, or NULL in case of error
122  */
123 ModestHeaderView*    modest_widget_factory_get_header_view (ModestWidgetFactory *self);
124
125
126 /**
127  * modest_widget_factory_get_msg_preview
128  * @self: a ModestWidgetFactory instance
129  * 
130  * return the message preview widget (ie. the widget with shows the currently selected message);
131  *
132  * This factory will always return the
133  * same widget, and takes care of its lifetime - users should *not* destroy it.
134  *
135  * Returns: a header tree view, or NULL in case of error
136  */
137 ModestMsgView*           modest_widget_factory_get_msg_preview (ModestWidgetFactory *self);
138
139
140 /**
141  * modest_widget_factory_get_account_view
142  * @self: a ModestWidgetFactory instance
143  * 
144  * return an account view widget (ie. the widget that shows a list of accounts)
145  *
146  * This factory will always return the
147  * same widget, and takes care of its lifetime - users should *not* destroy it.
148  *
149  * Returns: the account view, or NULL in case of error
150  */
151 ModestAccountView*    modest_widget_factory_get_account_view (ModestWidgetFactory *self);
152
153
154 /**
155  * modest_widget_factory_get_progress_bar
156  * @self: a ModestWidgetFactory instance
157  * 
158  * return an progress bar widget 
159  * if the widget factory was created with 'auto_connect', then this progress bar
160  * will automatically update for changes in the other widgets
161  * NOTE the naming inconsistency: GtkProgressBar vs GtkStatusbar 
162  * 
163  * This factory will always return the
164  * same widget, and takes care of its lifetime - users should *not* destroy it.
165  *
166  * Returns: the progress bar widget
167  */
168 GtkWidget*       modest_widget_factory_get_progress_bar (ModestWidgetFactory *self);
169
170
171
172 /**
173  * modest_widget_factory_get_status_bar
174  * @self: a ModestWidgetFactory instance
175  * 
176  * return an status bar widget 
177  * if the widget factory was created with 'auto_connect', then this status bar
178  * will automatically update for changes in the other widgets
179  * NOTE the naming inconsistency: GtkProgressBar vs GtkStatusbar 
180  * 
181  * This factory will always return the
182  * same widget, and takes care of its lifetime - users should *not* destroy it.
183  *
184  * Returns: the status bar widget
185  */
186 GtkWidget*     modest_widget_factory_get_status_bar (ModestWidgetFactory *self);
187
188 /**
189  * modest_widget_factory_get_store
190  * @self: a ModestWidgetFactory instance
191  * @type: the type of items we want a combo box for
192  * 
193  * return a combobox with with the given items
194  *  
195  * Returns: the combo box
196  */
197 GtkWidget*     modest_widget_factory_get_combo_box (ModestWidgetFactory *self,
198                                                     ModestComboBoxType type);
199
200
201 /**
202  * modest_widget_factory_get_online_combo
203  * @self: a ModestWidgetFactory instance
204  * 
205  * return a toggle which with one can see whether online/offline mode is active.
206  * In case of auto-connect, this will automatically be sync'd with the
207  * account_store / device
208  *  
209  * Returns: the combo box
210  */
211 GtkWidget*  modest_widget_factory_get_online_toggle (ModestWidgetFactory *self);
212
213
214
215
216 /**
217  * modest_widget_factory_get_folder_info_label
218  * @self: a ModestWidgetFactory instance
219  * 
220  * return a label with the number of items, unread items in the current folder
221  *  
222  * Returns: the label
223  */
224 GtkWidget* modest_widget_factory_get_folder_info_label (ModestWidgetFactory *self);
225
226
227 /**
228  * modest_widget_factory_get_main_toolbar
229  * @self: a ModestWidgetFactory instance
230  * @items: a list of ModestToolbarButtons (button_ids)
231  *
232  * returns the main toolbar widget; their enabled/disabled state synchronized with
233  * the other widgets. Note that after the first calling, this function will
234  * always return the same toolbar, regardless of the items
235  *  
236  * Returns: the toolbar
237  */
238 ModestToolbar *modest_widget_factory_get_main_toolbar (ModestWidgetFactory *self, 
239                                                        GSList *items);
240
241 /**
242  * modest_widget_factory_get_edit_toolbar
243  * @self: a ModestWidgetFactory instance
244  * @items: a list of ModestToolbarButtons (button_ids)
245  *
246  * returns the toolbar widget for edit windows; the enabled/disabled
247  * state synchronized with the other widgets.
248  *  
249  * Returns: the toolbar
250  */
251 ModestToolbar *modest_widget_factory_get_edit_toolbar (ModestWidgetFactory *self, 
252                                                        GSList *items);
253
254
255 G_END_DECLS
256
257 #endif /* __MODEST_WIDGET_FACTORY_H__ */
258