[gnome-nibbles/arnaudb/wip/gtk4: 155/188] Adapt to GtkDialog API.




commit 7e3f395a8351be27773064b0ea4a49e9c8c7af3c
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 f1f6243..13c8a3f 100644
--- a/src/nibbles-window.vala
+++ b/src/nibbles-window.vala
@@ -926,9 +926,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 216a1e2..ae79abb 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -194,11 +194,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]