Make adjustments

This commit is contained in:
daleclack 2022-10-19 19:52:46 +08:00
parent 7fb70bed6f
commit 8e751b2b7d
3 changed files with 12 additions and 4 deletions

View File

@ -39,6 +39,11 @@ MineSweeper::MineSweeper()
// Create Scores Window
scores_win = ScoresWin::create();
// Bind windows
input_dialog->set_transient_for(*this);
scores_win->set_transient_for(*this);
input_dialog->set_scores_window(scores_win);
// Show everything
add(main_box);
show_all_children();
@ -251,9 +256,6 @@ void MineSweeper::check_mines(int pos_x, int pos_y)
mytimer.disconnect();
// Save the time of game
input_dialog->set_transient_for(*this);
scores_win->set_transient_for(*this);
input_dialog->set_scores_window(scores_win);
input_dialog->set_game_time(timer_count);
input_dialog->show_all();
}

View File

@ -4,7 +4,9 @@ ScoresWin::ScoresWin(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &
: Gtk::Window(cobject),
ref_builder(ref_Glade)
{
// Get Widgets
ref_builder->get_widget("btnclose", btnclose);
btnclose->signal_clicked().connect(sigc::mem_fun(*this, &ScoresWin::hide));
}
ScoresWin *ScoresWin::create()

View File

@ -10,4 +10,8 @@ class ScoresWin : public Gtk::Window{
private:
Glib::RefPtr<Gtk::Builder> ref_builder;
// Child widgets
Gtk::Button *btnclose;
Gtk::TreeView *tree_view;
};