[gnome-boxes] Add get_utf8_basename helper function



commit 29c8a982aad794c565bcbf5c0d2f558706f422f9
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Nov 13 19:33:05 2012 +0100

    Add get_utf8_basename helper function
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686778

 src/util.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/util.vala b/src/util.vala
index 5f210a3..85760f6 100644
--- a/src/util.vala
+++ b/src/util.vala
@@ -78,6 +78,17 @@ namespace Boxes {
         return Path.build_filename (dir, file_name);
     }
 
+    public string get_utf8_basename (string path) {
+        var file = File.new_for_path (path);
+        string name = file.get_parse_name ();
+        try {
+            var info = file.query_info (FileAttribute.STANDARD_DISPLAY_NAME, 0);
+            name = info.get_display_name ();
+        } catch (GLib.Error e) {
+        }
+        return name;
+    }
+
     public string get_logo_cache (string? file_name = null) {
         var dir = Path.build_filename (get_user_pkgcache (), "logos");
 



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