Skip to content
Snippets Groups Projects
Commit 1158f96c authored by Nico's avatar Nico
Browse files

Warn users of closure

Closes #54
parent 57161b53
No related branches found
No related tags found
No related merge requests found
Pipeline #4788 failed
......@@ -2,7 +2,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
from gi.repository import Gtk
from gettext import gettext as _
from gi.repository import Gio, Gtk
from briar_gtk.actions.window import WindowActions
from briar_gtk.containers.add_contact import AddContactContainer
......@@ -29,6 +30,32 @@ class Window(Gtk.ApplicationWindow):
self.current_container.destroy()
self._setup_add_contact_container()
def do_delete_event(self, event):
settings = Gio.Settings.new(APPLICATION_ID)
if settings.get_boolean("quit-dialog-shown"):
return False
settings.set_boolean("quit-dialog-shown", True)
confirmation_dialog = Gtk.MessageDialog(
transient_for=self,
flags=Gtk.DialogFlags.MODAL,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK_CANCEL,
text=_("Are you sure you want to exit?")
)
confirmation_dialog.format_secondary_text(
_("Once you close Briar, you'll no longer receive or send "
"pending messages. Keep Briar open to stay connected "
"with your contacts.")
)
response = confirmation_dialog.run()
confirmation_dialog.destroy()
if response == Gtk.ResponseType.OK:
return False
return True # keeps the application running
def _initialize_gtk_application_window(self):
Gtk.ApplicationWindow.__init__(self, application=APP(),
title=APPLICATION_NAME,
......
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="briar_gtk">
<schema id="app.briar.gtk" path="/app/briar/gtk/">
</schema>
</schemalist>
......@@ -33,10 +33,6 @@ if appstream_util.found()
)
endif
install_data('app.briar.gtk.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)
compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test('Validate schema file', compile_schemas,
......
......@@ -10,5 +10,6 @@
<file compressed="true" preprocess="xml-stripblanks">private_chat.ui</file>
<file compressed="true" preprocess="xml-stripblanks">registration.ui</file>
<file compressed="true" preprocess="xml-stripblanks">about_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">app.briar.gtk.gschema.xml</file>
</gresource>
</gresources>
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="briar_gtk">
<schema id="app.briar.gtk" path="/app/briar/gtk/" gettext-domain="briar-gtk">
<key name="quit-dialog-shown" type="b">
<default>false</default>
<summary>Quit dialog has been shown already</summary>
<description>It should only be shown once</description>
</key>
</schema>
</schemalist>
......@@ -16,3 +16,7 @@ gnome.compile_resources('briar-gtk',
configuration: conf
)
)
install_data('app.briar.gtk.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)
......@@ -152,6 +152,12 @@ msgstr ""
msgid "Myself"
msgstr ""
msgid "Are you sure you want to exit?"
msgstr ""
msgid "Once you close Briar, you'll no longer receive or send pending messages. Keep Briar open to stay connected with your contacts."
msgstr ""
msgid "Confirm Contact Deletion"
msgstr "تأكيد حذف جهة الإتصال"
......
......@@ -162,6 +162,12 @@ msgstr ""
msgid "Myself"
msgstr ""
msgid "Are you sure you want to exit?"
msgstr ""
msgid "Once you close Briar, you'll no longer receive or send pending messages. Keep Briar open to stay connected with your contacts."
msgstr ""
msgid "Confirm Contact Deletion"
msgstr ""
......
......@@ -152,6 +152,12 @@ msgstr "Briar-Funktionalität von"
msgid "Myself"
msgstr "Ich"
msgid "Are you sure you want to exit?"
msgstr "Willst du Briar wirklich beenden?"
msgid "Once you close Briar, you'll no longer receive or send pending messages. Keep Briar open to stay connected with your contacts."
msgstr "Sobald du Briar schließt, wirst du keine ausstehenden Nachrichten mehr empfangen oder senden können. Lass Briar offen, um mit deinen Kontakten in Verbindung zu bleiben."
msgid "Confirm Contact Deletion"
msgstr "Löschen des Kontakts bestätigen"
......
......@@ -152,6 +152,12 @@ msgstr "Funcionalidad de Briar de"
msgid "Myself"
msgstr "Yo"
msgid "Are you sure you want to exit?"
msgstr "¿Estás seguro que quieres salir?"
msgid "Once you close Briar, you'll no longer receive or send pending messages. Keep Briar open to stay connected with your contacts."
msgstr "Cuando cierres Briar, no vas a recibir o enviar mensajes pendientes. Mantenlo abierto para permanecer conectado con tus contactos."
msgid "Confirm Contact Deletion"
msgstr "Confirmar eliminación de contacto"
......
......@@ -17,7 +17,7 @@ function generate_resource()
echo -n $(basename $file)
echo '</file>'
done
for file in briar-gtk/data/ui/*.ui about_dialog.ui
for file in briar-gtk/data/ui/*.ui about_dialog.ui briar-gtk/data/ui/app.briar.gtk.gschema.xml
do
echo -n ' <file compressed="true" preprocess="xml-stripblanks">'
echo -n $(basename $file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment