diff options
author | David Robillard <d@drobilla.net> | 2010-12-15 04:35:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-15 04:35:58 +0000 |
commit | 02dbee4a9bd8a02873b359cbc45e55f0b3de3973 (patch) | |
tree | e9270a04cf6d2ef9f896aef29d24b0dacd3e1ca9 /src/ProjectPropertiesDialog.cpp | |
parent | ef93b2e47870c95e9c9b547a23f9a4279a20451f (diff) | |
download | patchage-02dbee4a9bd8a02873b359cbc45e55f0b3de3973.tar.gz patchage-02dbee4a9bd8a02873b359cbc45e55f0b3de3973.tar.bz2 patchage-02dbee4a9bd8a02873b359cbc45e55f0b3de3973.zip |
Remove LashProxy dependency from Project.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2696 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/ProjectPropertiesDialog.cpp')
-rw-r--r-- | src/ProjectPropertiesDialog.cpp | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/ProjectPropertiesDialog.cpp b/src/ProjectPropertiesDialog.cpp index ef52c3d..36f0a1f 100644 --- a/src/ProjectPropertiesDialog.cpp +++ b/src/ProjectPropertiesDialog.cpp @@ -18,6 +18,8 @@ #include <gtkmm.h> #include <libglademm/xml.h> + +#include "LashProxy.hpp" #include "Patchage.hpp" #include "Project.hpp" #include "ProjectPropertiesDialog.hpp" @@ -28,18 +30,19 @@ using namespace std; struct ProjectPropertiesDialogImpl { - ProjectPropertiesDialogImpl(Glib::RefPtr<Gnome::Glade::Xml> xml); + ProjectPropertiesDialogImpl(LashProxy* proxy, Glib::RefPtr<Gnome::Glade::Xml> xml); - Widget<Gtk::Dialog> _dialog; - Widget<Gtk::Entry> _name; - Widget<Gtk::Entry> _description; + LashProxy* _proxy; + Widget<Gtk::Dialog> _dialog; + Widget<Gtk::Entry> _name; + Widget<Gtk::Entry> _description; Widget<Gtk::TextView> _notes; }; -ProjectPropertiesDialog::ProjectPropertiesDialog(Glib::RefPtr<Gnome::Glade::Xml> xml) +ProjectPropertiesDialog::ProjectPropertiesDialog(LashProxy* proxy, Glib::RefPtr<Gnome::Glade::Xml> xml) { - _impl = new ProjectPropertiesDialogImpl(xml); + _impl = new ProjectPropertiesDialogImpl(proxy, xml); } @@ -64,17 +67,27 @@ ProjectPropertiesDialog::run(shared_ptr<Project> project) result = _impl->_dialog->run(); if (result == 2) { - project->do_change_description(_impl->_description->get_text()); - project->do_change_notes(buffer->get_text()); - project->do_rename(_impl->_name->get_text()); + const std::string& old_name = project->get_name(); + const std::string& desc = _impl->_description->get_text(); + const std::string& notes = buffer->get_text(); + const std::string& name = _impl->_name->get_text(); + if (project->get_description() != desc) + _impl->_proxy->project_set_description(old_name, _impl->_description->get_text()); + if (project->get_notes() != notes) + _impl->_proxy->project_set_notes(old_name, buffer->get_text()); + if (old_name != name) + _impl->_proxy->project_rename(old_name, buffer->get_text()); } _impl->_dialog->hide(); } -ProjectPropertiesDialogImpl::ProjectPropertiesDialogImpl(Glib::RefPtr<Gnome::Glade::Xml> xml) - : _dialog(xml, "project_properties_dialog") +ProjectPropertiesDialogImpl::ProjectPropertiesDialogImpl( + LashProxy* proxy, + Glib::RefPtr<Gnome::Glade::Xml> xml) + : _proxy(proxy) + , _dialog(xml, "project_properties_dialog") , _name(xml, "project_name") , _description(xml, "project_description") , _notes(xml, "project_notes") |