Mikel Olasagasti Uranga avatar Mikel Olasagasti Uranga committed bcd9f75

Added support for gnome-screensaver
Fix error message when no file is opened
Show unlock dialog only once

Comments (0)

Files changed (1)

src/revelation.in

 	def __init_dbus(self):
 		loop = DBusGMainLoop()
 		bus = dbus.SessionBus(mainloop=loop)
+		bus.add_signal_receiver(self.__cb_screensaver_lock, signal_name='ActiveChanged', dbus_interface='org.gnome.ScreenSaver')
 		bus.add_signal_receiver(self.__cb_screensaver_lock, signal_name='ActiveChanged', dbus_interface='org.freedesktop.ScreenSaver')
 
 	##### STATE HANDLERS #####
 	def file_lock(self):
 		"Locks the current file"
 
+		if self.datafile.get_file() is None:
+			return
+
+		if self.file_locked is True:
+			return
+
 		password = self.datafile.get_password()
 
 		if password is None:
 		self.entryview.clear()
 		self.set_title('[' + _('Locked') + ']')
 		self.statusbar.set_status(_('File locked'))
+		self.file_locked = True;
 
 		# hide any dialogs
 		for window in transients:
 			self.entrystore.changed = False
 			self.undoqueue.clear()
 
+			self.file_locked = False;
 			self.statusbar.set_status(_('Opened file %s') % self.datafile.get_file())
 
 		except dialog.CancelError:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.