From 40a29118d0f9a87c9519a85eac0c6ef35db81435 Mon Sep 17 00:00:00 2001 From: Javier Fernandez Garcia-Boente Date: Wed, 2 May 2007 15:12:27 +0000 Subject: [PATCH] Fix bug on cmp_rows function assignment, due to elimination of on_progress_changed signal handler. pmo-trunk-r1733 --- src/widgets/modest-header-view.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/widgets/modest-header-view.c b/src/widgets/modest-header-view.c index d997f30..ca87c24 100644 --- a/src/widgets/modest-header-view.c +++ b/src/widgets/modest-header-view.c @@ -388,6 +388,13 @@ modest_header_view_set_columns (ModestHeaderView *self, const GList *columns, Tn 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)); @@ -396,8 +403,8 @@ modest_header_view_set_columns (ModestHeaderView *self, const GList *columns, Tn g_object_set_data (G_OBJECT(column), MODEST_HEADER_VIEW_PTR, self); gtk_tree_view_append_column (GTK_TREE_VIEW(self), column); - } - + } + return TRUE; } @@ -757,19 +764,23 @@ modest_header_view_set_folder_intern (ModestHeaderView *self, TnyFolder *folder) 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 -- 1.7.9.5