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



commit 9e4afcbbe7ea94fad85d60a79120c6a5bb8ded86
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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690757

 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]