summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2006-11-16 11:12:12 +0000
committerEmmanuele Bassi <ebassi@src.gnome.org>2006-11-16 11:12:12 +0000
commitaf6b361d6b481a21f69a3a1f7305c11425a500e2 (patch)
tree51e3d2732a23bb2478fe1665d18d250ef40bd058 /gtk
parentade821a03ee2cf23665a8dd54d1ba9605c416db7 (diff)
downloadgtk+-af6b361d6b481a21f69a3a1f7305c11425a500e2.tar.gz
Return the URI of the GtkRecentInfo object (upgraded to UTF-8 if needed)
2006-11-16 Emmanuele Bassi <ebassi@gnome.org> * gtk/gtkrecentmanager.c: (gtk_recent_info_get_uri_display): Return the URI of the GtkRecentInfo object (upgraded to UTF-8 if needed) in case of non-local file. (#351945)
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkrecentmanager.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 24baf5d772..68ac0de538 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -2295,7 +2295,9 @@ gtk_recent_info_get_short_name (GtkRecentInfo *info)
* gtk_recent_info_get_uri_display:
* @info: a #GtkRecentInfo
*
- * Gets a displayable version of the resource's URI.
+ * Gets a displayable version of the resource's URI. If the resource
+ * is local, it returns a local path; if the resource is not local,
+ * it returns the UTF-8 encoded content of gtk_recent_info_get_uri().
*
* Return value: a UTF-8 string containing the resource's URI or %NULL
*
@@ -2304,18 +2306,28 @@ gtk_recent_info_get_short_name (GtkRecentInfo *info)
gchar *
gtk_recent_info_get_uri_display (GtkRecentInfo *info)
{
- gchar *filename, *filename_utf8;
+ gchar *retval;
g_return_val_if_fail (info != NULL, NULL);
-
- filename = g_filename_from_uri (info->uri, NULL, NULL);
- if (!filename)
- return NULL;
+
+ retval = NULL;
+ if (gtk_recent_info_is_local (info))
+ {
+ gchar *filename;
+
+ filename = g_filename_from_uri (info->uri, NULL, NULL);
+ if (!filename)
+ return NULL;
- filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
- g_free (filename);
+ retval = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+ g_free (filename);
+ }
+ else
+ {
+ retval = make_valid_utf8 (info->uri);
+ }
- return filename_utf8;
+ return retval;
}
/**