After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 327152 - Long names in the FileChooserDialog directory buttons should be ellipsized
Long names in the FileChooserDialog directory buttons should be ellipsized
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other All
: Normal normal
: Small fix
Assigned To: gtk-bugs
Federico Mena Quintero
: 338092 341000 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-01-16 01:55 UTC by Steve Frécinaux
Modified: 2009-06-05 21:18 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
screenshot of the bug (87.60 KB, image/png)
2006-04-16 09:43 UTC, Steve Frécinaux
  Details
This is a patch for fixing the bug. (7.98 KB, patch)
2009-05-18 18:28 UTC, Denis Chertykov
needs-work Details | Review
Corrected patch. (7.03 KB, patch)
2009-05-23 07:56 UTC, Denis Chertykov
none Details | Review

Description Steve Frécinaux 2006-01-16 01:55:29 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:
Comment 1 Steve Frécinaux 2006-01-17 20:02:20 UTC
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.
Comment 2 Steve Frécinaux 2006-04-16 09:43:03 UTC
Created attachment 63629 [details]
screenshot of the bug
Comment 3 Vincent Untz 2006-04-17 15:18:22 UTC
*** Bug 338092 has been marked as a duplicate of this bug. ***
Comment 4 Steve Frécinaux 2006-05-24 11:20:19 UTC
*** Bug 341000 has been marked as a duplicate of this bug. ***
Comment 5 Federico Mena Quintero 2007-01-25 17:02:45 UTC
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.
Comment 6 Denis Chertykov 2009-05-18 18:28:07 UTC
Created attachment 134891 [details] [review]
This is a patch for fixing the bug.

I have prepared the fix for the bug.
Comment 7 Matthias Clasen 2009-05-23 05:34:07 UTC
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)))
Comment 8 Denis Chertykov 2009-05-23 07:56:15 UTC
Created attachment 135225 [details] [review]
Corrected patch.
Comment 9 Denis Chertykov 2009-05-23 08:31:54 UTC
How long must be the line length for fix formatting issues ?
Comment 10 Denis Chertykov 2009-05-27 17:55:36 UTC
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.
Comment 11 Matthias Clasen 2009-05-30 04:35:12 UTC
Federico, can you review this ?
Comment 12 Federico Mena Quintero 2009-06-05 18:49:54 UTC
Sure, I'll review this.
Comment 13 Federico Mena Quintero 2009-06-05 21:18:37 UTC
Commited as 4d7bbd058ebf4451d8f5856f2193bf176df87644.

Thanks for the patch, Denis!  I just made a couple of stylistic fixes, and based the commit message on your ChangeLog.