[gnome-chess/mcatanzaro/gtk4] Progress
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/mcatanzaro/gtk4] Progress
- Date: Wed, 23 Dec 2020 00:46:08 +0000 (UTC)
commit 7e8331a8065e248df7de3b74ce4c670f28976e09
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Dec 22 17:02:17 2020 -0600
Progress
src/gnome-chess.vala | 37 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index d57d092..7458b04 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -184,6 +184,7 @@ Copyright © 2015–2016 Sahil Sareen""";
set_accels_for_action ("win." + UNDO_MOVE_ACTION_NAME, { "<Primary>z" });
set_accels_for_action ("win." + PAUSE_RESUME_ACTION_NAME, { "<Primary>p",
"Pause" });
+
add_window (window);
scene = new ChessScene ();
@@ -417,6 +418,7 @@ return null;
autosave ();
window.destroy ();
+ window = null;
}
private void autosave ()
@@ -1483,15 +1485,6 @@ return null;
black_time_label.queue_draw ();
}
-#if 0
- [CCode (cname = "gnome_chess_app_delete_event_cb", instance_pos = -1)]
- public bool gnome_chess_app_delete_event_cb (Widget widget, Gdk.Event event)
- {
- quit_game ();
- return false;
- }
-#endif
-
private bool prompt_save_game (string prompt_text)
{
#if 0
@@ -2471,9 +2464,19 @@ return null;
present_save_dialog ();
}
+ private void open_game_response_cb (int response_id)
+ {
+ if (response_id == ResponseType.ACCEPT)
+ {
+ game_file = open_dialog.get_file ();
+ load_game (game_file);
+ }
+
+ open_dialog.hide ();
+ }
+
public void open_game_cb ()
{
-#if 0
if (!prompt_save_game (_("Save this game before loading another one?")))
return;
@@ -2498,18 +2501,12 @@ return null;
all_filter.set_filter_name (_("All files"));
all_filter.add_pattern ("*");
open_dialog.add_filter (all_filter);
- }
- var response_id = open_dialog.run ();
- if (response_id == ResponseType.ACCEPT)
- {
- game_file = open_dialog.get_file ();
- open_dialog.destroy ();
- open_dialog = null;
-
- load_game (game_file);
+ open_dialog.modal = true;
+ open_dialog.response.connect (open_game_response_cb);
}
-#endif
+
+ open_dialog.show ();
}
private void start_new_game ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]