diff options
author | Alexander Schwinn <alexxcons@xfce.org> | 2022-03-07 22:25:41 +0100 |
---|---|---|
committer | Alexander Schwinn <alexxcons@xfce.org> | 2022-03-12 15:18:45 +0000 |
commit | 0af13d572e05b4acf27a9e1630b4512dfbb0774e (patch) | |
tree | a3fd834098fef31323d58391707862ed123054fb /thunar | |
parent | 2db9a1daee477d1c6e9e99797882048ca25ad822 (diff) | |
download | thunar-0af13d572e05b4acf27a9e1630b4512dfbb0774e.tar.gz |
List view name column improvements (#736)
Always expand name column in case "automatically-expand-columns as
needed" is enabled.
If it is disabled, the default width of the name column is set to 60, in
order to have a sane value when auto-resize is pressed on it.
Fixes #545
Fixes #479
Fixes #736
MR !192
Diffstat (limited to 'thunar')
-rw-r--r-- | thunar/thunar-details-view.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c index c1eaec9f..89cf4345 100644 --- a/thunar/thunar-details-view.c +++ b/thunar/thunar-details-view.c @@ -279,7 +279,7 @@ thunar_details_view_init (ThunarDetailsView *details_view) /* add the name renderer */ g_object_set (G_OBJECT (THUNAR_STANDARD_VIEW (details_view)->name_renderer), - "xalign", 0.0, "ellipsize", PANGO_ELLIPSIZE_END, "width-chars", 30, NULL); + "xalign", 0.0, "ellipsize", PANGO_ELLIPSIZE_END, "width-chars", 60, NULL); gtk_tree_view_column_pack_start (details_view->columns[column], THUNAR_STANDARD_VIEW (details_view)->name_renderer, TRUE); gtk_tree_view_column_set_attributes (details_view->columns[column], THUNAR_STANDARD_VIEW (details_view)->name_renderer, "text", THUNAR_COLUMN_NAME, @@ -287,7 +287,6 @@ thunar_details_view_init (ThunarDetailsView *details_view) /* add some spacing between the icon and the name */ gtk_tree_view_column_set_spacing (details_view->columns[column], 2); - gtk_tree_view_column_set_expand (details_view->columns[column], TRUE); } else { @@ -326,6 +325,12 @@ thunar_details_view_init (ThunarDetailsView *details_view) for (column = 0; column < THUNAR_N_VISIBLE_COLUMNS; ++column) gtk_tree_view_column_set_fixed_width (details_view->columns[column], thunar_column_model_get_column_width (details_view->column_model, column)); } + else + { + /* Make sure the name column auto-expands */ + gtk_tree_view_column_set_fixed_width (details_view->columns[THUNAR_COLUMN_NAME],-1); + gtk_tree_view_column_set_expand (details_view->columns[THUNAR_COLUMN_NAME], TRUE); + } /* release the shared text renderers */ g_object_unref (G_OBJECT (right_aligned_renderer)); @@ -630,6 +635,9 @@ thunar_details_view_notify_width (GtkTreeViewColumn *tree_view_column, _thunar_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_view_column)); _thunar_return_if_fail (THUNAR_IS_DETAILS_VIEW (details_view)); + /* for some reason gtk forgets the auto-expand state of the name column */ + gtk_tree_view_column_set_expand (details_view->columns[THUNAR_COLUMN_NAME], !details_view->fixed_columns); + /* lookup the column no for the given tree view column */ for (column = 0; column < THUNAR_N_VISIBLE_COLUMNS; ++column) if (details_view->columns[column] == tree_view_column) @@ -1060,6 +1068,7 @@ thunar_details_view_set_fixed_columns (ThunarDetailsView *details_view, { /* reset column to grow-only mode */ gtk_tree_view_column_set_sizing (details_view->columns[column], GTK_TREE_VIEW_COLUMN_GROW_ONLY); + gtk_tree_view_column_set_fixed_width (details_view->columns[column],-1); } } @@ -1068,6 +1077,14 @@ thunar_details_view_set_fixed_columns (ThunarDetailsView *details_view, if (fixed_columns) gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (gtk_bin_get_child (GTK_BIN (details_view))), TRUE); + if (fixed_columns == FALSE) + { + /* Make sure the name column auto-expands */ + gtk_tree_view_column_set_expand (details_view->columns[THUNAR_COLUMN_NAME], TRUE); + } + + gtk_tree_view_column_queue_resize (details_view->columns[THUNAR_COLUMN_NAME]); + /* notify listeners */ g_object_notify (G_OBJECT (details_view), "fixed-columns"); } |