| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 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 | |
|---|
| 37 | struct 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 | |
|---|
| 47 | project_properties_dialog::project_properties_dialog() |
|---|
| 48 | { |
|---|
| 49 | _impl_ptr = new project_properties_dialog_impl; |
|---|
| 50 | |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | project_properties_dialog::~project_properties_dialog() |
|---|
| 54 | { |
|---|
| 55 | delete _impl_ptr; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | void |
|---|
| 59 | project_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 | |
|---|
| 89 | project_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 | } |
|---|