columns which can be used to sort headers list.
* Review restore_settings_header to set TreeSortable
sort column id.
pmo-trunk-r1673
/* TODO */
}
+void
+modest_main_window_set_toolbar_mode (ModestMainWindow *self,
+ ModestToolBarModes mode)
+{
+ /* TODO */
+}
+
ModestMainWindowStyle
modest_main_window_get_style (ModestMainWindow *self)
{
typedef struct {
ModestHeaderViewColumn col;
guint width;
+ gint sort;
} FolderCols;
static const FolderCols INBOX_COLUMNS_DETAILS[] = {
- {MODEST_HEADER_VIEW_COLUMN_MSGTYPE, 40},
- {MODEST_HEADER_VIEW_COLUMN_ATTACH, 40},
- {MODEST_HEADER_VIEW_COLUMN_FROM, 80},
- {MODEST_HEADER_VIEW_COLUMN_SUBJECT, 80},
- {MODEST_HEADER_VIEW_COLUMN_RECEIVED_DATE, 60},
- {MODEST_HEADER_VIEW_COLUMN_SIZE, 50}
+ {MODEST_HEADER_VIEW_COLUMN_MSGTYPE, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_ATTACH, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_FROM, 80, 0},
+ {MODEST_HEADER_VIEW_COLUMN_SUBJECT, 80, 0},
+ {MODEST_HEADER_VIEW_COLUMN_RECEIVED_DATE, 60, 0},
+ {MODEST_HEADER_VIEW_COLUMN_SIZE, 50, 0}
};
static const FolderCols INBOX_COLUMNS_TWOLINES[] = {
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, 40},
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_IN, 180},
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_RECEIVED_DATE, 240}
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_IN, 180, 0},
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_RECEIVED_DATE, 240, 1}
};
static const FolderCols OUTBOX_COLUMNS_DETAILS[] = {
- {MODEST_HEADER_VIEW_COLUMN_MSGTYPE, 40},
- {MODEST_HEADER_VIEW_COLUMN_ATTACH, 40},
- {MODEST_HEADER_VIEW_COLUMN_TO, 80},
- {MODEST_HEADER_VIEW_COLUMN_SUBJECT, 80},
- {MODEST_HEADER_VIEW_COLUMN_SENT_DATE, 80},
- {MODEST_HEADER_VIEW_COLUMN_SIZE, 50}
+ {MODEST_HEADER_VIEW_COLUMN_MSGTYPE, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_ATTACH, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_TO, 80, 0},
+ {MODEST_HEADER_VIEW_COLUMN_SUBJECT, 80, 0},
+ {MODEST_HEADER_VIEW_COLUMN_SENT_DATE, 80, 0},
+ {MODEST_HEADER_VIEW_COLUMN_SIZE, 50, 0}
};
static const FolderCols OUTBOX_COLUMNS_TWOLINES[] = {
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, 40},
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT,180},
- {MODEST_HEADER_VIEW_COLUMN_STATUS, 240}
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT,180, 0},
+ {MODEST_HEADER_VIEW_COLUMN_STATUS, 240, 0}
};
static const FolderCols SENT_COLUMNS_TWOLINES[] = {
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, 40},
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT,180},
- {MODEST_HEADER_VIEW_COLUMN_COMPACT_SENT_DATE, 240}
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_FLAG, 40, 0},
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT,180, 0},
+ {MODEST_HEADER_VIEW_COLUMN_COMPACT_SENT_DATE, 240, 1}
};
#ifdef MODEST_PLATFORM_MAEMO
/* the format is necessarily the same as the one in modest-widget-memory */
str = g_string_new (NULL);
for (i = 0; i != col_num; ++i)
- g_string_append_printf (str, "%d:%d ",
- cols[i].col, cols[i].width);
+ g_string_append_printf (str, "%d:%d:%d ",
+ cols[i].col, cols[i].width, cols[i].sort);
modest_conf_set_string (conf, key, str->str, NULL);
g_free (key);
modest_text_utils_strftime (date_buf, BUF_SIZE, "%d/%m/%Y", date);
modest_text_utils_strftime (now_buf, BUF_SIZE, "%d/%m/%Y", now); /* today */
+/* modest_text_utils_strftime (date_buf, BUF_SIZE, "%x", date); */
+/* modest_text_utils_strftime (now_buf, BUF_SIZE, "%x", now); /\* today *\/ */
/* if this is today, get the time instead of the date */
if (strcmp (date_buf, now_buf) == 0)
modest_ui_actions_on_sort (GtkAction *action,
ModestWindow *window)
{
+ ModestWindowMgr *mgr;
+
g_return_if_fail (MODEST_IS_WINDOW(window));
- /* FIXME: unimplemented */
+
+ /* Show sorting dialog */
+ mgr = modest_runtime_get_window_mgr ();
+
}
TnyFolder *folder;
TnyFolderType type;
ModestHeaderViewStyle style;
+ gint sort_colid;
folder = modest_header_view_get_folder (header_view);
if (!folder || modest_header_view_is_empty (header_view))
/* NOTE: the exact details of this format are important, as they
* are also used in modest-init.
*/
+ sort_colid = modest_header_view_get_sort_column_id (header_view, type);
while (cursor) {
- int col_id, width;
+ int col_id, width, sort;
GtkTreeViewColumn *col;
col = GTK_TREE_VIEW_COLUMN (cursor->data);
col_id = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(col),
MODEST_HEADER_VIEW_COLUMN));
width = gtk_tree_view_column_get_width (col);
-
- g_string_append_printf (str, "%d:%d ", col_id, width);
+ sort = 0;
+ if (sort_colid == gtk_tree_view_column_get_sort_column_id(col))
+ sort = 1;
+
+ g_string_append_printf (str, "%d:%d:%d ", col_id, width, sort);
cursor = g_list_next (cursor);
}
restore_settings_header_view (ModestConf *conf, ModestHeaderView *header_view,
const gchar *name)
{
+ guint col, width;
+ gint sort;
gchar *key;
TnyFolder *folder;
TnyFolderType type;
if (modest_conf_key_exists (conf, key, NULL)) {
gchar *data, *cursor;
- guint col, width;
GList *cols = NULL;
GList *colwidths = NULL;
-
+ GList *colsortables = NULL;
+ GtkTreeModel *sortable;
+
cursor = data = modest_conf_get_string (conf, key, NULL);
- while (cursor && sscanf (cursor, "%u:%u ", &col, &width) == 2) {
+ while (cursor && sscanf (cursor, "%u:%u:%u ", &col, &width, &sort) == 3) {
cols = g_list_append (cols, GINT_TO_POINTER(col));
colwidths = g_list_append (colwidths, GINT_TO_POINTER(width));
+ colsortables = g_list_append (colsortables, GINT_TO_POINTER(sort));
cursor = strchr (cursor + 1, ' ');
}
g_free (data);
if (cols) {
- GList *viewcolumns, *colcursor, *widthcursor;
- modest_header_view_set_columns (header_view, cols);
+ GList *viewcolumns, *colcursor, *widthcursor, *sortablecursor, *colidcursor;
+ gint sort_colid = -1;
+ modest_header_view_set_columns (header_view, cols, type);
+ sortable = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view));
+ colidcursor = cols;
widthcursor = colwidths;
+ sortablecursor = colsortables;
colcursor = viewcolumns = gtk_tree_view_get_columns (GTK_TREE_VIEW(header_view));
- while (colcursor && widthcursor) {
+ while (colcursor && widthcursor && sortablecursor && colidcursor) {
int width = GPOINTER_TO_INT(widthcursor->data);
+ int sort = GPOINTER_TO_INT(sortablecursor->data);
+ int colid = GPOINTER_TO_INT(colidcursor->data);
if (width > 0)
gtk_tree_view_column_set_max_width(GTK_TREE_VIEW_COLUMN(colcursor->data),
width);
+ if (sort > 0) {
+ sort_colid = gtk_tree_view_column_get_sort_column_id (GTK_TREE_VIEW_COLUMN(colcursor->data));
+ modest_header_view_set_sort_column_id (header_view, sort_colid, type);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
+ colid,
+ GTK_SORT_DESCENDING);
+ gtk_tree_sortable_sort_column_changed (GTK_TREE_SORTABLE(sortable));
+ }
+ colidcursor = g_list_next (colidcursor);
colcursor = g_list_next (colcursor);
widthcursor = g_list_next (widthcursor);
+ sortablecursor = g_list_next (sortablecursor);
}
+
g_list_free (cols);
g_list_free (colwidths);
+ g_list_free (colsortables);
g_list_free (viewcolumns);
}
}
static GdkPixbuf *low_attachments_pixbuf = NULL;
static GdkPixbuf *high_pixbuf = NULL;
static GdkPixbuf *low_pixbuf = NULL;
- TnyHeaderFlags prior;
+ TnyHeaderPriorityFlags prior;
- prior = flags & TNY_HEADER_FLAG_HIGH_PRIORITY;
+ prior = flags & TNY_HEADER_FLAG_PRIORITY;
switch (prior) {
case TNY_HEADER_FLAG_HIGH_PRIORITY:
if (flags & TNY_HEADER_FLAG_ATTACHMENTS) {
TnyFolderMonitor *monitor;
GMutex *monitor_lock;
+ gint sort_colid[2][TNY_FOLDER_TYPE_NUM];
};
#define MODEST_HEADER_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
}
gboolean
-modest_header_view_set_columns (ModestHeaderView *self, const GList *columns)
+modest_header_view_set_columns (ModestHeaderView *self, const GList *columns, TnyFolderType type)
{
GtkTreeModel *sortable;
GtkTreeViewColumn *column=NULL;
(GtkTreeCellDataFunc)_modest_header_view_compact_date_cell_data,
GINT_TO_POINTER(TRUE));
gtk_tree_view_column_set_fixed_width (column, 130);
- /* FIXME: this value must be stored in configuration */
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
- TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN,
- GTK_SORT_DESCENDING);
-
break;
case MODEST_HEADER_VIEW_COLUMN_COMPACT_SENT_DATE:
(GtkTreeCellDataFunc)_modest_header_view_compact_date_cell_data,
GINT_TO_POINTER(FALSE));
gtk_tree_view_column_set_fixed_width (column, 130);
- /* FIXME: this value must be stored in configuration */
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
- TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN,
- GTK_SORT_DESCENDING);
break;
case MODEST_HEADER_VIEW_COLUMN_SIZE:
column = get_new_column (_("Size"), renderer_header, TRUE,
g_return_val_if_reached(FALSE);
}
- if (sortable)
+ if (sortable)
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(sortable),
col, (GtkTreeIterCompareFunc)cmp_rows,
column, NULL);
self);
gtk_tree_view_append_column (GTK_TREE_VIEW(self), column);
}
-
+
+
return TRUE;
}
modest_header_view_init (ModestHeaderView *obj)
{
ModestHeaderViewPrivate *priv;
+ guint i, j;
priv = MODEST_HEADER_VIEW_GET_PRIVATE(obj);
priv->monitor = NULL;
priv->monitor_lock = g_mutex_new ();
-
+ for (j=0; j < 2; j++)
+ for (i=0; i < TNY_FOLDER_TYPE_NUM; i++)
+ priv->sort_colid[j][i] = -1;
setup_drag_and_drop (GTK_TREE_VIEW (obj));
}
}
void
+modest_header_view_set_sort_column_id (ModestHeaderView *self, guint sort_colid, TnyFolderType type)
+{
+ ModestHeaderViewPrivate *priv;
+ ModestHeaderViewStyle style;
+
+ style = modest_header_view_get_style (self);
+ priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
+
+ priv->sort_colid[style][type] = sort_colid;
+}
+
+gint
+modest_header_view_get_sort_column_id (ModestHeaderView *self, TnyFolderType type)
+{
+ ModestHeaderViewPrivate *priv;
+ ModestHeaderViewStyle style;
+
+ style = modest_header_view_get_style (self);
+ priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
+
+ return priv->sort_colid[style][type];
+}
+
+void
modest_header_view_set_folder (ModestHeaderView *self, TnyFolder *folder)
{
ModestHeaderViewPrivate *priv;
gint t1, t2;
gint val1, val2;
gchar *s1, *s2;
- gint cmp;
-
+ gint cmp;
static int counter = 0;
+
+ g_return_val_if_fail (G_IS_OBJECT(user_data), 0);
col_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(user_data), MODEST_HEADER_VIEW_COLUMN));
if (!(++counter % 100)) {
* modest_header_view_set_columns:
* @self: a ModestHeaderView instance
* @columns: a list of ModestHeaderViewColumn
+ * @type: #TnyFolderType type
*
* set the columns for this ModestHeaderView.
*
* Returns: TRUE if it succeeded, FALSE otherwise
*/
gboolean modest_header_view_set_columns (ModestHeaderView *self,
- const GList *columns);
+ const GList *columns,
+ TnyFolderType type);
/**
* modest_header_view_get_columns:
* @self: a ModestHeaderView instance
_modest_header_view_change_selection (GtkTreeSelection *selection,
gpointer user_data);
+/**
+ * modest_header_view_get_sort_column_id:
+ * @self: a #ModestHeaderView
+ * @type: #TnyFolderType type
+ *
+ * Gets the selected logical columnd id for sorting.
+ **/
+gint
+modest_header_view_get_sort_column_id (ModestHeaderView *self, TnyFolderType type);
+
+/**
+ * modest_header_view_get_sort_column_id:
+ * @self: a #ModestHeaderView
+ * @sort_colid: logical column id to sort
+ * @type: #TnyFolderType type
+ *
+ * Sets the logical columnd id for sorting.
+ **/
+void
+modest_header_view_set_sort_column_id (ModestHeaderView *self, guint sort_colid, TnyFolderType type);
+
+
+
G_END_DECLS
+
#endif /* __MODEST_HEADER_VIEW_H__ */
g_return_if_fail (MODEST_IS_MAIL_HEADER_VIEW (headers_view));
priv = MODEST_MAIL_HEADER_VIEW_GET_PRIVATE (headers_view);
- priv->priority_flags = flags & (TNY_HEADER_FLAG_HIGH_PRIORITY);
+ priv->priority_flags = flags & (TNY_HEADER_FLAG_PRIORITY);
if (priv->priority_flags == 0) {
if (priv->priority_icon != NULL) {
MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS,
} ModestMainWindowContentsStyle;
+/* toolbar modes */
+typedef enum _ModestToolBarModes {
+ TOOLBAR_MODE_NORMAL,
+ TOOLBAR_MODE_TRANSFER,
+} ModestToolBarModes;
+
/**
* modest_main_window_get_type:
*
void modest_main_window_set_contents_style (ModestMainWindow *self,
ModestMainWindowContentsStyle style);
+/**
+ * modest_main_window_set_contents_style:
+ * @self: the #ModestMainWindow
+ * @mode: a #ModestTollbarMode that will be set
+ *
+ * Shows toolitems associated with toolbar mode (Normal/Transfer),
+ * defined by @mode argument.
+ *
+ **/
+void
+modest_main_window_set_toolbar_mode (ModestMainWindow *self,
+ ModestToolBarModes mode);
G_END_DECLS