[pitivi] Fix XDG user dirs regressions from commits 8159d2374 and da87a41ce



commit 3565b6afbe8d971b63a8e29e9aec047fcfad5c6c
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Thu Oct 31 14:28:51 2013 +0100

    Fix XDG user dirs regressions from commits 8159d2374 and da87a41ce
    
    Add the missing import for GLib, and fix the subtle change in subdirectories:
    ~/.cache/pitivi/pitivi/ was used instead of ~/.cache/pitivi/
    and ~/.config/ was used instead of ~/.config/pitivi/

 pitivi/settings.py            |    6 +++---
 pitivi/timeline/previewers.py |    6 +++---
 pitivi/utils/ui.py            |    1 +
 3 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/settings.py b/pitivi/settings.py
index f6a02d4..f267449 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -95,7 +95,7 @@ def xdg_data_home(autocreate=True):
 
 
 def xdg_cache_home(autocreate=True):
-    """Get the user cache directory"""
+    """Get the Pitivi cache directory"""
     return get_dir(os.path.join(GLib.get_user_cache_dir(), "pitivi"), autocreate)
 
 
@@ -151,7 +151,7 @@ class GlobalSettings(Signallable):
     def _readSettingsFromConfigurationFile(self):
         # This reads the configuration from the user configuration file
         try:
-            conf_file_path = os.path.join(GLib.get_user_config_dir(), "pitivi.conf")
+            conf_file_path = os.path.join(xdg_config_home(), "pitivi.conf")
             self._config.read(conf_file_path)
         except ParsingError:
             return
@@ -209,7 +209,7 @@ class GlobalSettings(Signallable):
                 setattr(self, attrname, value)
 
     def _writeSettingsToConfigurationFile(self):
-        conf_file_path = os.path.join(GLib.get_user_config_dir(), "pitivi.conf")
+        conf_file_path = os.path.join(xdg_config_home(), "pitivi.conf")
 
         for (section, attrname, typ, key, env_var, value) in self.iterAllOptions():
             if not self._config.has_section(section):
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 889147a..373ebaf 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -594,8 +594,8 @@ class ThumbnailCache(Loggable):
         # TODO: replace with utils.misc.hash_file
         self._filehash = hash_file(Gst.uri_get_location(uri))
         self._filename = filename_from_uri(uri)
-        cache_dir = get_dir(os.path.join(xdg_cache_home(), "pitivi"), autocreate)
-        dbfile = os.path.join(get_dir(os.path.join(cache_dir, "thumbs")), self._filehash)
+        thumbs_cache_dir = get_dir(os.path.join(xdg_cache_home(), "thumbs"))
+        dbfile = os.path.join(thumbs_cache_dir, self._filehash)
         self._db = sqlite3.connect(dbfile)
         self._cur = self._db.cursor()  # Use this for normal db operations
         self._cur.execute("CREATE TABLE IF NOT EXISTS Thumbs\
@@ -777,7 +777,7 @@ class AudioPreviewer(Clutter.Actor, PreviewGenerator, Zoomable, Loggable):
     def _startLevelsDiscovery(self):
         self.log('Preparing waveforms for "%s"' % filename_from_uri(self._uri))
         filename = hash_file(Gst.uri_get_location(self._uri)) + ".wave"
-        cache_dir = get_dir(os.path.join(xdg_cache_home(), os.path.join("pitivi/waves")), autocreate)
+        cache_dir = get_dir(os.path.join(xdg_cache_home(), "waves"))
         filename = cache_dir + "/" + filename
 
         if os.path.exists(filename):
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 5bd0701..c46aa50 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -29,6 +29,7 @@ classes that help with UI drawing around the application
 
 from decimal import Decimal
 from gettext import ngettext, gettext as _
+from gi.repository import GLib
 from gi.repository import GES
 from gi.repository import Gst
 from gi.repository import Gtk


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