diff options
Diffstat (limited to 'grc/gui/MainWindow.py')
-rw-r--r-- | grc/gui/MainWindow.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py index d1cf866ce7..f26f30ea78 100644 --- a/grc/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -236,10 +236,15 @@ class MainWindow(gtk.Window): if self.page_to_be_closed.get_proc() or not self.page_to_be_closed.get_saved(): self._set_page(self.page_to_be_closed) #unsaved? ask the user - if not self.page_to_be_closed.get_saved() and self._save_changes(): - Actions.FLOW_GRAPH_SAVE() #try to save - if not self.page_to_be_closed.get_saved(): #still unsaved? - self.page_to_be_closed = None #set the page to be closed back to None + if not self.page_to_be_closed.get_saved(): + response = self._save_changes() # return value is either OK, CLOSE, or CANCEL + if response == gtk.RESPONSE_OK: + Actions.FLOW_GRAPH_SAVE() #try to save + if not self.page_to_be_closed.get_saved(): #still unsaved? + self.page_to_be_closed = None #set the page to be closed back to None + return + elif response == gtk.RESPONSE_CANCEL: + self.page_to_be_closed = None return #stop the flow graph if executing if self.page_to_be_closed.get_proc(): Actions.FLOW_GRAPH_KILL() @@ -337,12 +342,17 @@ class MainWindow(gtk.Window): Save changes to flow graph? Returns: - true if yes + the response_id (see buttons variable below) """ + buttons = ( + 'Close without saving', gtk.RESPONSE_CLOSE, + gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_SAVE, gtk.RESPONSE_OK + ) return MessageDialogHelper( - gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Unsaved Changes!', - 'Would you like to save changes before closing?' - ) == gtk.RESPONSE_YES + gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, 'Unsaved Changes!', + 'Would you like to save changes before closing?', buttons + ) def _get_files(self): """ |