482140927fccdbe45d69e31863792b4ebecd4ea8
[modest] / src / modest-tny-folder-tree-view.h
1 /* modest-tny-folder-tree-view.h */
2 /* insert (c)/licensing information) */
3
4 #ifndef __MODEST_TNY_FOLDER_TREE_VIEW_H__
5 #define __MODEST_TNY_FOLDER_TREE_VIEW_H__
6
7 #include <tny-account-tree-model.h>
8 #include <tny-account-store-iface.h>
9 #include <glib-object.h>
10
11 G_BEGIN_DECLS
12
13 /* convenience macros */
14 #define MODEST_TYPE_TNY_FOLDER_TREE_VIEW             (modest_tny_folder_tree_view_get_type())
15 #define MODEST_TNY_FOLDER_TREE_VIEW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_TNY_FOLDER_TREE_VIEW,ModestTnyFolderTreeView))
16 #define MODEST_TNY_FOLDER_TREE_VIEW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_TNY_FOLDER_TREE_VIEW,ModestTnyFolderTreeViewClass))
17 #define MODEST_IS_TNY_FOLDER_TREE_VIEW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_TNY_FOLDER_TREE_VIEW))
18 #define MODEST_IS_TNY_FOLDER_TREE_VIEW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_TNY_FOLDER_TREE_VIEW))
19 #define MODEST_TNY_FOLDER_TREE_VIEW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_TNY_FOLDER_TREE_VIEW,ModestTnyFolderTreeViewClass))
20
21 typedef struct _ModestTnyFolderTreeView      ModestTnyFolderTreeView;
22 typedef struct _ModestTnyFolderTreeViewClass ModestTnyFolderTreeViewClass;
23
24 struct _ModestTnyFolderTreeView {
25          GtkTreeView parent;
26         /* insert public members, if any */
27 };
28
29 struct _ModestTnyFolderTreeViewClass {
30         GtkTreeViewClass parent_class;
31
32         /* emitted when a folder is clicked */
33         void (*folder_selected) (ModestTnyFolderTreeView* self,
34                                  TnyMsgFolderIface *folder,
35                                  gpointer user_data);
36                                  
37         gboolean (*update_model) (ModestTnyFolderTreeView *self, 
38                                   TnyAccountStoreIface *iface);
39
40 };
41
42
43 /**
44  * modest_tny_folder_tree_view_get_type:
45  * 
46  * get the GType for ModestTnyFolderTreeView
47  *  
48  * Returns: the GType
49  */
50 GType        modest_tny_folder_tree_view_get_type    (void) G_GNUC_CONST;
51
52
53 /**
54  * modest_tny_folder_tree_view_new:
55  * @iface: a TnyAccountStoreIface object
56  * 
57  * create a new ModestTnyFolderTreeView instance, based on an account store
58  *  
59  * Returns: a new GtkWidget (a GtkTreeView-subclass)
60  */
61
62 GtkWidget*   modest_tny_folder_tree_view_new         (TnyAccountStoreIface *iface);
63
64
65 /**
66  * modest_tny_folder_tree_view_is_empty:
67  * @self: a ModestTnyFolderTreeView instance
68  * 
69  * check to see of the view is empty. Note that when it is empty,
70  * there will still be one item, telling "(empty)" or similar
71  *  
72  * Returns: TRUE if the tree view is empty, FALSE otherwise
73  */
74 gboolean     modest_tny_folder_tree_view_is_empty    (ModestTnyFolderTreeView *self);
75
76
77 /**
78  * modest_tny_folder_tree_view_update_model:
79  * @self: a #ModestTnyFolderTreeView instance
80  * @iface: a #TnyAccountStoreIface instance
81  * 
82  * Update the thee model from a given account store.
83  *  
84  * Returns: TRUE on success, FALSE otherwise
85  */
86 gboolean     modest_tny_folder_tree_view_update_model(ModestTnyFolderTreeView *self, 
87                                          TnyAccountStoreIface *iface);
88
89
90 G_END_DECLS
91
92 #endif /* __MODEST_TNY_FOLDER_TREE_VIEW_H__ */
93