[lightsoff/wip/gtkview] Removed unnecessary simple method



commit c7381f6bdb2cb04440331e65fef534e63a2ee6f0
Author: Robert Roth <robert roth off gmail com>
Date:   Tue Jul 17 01:32:04 2018 +0300

    Removed unnecessary simple method

 src/board-view-clutter.vala |  7 +------
 src/board-view-gtk.vala     | 11 +++--------
 2 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/src/board-view-clutter.vala b/src/board-view-clutter.vala
index ec97086..f8b4e87 100644
--- a/src/board-view-clutter.vala
+++ b/src/board-view-clutter.vala
@@ -104,7 +104,7 @@ public class BoardViewClutter : Clutter.Group, BoardView
                 l.reactive = true;
                 var tap = new Clutter.TapAction ();
                 l.add_action (tap);
-                tap.tap.connect (light_button_press_cb);
+                tap.tap.connect ((tap, actor) => handle_toggle (actor));
 
                 float xx, yy;
                 get_light_position (x, y, out xx, out yy);
@@ -142,11 +142,6 @@ public class BoardViewClutter : Clutter.Group, BoardView
                                "y", sign * (1 - direction) * height);
     }
 
-    private void light_button_press_cb (Clutter.TapAction tap, Clutter.Actor actor)
-    {
-        handle_toggle (actor);
-    }
-
     // Toggle a light and those in each cardinal direction around it.
     public void toggle_light (int x, int y, bool animate = true)
     {
diff --git a/src/board-view-gtk.vala b/src/board-view-gtk.vala
index fa73c06..0fce027 100644
--- a/src/board-view-gtk.vala
+++ b/src/board-view-gtk.vala
@@ -41,7 +41,7 @@ public class BoardViewGtk : Gtk.Grid, BoardView
             {
                 lights[x, y] = new Gtk.ToggleButton ();
                 lights[x, y].show ();
-                lights[x, y].toggled.connect (light_toggled_cb);
+                lights[x, y].toggled.connect (handle_toggle);
                 attach (lights[x, y], x, y, 1, 1);
                 focus_list.append (lights[x, y]);
             }
@@ -49,10 +49,6 @@ public class BoardViewGtk : Gtk.Grid, BoardView
         _moves = 0;
     }
 
-    public void light_toggled_cb (Gtk.ToggleButton source)
-    {
-        handle_toggle (source);
-    }
     // Pseudorandomly generates and sets the state of each light based on
     // a level number; hopefully this is stable between machines, but that
     // depends on GLib's PRNG stability. Also, provides some semblance of
@@ -61,7 +57,7 @@ public class BoardViewGtk : Gtk.Grid, BoardView
      // Toggle a light and those in each cardinal direction around it.
     public void toggle_light (int x, int y, bool clicked = true)
     {
-        @foreach((light) => (light as Gtk.ToggleButton).toggled.disconnect (light_toggled_cb));
+        @foreach((light) => (light as Gtk.ToggleButton).toggled.disconnect (handle_toggle));
 
         if (x>= size || y >= size || x < 0 || y < 0 )
             return;
@@ -77,10 +73,9 @@ public class BoardViewGtk : Gtk.Grid, BoardView
         if (!clicked)
             lights[(int) x, (int) y].set_active (!lights[(int) x, (int) y ].get_active ());
 
-        @foreach((light) => (light as Gtk.ToggleButton).toggled.connect (light_toggled_cb));
+        @foreach((light) => (light as Gtk.ToggleButton).toggled.connect (handle_toggle));
     }
 
-
     public void clear_level ()
     {
         /* Clear level */


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