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 148620 - Non-file URIs not properly displayed
Non-file URIs not properly displayed
Status: RESOLVED FIXED
Product: libegg
Classification: Other
Component: recent-files
unspecified
Other All
: Normal normal
: ---
Assigned To: James Willcox
James Willcox
Depends on:
Blocks:
 
 
Reported: 2004-07-27 22:15 UTC by Federico Mena Quintero
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
Patch with fix; adds egg_recent_item_get_short_name() (5.94 KB, patch)
2004-07-27 22:23 UTC, Federico Mena Quintero
none Details | Review

Description Federico Mena Quintero 2004-07-27 22:15:54 UTC
- Go to "fonts:///" in Nautilus
- Double-click on a font; fontilus opens
- Visit the panel's recent-files menu and see "Bitstream%20Vera%20Sans"

The problem occurs because:

1. egg_recent_view_gtk_new_menu_item() calls
egg_recent_item_get_uri_for_display()

2. egg_recent_item_get_uri_for_display() calls
gnome_vfs_format_uri_for_display("fonts:///Bitstream%20Vera%20Sans")

3. After making the URI canonical, this calls
gnome_vfs_get_local_path_from_uri().  Since the URI is not a file:///
URI, the latter function returns NULL.

4. gnome_vfs_format_uri_for_display_internal() validates the URI for
being UTF-8 (which it is), and returns it intact.

5. Back to egg_recent_view_gtk_new_menu_item() where we call
g_path_get_basename("fonts:///Bitstream%20Vera%20Sans"). 
This just gets the string after the last slash, so it returns
"Bitstream%20Vera%20Sans".

The problem is that we are calling gnome_vfs_format_uri_for_display() on
non-file URIs, and it doesn't do what we want there.

The attached patch adds a function called egg_recent_item_get_short_name(),
which gives you a string suitable for displaying in a menu or list.  It uses
some heuristics to figure out a valid UTF-8 name from the URI's short name.
Comment 1 Federico Mena Quintero 2004-07-27 22:23:27 UTC
Created attachment 29971 [details] [review]
Patch with fix; adds egg_recent_item_get_short_name()
Comment 2 Federico Mena Quintero 2004-07-29 21:19:50 UTC
Bug #148808 is the corresponding bug for the panel. 
Comment 3 James Willcox 2004-08-02 18:28:52 UTC
Looks good
Comment 4 Federico Mena Quintero 2004-08-02 21:59:47 UTC
Thanks, committed.