[four-in-a-row/KaKnife/four-in-a-row-vala: 57/65] removed last global vars
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [four-in-a-row/KaKnife/four-in-a-row-vala: 57/65] removed last global vars
- Date: Sun, 16 Dec 2018 03:24:46 +0000 (UTC)
commit 86f432b5a9517fad4ad16ffb70b70db03daa6404
Author: Jacob Humphrey <jacob ryan humphrey gmail com>
Date: Sat Dec 15 05:45:37 2018 -0600
removed last global vars
src/four-in-a-row.vala | 7 +++++--
src/game-board-view.vala | 2 +-
src/games-controls-list.vala | 2 +-
src/main.vala | 6 +-----
src/prefs-box.vala | 7 ++++---
src/scorebox.vala | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/four-in-a-row.vala b/src/four-in-a-row.vala
index 2744b26..a7e4322 100644
--- a/src/four-in-a-row.vala
+++ b/src/four-in-a-row.vala
@@ -34,6 +34,7 @@ class FourInARow : Gtk.Application {
Scorebox scorebox;
GameBoardView game_board_view;
Board game_board;
+ Gtk.ApplicationWindow window;
/**
* socre:
*
@@ -706,7 +707,7 @@ class FourInARow : Gtk.Application {
protected override void startup() {
base.startup();
- scorebox = new Scorebox(this);
+
Gtk.AspectFrame frame;
GLib.Menu app_menu, section;
@@ -734,6 +735,8 @@ class FourInARow : Gtk.Application {
headerbar = builder.get_object("headerbar") as Gtk.HeaderBar;
+ scorebox = new Scorebox(window, this);
+
add_actions();
app_menu = new GLib.Menu();
@@ -792,7 +795,7 @@ class FourInARow : Gtk.Application {
return;
}
- prefsbox = new PrefsBox(window);
+ prefsbox = new PrefsBox(window, this);
prefsbox.show_all();
}
}
diff --git a/src/game-board-view.vala b/src/game-board-view.vala
index 7e77de8..f6294ab 100644
--- a/src/game-board-view.vala
+++ b/src/game-board-view.vala
@@ -149,7 +149,7 @@ class GameBoardView : Gtk.DrawingArea {
void load_error(string fname) {
Gtk.MessageDialog dialog;
- dialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.MODAL,
+ dialog = new Gtk.MessageDialog(get_window() as Gtk.Window, Gtk.DialogFlags.MODAL,
Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE,
dgettext(Config.GETTEXT_PACKAGE, "Unable to load image:\n%s"), fname);
diff --git a/src/games-controls-list.vala b/src/games-controls-list.vala
index c7228ef..281b56a 100644
--- a/src/games-controls-list.vala
+++ b/src/games-controls-list.vala
@@ -146,7 +146,7 @@ public class GamesControlsList : Gtk.ScrolledWindow {
unused_key = false;
if (conf_key == actual_conf_key) {
- var dialog = new Gtk.MessageDialog.with_markup(window,
+ var dialog = new Gtk.MessageDialog.with_markup(null,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.MessageType.WARNING,
Gtk.ButtonsType.OK,
diff --git a/src/main.vala b/src/main.vala
index d110db2..0457ed3 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -72,14 +72,10 @@ public enum SoundID {
COLUMN_FULL
}
-FourInARow? application;
-Gtk.ApplicationWindow window;
-//Settings settings;
-
public int main(string[] argv) {
Intl.setlocale();
- application = new FourInARow();
+ var application = new FourInARow();
Intl.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
Intl.bind_textdomain_codeset(Config.GETTEXT_PACKAGE, "UTF-8");
diff --git a/src/prefs-box.vala b/src/prefs-box.vala
index 0b0ab51..81e88d9 100644
--- a/src/prefs-box.vala
+++ b/src/prefs-box.vala
@@ -23,8 +23,9 @@ class PrefsBox : Gtk.Dialog {
Gtk.ComboBox combobox;
Gtk.ComboBoxText combobox_theme;
Gtk.ToggleButton checkbutton_sound;
+ FourInARow application;
- public PrefsBox(Gtk.Window parent) {
+ public PrefsBox(Gtk.Window parent, FourInARow application) {
Gtk.Grid grid;
GamesControlsList controls_list;
Gtk.Label label;
@@ -140,7 +141,7 @@ class PrefsBox : Gtk.Dialog {
Prefs.instance.level[PlayerID.PLAYER2] = (Level)value;
Prefs.instance.settings.set_int("opponent", value);
- global::application.who_starts = PlayerID.PLAYER2; /* This gets reversed in game_reset. */
- global::application.game_reset();
+ application.who_starts = PlayerID.PLAYER2; /* This gets reversed in game_reset. */
+ application.game_reset();
}
}
diff --git a/src/scorebox.vala b/src/scorebox.vala
index 702b55e..63e78f2 100644
--- a/src/scorebox.vala
+++ b/src/scorebox.vala
@@ -36,7 +36,7 @@ class Scorebox : Gtk.Dialog {
// }
// }
- public Scorebox(FourInARow application) {
+ public Scorebox(Gtk.Window parent, FourInARow application) {
Object(title: _("Scores"),
//parent: window,
use_header_bar: 1,
@@ -44,7 +44,7 @@ class Scorebox : Gtk.Dialog {
resizable: false,
border_width: 5);
get_content_area().spacing = 2;
- set_transient_for(window);
+ set_transient_for(parent);
Gtk.Grid grid, grid2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]