summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2015-01-05 15:13:04 +0100
committerinfirit <[email protected]>2015-01-05 15:13:04 +0100
commitf640fd7199fbd182b9597537f1e2e180b8950786 (patch)
treebc7abe6b2d6a56d7a07092fb8166627858449a56
parent336b8a375332133fe24413e2f362364399b40f50 (diff)
downloadmate-applets-f640fd7199fbd182b9597537f1e2e180b8950786.tar.bz2
mate-applets-f640fd7199fbd182b9597537f1e2e180b8950786.tar.xz
invest: use GLib to get home and config dirs.
We can not assume the config dir is ~/.config so we use GLib to handle this.
-rw-r--r--invest-applet/invest/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/invest-applet/invest/__init__.py b/invest-applet/invest/__init__.py
index 10f727c4..8835f7d6 100644
--- a/invest-applet/invest/__init__.py
+++ b/invest-applet/invest/__init__.py
@@ -1,5 +1,5 @@
import os, sys
-from os.path import join, exists, isdir, isfile, dirname, abspath, expanduser
+from os.path import join, exists, isdir, isfile, dirname, abspath
from types import ListType
import datetime
@@ -12,6 +12,7 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import Gio
+from gi.repository import GLib
import cPickle
@@ -50,7 +51,7 @@ else:
BUILDER_DATA_DIR = BUILDERDIR
ART_DATA_DIR = SHARED_DATA_DIR
-USER_INVEST_DIR = expanduser("~/.config/mate/invest-applet")
+USER_INVEST_DIR = join(GLib.get_user_config_dir(), "mate/invest-applet")
if not exists(USER_INVEST_DIR):
try:
os.makedirs(USER_INVEST_DIR, 0744)
@@ -60,7 +61,7 @@ if not exists(USER_INVEST_DIR):
# Set the cwd to the home directory so spawned processes behave correctly
# when presenting save/open dialogs
-os.chdir(expanduser("~"))
+os.chdir(GLib.get_home_dir())
# tests whether the given stocks are in the old labelless format
def labelless_stock_format(stocks):