summaryrefslogtreecommitdiff
path: root/src/file-manager/fm-list-view.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-01-06 13:39:44 +0300
committermonsta <[email protected]>2017-01-22 13:30:57 +0300
commitd443ee5ad388cacc96ce7d523af5216e266daf01 (patch)
tree3408d663fe7d13221035b8ac2501494c63b96aac /src/file-manager/fm-list-view.c
parentd6dd10e66392e9b433eec39d8c86993d1d4386c9 (diff)
downloadcaja-d443ee5ad388cacc96ce7d523af5216e266daf01.tar.bz2
caja-d443ee5ad388cacc96ce7d523af5216e266daf01.tar.xz
show/hide columns instead of appending/removing them
fixes https://github.com/mate-desktop/caja/issues/649 adapted from: https://git.gnome.org/browse/nautilus/commit/?id=e19f7cb3fec1e6c884d1741c3c00916c65ab035f
Diffstat (limited to 'src/file-manager/fm-list-view.c')
-rw-r--r--src/file-manager/fm-list-view.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 46f6c143..163f1be8 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -1541,27 +1541,22 @@ apply_columns_settings (FMListView *list_view,
view_columns = g_list_reverse (view_columns);
- /* remove columns that are not present in the configuration */
+ /* hide columns that are not present in the configuration */
old_view_columns = gtk_tree_view_get_columns (list_view->details->tree_view);
for (l = old_view_columns; l != NULL; l = l->next)
{
if (g_list_find (view_columns, l->data) == NULL)
{
- gtk_tree_view_remove_column (list_view->details->tree_view, l->data);
+ gtk_tree_view_column_set_visible (l->data, FALSE);
}
}
g_list_free (old_view_columns);
- /* append new columns from the configuration */
- old_view_columns = gtk_tree_view_get_columns (list_view->details->tree_view);
+ /* show new columns from the configuration */
for (l = view_columns; l != NULL; l = l->next)
{
- if (g_list_find (old_view_columns, l->data) == NULL)
- {
- gtk_tree_view_append_column (list_view->details->tree_view, l->data);
- }
+ gtk_tree_view_column_set_visible (l->data, TRUE);
}
- g_list_free (old_view_columns);
/* place columns in the correct order */
prev_view_column = NULL;
@@ -1643,7 +1638,7 @@ create_and_set_up_tree_view (FMListView *view)
view->details->columns = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify)g_free,
- (GDestroyNotify) g_object_unref);
+ NULL);
gtk_tree_view_set_enable_search (view->details->tree_view, TRUE);
/* Don't handle backspace key. It's used to open the parent folder. */
@@ -1762,7 +1757,7 @@ create_and_set_up_tree_view (FMListView *view)
font_size = PANGO_PIXELS (pango_font_description_get_size (gtk_widget_get_style (GTK_WIDGET(view))->font_desc));
#endif
gtk_tree_view_column_set_min_width (view->details->file_name_column, 20*font_size);
- g_object_ref_sink (view->details->file_name_column);
+ gtk_tree_view_append_column (view->details->tree_view, view->details->file_name_column);
view->details->file_name_column_num = column_num;
g_hash_table_insert (view->details->columns,
@@ -1806,14 +1801,13 @@ create_and_set_up_tree_view (FMListView *view)
cell,
"text", column_num,
NULL);
- g_object_ref_sink (column);
+ gtk_tree_view_append_column (view->details->tree_view, column);
gtk_tree_view_column_set_sort_column_id (column, column_num);
g_hash_table_insert (view->details->columns,
g_strdup (name),
column);
gtk_tree_view_column_set_resizable (column, TRUE);
- gtk_tree_view_column_set_visible (column, TRUE);
}
g_free (name);
g_free (label);