Settings: fix notifications

This commit is contained in:
Bilal Elmoussaoui 2019-02-11 17:27:03 +01:00
parent 3fb0d87c43
commit c260624e1c
4 changed files with 2 additions and 29 deletions

View file

@ -16,15 +16,5 @@
<summary>Default window maximized behaviour</summary>
<description></description>
</key>
<key name="is-locked" type="b">
<default>false</default>
<summary>Whether the application is locked with a password or not</summary>
<description></description>
</key>
<key name="can-be-locked" type="b">
<default>false</default>
<summary>Whether the application can be locked or not</summary>
<description></description>
</key>
</schema>
</schemalist>

View file

@ -89,7 +89,7 @@ class Application(Gtk.Application):
def __generate_menu(self):
"""Generate application menu."""
# Lock/Unlock
if Settings.get_default().can_be_locked:
if Keyring.get_default().has_password():
lock_content = Gio.Menu.new()
lock_content.append_item(Gio.MenuItem.new(_("Lock the application"), "app.lock"))
self._menu.append_item(Gio.MenuItem.new_section(None, lock_content))

View file

@ -92,20 +92,3 @@ class Settings(Gio.Settings):
:type is_maximized: bool
"""
self.set_boolean("is-maximized", is_maximized)
@property
def is_locked(self):
return self.get_boolean("is-locked")
@is_locked.setter
def is_locked(self, state):
self.set_boolean("is-locked", state)
@property
def can_be_locked(self):
return self.get_boolean("can-be-locked")
@can_be_locked.setter
def can_be_locked(self, state):
self.set_boolean("can-be-locked", state)

View file

@ -69,7 +69,7 @@ class SettingsWindow(Gtk.Window):
def __on_app_set_password(self, __, state):
if state and not Keyring.get_default().has_password():
self.props.view = SettingsView.PASSWORD
else:
elif Keyring.get_default().has_password():
Keyring.get_default().clear_password()
self.__send_notification(_("Authentication password was unset. Please restart the application"))