From ef93b2e47870c95e9c9b547a23f9a4279a20451f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 15 Dec 2010 04:13:23 +0000 Subject: LashClient => Client. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2695 a436a847-0d15-0410-975c-d299462d15a1 --- src/Client.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Client.hpp | 51 ++++++++++++++++++++++++++++++++++++++ src/LashClient.cpp | 71 ----------------------------------------------------- src/LashClient.hpp | 51 -------------------------------------- src/LashProxy.cpp | 66 ++++++++++++++++++++++--------------------------- src/Project.cpp | 21 +++++++--------- src/Project.hpp | 11 ++++----- src/ProjectList.cpp | 10 ++++---- src/Session.cpp | 24 ++++++++++-------- src/Session.hpp | 6 ++--- 10 files changed, 188 insertions(+), 194 deletions(-) create mode 100644 src/Client.cpp create mode 100644 src/Client.hpp delete mode 100644 src/LashClient.cpp delete mode 100644 src/LashClient.hpp (limited to 'src') diff --git a/src/Client.cpp b/src/Client.cpp new file mode 100644 index 0000000..3baf3c0 --- /dev/null +++ b/src/Client.cpp @@ -0,0 +1,71 @@ +/* This file is part of Patchage. + * Copyright (C) 2008-2010 David Robillard + * Copyright (C) 2008 Nedko Arnaudov + * + * Patchage is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "Client.hpp" +#include "Patchage.hpp" + +using namespace std; + +struct ClientImpl { + Project* project; + string id; + string name; +}; + +Client::Client( + Project* project, + const string& id, + const string& name) +{ + _impl = new ClientImpl(); + _impl->project = project; + _impl->id = id; + _impl->name = name; +} + +Client::~Client() +{ + delete _impl; +} + +Project* +Client::get_project() +{ + return _impl->project; +} + +const string& +Client::get_id() const +{ + return _impl->id; +} + +const string& +Client::get_name() const +{ + return _impl->name; +} + +void +Client::set_name(const string& name) +{ + if (_impl->name != name) { + _impl->name = name; + _signal_renamed.emit(); + } +} diff --git a/src/Client.hpp b/src/Client.hpp new file mode 100644 index 0000000..a97508b --- /dev/null +++ b/src/Client.hpp @@ -0,0 +1,51 @@ +/* This file is part of Patchage. + * Copyright (C) 2008-2010 David Robillard + * Copyright (C) 2008 Nedko Arnaudov + * + * Patchage is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef PATCHAGE_LASH_CLIENT_HPP +#define PATCHAGE_LASH_CLIENT_HPP + +#include +#include + +class ClientImpl; +class Project; + +class Client +{ +public: + Client( + Project* project, + const std::string& id, + const std::string& name); + + ~Client(); + + Project* get_project(); + + const std::string& get_id() const; + const std::string& get_name() const; + + void set_name(const std::string& name); + + sigc::signal _signal_renamed; + +private: + ClientImpl* _impl; +}; + +#endif // PATCHAGE_LASH_CLIENT_HPP diff --git a/src/LashClient.cpp b/src/LashClient.cpp deleted file mode 100644 index a7dd4ae..0000000 --- a/src/LashClient.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* This file is part of Patchage. - * Copyright (C) 2008-2010 David Robillard - * Copyright (C) 2008 Nedko Arnaudov - * - * Patchage is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "LashClient.hpp" -#include "Patchage.hpp" - -using namespace std; - -struct LashClientImpl { - Project* project; - string id; - string name; -}; - -LashClient::LashClient( - Project* project, - const string& id, - const string& name) -{ - _impl = new LashClientImpl(); - _impl->project = project; - _impl->id = id; - _impl->name = name; -} - -LashClient::~LashClient() -{ - delete _impl; -} - -Project* -LashClient::get_project() -{ - return _impl->project; -} - -const string& -LashClient::get_id() const -{ - return _impl->id; -} - -const string& -LashClient::get_name() const -{ - return _impl->name; -} - -void -LashClient::set_name(const string& name) -{ - if (_impl->name != name) { - _impl->name = name; - _signal_renamed.emit(); - } -} diff --git a/src/LashClient.hpp b/src/LashClient.hpp deleted file mode 100644 index bd18d6c..0000000 --- a/src/LashClient.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Patchage. - * Copyright (C) 2008-2010 David Robillard - * Copyright (C) 2008 Nedko Arnaudov - * - * Patchage is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef PATCHAGE_LASH_CLIENT_HPP -#define PATCHAGE_LASH_CLIENT_HPP - -#include -#include - -class LashClientImpl; -class Project; - -class LashClient -{ -public: - LashClient( - Project* project, - const std::string& id, - const std::string& name); - - ~LashClient(); - - Project* get_project(); - - const std::string& get_id() const; - const std::string& get_name() const; - - void set_name(const std::string& name); - - sigc::signal _signal_renamed; - -private: - LashClientImpl* _impl; -}; - -#endif // PATCHAGE_LASH_CLIENT_HPP diff --git a/src/LashProxy.cpp b/src/LashProxy.cpp index 02fd311..7bd9ec5 100644 --- a/src/LashProxy.cpp +++ b/src/LashProxy.cpp @@ -1,4 +1,3 @@ -// -*- Mode: C++ ; indent-tabs-mode: t -*- /* This file is part of Patchage. * Copyright (C) 2008 Nedko Arnaudov * @@ -23,7 +22,7 @@ #include "LashProxy.hpp" #include "Session.hpp" #include "Project.hpp" -#include "LashClient.hpp" +#include "Client.hpp" #include "DBus.hpp" #define LASH_SERVICE "org.nongnu.LASH" @@ -42,35 +41,30 @@ struct LashProxyImpl { void error_msg(const std::string& msg); void info_msg(const std::string& msg); - static - DBusHandlerResult - dbus_message_hook( + static DBusHandlerResult dbus_message_hook( DBusConnection* connection, - DBusMessage* message, - void* proxy); - - bool - call( - bool response_expected, - const char* iface, - const char* method, + DBusMessage* message, + void* proxy); + + bool call( + bool response_expected, + const char* iface, + const char* method, DBusMessage** reply_ptr, - int in_type, + int in_type, ...); - shared_ptr - on_project_added(const string& name); + shared_ptr on_project_added(const string& name); - shared_ptr - on_client_added( + shared_ptr on_client_added( shared_ptr project, - string id, - string name); + string id, + string name); - bool _server_responding; - Session* _session; - LashProxy* _interface; - Patchage* _app; + bool _server_responding; + Session* _session; + LashProxy* _interface; + Patchage* _app; }; LashProxy::LashProxy(Patchage* app, Session* session) @@ -131,17 +125,17 @@ LashProxyImpl::dbus_message_hook( DBusMessage* message, void* proxy) { - const char* project_name; - const char* new_project_name; - const char* object_name; - const char* old_owner; - const char* new_owner; - const char* value_string; - const char* client_id; - const char* client_name; - dbus_bool_t modified_status; + const char* project_name; + const char* new_project_name; + const char* object_name; + const char* old_owner; + const char* new_owner; + const char* value_string; + const char* client_id; + const char* client_name; + dbus_bool_t modified_status; shared_ptr project; - shared_ptr client; + shared_ptr client; assert(proxy); LashProxyImpl* me = reinterpret_cast(proxy); @@ -485,13 +479,13 @@ LashProxyImpl::on_project_added(const string& name) return project; } -shared_ptr +shared_ptr LashProxyImpl::on_client_added( shared_ptr project, string id, string name) { - shared_ptr client(new LashClient(project.get(), id, name)); + shared_ptr client(new Client(project.get(), id, name)); project->on_client_added(client); _session->client_add(client); diff --git a/src/Project.cpp b/src/Project.cpp index a6e657b..0c19b8e 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1,6 +1,5 @@ -// -*- Mode: C++ ; indent-tabs-mode: t -*- /* This file is part of Patchage. - * Copyright (C) 2008-2009 David Robillard + * Copyright (C) 2008-2010 David Robillard * Copyright (C) 2008 Nedko Arnaudov * * Patchage is free software; you can redistribute it and/or modify it under the @@ -19,7 +18,7 @@ #include "Project.hpp" #include "LashProxy.hpp" -#include "LashClient.hpp" +#include "Client.hpp" using namespace std; using boost::shared_ptr; @@ -30,7 +29,7 @@ struct ProjectImpl { string description; string notes; bool modified_status; - list< shared_ptr > clients; + list< shared_ptr > clients; }; Project::Project(LashProxy* proxy, const string& name) @@ -39,27 +38,24 @@ Project::Project(LashProxy* proxy, const string& name) proxy->get_loaded_project_properties(name, properties); - _impl = new ProjectImpl; + _impl = new ProjectImpl(); _impl->proxy = proxy; _impl->name = name; _impl->description = properties.description; _impl->notes = properties.notes; _impl->modified_status = properties.modified_status; - - //g_app->info_msg("project created"); } Project::~Project() { delete _impl; - //g_app->info_msg("project destroyed"); } void Project::clear() { - shared_ptr client; + shared_ptr client; while (!_impl->clients.empty()) { client = _impl->clients.front(); @@ -106,7 +102,7 @@ Project::get_clients() const } void -Project::on_client_added(shared_ptr client) +Project::on_client_added(shared_ptr client) { _impl->clients.push_back(client); _signal_client_added.emit(client); @@ -115,9 +111,10 @@ Project::on_client_added(shared_ptr client) void Project::on_client_removed(const string& id) { - shared_ptr client; + shared_ptr client; - for (list< shared_ptr >::iterator iter = _impl->clients.begin(); iter != _impl->clients.end(); iter++) { + for (list< shared_ptr >::iterator iter = _impl->clients.begin(); + iter != _impl->clients.end(); iter++) { client = *iter; if (client->get_id() == id) { diff --git a/src/Project.hpp b/src/Project.hpp index 0509bf6..b31efa3 100644 --- a/src/Project.hpp +++ b/src/Project.hpp @@ -1,4 +1,3 @@ -// -*- Mode: C++ ; indent-tabs-mode: t -*- /* This file is part of Patchage. * Copyright (C) 2008 Nedko Arnaudov * @@ -28,7 +27,7 @@ struct ProjectImpl; class LashProxy; class LashProxyImpl; -class LashClient; +class Client; class Project { public: @@ -38,7 +37,7 @@ public: void clear(); - typedef std::list< boost::shared_ptr > Clients; + typedef std::list< boost::shared_ptr > Clients; const std::string& get_name() const; const std::string& get_description() const; @@ -55,8 +54,8 @@ public: sigc::signal _signal_description_changed; sigc::signal _signal_notes_changed; - sigc::signal< void, boost::shared_ptr > _signal_client_added; - sigc::signal< void, boost::shared_ptr > _signal_client_removed; + sigc::signal< void, boost::shared_ptr > _signal_client_added; + sigc::signal< void, boost::shared_ptr > _signal_client_removed; private: friend class LashProxyImpl; @@ -65,7 +64,7 @@ private: void on_modified_status_changed(bool modified_status); void on_description_changed(const std::string& description); void on_notes_changed(const std::string& notes); - void on_client_added(boost::shared_ptr client); + void on_client_added(boost::shared_ptr client); void on_client_removed(const std::string& id); ProjectImpl* _impl; diff --git a/src/ProjectList.cpp b/src/ProjectList.cpp index 155a878..c209ff7 100644 --- a/src/ProjectList.cpp +++ b/src/ProjectList.cpp @@ -19,7 +19,7 @@ #include #include -#include "LashClient.hpp" +#include "Client.hpp" #include "LashProxy.hpp" #include "Project.hpp" #include "ProjectList.hpp" @@ -43,8 +43,8 @@ struct ProjectListImpl : public sigc::trackable { void project_added(shared_ptr project); void project_closed(shared_ptr project); void project_renamed(Gtk::TreeModel::iterator iter); - void client_added(shared_ptr client, Gtk::TreeModel::iterator iter); - void client_removed(shared_ptr client, Gtk::TreeModel::iterator iter); + void client_added(shared_ptr client, Gtk::TreeModel::iterator iter); + void client_removed(shared_ptr client, Gtk::TreeModel::iterator iter); bool on_button_press_event(GdkEventButton * event); @@ -264,7 +264,7 @@ ProjectListImpl::project_renamed( void ProjectListImpl::client_added( - shared_ptr client, + shared_ptr client, Gtk::TreeModel::iterator iter) { Gtk::TreeModel::Path path = _model->get_path(iter); @@ -279,7 +279,7 @@ ProjectListImpl::client_added( void ProjectListImpl::client_removed( - shared_ptr client, + shared_ptr client, Gtk::TreeModel::iterator iter) { if (!iter) diff --git a/src/Session.cpp b/src/Session.cpp index 85d9a58..a2f0850 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -16,7 +16,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "LashClient.hpp" +#include "Client.hpp" #include "Project.hpp" #include "Session.hpp" @@ -24,8 +24,8 @@ using namespace std; using boost::shared_ptr; struct SessionImpl { - list< shared_ptr > projects; - list< shared_ptr > clients; + list< shared_ptr > projects; + list< shared_ptr > clients; }; Session::Session() @@ -65,7 +65,8 @@ shared_ptr Session::find_project_by_name(const string& name) { shared_ptr project; - for (list< shared_ptr >::iterator i = _impl->projects.begin(); i != _impl->projects.end(); i++) + for (list< shared_ptr >::iterator i = _impl->projects.begin(); + i != _impl->projects.end(); i++) if ((*i)->get_name() == name) return (*i); @@ -78,7 +79,8 @@ Session::project_close(const string& project_name) shared_ptr project; Project::Clients clients; - for (list >::iterator iter = _impl->projects.begin(); iter != _impl->projects.end(); iter++) { + for (list >::iterator iter = _impl->projects.begin(); + iter != _impl->projects.end(); iter++) { project = *iter; if (project->get_name() == project_name) { @@ -96,7 +98,7 @@ Session::project_close(const string& project_name) } void -Session::client_add(shared_ptr client) +Session::client_add(shared_ptr client) { _impl->clients.push_back(client); } @@ -104,7 +106,8 @@ Session::client_add(shared_ptr client) void Session::client_remove(const string& id) { - for (list >::iterator i = _impl->clients.begin(); i != _impl->clients.end(); i++) { + for (list< shared_ptr >::iterator i = _impl->clients.begin(); + i != _impl->clients.end(); i++) { if ((*i)->get_id() == id) { _impl->clients.erase(i); return; @@ -112,13 +115,14 @@ Session::client_remove(const string& id) } } -shared_ptr +shared_ptr Session::find_client_by_id(const string& id) { - for (list >::iterator i = _impl->clients.begin(); i != _impl->clients.end(); i++) + for (list< shared_ptr >::iterator i = _impl->clients.begin(); + i != _impl->clients.end(); i++) if ((*i)->get_id() == id) return *i; - return shared_ptr(); + return shared_ptr(); } diff --git a/src/Session.hpp b/src/Session.hpp index 0342794..a2cf381 100644 --- a/src/Session.hpp +++ b/src/Session.hpp @@ -23,7 +23,7 @@ struct SessionImpl; class Project; -class LashClient; +class Client; class Session { @@ -38,10 +38,10 @@ public: boost::shared_ptr find_project_by_name(const std::string& name); - void client_add(boost::shared_ptr client); + void client_add(boost::shared_ptr client); void client_remove(const std::string& id); - boost::shared_ptr find_client_by_id(const std::string& id); + boost::shared_ptr find_client_by_id(const std::string& id); sigc::signal< void, boost::shared_ptr > _signal_project_added; sigc::signal< void, boost::shared_ptr > _signal_project_closed; -- cgit v1.2.1