[pybliographer] config: Remove old-confirmation-dialog option
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer] config: Remove old-confirmation-dialog option
- Date: Thu, 29 Mar 2018 03:40:00 +0000 (UTC)
commit 61fe9af0f9d758bcb12c0282facd834674b5d458
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Tue Oct 10 17:26:25 2017 -0300
config: Remove old-confirmation-dialog option
Pyblio/ConfDir/Gnome.py | 5 -----
Pyblio/Config.py | 16 ++++++++++------
Pyblio/GnomeUI/Document.py | 28 ++++++++++++----------------
3 files changed, 22 insertions(+), 27 deletions(-)
---
diff --git a/Pyblio/ConfDir/Gnome.py b/Pyblio/ConfDir/Gnome.py
index b508820..acd5328 100644
--- a/Pyblio/ConfDir/Gnome.py
+++ b/Pyblio/ConfDir/Gnome.py
@@ -17,9 +17,6 @@ tooltips are enabled """, Config.Boolean ())
Config.define ('gnome/native-as-default', """ Should we edit the
entries in their native format by default ? """, Config.Boolean ())
-Config.define ('gnome/old-confirmation-dialog',
- """ Should we use the old dialog when closing, and ask for permission to skip saving? """,
Config.Boolean ())
-
Config.define ('gnome/searched', """ List of searchable fields """,
Config.List (Config.String ()))
@@ -37,8 +34,6 @@ Config.set ('gnome/tooltips', 1)
Config.set ('gnome/native-as-default', 0)
-Config.set ('gnome/old-confirmation-dialog', 0)
-
Config.set ('gnome/columns', ('Author', 'Date', 'Title'))
Config.set ('gnome/history', 10)
diff --git a/Pyblio/Config.py b/Pyblio/Config.py
index 3e22207..22bdbe3 100644
--- a/Pyblio/Config.py
+++ b/Pyblio/Config.py
@@ -32,6 +32,8 @@ import types
pickle = cPickle
del cPickle
+deprecated_keys = ['gnome/old-confirmation-dialog',]
+
class ConfigItem:
@@ -155,14 +157,16 @@ def define (key, description, vtype = None, hook = None, user = None):
return
-def set (key, value):
+def set(key, value):
try:
- ConfigItems [key].set (value)
+ ConfigItems[key].set(value)
except KeyError:
- sys.stderr.write (
- "pybliographer: warning: configuration key `%s' is undefined\n"
- % key)
- return
+ if key not in deprecated_keys:
+ # We removed a configuration setting, we no need to bother
+ # the user about it.
+ sys.stderr.write(
+ "pybliographer: warning: configuration key `%s' is undefined\n"
+ % key)
_changes = {}
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 4819cc8..5d93775 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -461,22 +461,18 @@ class Document (Connector.Publisher):
def confirm (self):
''' eventually ask for modification cancellation '''
- if self.changed:
- if Config.get('gnome/old-confirmation-dialog').data:
- return Utils.Callback (_("The database has been modified.\nDiscard changes?"),
- self.w).answer ()
-
- else:
- answer = Utils.Callback (_("The database has been modified.\nSave changes?"),
- self.w, cancel_add = True).answer ()
- if answer == 2:
- return False
- elif answer and self.modification_check ():
- self.save_document ()
- return True
- else:
- return True
- return 1
+ if not self.changed:
+ return True
+
+ result = Utils.Callback (_("The database has been modified.\nSave changes?"),
+ self.w, cancel_add=True).answer()
+ if result == 2:
+ return False
+ elif result and self.modification_check ():
+ self.save_document ()
+ return True
+ else:
+ return True
def modification_check (self):
"""Check for external modification, if necessary,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]