[gnome-nibbles/arnaudb/wip/gtk4: 18/40] Adapt to GtkDialog API.



commit 7106d61a1c65ffe687ba6248484126fbecba42c5
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun May 31 00:19:46 2020 +0200

    Adapt to GtkDialog API.

 src/nibbles-window.vala     |  4 +++-
 src/preferences-dialog.vala | 15 ++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/nibbles-window.vala b/src/nibbles-window.vala
index 4885444..50d5331 100644
--- a/src/nibbles-window.vala
+++ b/src/nibbles-window.vala
@@ -830,9 +830,11 @@ private class NibblesWindow : ApplicationWindow
 
         PreferencesDialog preferences_dialog = new PreferencesDialog (this, settings, worm_settings, ((!) 
variant).get_int32 (), game.numhumans);
 
-        preferences_dialog.destroy.connect (() => {
+        preferences_dialog.close_request.connect (() => {
                 if (should_unpause)
                     pause_action.activate (null);
+
+                return /* do your usual stuff */ false;
             });
 
         preferences_dialog.present ();
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index 859b1a4..0c60a51 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -197,11 +197,16 @@ private class PreferencesDialog : Window
                 /* Translators: label of one of the buttons of a MessageDialog that appears when one tries 
to assign an already assigned key (with a mnemonic that appears when pressing Alt) */
                 dialog.add_button (_("_Set anyway"), 42);
 
-                int response = dialog.run ();
-                dialog.destroy ();
-                if (response != 42)
-                    valid = false;
-                break;
+                dialog.response.connect ((_dialog, response) => {
+                        _dialog.destroy ();
+                        if (response == 42)
+                        {
+                            list_store.@set (it, 2, keyval);
+                            worm_settings[id].set_int (key, (int) keyval);
+                        }
+                    });
+                dialog.present ();
+                return;
             }
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]