[gnome-boxes/wip/image-import: 4/18] installer-media: Exclude extensions from VM name



commit 97ccb202021789ff54687c2c34f61a72a4464c9b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Jun 7 02:26:40 2013 +0300

    installer-media: Exclude extensions from VM name
    
    When creating label/VM name from an unknown media, we simply use the
    basename of the media filename. There is no point in taking the
    extensions and it usually only makes the name longer and is unlikely to
    be desired by users.

 src/installer-media.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 7b567ab..4fed342 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -215,8 +215,10 @@ private class Boxes.InstallerMedia : GLib.Object {
         else if (os != null)
             this.label = os.get_name ();
         else {
-            // No appropriate label? :( Lets just use filename then
-            this.label = get_utf8_basename (device_file);
+            // No appropriate label? :( Lets just use filename w/o extensions (if any) then
+            var basename = get_utf8_basename (device_file);
+            var ext_index = basename.index_of (".");
+            this.label = (ext_index > 0)? basename[0:ext_index] : basename;
 
             return;
         }


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