# HG changeset patch # User Erik Grinaker # Date 1139606098 0 # Node ID 3961c230bd79b267ff9fd3177ff1a098622700ee # Parent c9459c0691330cb4893a2d273cddbbd8475f38e7 use gtk.FileChooser.set_do_overwrite_confirmation() diff -r c9459c0691330cb4893a2d273cddbbd8475f38e7 -r 3961c230bd79b267ff9fd3177ff1a098622700ee ChangeLog --- a/ChangeLog Fri Feb 10 15:03:05 2006 +0000 +++ b/ChangeLog Fri Feb 10 21:14:58 2006 +0000 @@ -10,6 +10,8 @@ * added note to lock dialog when quit disabled due to unsaved changes + * use gtk.FileChooser.set_do_overwrite_confirmation() + 2006-02-08 Erik Grinaker * cleaned up preferences dialog diff -r c9459c0691330cb4893a2d273cddbbd8475f38e7 -r 3961c230bd79b267ff9fd3177ff1a098622700ee NEWS --- a/NEWS Fri Feb 10 15:03:05 2006 +0000 +++ b/NEWS Fri Feb 10 21:14:58 2006 +0000 @@ -2,8 +2,7 @@ ============================ New features: -- use gtk.AboutDialog for about dialogs -- use gtk.FileChooserButton for selecting files +- ported to gtk+ 2.8 and gnome 2.10 - cleaned up preferences dialog Bugfixes: diff -r c9459c0691330cb4893a2d273cddbbd8475f38e7 -r 3961c230bd79b267ff9fd3177ff1a098622700ee TODO --- a/TODO Fri Feb 10 15:03:05 2006 +0000 +++ b/TODO Fri Feb 10 21:14:58 2006 +0000 @@ -6,8 +6,6 @@ - remove namespacing for field identifiers - add a unique id for each entry (md5sum or something) - xml namespace (can identify xml type in fd.o mime system) - - sha-256 password hashing - - 10k password hash iterations - add note / comment field to accounts - add remote desktop account type - add im account type diff -r c9459c0691330cb4893a2d273cddbbd8475f38e7 -r 3961c230bd79b267ff9fd3177ff1a098622700ee src/lib/dialog.py --- a/src/lib/dialog.py Fri Feb 10 15:03:05 2006 +0000 +++ b/src/lib/dialog.py Fri Feb 10 21:14:58 2006 +0000 @@ -344,14 +344,14 @@ -class FileOverwrite(Warning): - "Asks for confirmation when overwriting a file" +class FileReplace(Warning): + "Asks for confirmation when replacing a file" def __init__(self, parent, file): Warning.__init__( - self, parent, "Overwrite existing file?", + self, parent, "Replace existing file?", "The file '%s' already exists - do you wish to replace this file?" % file, - ( ( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL ), ( ui.STOCK_OVERWRITE, gtk.RESPONSE_OK ) ), + ( ( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL ), ( ui.STOCK_REPLACE, gtk.RESPONSE_OK ) ), gtk.RESPONSE_CANCEL ) @@ -554,6 +554,22 @@ gtk.FILE_CHOOSER_ACTION_SAVE, gtk.STOCK_SAVE ) + self.set_do_overwrite_confirmation(True) + self.connect("confirm-overwrite", self.__cb_confirm_overwrite) + + + def __cb_confirm_overwrite(self, widget, data = None): + "Handles confirm-overwrite signals" + + try: + FileReplace(self, io.file_normpath(self.get_uri())).run() + + except CancelError: + return gtk.FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN + + else: + return gtk.FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME + ##### PASSWORD DIALOGS ##### diff -r c9459c0691330cb4893a2d273cddbbd8475f38e7 -r 3961c230bd79b267ff9fd3177ff1a098622700ee src/lib/ui.py --- a/src/lib/ui.py Fri Feb 10 15:03:05 2006 +0000 +++ b/src/lib/ui.py Fri Feb 10 21:14:58 2006 +0000 @@ -41,7 +41,6 @@ STOCK_NEW_ENTRY = "revelation-new-entry" STOCK_NEW_FOLDER = "revelation-new-folder" STOCK_NEXT = "revelation-next" -STOCK_OVERWRITE = "revelation-overwrite" STOCK_PASSWORD_CHANGE = "revelation-password-change" STOCK_PASSWORD_CHECK = "revelation-password-check" STOCK_PASSWORD_STRONG = "revelation-password-strong" @@ -49,6 +48,7 @@ STOCK_PREVIOUS = "revelation-previous" STOCK_RELOAD = "revelation-reload" STOCK_REMOVE = "revelation-remove" +STOCK_REPLACE = "revelation-replace" STOCK_UNKNOWN = "revelation-unknown" STOCK_UNLOCK = "revelation-unlock" STOCK_UPDATE = "revelation-update" @@ -1514,7 +1514,6 @@ ( STOCK_NEW_ENTRY, "_Add Entry", gtk.STOCK_ADD ), ( STOCK_NEW_FOLDER, "_Add Folder", "stock_folder" ), ( STOCK_NEXT, "Next", gtk.STOCK_GO_DOWN ), - ( STOCK_OVERWRITE, "_Overwrite", gtk.STOCK_SAVE_AS ), ( STOCK_PASSWORD_CHANGE,"_Change", "stock_lock-ok" ), ( STOCK_PASSWORD_CHECK, "_Check", "stock_lock-ok" ), ( STOCK_PASSWORD_STRONG,"", "stock_lock-ok" ), @@ -1522,6 +1521,7 @@ ( STOCK_PREVIOUS, "Previous", gtk.STOCK_GO_UP ), ( STOCK_RELOAD, "_Reload", gtk.STOCK_REFRESH ), ( STOCK_REMOVE, "Re_move", gtk.STOCK_DELETE ), + ( STOCK_REPLACE, "_Replace", gtk.STOCK_SAVE_AS ), ( STOCK_UNKNOWN, "Unknown", gtk.STOCK_DIALOG_QUESTION ), ( STOCK_UNLOCK, "_Unlock", "stock_lock-open" ), ( STOCK_UPDATE, "_Update", "stock_edit" ), diff -r c9459c0691330cb4893a2d273cddbbd8475f38e7 -r 3961c230bd79b267ff9fd3177ff1a098622700ee src/revelation.in --- a/src/revelation.in Fri Feb 10 15:03:05 2006 +0000 +++ b/src/revelation.in Fri Feb 10 21:14:58 2006 +0000 @@ -903,9 +903,6 @@ if datafile is None: datafile = self.datafile - if io.file_normpath(str(datafile)) != io.file_normpath(file) and io.file_exists(file): - dialog.FileOverwrite(self, file).run() - if datafile.get_handler().encryption == True: if password is None: password = dialog.PasswordSave(self, file).run()