[gnome-boxes] Use consistent naming for Util::get_*_pkg*_dir



commit df50500d354990d7a052a0718b59f2648981e0b3
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Wed May 23 18:19:03 2012 +0200

    Use consistent naming for Util::get_*_pkg*_dir
    
    The various helpers to get the paths of the various directories
    boxes uses were not consistently named. When referring to path in
    the user home directory, some had _user_ in their name, some did
    not. This commit makes sure all such methods have _user_ in their
    name.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676658

 src/app.vala                  |    6 +++---
 src/collection-source.vala    |    6 +++---
 src/machine.vala              |    2 +-
 src/unattended-installer.vala |    2 +-
 src/util.vala                 |   22 +++++++++++-----------
 5 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index d2d955e..2baeb36 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -247,9 +247,9 @@ private class Boxes.App: Boxes.UI {
 
     private async void setup_sources () {
 
-        if (!has_pkgconfig_sources ()) {
+        if (!has_user_pkgconfig_sources ()) {
             var src = File.new_for_path (get_pkgdata_source ("QEMU_Session"));
-            var dst = File.new_for_path (get_pkgconfig_source ("QEMU Session"));
+            var dst = File.new_for_path (get_user_pkgconfig_source ("QEMU Session"));
             try {
                 yield src.copy_async (dst, FileCopyFlags.NONE);
             } catch (GLib.Error error) {
@@ -268,7 +268,7 @@ private class Boxes.App: Boxes.UI {
             application.release (); // will end application
         }
 
-        var dir = File.new_for_path (get_pkgconfig_source ());
+        var dir = File.new_for_path (get_user_pkgconfig_source ());
         yield get_sources_from_dir (dir);
     }
 
diff --git a/src/collection-source.vala b/src/collection-source.vala
index 810e749..e7ef13f 100644
--- a/src/collection-source.vala
+++ b/src/collection-source.vala
@@ -7,7 +7,7 @@ private interface Boxes.IConfig {
     protected abstract bool has_file { get; set; }
 
     public void save () {
-        keyfile_save (keyfile, get_pkgconfig_source (filename), has_file);
+        keyfile_save (keyfile, get_user_pkgconfig_source (filename), has_file);
         has_file = true;
     }
 
@@ -27,7 +27,7 @@ private interface Boxes.IConfig {
         if (!has_file)
             throw new Boxes.Error.INVALID ("has_file is false");
 
-        keyfile.load_from_file (get_pkgconfig_source (filename),
+        keyfile.load_from_file (get_user_pkgconfig_source (filename),
                                 KeyFileFlags.KEEP_COMMENTS | KeyFileFlags.KEEP_TRANSLATIONS);
     }
 
@@ -108,7 +108,7 @@ private class Boxes.CollectionSource: GLib.Object, Boxes.IConfig {
         if (!has_file)
             return;
 
-        FileUtils.unlink (get_pkgconfig_source (filename));
+        FileUtils.unlink (get_user_pkgconfig_source (filename));
         has_file = false;
     }
 }
diff --git a/src/machine.vala b/src/machine.vala
index c84c3d2..80e2cbe 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -128,7 +128,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     }
 
     public virtual string get_screenshot_filename (string ext = "ppm") {
-        return get_pkgcache (get_screenshot_prefix () + "-screenshot." + ext);
+        return get_user_pkgcache (get_screenshot_prefix () + "-screenshot." + ext);
     }
 
     public virtual async bool take_screenshot () throws GLib.Error {
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index d16d49d..dfa5513 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -86,7 +86,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         mount_point = media.mount_point;
         resources = media.resources;
 
-        disk_path = get_pkgcache (os.short_id + "-unattended.img");
+        disk_path = get_user_pkgcache (os.short_id + "-unattended.img");
         newline_type = DataStreamNewlineType.LF;
 
         unattended_files = new GLib.List<UnattendedFile> ();
diff --git a/src/util.vala b/src/util.vala
index 3d787dd..d9b4428 100644
--- a/src/util.vala
+++ b/src/util.vala
@@ -34,19 +34,19 @@ namespace Boxes {
         return Path.build_filename (dir, file_name);
     }
 
+    public string get_pkgdata_source (string? file_name = null) {
+        return Path.build_filename (get_pkgdata (), "sources", file_name);
+    }
+
     public string get_user_unattended_dir (string? file_name = null) {
-        var dir = Path.build_filename (get_pkgconfig (), "unattended");
+        var dir = Path.build_filename (get_user_pkgconfig (), "unattended");
 
         ensure_directory (dir);
 
         return Path.build_filename (dir, file_name);
     }
 
-    public string get_pkgdata_source (string? file_name = null) {
-        return Path.build_filename (get_pkgdata (), "sources", file_name);
-    }
-
-    public string get_pkgcache (string? file_name = null) {
+    public string get_user_pkgcache (string? file_name = null) {
         var dir = Path.build_filename (Environment.get_user_cache_dir (), Config.PACKAGE_TARNAME);
 
         ensure_directory (dir);
@@ -54,7 +54,7 @@ namespace Boxes {
         return Path.build_filename (dir, file_name);
     }
 
-    public string get_pkgconfig (string? file_name = null) {
+    public string get_user_pkgconfig (string? file_name = null) {
         var dir = Path.build_filename (Environment.get_user_config_dir (), Config.PACKAGE_TARNAME);
 
         ensure_directory (dir);
@@ -70,12 +70,12 @@ namespace Boxes {
         return Path.build_filename (dir, file_name);
     }
 
-    public bool has_pkgconfig_sources () {
-        return FileUtils.test (Path.build_filename (get_pkgconfig (), "sources"), FileTest.IS_DIR);
+    public bool has_user_pkgconfig_sources () {
+        return FileUtils.test (Path.build_filename (get_user_pkgconfig (), "sources"), FileTest.IS_DIR);
     }
 
-    public string get_pkgconfig_source (string? file_name = null) {
-        var dir = Path.build_filename (get_pkgconfig (), "sources");
+    public string get_user_pkgconfig_source (string? file_name = null) {
+        var dir = Path.build_filename (get_user_pkgconfig (), "sources");
 
         ensure_directory (dir);
 



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