g_return_val_if_reached(FALSE);
}
+ if (sortable) {
+ 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));
g_object_set_data (G_OBJECT(column), MODEST_HEADER_VIEW_PTR,
self);
gtk_tree_view_append_column (GTK_TREE_VIEW(self), column);
- }
-
+ }
+
return TRUE;
}
cursor->data, NULL);
cursor = g_list_next(cursor);
}
- 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);
- sort_type = modest_header_view_get_sort_type (self, type);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
- sort_colid,
- sort_type);
+ if (cols) {
+ type = modest_tny_folder_guess_folder_type (folder);
+ sort_colid = modest_header_view_get_sort_column_id (self, type);
+ sort_type = modest_header_view_get_sort_type (self, type);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
+ sort_colid,
+ sort_type);
+ }
/* Set new model */
modest_header_view_set_model (GTK_TREE_VIEW (self), sortable);
g_object_unref (G_OBJECT (sortable));
+
+ /* Free */
+ g_list_free (cols);
}
void