Commit f3aeb9f6 authored by Manuel Cortez's avatar Manuel Cortez

Ask for confirmation before exiting

parent 20dcb4a4
......@@ -4,6 +4,8 @@
### New additions
* Socializer will ask for confirmation before closing the application.
### bugfixes
* Fixed an error that was making socializer unable to render correctly certain Links containing uppercase letters (such as yandex.disk shared links). Before, those links were giving 404 errors when pressed, now they should work normally. This error was present in wall posts, comments, topics and chat messages.
......
......@@ -619,6 +619,7 @@ class Controller(object):
### GUI events
# These functions are connected to GUI elements such as menus, buttons and so on.
def connect_gui_events(self):
widgetUtils.connectExitFunction(self.exit_)
widgetUtils.connect_event(self.window, widgetUtils.CLOSE_EVENT, self.exit)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.update_buffer, menuitem=self.window.update_buffer)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.check_for_updates, menuitem=self.window.check_for_updates)
......@@ -655,6 +656,11 @@ class Controller(object):
self.window.tb.Bind(wx.EVT_CONTEXT_MENU, self.on_context_menu)
def exit(self, *args, **kwargs):
answer = commonMessages.exit()
if answer == widgetUtils.YES:
self.exit_()
def exit_(self, *args, **kwargs):
""" Try to set offline in the current user's profile at VK, then closes the application. """
log.debug("Receibed an exit signal. closing...")
self.set_offline()
......
......@@ -93,4 +93,8 @@ def alpha_reminder():
sys.exit()
return
else:
return wx.MessageDialog(None, _("Please remember that from November 27, 2019, you will have to download the alpha version from scratch from the Socializer website. The alpha version you are currently running will no longer receive updates. The new alpha version, which must be downloaded from the project's page, should not be considered suspicious by most antivirus vendors and all automatic updates will be sent to the new generation of socializer alpha. Thank you for your patience."), _("Important notice"), style=wx.OK).ShowModal()
\ No newline at end of file
return wx.MessageDialog(None, _("Please remember that from November 27, 2019, you will have to download the alpha version from scratch from the Socializer website. The alpha version you are currently running will no longer receive updates. The new alpha version, which must be downloaded from the project's page, should not be considered suspicious by most antivirus vendors and all automatic updates will be sent to the new generation of socializer alpha. Thank you for your patience."), _("Important notice"), style=wx.OK).ShowModal()
def exit():
dlg = wx.MessageDialog(None, _("Do you really want to close Socializer?"), _("Exit"), wx.YES_NO|wx.ICON_QUESTION)
return dlg.ShowModal()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment