Commits

Mikel Olasagasti Uranga  committed bcd9f75

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

  • Participants
  • Parent commits 82d030b

Comments (0)

Files changed (1)

File 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: