From c18043684137440e5853d5c952f89751148b6c24 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 11 Dec 2012 09:38:46 +0100 Subject: Do not restore certificate manager columns when all are hidden If all columns are hidden, then header of a GtkTreeView is also hidden, thus there is no way to show columns again, which results in empty Certificate Preferences view. --- smime/gui/certificate-manager.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index a48442f50b..548c9c7d79 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -254,13 +254,19 @@ load_treeview_state (GtkTreeView *treeview) list = g_key_file_get_integer_list (keyfile, tree_name, "columns", &length, NULL); if (list) { + gboolean all_hidden = TRUE; + if (length != (gtk_tree_model_get_n_columns (model) - 1)) { g_debug ("%s: Unexpected number of columns in config file", G_STRFUNC); g_free (list); goto exit; } - for (i = 0; i < length; i++) { + for (i = 0; all_hidden && i < length; i++) { + all_hidden = list[i] == 0; + } + + for (i = 0; !all_hidden && i < length; i++) { GtkTreeViewColumn *column = gtk_tree_view_get_column (treeview, i); if (list[i]) { gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED); -- cgit