1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains interface of the project_properties_dialog class
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <libglademm/xml.h>
32 #include "project.hpp"
33 #include "project_properties.hpp"
35 #include "globals.hpp"
37 struct project_properties_dialog_impl
39 Widget
<Gtk::Dialog
> _dialog
;
40 Widget
<Gtk::Entry
> _name
;
41 Widget
<Gtk::Entry
> _description
;
42 Widget
<Gtk::TextView
> _notes
;
44 project_properties_dialog_impl();
47 project_properties_dialog::project_properties_dialog()
49 _impl_ptr
= new project_properties_dialog_impl
;
53 project_properties_dialog::~project_properties_dialog()
59 project_properties_dialog::run(
60 boost::shared_ptr
<project
> project_ptr
)
63 std::string description
;
65 Glib::RefPtr
<Gtk::TextBuffer
> buffer
;
68 project_ptr
->get_name(name
);
69 _impl_ptr
->_name
->set_text(name
);
71 project_ptr
->get_description(description
);
72 _impl_ptr
->_description
->set_text(description
);
74 project_ptr
->get_notes(notes
);
75 buffer
= _impl_ptr
->_notes
->get_buffer();
76 buffer
->set_text(notes
);
78 result
= _impl_ptr
->_dialog
->run();
81 project_ptr
->do_change_description(_impl_ptr
->_description
->get_text());
82 project_ptr
->do_change_notes(buffer
->get_text());
83 project_ptr
->do_rename(_impl_ptr
->_name
->get_text());
86 _impl_ptr
->_dialog
->hide();
89 project_properties_dialog_impl::project_properties_dialog_impl()
91 _dialog
.init(g_xml
, "project_properties_dialog");
92 _name
.init(g_xml
, "project_name");
93 _description
.init(g_xml
, "project_description");
94 _notes
.init(g_xml
, "project_notes");