[gnome-boxes/wip/image-import: 20/30] installer-media: Make label setup available to subclasses



commit 696014135083ab97e79a08278e009919ffb356f4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jun 6 22:17:17 2013 +0300

    installer-media: Make label setup available to subclasses
    
    Make setup_label() accessible to subclasses and rename it to
    label_setup() to avoid conflict with UnattendedInstaller.setup_label.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690757

 src/installer-media.vala |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 04d5ec4..e400905 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -45,7 +45,7 @@ private class Boxes.InstallerMedia : GLib.Object {
         this.resources = resources;
         from_image = true;
 
-        setup_label (label);
+        label_setup (label);
     }
 
     public async InstallerMedia.for_path (string       path,
@@ -62,7 +62,7 @@ private class Boxes.InstallerMedia : GLib.Object {
                 os = os_media.os;
         }
 
-        setup_label ();
+        label_setup ();
 
         // FIXME: these values could be made editable somehow
         var architecture = (os_media != null) ? os_media.architecture : "i686";
@@ -130,6 +130,21 @@ private class Boxes.InstallerMedia : GLib.Object {
         domain.add_device (disk);
     }
 
+    protected void label_setup (string? label = null) {
+        if (label != null)
+            this.label = label;
+        else if (os != null)
+            this.label = os.get_name ();
+        else {
+            // 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;
+        }
+    }
+
     private async GUdev.Device? get_device_from_path (string path, Client client, Cancellable? cancellable) {
         try {
             var mount_dir = File.new_for_path (path);
@@ -213,21 +228,6 @@ private class Boxes.InstallerMedia : GLib.Object {
         return decoded;
     }
 
-    private void setup_label (string? label = null) {
-        if (label != null)
-            this.label = label;
-        else if (os != null)
-            this.label = os.get_name ();
-        else {
-            // 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;
-        }
-    }
-
     private void eject_cdrom_media (Domain domain) {
         var devices = domain.get_devices ();
         foreach (var device in devices) {


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