Commit 525a2749 authored by Ruxandra Simion's avatar Ruxandra Simion

Fix resizing after commit a43f2362

parent c82751c5
......@@ -40,6 +40,7 @@ public class Board
}
public signal void grid_changed ();
public signal void board_changed ();
private Cell src;
private Cell dst;
......@@ -78,6 +79,8 @@ public class Board
grid[row, col] = new Cell (row, col, null, null);
}
}
board_changed ();
}
public Cell[,]? get_grid ()
......
......@@ -73,12 +73,7 @@ public class View : Gtk.DrawingArea
board_rectangle = Gdk.Rectangle ();
board_rectangle.x = board_rectangle.y = 0;
update_sizes (MINIMUM_BOARD_SIZE, MINIMUM_BOARD_SIZE);
/* it depends on which one changes last, so it is better to call them both */
game.notify["n-rows"].connect (() => {
update_sizes (get_allocated_width (), get_allocated_height ());
queue_draw ();
});
game.notify["n-cols"].connect (() => {
game.board.board_changed.connect (() => {
update_sizes (get_allocated_width (), get_allocated_height ());
queue_draw ();
});
......
......@@ -74,9 +74,7 @@ public class GameWindow : Gtk.ApplicationWindow
next_pieces_widget.show ();
grid_frame.set (game.n_cols, game.n_rows);
/* it depends on which one changes last, so it is better to call them both */
game.notify["n-cols"].connect ((s, p) => { grid_frame.set (game.n_cols, game.n_rows); });
game.notify["n-rows"].connect ((s, p) => { grid_frame.set (game.n_cols, game.n_rows); });
game.board.board_changed.connect (() => { grid_frame.set (game.n_cols, game.n_rows); });
game.notify["score"].connect ((s, p) => { scorelabel.set_text (game.score.to_string ()); });
game.notify["status-message"].connect ((s, p) => { set_status_message (status[game.status_message]); });
set_status_message (status[game.status_message]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment