From 4c8f1b7a34af371afe4aa29bdcc3dde9c32a0202 Mon Sep 17 00:00:00 2001 From: "Paul W. Frields" Date: Sun, 19 Dec 2010 16:41:32 -0500 Subject: Add confirmation for case where user cancels save --- pulsecaster/ui.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'pulsecaster') diff --git a/pulsecaster/ui.py b/pulsecaster/ui.py index 7a318a4..2ac69cc 100644 --- a/pulsecaster/ui.py +++ b/pulsecaster/ui.py @@ -238,8 +238,18 @@ class PulseCasterUI: self.file_chooser.show() def hideFileChooser(self, *args): - if self.filesinkpath: - self.file_chooser.hide() + if not self.filesinkpath: + confirm = gtk.MessageDialog(type=gtk.MESSAGE_WARNING, + buttons=gtk.BUTTONS_YES_NO, + message_format=_('Are you sure you want to cancel ' + + 'saving your work? If you choose "Yes" ' + + 'your audio recording will be erased ' + + 'permanently.')) + response = confirm.run() + confirm.destroy() + if response == gtk.RESPONSE_NO: + return + self.file_chooser.hide() def updateFileSinkPath(self, *args): self.filesinkpath = self.file_chooser.get_filename() -- cgit