Skip to content
Permalink
Browse files

Correct handling of existing settings file

  • Loading branch information...
adamwojs committed Sep 5, 2016
1 parent 24b3366 commit b9e1e4ed2b4c33190b534b754e71318840a29554
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/rocket-menu
@@ -5,7 +5,6 @@ import json
import signal
import gi
from subprocess import call
from webob import exc

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
@@ -233,14 +232,18 @@ class qcm_settings():
def _get_default_settings(self):
return {
'connections_file': config_dir + '/connections.json',
'terminal': 'gnome-terminal -e \'%s\''
'terminal': "gnome-terminal -e '%s'"
}

def _load(self):
f = open(settings_file, 'r')
settings = f.read()
f.close()
return json.loads(settings)
try:
settings = json.loads(f.read())
# Override default settings
settings = dict(self._get_default_settings().items() + settings.items())
return settings;
finally:
f.close()

def _save(self, settings):
f = open(settings_file, 'w')

0 comments on commit b9e1e4e

Please sign in to comment.
You can’t perform that action at this time.