MODEST_HEADER_VIEW_COLUMN));
width = gtk_tree_view_column_get_width (col);
sort = 0;
- if (sort_colid == gtk_tree_view_column_get_sort_column_id(col))
+/* if (sort_colid == gtk_tree_view_column_get_sort_column_id(col)) */
+ if (sort_colid == col_id)
sort = 1;
g_string_append_printf (str, "%d:%d:%d ", col_id, width, sort);
g_free (data);
if (cols) {
- GList *viewcolumns, *colcursor, *widthcursor, *sortablecursor, *colidcursor;
- gint sort_colid = -1;
+ GList *viewcolumns, *colcursor, *widthcursor, *sortablecursor;
+/* 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 && sortablecursor && colidcursor) {
+ while (colcursor && widthcursor && sortablecursor) {
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);
+ int colid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(colcursor->data), MODEST_HEADER_VIEW_COLUMN));
+ modest_header_view_set_sort_column_id (header_view, colid, type);
+/* 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), */
+/* sort_colid, */
+/* GTK_SORT_DESCENDING); */
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);
#include <modest-header-view.h>
#include <modest-header-view-priv.h>
#include <modest-dnd.h>
+#include <modest-tny-folder.h>
#include <modest-marshal.h>
#include <modest-text-utils.h>
g_return_val_if_reached(FALSE);
}
- if (sortable)
+ if (sortable) {
+/* guint sort_colid = gtk_tree_view_column_get_sort_column_id (column); */
+/* gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(sortable), */
+/* sort_colid, (GtkTreeIterCompareFunc)cmp_rows, */
+/* column, NULL); */
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(sortable),
col, (GtkTreeIterCompareFunc)cmp_rows,
column, NULL);
-
+ }
/* we keep the column id around */
g_object_set_data (G_OBJECT(column), MODEST_HEADER_VIEW_COLUMN,
GINT_TO_POINTER(col));
on_progress_changed (ModestMailOperation *mail_op,
ModestHeaderView *self)
{
+ TnyFolderType type;
GtkTreeModel *sortable;
ModestHeaderViewPrivate *priv;
GList *cols, *cursor;
TnyList *headers;
+ guint sort_colid;
if (!modest_mail_operation_is_finished (mail_op))
return;
sortable = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL(headers));
g_object_unref (G_OBJECT (headers));
-
+
/* install our special sorting functions */
cursor = cols = gtk_tree_view_get_columns (GTK_TREE_VIEW(self));
while (cursor) {
}
g_list_free (cols);
+ /* Restore sort column id */
+ type = modest_tny_folder_guess_folder_type (priv->folder);
+ sort_colid = modest_header_view_get_sort_column_id (self, type);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
+ sort_colid,
+ GTK_SORT_DESCENDING);
+
/* Set new model */
modest_header_view_set_model (GTK_TREE_VIEW (self), sortable);
g_object_unref (G_OBJECT (sortable));
tny_folder_monitor_add_list (priv->monitor, TNY_LIST (headers));
tny_folder_monitor_start (priv->monitor);
g_mutex_unlock (priv->monitor_lock);
+
}
TnyFolder*
static void
modest_header_view_set_folder_intern (ModestHeaderView *self, TnyFolder *folder)
{
+ TnyFolderType type;
TnyList *headers;
ModestHeaderViewPrivate *priv;
GList *cols, *cursor;
GtkTreeModel *sortable;
+ guint sort_colid;
priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
}
g_list_free (cols);
+ /* Restore sort column id */
+ type = modest_tny_folder_guess_folder_type (folder);
+ sort_colid = modest_header_view_get_sort_column_id (self, type);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
+ sort_colid,
+ GTK_SORT_DESCENDING);
/* Set new model */
modest_header_view_set_model (GTK_TREE_VIEW (self), sortable);
g_object_unref (G_OBJECT (sortable));
+ g_object_unref (G_OBJECT (folder));
}
void