[gthumb] Use the gfile display_name to provide UTF8 encoded names.



commit b4d5fd63197cc4951d4f5759e1d7581a657e673b
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Wed Apr 22 10:45:23 2009 -0400

    Use the gfile display_name to provide UTF8 encoded names.
---
 libgthumb/file-utils.c |    9 ++++++++-
 src/gth-browser.c      |    6 +++---
 src/gth-location.c     |    2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/libgthumb/file-utils.c b/libgthumb/file-utils.c
index 1c8324d..07aab15 100644
--- a/libgthumb/file-utils.c
+++ b/libgthumb/file-utils.c
@@ -1413,7 +1413,14 @@ same_uri (const char *uri1,
 char *
 basename_for_display (const char *uri)
 {
-	return get_utf8_display_name_from_uri (file_name_from_path (uri));
+        GFile *gfile;
+        char  *result;
+
+        gfile = gfile_new (uri);
+        result = gfile_get_display_name (gfile);
+        g_object_unref (gfile);
+
+	return result;
 }
 
 
diff --git a/src/gth-browser.c b/src/gth-browser.c
index 814ac26..92570d8 100644
--- a/src/gth-browser.c
+++ b/src/gth-browser.c
@@ -586,7 +586,7 @@ window_update_infobar (GthBrowser *browser)
 	images = gth_file_view_get_images (priv->file_list->view);
 	current = gth_file_list_pos_from_path (priv->file_list, priv->image->path) + 1;
 
-	display_name = get_utf8_display_name_from_uri (file_name_from_path (priv->image->path));
+	display_name = basename_for_display (priv->image->path);
 	escaped_name = g_markup_escape_text (display_name, -1);
 
 	text = g_strdup_printf ("%d/%d - <b>%s</b> %s",
@@ -642,12 +642,12 @@ window_update_title (GthBrowser *browser)
 		char *image_name;
 		int   images, current;
 
-		image_name = get_utf8_display_name_from_uri (file_name_from_path (priv->image->path));
+		image_name = basename_for_display (priv->image->path);
 		images = gth_file_view_get_images (priv->file_list->view);
 		current = gth_file_list_pos_from_path (priv->file_list, priv->image->path) + 1;
 
 		if (priv->image_catalog != NULL) {
-			char *cat_name = get_utf8_display_name_from_uri (file_name_from_path (priv->image_catalog));
+			char *cat_name = basename_for_display (priv->image_catalog);
 
 			/* Cut out the file extension. */
 			cat_name[strlen (cat_name) - 4] = 0;
diff --git a/src/gth-location.c b/src/gth-location.c
index 6d344e6..0ad1a0d 100644
--- a/src/gth-location.c
+++ b/src/gth-location.c
@@ -836,7 +836,7 @@ update_uri (GthLocation *loc,
 			if (same_uri (uri, home_uri))
 				uri_name = g_strdup (_("Home"));
 			else
-				uri_name = get_utf8_display_name_from_uri (file_name_from_path (uri));
+				uri_name = basename_for_display (uri);
 		}
 
 		gtk_list_store_insert (loc->priv->model, &iter, pos++);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]