a8a72b3d2ef0eeedea418cdf9af57a6f0e967e1b
[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 <glib-object.h>
34 #include "modest-account-mgr.h"
35 #include "modest-tny-account-store.h"
36
37 #include "widgets/modest-header-view.h"
38 #include "widgets/modest-folder-view.h"
39 #include "widgets/modest-msg-view.h"
40 #include "widgets/modest-account-view.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  * modest_widget_factory_get_type
68  *
69  * get the GType for ModestWidgetFactory
70  *
71  * Returns: the GType
72  */
73 GType        modest_widget_factory_get_type    (void) G_GNUC_CONST;
74
75
76 /**
77  * modest_widget_factory_new
78  * @conf: a modest conf instance
79  * @acc_store: a modest account store instance
80  * @acc_mgr: a modest account mgr instance
81  * @autoconnect: should we autoconnect the widgets (ie. depedent widgets are update
82  * automagically)
83  *
84  * instantiates a ModestWidgetFactory
85  *
86  * Returns: a new ModestWidgetFactory, or NULL in case of error
87  */
88 ModestWidgetFactory*      modest_widget_factory_new   (ModestConf *conf,
89                                                        ModestTnyAccountStore *acc_store,
90                                                        ModestAccountMgr *account_mgr,
91                                                        gboolean auto_connect);
92 /**
93  * modest_widget_factory_get_folder_view
94  * @self: a ModestWidgetFactory instance
95  * 
96  * return the folder tree widget (ie. the widget with the list of folders);
97  *
98  * This factory will always return the
99  * same widget, and takes care of its lifetime - users should *not* destroy it.
100  *
101  * Returns: a folder tree view, or NULL in case of error
102  */
103 ModestFolderView*    modest_widget_factory_get_folder_view (ModestWidgetFactory *self);
104
105
106 /**
107  * modest_widget_factory_get_header_view
108  * @self: a ModestWidgetFactory instance
109  * 
110  * return the header tree widget (ie. the widget with the list of headers);
111  *
112  * This factory will always return the
113  * same widget, and takes care of its lifetime - users should *not* destroy it.
114  *
115  * Returns: a header tree view, or NULL in case of error
116  */
117 ModestHeaderView*    modest_widget_factory_get_header_view (ModestWidgetFactory *self);
118
119
120 /**
121  * modest_widget_factory_get_msg_preview
122  * @self: a ModestWidgetFactory instance
123  * 
124  * return the message preview widget (ie. the widget with shows the currently selected message);
125  *
126  * This factory will always return the
127  * same widget, and takes care of its lifetime - users should *not* destroy it.
128  *
129  * Returns: a header tree view, or NULL in case of error
130  */
131 ModestMsgView*           modest_widget_factory_get_msg_preview (ModestWidgetFactory *self);
132
133
134 /**
135  * modest_widget_factory_get_account_view
136  * @self: a ModestWidgetFactory instance
137  * 
138  * return an account view widget (ie. the widget that shows a list of accounts)
139  *
140  * This factory will always return the
141  * same widget, and takes care of its lifetime - users should *not* destroy it.
142  *
143  * Returns: the account view, or NULL in case of error
144  */
145 ModestAccountView*    modest_widget_factory_get_account_view (ModestWidgetFactory *self);
146
147
148 G_END_DECLS
149
150 #endif /* __MODEST_WIDGET_FACTORY_H__ */
151