[gnome-mines/arnaudb/gaction: 2/2] Use GAction even more.




commit a00c0c3e0475d258f27a03052ba6b4634a11675d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Sep 9 18:15:30 2020 +0200

    Use GAction even more.

 src/gnome-mines.vala | 8 ++------
 src/interface.ui     | 6 ++++--
 2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 0dc8d9f..9e633ef 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -108,6 +108,8 @@ public class Mines : Gtk.Application
         { "medium-size",        medium_size_clicked_cb                      },
         { "large-size",         large_size_clicked_cb                       },
         { "custom-size",        show_custom_game_screen                     },
+        { "cancel-custom",      show_new_game_screen                        },
+        { "start-custom",       custom_size_clicked_cb                      },
         { "pause",              toggle_pause_cb                             },
         { "scores",             scores_cb                                   },
         { "preferences",        preferences_cb                              },
@@ -428,12 +430,6 @@ public class Mines : Gtk.Application
         mines_spin.value_changed.connect (mines_spin_cb);
         set_mines_limit ();
 
-        var button = (Button) builder.get_object ("cancel_btn");
-        button.clicked.connect (show_new_game_screen);
-
-        button = (Button) builder.get_object ("play_game_btn");
-        button.clicked.connect (custom_size_clicked_cb);
-
         custom_game_screen.show_all ();
     }
 
diff --git a/src/interface.ui b/src/interface.ui
index f2708e5..51c49cf 100644
--- a/src/interface.ui
+++ b/src/interface.ui
@@ -184,7 +184,7 @@
                         <property name="margin_top">12</property>
                         <property name="row_spacing">5</property>
                         <child>
-                          <object class="GtkButton" id="cancel_btn">
+                          <object class="GtkButton">
                             <property name="label" translatable="yes">_Cancel</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -193,6 +193,7 @@
                             <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
                             <property name="use_underline">True</property>
+                            <property name="action_name">app.cancel-custom</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
@@ -200,7 +201,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="play_game_btn">
+                          <object class="GtkButton">
                             <property name="label" translatable="yes">_Play Game</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -209,6 +210,7 @@
                             <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
                             <property name="use_underline">True</property>
+                            <property name="action_name">app.start-custom</property>
                             <style>
                               <class name="suggested-action"/>
                             </style>


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