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



commit 16731d1386cd30726c42d3c6e670a6112d7dc35e
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]