This is a manual merge of branch drop split view intro trunk.
[modest] / src / widgets / modest-header-view.h
index dbfb5d9..3ff7c81 100644 (file)
 #define __MODEST_HEADER_VIEW_H__
 
 #include <tny-folder.h>
+#include <tny-folder-change.h>
 #include <tny-gtk-account-list-model.h>
 #include <tny-msg.h>
 #include <tny-header.h>
 #include <tny-gtk-header-list-model.h>
+#include "modest-mail-operation.h"
+#include "modest-header-view-observer.h"
 
 G_BEGIN_DECLS
 
@@ -58,12 +61,11 @@ struct _ModestHeaderView {
 #define MODEST_HEADER_VIEW_FLAG_SORT "header-view-flags-sort"
 
 typedef enum _ModestHeaderViewColumn {
-       MODEST_HEADER_VIEW_COLUMN_FROM            = 0,
+       MODEST_HEADER_VIEW_COLUMN_FROM,
        MODEST_HEADER_VIEW_COLUMN_TO,
        MODEST_HEADER_VIEW_COLUMN_SUBJECT,
        MODEST_HEADER_VIEW_COLUMN_SENT_DATE,
        MODEST_HEADER_VIEW_COLUMN_RECEIVED_DATE,
-       MODEST_HEADER_VIEW_COLUMN_MSGTYPE,
        MODEST_HEADER_VIEW_COLUMN_ATTACH,
        MODEST_HEADER_VIEW_COLUMN_SIZE,
        MODEST_HEADER_VIEW_COLUMN_STATUS,
@@ -72,14 +74,14 @@ typedef enum _ModestHeaderViewColumn {
         * these two are for compact display on small devices,
         * with two line display with all relevant headers
         */
-       MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG,       /* priority and attachments */
-       MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_IN,  /* incoming mail */
-       MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT, /* outgoing mail */
+       MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, /* priority and attachments */
+       MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_IN, /* incoming mail */
+       MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT,/* outgoing mail */
        MODEST_HEADER_VIEW_COLUMN_COMPACT_SENT_DATE,
        MODEST_HEADER_VIEW_COLUMN_COMPACT_RECEIVED_DATE,
 
        MODEST_HEADER_VIEW_COLUMN_NUM
-
+       
 } ModestHeaderViewColumn;
 
 /*
@@ -87,9 +89,9 @@ typedef enum _ModestHeaderViewColumn {
  * to make a small-device specific display
  */
 typedef enum _ModestHeaderViewStyle {
-       MODEST_HEADER_VIEW_STYLE_DETAILS, /* many columns, single line, col headers visible */
-       MODEST_HEADER_VIEW_STYLE_TWOLINES, /* two-line headers, col headers invisible */
-
+       MODEST_HEADER_VIEW_STYLE_DETAILS   = 0, /* many columns, single line, col headers visible */
+       MODEST_HEADER_VIEW_STYLE_TWOLINES  = 1, /* two-line headers, col headers invisible */
+       
        MODEST_HEADER_VIEW_STYLE_NUM    
 } ModestHeaderViewStyle;
 
@@ -113,14 +115,17 @@ struct _ModestHeaderViewClass {
 
        void (*header_activated) (ModestHeaderView* self,
                                  TnyHeader *header,
+                                 GtkTreePath *path,
                                  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);
+       void (*msg_count_changed) (ModestHeaderView* self,
+                                  TnyFolder *folder,
+                                  TnyFolderChange *change,
+                                  gpointer user_data);
+
+       void (*updating_msg_list) (ModestHeaderView *self,
+                                  gboolean starting,
+                                  gpointer user_data);
 };
 
 /**
@@ -154,7 +159,11 @@ GtkWidget*   modest_header_view_new        (TnyFolder *folder,
  * set the folder for this ModestHeaderView
  */
 void         modest_header_view_set_folder (ModestHeaderView *self,
-                                           TnyFolder *folder);
+                                           TnyFolder *folder,
+                                           gboolean refresh,
+                                           ModestWindow *progress_window,
+                                           RefreshAsyncUserCallback callback,
+                                           gpointer user_data);
 
 /**
  * modest_header_view_get_folder:
@@ -170,7 +179,7 @@ TnyFolder *modest_header_view_get_folder (ModestHeaderView *self);
 /**
  * modest_header_view_set_columns:
  * @self: a ModestHeaderView instance
- * @columns: a list of ModestHeaderViewColumn
+ * @columns: a list of gint ModestHeaderViewColumn column IDs, using GINT_TO_POINTER() and GPOINTER_TO_INT().
  * @type: #TnyFolderType type
  * 
  * set the columns for this ModestHeaderView.
@@ -218,10 +227,31 @@ gboolean   modest_header_view_set_style (ModestHeaderView *self,
 ModestHeaderViewStyle   modest_header_view_get_style (ModestHeaderView *self);
 
 /**
+ * modest_header_view_count_selected_headers:
+ * @self: a ModestHeaderView instance
+ * 
+ * Check selected headers counter. 
+ * Returns: the number of selected headers.
+ */
+guint
+modest_header_view_count_selected_headers (ModestHeaderView *self);
+
+/**
+ * modest_header_view_has_selected_headers:
+ * @self: a ModestHeaderView instance
+ * 
+ * Check if any row is selected on headers tree view. 
+ * Returns: TRUE if any header is selected, FALSE otherwise.
+ */
+gboolean
+modest_header_view_has_selected_headers (ModestHeaderView *self);
+
+/**
  * modest_header_view_get_selected_headers:
  * @self: a ModestHeaderView instance
  * 
- * get the list of the currently selected TnyHeader's
+ * get the list of the currently selected TnyHeader's. The list and
+ * the headers should be freed by the caller
  *  
  * Returns: the list with the currently selected headers
  */
@@ -315,6 +345,80 @@ modest_header_view_sort_by_column_id (ModestHeaderView *self,
                                      guint sort_colid,
                                      GtkSortType sort_type);
 
+/**
+ * modest_header_view_clear:
+ * @self: a #ModestHeaderView
+ *
+ * Clear the contents of a header view. It internally calls the
+ * set_folder function with last three arguments as NULL
+ **/
+void
+modest_header_view_clear (ModestHeaderView *self);
+
+/**
+ * modest_header_view_copy_selection:
+ * @self: a #ModestHeaderView
+ * 
+ * Stores a #TnyList of selected headers in the own clibpoard of 
+ * @self header view.
+ **/
+void 
+modest_header_view_copy_selection (ModestHeaderView *header_view);
+
+/**
+ * modest_header_view_cut_selection:
+ * @self: a #ModestHeaderView
+ * 
+ * Stores a #TnyList of selected headers in the own clibpoard of 
+ * @self header view and filter them into headers tree model to
+ * hide these rows in treeview.
+ **/
+void 
+modest_header_view_cut_selection (ModestHeaderView *header_view);
+
+
+/**
+ * modest_header_view_paste_selection:
+ * @self: a #ModestHeaderView
+ * @headers: ouput parameter with a #TnyList of headers which will be returned.
+ * @delete: output parameter with indication about delete or not the selected headers. 
+ * 
+ * Gets the selected headers to copy/cut.
+ **/
+void
+modest_header_view_paste_selection (ModestHeaderView *header_view,
+                                   TnyList **headers,
+                                   gboolean *delete);
+
+void modest_header_view_refilter (ModestHeaderView *header_view);
+
+/**
+ * modest_header_view_add_observer:
+ * @header_view: a #ModestHeaderView
+ * @observer: The observer to notify.
+ * 
+ * Registers a new observer. Warning! Each added observer object must
+ * removed using @modest_header_view_remove_observer before destroying
+ * the observer, or at least when it is under destruction. Also you
+ * should care about that the observer's #update function might be
+ * called any time until the observer is removed.
+ **/
+void modest_header_view_add_observer(
+               ModestHeaderView *header_view,
+               ModestHeaderViewObserver *observer);
+
+/**
+ * modest_header_view_remove_observer:
+ * @header_view: a #ModestHeaderView
+ * @observer: The observer to remove.
+ * 
+ * Removes exactly one observer from the notification list. If you
+ * added an observer twice, you should call this remove funtion twice
+ * as well.
+ **/
+void modest_header_view_remove_observer(
+               ModestHeaderView *header_view,
+               ModestHeaderViewObserver *observer);
 
 G_END_DECLS