GNOME Bugzilla – Bug 327152
Long names in the FileChooserDialog directory buttons should be ellipsized
Last modified: 2009-06-05 21:18:37 UTC
Please describe the problem: When the directory name is long, this cause the FileChooserDialog to be resized because the text is not ellipsized in the arborescence buttons above the file list. Steps to reproduce: 1. Create a directory with a long, long, long name 2. Open it in the file dialog Actual results: The file dialog resize itself to be able to show the button Expected results: The button text should be ellipsized so that the file dialog does not resize itself Does this happen every time? yes Other information:
Set priority to normal and added the keyword usability. The reason is that if the directory name is really too long, the right part of the dialog window can be put off-screen, making the close and actions buttons unreachable.
Created attachment 63629 [details] screenshot of the bug
*** Bug 338092 has been marked as a duplicate of this bug. ***
*** Bug 341000 has been marked as a duplicate of this bug. ***
This is easy to fix. Can someone please provide a patch for GtkPathBar? The button should have a tooltip to show the full name if the name gets ellipsized.
Created attachment 134891 [details] [review] This is a patch for fixing the bug. I have prepared the fix for the bug.
Patch seems to work fine in brief testing. But it contains some unrelated whitespace and linebreaking changes that should be removed or committed separately: - width = 0; + width = 0; - if (width + child->requisition.width + path_bar->spacing + slider_space > allocation_width) + if (width + child->requisition.width + + path_bar->spacing + slider_space > allocation_width) And don't compare booleans with TRUE: if (gtk_widget_get_has_tooltip (GTK_WIDGET (child)) != TRUE) + gtk_widget_set_tooltip_text (GTK_WIDGET (child), + BUTTON_DATA (list->data)->dir_name); + } + else if (gtk_widget_get_has_tooltip (GTK_WIDGET (child)) == TRUE) + gtk_widget_set_tooltip_text (GTK_WIDGET (child), NULL); Just do if (!gtk_widget_get_has_tooltip (GTK_WIDGET (child))) if (gtk_widget_get_has_tooltip (GTK_WIDGET (child)))
Created attachment 135225 [details] [review] Corrected patch.
How long must be the line length for fix formatting issues ?
Description for the patch: [GtkFileChooser] Closes GNOME Bug #327152 * gtkfilechooserdefault.c (save_folder_combo_create): Ellipsize the text cell because we can have too long save folder name. * gtkpathbar.c (gtk_path_bar_size_request): For normal buttons use 2*Height as button width because of ellipsized label. (gtk_path_bar_size_allocate): Remove calculation of down_slider_offset. Use remaining space of path bar for last button. Add tooltip for ellipsized label. (gtk_path_bar_scroll_down): Use the different method for calculation the first visible button. Walk down from the end, adding buttons until we use all free space. Remove variables: up_button, space_needed, border_width, direction.
Federico, can you review this ?
Sure, I'll review this.
Commited as 4d7bbd058ebf4451d8f5856f2193bf176df87644. Thanks for the patch, Denis! I just made a couple of stylistic fixes, and based the commit message on your ChangeLog.