From ad3166ad6d7a89c0265af5edb2829718d0de5327 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Thu, 17 Nov 2005 18:55:30 +0000 Subject: Set the model's sort column only after filling it. Vastly improves delay 2005-11-17 Christian Persch * src/pdm-dialog.c: Set the model's sort column only after filling it. Vastly improves delay when opening the PDM dialogue when you have many cookies. --- src/pdm-dialog.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 69482153f..b46a60c77 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -544,9 +544,7 @@ pdm_dialog_cookies_construct (PdmActionInfo *info) gtk_tree_view_set_headers_visible (treeview, TRUE); selection = gtk_tree_view_get_selection (treeview); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (liststore), - COL_COOKIES_HOST, - GTK_SORT_ASCENDING); + info->model = GTK_TREE_MODEL (liststore); g_object_unref (liststore); @@ -722,6 +720,11 @@ pdm_dialog_fill_cookies_list (PdmActionInfo *info) G_CALLBACK (cookie_deleted_cb), info->dialog); g_signal_connect (manager, "cookies-cleared", G_CALLBACK (cookies_cleared_cb), info->dialog); + + /* Now turn on sorting */ + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (info->model), + COL_COOKIES_HOST, + GTK_SORT_ASCENDING); } static void @@ -816,9 +819,7 @@ pdm_dialog_passwords_construct (PdmActionInfo *info) gtk_tree_view_set_headers_visible (treeview, TRUE); selection = gtk_tree_view_get_selection (treeview); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (liststore), - COL_PASSWORDS_HOST, - GTK_SORT_ASCENDING); + info->model = GTK_TREE_MODEL (liststore); g_object_unref (liststore); @@ -871,12 +872,19 @@ static void passwords_changed_cb (EphyPasswordManager *manager, PdmDialog *dialog) { + GtkTreeModel *model = dialog->priv->passwords->model; + LOG ("passwords changed"); /* since the callback doesn't carry any information about what * exactly has changed, we have to rebuild the list from scratch. */ - gtk_list_store_clear (GTK_LIST_STORE (dialog->priv->passwords->model)); + gtk_list_store_clear (GTK_LIST_STORE (model)); + + /* And turn off sorting */ + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), + GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, + GTK_SORT_ASCENDING); dialog->priv->passwords->fill (dialog->priv->passwords); } @@ -908,6 +916,10 @@ pdm_dialog_fill_passwords_list (PdmActionInfo *info) } info->filled = TRUE; + + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (info->model), + COL_PASSWORDS_HOST, + GTK_SORT_ASCENDING); } static void -- cgit v1.2.3