1 // Copyright (C) 2007 Ole Laursen
2 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Library General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #include <sigc++/functors/mem_fun.h>
23 #include "map-info-dialog.h"
25 #include "glade-helpers.h"
26 #include "ucompose.hpp"
29 #include "GameScenario.h"
32 MapInfoDialog::MapInfoDialog(GameScenario *g)
36 Glib::RefPtr<Gtk::Builder> xml
37 = Gtk::Builder::create_from_file(get_glade_path()
38 + "/map-info-dialog.ui");
40 xml->get_widget("dialog", dialog);
42 xml->get_widget("name_entry", name_entry);
43 name_entry->set_text(game_scenario->getName());
45 xml->get_widget("description_textview", description_textview);
46 description_textview->get_buffer()->set_text(game_scenario->getComment());
47 xml->get_widget("copyright_textview", copyright_textview);
48 copyright_textview->get_buffer()->set_text(game_scenario->getCopyright());
49 xml->get_widget("license_textview", license_textview);
50 license_textview->get_buffer()->set_text(game_scenario->getLicense());
53 MapInfoDialog::~MapInfoDialog()
57 void MapInfoDialog::set_parent_window(Gtk::Window &parent)
59 dialog->set_transient_for(parent);
60 //dialog->set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
63 int MapInfoDialog::run()
66 int response = dialog->run();
68 if (response == Gtk::RESPONSE_ACCEPT) // accepted
70 game_scenario->setName(name_entry->get_text());
71 game_scenario->setComment(description_textview->get_buffer()->get_text());
72 game_scenario->setCopyright(copyright_textview->get_buffer()->get_text());
73 game_scenario->setLicense(license_textview->get_buffer()->get_text());