diff --git a/buypeeb.py b/buypeeb.py index 207562e..1b2d3df 100755 --- a/buypeeb.py +++ b/buypeeb.py @@ -69,8 +69,22 @@ class BuypeebApp: self.settings.save() self.app.quit() + def msgBox(self, title, text, form = Gtk.MessageType.WARNING): + msgbox = Gtk.MessageDialog(self.window, 0, form, Gtk.ButtonsType.OK, title) + msgbox.format_secondary_text(text) + response = msgbox.run() + msgbox.destroy() + return response + def btnAddClicked(self, widget): - pass + self.msgBox("good job", "succkeess") + + def btnQuitClicked(self, widget): + prompt = Gtk.MessageDialog(self.window, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, "Really quit?") + prompt.format_secondary_text("Are you sure you want to quit buypeeb?") + response = prompt.run() + if response: + self.shutdown(self) if __name__ == '__main__': app = BuypeebApp() diff --git a/functions.py b/functions.py index ce13be2..398b68e 100644 --- a/functions.py +++ b/functions.py @@ -12,12 +12,5 @@ def get_exchange_rate(): except: return 76.15 -def msgBox(title, text, form = Gtk.MessageType.WARNING): - msgbox = Gtk.MessageDialog(app.window, 0, form, Gtk.ButtonsType.OK, title) - msgbox.format_secondary_text(text) - response = msgbox.run() - msgbox.destroy() - return response - def rmatch(pattern, string): return re.match(pattern, string) != None diff --git a/ui/main.glade b/ui/main.glade index dedd09a..465e78d 100644 --- a/ui/main.glade +++ b/ui/main.glade @@ -322,10 +322,10 @@ True False - app.shutdown Quit True gtk-quit +