root/gui/project_properties.cpp

Revision 05a08605dab4caa7ae36474a28227061bab5205f, 2.7 KB (checked in by Nedko Arnaudov <nedko@…>, 14 months ago)

remove use of implicit namespaces

  • Property mode set to 100644
Line 
1/* -*- Mode: C ; c-basic-offset: 2 -*- */
2/*
3 * LADI Session Handler (ladish)
4 *
5 * Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
6 *
7 **************************************************************************
8 * This file contains interface of the project_properties_dialog class
9 **************************************************************************
10 *
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.
15 *
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.
20 *
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.
25 */
26
27#include "common.h"
28
29#include <gtkmm.h>
30#include <libglademm/xml.h>
31
32#include "project.hpp"
33#include "project_properties.hpp"
34#include "Widget.hpp"
35#include "globals.hpp"
36
37struct project_properties_dialog_impl
38{
39  Widget<Gtk::Dialog> _dialog;
40  Widget<Gtk::Entry> _name;
41  Widget<Gtk::Entry> _description;
42  Widget<Gtk::TextView> _notes;
43
44  project_properties_dialog_impl();
45};
46
47project_properties_dialog::project_properties_dialog()
48{
49  _impl_ptr = new project_properties_dialog_impl;
50
51}
52
53project_properties_dialog::~project_properties_dialog()
54{
55  delete _impl_ptr;
56}
57
58void
59project_properties_dialog::run(
60  boost::shared_ptr<project> project_ptr)
61{
62  std::string name;
63  std::string description;
64  std::string notes;
65  Glib::RefPtr<Gtk::TextBuffer> buffer;
66  int result;
67
68  project_ptr->get_name(name);
69  _impl_ptr->_name->set_text(name);
70
71  project_ptr->get_description(description);
72  _impl_ptr->_description->set_text(description);
73
74  project_ptr->get_notes(notes);
75  buffer = _impl_ptr->_notes->get_buffer();
76  buffer->set_text(notes);
77
78  result = _impl_ptr->_dialog->run();
79  if (result == 2)
80  {
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());
84  }
85
86  _impl_ptr->_dialog->hide();
87}
88
89project_properties_dialog_impl::project_properties_dialog_impl()
90{
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");
95}
Note: See TracBrowser for help on using the browser.