summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Gedminas <marius@gedmin.as>2020-10-08 14:23:40 +0300
committerMarius Gedminas <marius@gedmin.as>2020-10-08 14:23:40 +0300
commit8c6d2aa17b3bf86d28c1fa275b50e5cc4794b30d (patch)
tree14715ca1b2546b5a8cfcc5f2b5509dcfa646ec4e
parentb3d4bca0a76b72f34abcc23f43295f2122b9e572 (diff)
Skip misleading "settings migrated" message
When there was no legacy configuration file, gtimelog would still print the "settings migrated" message. Let's do that only if there actually were any settings to be migrated.
-rw-r--r--src/gtimelog/main.py5
-rw-r--r--src/gtimelog/settings.py3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/gtimelog/main.py b/src/gtimelog/main.py
index 6cb9e9e..d9e4a7b 100644
--- a/src/gtimelog/main.py
+++ b/src/gtimelog/main.py
@@ -644,7 +644,7 @@ class Window(Gtk.ApplicationWindow):
if not self.gsettings.get_boolean('settings-migrated'):
old_settings = Settings()
- old_settings.load()
+ loaded_files = old_settings.load()
if old_settings.summary_view:
self.gsettings.set_string('detail-level', 'summary')
elif old_settings.chronological:
@@ -667,7 +667,8 @@ class Window(Gtk.ApplicationWindow):
self.gsettings.set_value('virtual-midnight', GLib.Variant('(ii)', (vm.hour, vm.minute)))
self.gsettings.set_boolean('gtk-completion', bool(old_settings.enable_gtk_completion))
self.gsettings.set_boolean('settings-migrated', True)
- log.info(_('Settings from {filename} migrated to GSettings (org.gtimelog)').format(filename=old_settings.get_config_file()))
+ if loaded_files:
+ log.info(_('Settings from {filename} migrated to GSettings (org.gtimelog)').format(filename=old_settings.get_config_file()))
mark_time('settings loaded')
diff --git a/src/gtimelog/settings.py b/src/gtimelog/settings.py
index a253b0c..6292c81 100644
--- a/src/gtimelog/settings.py
+++ b/src/gtimelog/settings.py
@@ -123,7 +123,7 @@ class Settings(object):
if filename is None:
filename = self.get_config_file()
config = self._config()
- config.read([filename])
+ loaded_files = config.read([filename])
self.email = config.get('gtimelog', 'list-email')
self.name = config.get('gtimelog', 'name')
self.sender = config.get('gtimelog', 'sender')
@@ -148,6 +148,7 @@ class Settings(object):
'prefer_app_indicator')
self.report_style = config.get('gtimelog', 'report_style')
self.start_in_tray = config.getboolean('gtimelog', 'start_in_tray')
+ return loaded_files
def save(self, filename):
config = self._config()