diff --git a/briar-gtk/briar_gtk/window.py b/briar-gtk/briar_gtk/window.py index ab7132393e604ad88961d5a978d967a41059e475..3ef29177419d8094375c3012bef5252154d510cb 100644 --- a/briar-gtk/briar_gtk/window.py +++ b/briar-gtk/briar_gtk/window.py @@ -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,33 @@ class Window(Gtk.ApplicationWindow): self.current_container.destroy() self._setup_add_contact_container() + # pylint: disable=arguments-differ,unused-argument + def do_delete_event(self, event): + settings = Gio.Settings.new(APPLICATION_ID) + if settings.get_boolean("quit-dialog-shown"): + return False # closes the window + 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 # closes the window + + return True # keeps the window open + def _initialize_gtk_application_window(self): Gtk.ApplicationWindow.__init__(self, application=APP(), title=APPLICATION_NAME, diff --git a/briar-gtk/data/app.briar.gtk.gschema.xml b/briar-gtk/data/app.briar.gtk.gschema.xml deleted file mode 100644 index acbc4eea9ab180873f2c546629df176206b29050..0000000000000000000000000000000000000000 --- a/briar-gtk/data/app.briar.gtk.gschema.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<schemalist gettext-domain="briar_gtk"> - <schema id="app.briar.gtk" path="/app/briar/gtk/"> - </schema> -</schemalist> diff --git a/briar-gtk/data/meson.build b/briar-gtk/data/meson.build index 047c5776720b6c5673aca72a593ca9ffaf3eefa1..5743dc9acbb552b87e56a3c1a17d85519177422d 100644 --- a/briar-gtk/data/meson.build +++ b/briar-gtk/data/meson.build @@ -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, diff --git a/briar-gtk/data/ui/app.briar.gtk.gresource.xml b/briar-gtk/data/ui/app.briar.gtk.gresource.xml index 6767e4c02d9983d6c1dd3acf90a61f01e5eec70f..a059c5c50a1a909cea7250344a9b8241aae77ecc 100644 --- a/briar-gtk/data/ui/app.briar.gtk.gresource.xml +++ b/briar-gtk/data/ui/app.briar.gtk.gresource.xml @@ -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> diff --git a/briar-gtk/data/ui/app.briar.gtk.gschema.xml b/briar-gtk/data/ui/app.briar.gtk.gschema.xml new file mode 100644 index 0000000000000000000000000000000000000000..d143ff18f55abe09fd730c14fa766dbe23df6b94 --- /dev/null +++ b/briar-gtk/data/ui/app.briar.gtk.gschema.xml @@ -0,0 +1,10 @@ +<?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> diff --git a/briar-gtk/data/ui/meson.build b/briar-gtk/data/ui/meson.build index cd985dbd5606d21fe61a7f294bab64fef2df92a8..8387be5a9378ab6f29c799e40ce3cd215f7891bf 100644 --- a/briar-gtk/data/ui/meson.build +++ b/briar-gtk/data/ui/meson.build @@ -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') +) diff --git a/briar-gtk/po/ar.po b/briar-gtk/po/ar.po index 0181ef8abb7d6557395f08d5358522f739fba482..2e3e2c217f15b40f3551faa5a5bac025ab2bd755 100644 --- a/briar-gtk/po/ar.po +++ b/briar-gtk/po/ar.po @@ -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 "تأكيد ØØ°Ù جهة الإتصال" diff --git a/briar-gtk/po/briar-gtk.pot b/briar-gtk/po/briar-gtk.pot index 3242ea495a20eef43c3c5760ceb51bc48c34592b..9b93da80683fe59fc64c31b3862b82a3fa55073e 100644 --- a/briar-gtk/po/briar-gtk.pot +++ b/briar-gtk/po/briar-gtk.pot @@ -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 "" diff --git a/briar-gtk/po/de.po b/briar-gtk/po/de.po index e33a58773ba9813020020261853bd5e1ac3535b3..ac511a486135e993249ea373dfda73c65fd59024 100644 --- a/briar-gtk/po/de.po +++ b/briar-gtk/po/de.po @@ -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" diff --git a/briar-gtk/po/es.po b/briar-gtk/po/es.po index cef368ad00da4275d709d36a244520fbe8227169..66ffb151e8c5baf922aec2af86920ad3be56c665 100644 --- a/briar-gtk/po/es.po +++ b/briar-gtk/po/es.po @@ -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" diff --git a/tools/generate_data.sh b/tools/generate_data.sh index de14b4533f05b90b7764b202b9f39ec1ee26110a..a12c691a260466ab17b46290ce307c7142fbf41b 100755 --- a/tools/generate_data.sh +++ b/tools/generate_data.sh @@ -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)