From 9e068ccb788673d631d88ad89fd6ec81e9b7d915 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn <acs82@gmx.de> Date: Mon, 23 Jul 2018 23:26:16 +0200 Subject: [PATCH] Fix of messed up row-height with disabled "automatically expand columns as needed" in detailed view. (Part II) (Bug #14548) --- thunar/thunar-details-view.c | 29 +++++++++++++++++++++-------- thunar/thunar-standard-view.c | 4 +--- thunar/thunar-standard-view.h | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c index 6a47d68d6..2b402b9ff 100644 --- a/thunar/thunar-details-view.c +++ b/thunar/thunar-details-view.c @@ -901,12 +901,16 @@ static void thunar_details_view_zoom_level_changed (ThunarDetailsView *details_view) { ThunarColumn column; + gboolean fixed_columns_used = FALSE; _thunar_return_if_fail (THUNAR_IS_DETAILS_VIEW (details_view)); - /* Disable fixed height optimization during resize, since it can mess up the row height */ - if (details_view->fixed_columns) - gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (gtk_bin_get_child (GTK_BIN (details_view))), FALSE); + if (details_view->fixed_columns == TRUE) + fixed_columns_used = TRUE; + + /* Disable fixed column mode during resize, since it can generate graphical glitches */ + if (fixed_columns_used) + thunar_details_view_set_fixed_columns (details_view, FALSE); /* determine the list of tree view columns */ for (column = 0; column < THUNAR_N_VISIBLE_COLUMNS; ++column) @@ -915,8 +919,13 @@ thunar_details_view_zoom_level_changed (ThunarDetailsView *details_view) gtk_tree_view_column_queue_resize (details_view->columns[column]); } - if (details_view->fixed_columns) - gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (gtk_bin_get_child (GTK_BIN (details_view))), TRUE); + if (fixed_columns_used) + { + thunar_details_view_set_fixed_columns (details_view, TRUE); + + /* For unknown reason a reload is required to display the correct row-height (otherwise some rows will keep the old height )*/ + thunar_standard_view_reload (THUNAR_VIEW (details_view), TRUE); + } } @@ -978,6 +987,10 @@ thunar_details_view_set_fixed_columns (ThunarDetailsView *details_view, /* apply the new value */ details_view->fixed_columns = fixed_columns; + /* disable in reverse order, otherwise graphical glitches can appear*/ + if (!fixed_columns) + gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (gtk_bin_get_child (GTK_BIN (details_view))), FALSE); + /* apply the new setting to all columns */ for (column = 0; column < THUNAR_N_VISIBLE_COLUMNS; ++column) { @@ -1001,9 +1014,9 @@ thunar_details_view_set_fixed_columns (ThunarDetailsView *details_view, } /* for fixed columns mode, we can enable the fixed height - * mode to improve the performance of the GtkTreeVeiw. - */ - gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (gtk_bin_get_child (GTK_BIN (details_view))), fixed_columns); + * mode to improve the performance of the GtkTreeVeiw. */ + if (fixed_columns) + gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (gtk_bin_get_child (GTK_BIN (details_view))), TRUE); /* notify listeners */ g_object_notify (G_OBJECT (details_view), "fixed-columns"); diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 07b0e9564..45a92aafe 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -140,8 +140,6 @@ static ThunarZoomLevel thunar_standard_view_get_zoom_level (Thu static void thunar_standard_view_set_zoom_level (ThunarView *view, ThunarZoomLevel zoom_level); static void thunar_standard_view_reset_zoom_level (ThunarView *view); -static void thunar_standard_view_reload (ThunarView *view, - gboolean reload_info); static gboolean thunar_standard_view_get_visible_range (ThunarView *view, ThunarFile **start_file, ThunarFile **end_file); @@ -1756,7 +1754,7 @@ thunar_standard_view_reset_zoom_level (ThunarView *view) -static void +void thunar_standard_view_reload (ThunarView *view, gboolean reload_info) { diff --git a/thunar/thunar-standard-view.h b/thunar/thunar-standard-view.h index f85136858..7d7f4f872 100644 --- a/thunar/thunar-standard-view.h +++ b/thunar/thunar-standard-view.h @@ -148,6 +148,8 @@ void thunar_standard_view_context_menu (ThunarStandardView *standard_view void thunar_standard_view_queue_popup (ThunarStandardView *standard_view, GdkEventButton *event); +void thunar_standard_view_reload (ThunarView *view, + gboolean reload_info); void thunar_standard_view_selection_changed (ThunarStandardView *standard_view); -- GitLab