From f0f8d27d194341c1c2920bc104fd1b91d3d5a474 Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 19 May 2009 19:50:05 +0000 Subject: [PATCH] Added on_quit method. --- pygtktalog/controllers/main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pygtktalog/controllers/main.py b/pygtktalog/controllers/main.py index e7f4349..ca92ccf 100644 --- a/pygtktalog/controllers/main.py +++ b/pygtktalog/controllers/main.py @@ -5,8 +5,11 @@ Author: Roman 'gryf' Dobosz, gryf73@gmail.com Created: 2009-05-02 """ +import gtk + from gtkmvc import Controller +from pygtktalog.dialogs import yesno, okcancel, info, warn, error class MainController(Controller): """ @@ -26,3 +29,24 @@ class MainController(Controller): progress bar/status bar adapters goes here """ pass + + + def on_quit_activate(self, widget): + """Quit and save window parameters to config file""" + # check if any unsaved project is on go. + #if self.model.unsaved_project and \ + #self.model.config.confd['confirmquit']: + # if not yesno.Qst(_("Quit application") + " - pyGTKtalog", + # _("Do you really want to quit?"), + # _("Current database is not saved, any changes " + # "will be lost.")).run(): + # return + #self.__store_settings() + #self.model.cleanup() + msg1 = _("Do you really want to quit?") + msg2 = _("Current database is not saved, any changes will be lost.") + title = _("Quit application") + " - pyGTKtalog" + + if yesno(msg1, msg2, title, 0): + gtk.main_quit() + return False