Fix bug on cmp_rows function assignment, due to elimination of
authorJavier Fernandez Garcia-Boente <jfernandez@igalia.com>
Wed, 2 May 2007 15:12:27 +0000 (15:12 +0000)
committerJavier Fernandez Garcia-Boente <jfernandez@igalia.com>
Wed, 2 May 2007 15:12:27 +0000 (15:12 +0000)
on_progress_changed signal handler.

pmo-trunk-r1733

src/widgets/modest-header-view.c

index d997f30..ca87c24 100644 (file)
@@ -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