5fee5cbe0fa3ade2b1b1a7570f4d64e3e68b287c
[modest] / src / modest-tny-header-tree-view.h
1 /* modest-tny-header-tree-view.h */
2 /* insert (c)/licensing information) */
3
4 #ifndef __MODEST_TNY_HEADER_TREE_VIEW_H__
5 #define __MODEST_TNY_HEADER_TREE_VIEW_H__
6
7 #include <gtk/gtk.h>
8 #include <tny-msg-folder-iface.h>
9 #include <tny-account-tree-model.h>
10 #include <tny-msg-iface.h>
11 #include <tny-msg-header-iface.h>
12 #include <tny-msg-header-list-model.h>
13
14 G_BEGIN_DECLS
15
16 /* convenience macros */
17 #define MODEST_TYPE_TNY_HEADER_TREE_VIEW             (modest_tny_header_tree_view_get_type())
18 #define MODEST_TNY_HEADER_TREE_VIEW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_TNY_HEADER_TREE_VIEW,ModestTnyHeaderTreeView))
19 #define MODEST_TNY_HEADER_TREE_VIEW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_TNY_HEADER_TREE_VIEW,ModestTnyHeaderTreeViewClass))
20 #define MODEST_IS_TNY_HEADER_TREE_VIEW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_TNY_HEADER_TREE_VIEW))
21 #define MODEST_IS_TNY_HEADER_TREE_VIEW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_TNY_HEADER_TREE_VIEW))
22 #define MODEST_TNY_HEADER_TREE_VIEW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_TNY_HEADER_TREE_VIEW,ModestTnyHeaderTreeViewClass))
23
24 typedef struct _ModestTnyHeaderTreeView      ModestTnyHeaderTreeView;
25 typedef struct _ModestTnyHeaderTreeViewClass ModestTnyHeaderTreeViewClass;
26
27 struct _ModestTnyHeaderTreeView {
28          GtkTreeView parent;
29         /* insert public members, if any */
30 };
31
32 struct _ModestTnyHeaderTreeViewClass {
33         GtkTreeViewClass parent_class;
34
35         void (*message_selected) (ModestTnyHeaderTreeView* self,
36                                   TnyMsgIface *msg,
37                                   gpointer user_data);
38
39         /* msg == NULL implies that the operation is finished, ie.
40          * the progress indictation can be hidden */
41         void (*status_update) (ModestTnyHeaderTreeView* self,
42                                const gchar* msg,
43                                gint status,
44                                gpointer user_data);
45 };
46
47
48 enum {
49         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_FROM,
50         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_TO,
51         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_SUBJECT,
52         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_SENT_DATE,
53         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_RECEIVED_DATE,
54         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_MSGTYPE,
55         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_ATTACH,
56         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_COMPACT_HEADER,
57
58         MODEST_TNY_HEADER_TREE_VIEW_COLUMN_NUM
59 };
60 typedef guint ModestTnyHeaderTreeViewColumn;
61
62 enum {
63         MODEST_TNY_HEADER_TREE_VIEW_STYLE_NORMAL,
64         MODEST_TNY_HEADER_TREE_VIEW_STYLE_COMPACT,
65         
66         MODEST_TNY_HEADER_TREE_VIEW_STYLE_NUM
67 };
68 typedef guint ModestTnyHeaderTreeViewStyle;
69
70
71
72 /**
73  * modest_tny_header_tree_view_get_type:
74  * 
75  * get the GType for ModestTnyHeaderTreeView
76  *  
77  * Returns: the GType
78  */
79 GType        modest_tny_header_tree_view_get_type    (void) G_GNUC_CONST;
80
81
82 /**
83  * modest_tny_header_tree_view_new:
84  * @folder: a TnyMsgFolderIface object
85  * @columns: a list of ModestTnyHeaderTreeViewColumn
86  * @style: a ModestTnyHeaderTreeViewColumn with the style of this listview
87  *  (   MODEST_TNY_HEADER_TREE_VIEW_STYLE_NORMAL or MODEST_TNY_HEADER_TREE_VIEW_STYLE_COMPACT)
88  * 
89  * create a new ModestTnyHeaderTreeView instance, based on a folder iface
90  *   
91  * Returns: a new GtkWidget (a GtkTreeView-subclass)
92  */
93 GtkWidget*   modest_tny_header_tree_view_new        (TnyMsgFolderIface *folder,
94                                                      GSList *columns,
95                                                      ModestTnyHeaderTreeViewStyle style);
96
97 /**
98  * modest_tny_header_tree_view_set_folder:
99  * @self: a ModestTnyHeaderTreeView instance
100  * @folder: a TnyMsgFolderIface object
101  * 
102  * set the folder for this ModestTnyHeaderTreeView
103  *  
104  * Returns: TRUE if it succeeded, FALSE otherwise
105  */
106 gboolean     modest_tny_header_tree_view_set_folder (ModestTnyHeaderTreeView *self,
107                                                       TnyMsgFolderIface *folder);
108
109
110 /**
111  * modest_tny_header_tree_view_set_columns:
112  * @self: a ModestTnyHeaderTreeView instance
113  * @columns: a list of ModestTnyHeaderTreeViewColumn
114  * 
115  * set the columns for this ModestTnyHeaderTreeView
116  *  
117  * Returns: TRUE if it succeeded, FALSE otherwise
118  */
119 gboolean     modest_tny_header_tree_view_set_columns (ModestTnyHeaderTreeView *self,
120                                                       GSList *columns);
121 /**
122  * modest_tny_header_tree_view_get_columns:
123  * @self: a ModestTnyHeaderTreeView instance
124  * @folder: a TnyMsgFolderIface object
125  * 
126  * get the columns for this ModestTnyHeaderTreeView
127  *  
128  * Returns: list of columms, or NULL in case of no columns or error
129  */
130 const GSList*   modest_tny_header_tree_view_get_columns (ModestTnyHeaderTreeView *self);
131         
132
133 /**
134  * modest_tny_header_tree_view_set_style:
135  * @self: a ModestTnyHeaderTreeView instance
136  * @style: the style for this tree view
137  * 
138  * set the folder for this ModestTnyHeaderTreeView
139  *  
140  * Returns: TRUE if it succeeded, FALSE otherwise
141  */
142 gboolean   modest_tny_header_tree_view_set_style (ModestTnyHeaderTreeView *self,
143                                                   ModestTnyHeaderTreeViewStyle style);
144
145 /**
146  * modest_tny_header_tree_view_set_folder:
147  * @self: a ModestTnyHeaderTreeView instance
148  * @folder: a TnyMsgFolderIface object
149  * 
150  * set the folder for this ModestTnyHeaderTreeView
151  *  
152  * Returns: TRUE if it succeeded, FALSE otherwise
153  */
154 ModestTnyHeaderTreeViewStyle   modest_tny_header_tree_view_get_style (ModestTnyHeaderTreeView *self);
155
156 G_END_DECLS
157
158
159
160
161
162 #endif /* __MODEST_TNY_HEADER_TREE_VIEW_H__ */
163