#define __MODEST_HEADER_VIEW_H__
#include <gtk/gtk.h>
-#include <tny-msg-folder-iface.h>
-#include <tny-account-tree-model.h>
-#include <tny-msg-iface.h>
-#include <tny-msg-header-iface.h>
-#include <tny-msg-header-list-model.h>
+#include <tny-folder.h>
+#include <tny-gtk-account-list-model.h>
+#include <tny-msg.h>
+#include <tny-header.h>
+#include <tny-gtk-header-list-model.h>
G_BEGIN_DECLS
/* insert public members, if any */
};
-struct _ModestHeaderViewClass {
- GtkTreeViewClass parent_class;
-
- void (*message_selected) (ModestHeaderView* self,
- TnyMsgIface *msg,
- gpointer user_data);
-
- /* msg == NULL implies that the operation is finished, ie.
- * the progress indictation can be hidden */
- void (*status_update) (ModestHeaderView* self,
- const gchar* msg,
- gint status,
- gpointer user_data);
-};
-
+#define MODEST_HEADER_VIEW_COLUMN "header-view-column"
-enum _ModestHeaderViewColumn {
- MODEST_HEADER_VIEW_COLUMN_FROM,
+typedef enum _ModestHeaderViewColumn {
+ MODEST_HEADER_VIEW_COLUMN_FROM = 0,
MODEST_HEADER_VIEW_COLUMN_TO,
MODEST_HEADER_VIEW_COLUMN_SUBJECT,
MODEST_HEADER_VIEW_COLUMN_SENT_DATE,
MODEST_HEADER_VIEW_COLUMN_MSGTYPE,
MODEST_HEADER_VIEW_COLUMN_ATTACH,
MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER,
-
MODEST_HEADER_VIEW_COLUMN_NUM
-};
-typedef enum _ModestHeaderViewColumn ModestHeaderViewColumn;
-
+} ModestHeaderViewColumn;
-enum _ModestHeaderViewStyle {
+typedef enum _ModestHeaderViewStyle {
MODEST_HEADER_VIEW_STYLE_NORMAL,
MODEST_HEADER_VIEW_STYLE_COMPACT,
-
MODEST_HEADER_VIEW_STYLE_NUM
-};
-typedef enum _ModestHeaderViewStyle ModestHeaderViewStyle;
+} ModestHeaderViewStyle;
+
+typedef enum _ModestItemType {
+ MODEST_ITEM_TYPE_MESSAGE,
+ MODEST_ITEM_TYPE_FOLDER,
+ MODEST_ITEM_TYPE_NUM
+} ModestItemType;
+
+struct _ModestHeaderViewClass {
+ GtkTreeViewClass parent_class;
+
+ void (*message_selected) (ModestHeaderView* self,
+ TnyMsg *msg,
+ gpointer user_data);
+ void (*item_not_found) (ModestHeaderView* self,
+ ModestItemType type,
+ gpointer user_data);
+
+ /* msg == NULL implies that the operation is finished, ie.
+ * the progress indictation can be hidden */
+ void (*status_update) (ModestHeaderView* self,
+ const gchar* msg,
+ gint num, gint total,
+ gpointer user_data);
+};
/**
* modest_header_view_get_type:
/**
* modest_header_view_new:
- * @folder: a TnyMsgFolderIface object
+ * @folder: a TnyMsgFolder object
* @columns: a list of ModestHeaderViewColumn
* @style: a ModestHeaderViewColumn with the style of this listview
* ( MODEST_HEADER_VIEW_STYLE_NORMAL or MODEST_HEADER_VIEW_STYLE_COMPACT)
*
* Returns: a new GtkWidget (a GtkTreeView-subclass)
*/
-GtkWidget* modest_header_view_new (TnyMsgFolderIface *folder,
- GSList *columns,
- ModestHeaderViewStyle style);
+GtkWidget* modest_header_view_new (TnyFolder *folder,
+ const GList *columns,
+ ModestHeaderViewStyle style);
/**
* modest_header_view_set_folder:
* @self: a ModestHeaderView instance
- * @folder: a TnyMsgFolderIface object
+ * @folder: a TnyFolder object
*
* set the folder for this ModestHeaderView
*
* Returns: TRUE if it succeeded, FALSE otherwise
*/
gboolean modest_header_view_set_folder (ModestHeaderView *self,
- TnyMsgFolderIface *folder);
+ TnyFolder *folder);
+
+
+
+
+/**
+ * modest_header_view_get_folder:
+ * @self: a ModestHeaderView instance
+ *
+ * get the folder in this ModestHeaderView
+ *
+ * Returns: the tny folder instance or NULL if there is none
+ */
+TnyFolder *modest_header_view_get_folder (ModestHeaderView *self);
/**
* @self: a ModestHeaderView instance
* @columns: a list of ModestHeaderViewColumn
*
- * set the columns for this ModestHeaderView
+ * set the columns for this ModestHeaderView.
*
* Returns: TRUE if it succeeded, FALSE otherwise
*/
-gboolean modest_header_view_set_columns (ModestHeaderView *self,
- GSList *columns);
+gboolean modest_header_view_set_columns (ModestHeaderView *self,
+ const GList *columns);
/**
* modest_header_view_get_columns:
* @self: a ModestHeaderView instance
- * @folder: a TnyMsgFolderIface object
*
- * get the columns for this ModestHeaderView
+ * get the GtkTreeColumns for this ModestHeaderView. Each one of the
+ * tree columns will have property than can be retrieved
+ * with g_object_get_data MODEST_HEADER_VIEW_COLUMN (#define),
+ * and which contains the corresponding ModestHeaderViewColumn
*
- * Returns: list of columms, or NULL in case of no columns or error
+ * Returns: newly allocated list of column ids, or NULL in case of no columns or error
+ * You must free the list with g_list_free
*/
-const GSList* modest_header_view_get_columns (ModestHeaderView *self);
+GList* modest_header_view_get_columns (ModestHeaderView *self);
/**
* @self: a ModestHeaderView instance
* @style: the style for this tree view
*
- * set the folder for this ModestHeaderView
+ * set the style this ModestHeaderView
*
* Returns: TRUE if it succeeded, FALSE otherwise
*/
gboolean modest_header_view_set_style (ModestHeaderView *self,
- ModestHeaderViewStyle style);
+ ModestHeaderViewStyle style);
/**
* modest_header_view_set_folder:
* @self: a ModestHeaderView instance
- * @folder: a TnyMsgFolderIface object
*
- * set the folder for this ModestHeaderView
+ * get the style for this ModestHeaderView
*
- * Returns: TRUE if it succeeded, FALSE otherwise
+ * Returns: the current style
*/
ModestHeaderViewStyle modest_header_view_get_style (ModestHeaderView *self);
+/**
+ * modest_header_view_get_selected_headers:
+ * @self: a ModestHeaderView instance
+ *
+ * get the list of the currently selected TnyHeader's
+ *
+ * Returns: the list with the currently selected headers
+ */
+TnyList* modest_header_view_get_selected_headers (ModestHeaderView *self);
+
G_END_DECLS