From cbe721af1a9c84169cec5e58ffbd71367bb8199b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 15 Dec 2010 03:59:18 +0000 Subject: Simplify LashClient. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2694 a436a847-0d15-0410-975c-d299462d15a1 --- src/LashClient.cpp | 34 +++++++++++----------------------- src/LashClient.hpp | 20 +++++--------------- src/LashProxy.cpp | 9 ++------- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/src/LashClient.cpp b/src/LashClient.cpp index c41fef6..a7dd4ae 100644 --- a/src/LashClient.cpp +++ b/src/LashClient.cpp @@ -1,5 +1,5 @@ -// -*- Mode: C++ ; indent-tabs-mode: t -*- /* 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 @@ -22,31 +22,25 @@ using namespace std; struct LashClientImpl { - LashProxy* proxy; - Project* project; - string id; - string name; + Project* project; + string id; + string name; }; LashClient::LashClient( - LashProxy* proxy, - Project* project, + Project* project, const string& id, const string& name) { - _impl = new LashClientImpl; - _impl->proxy = proxy; + _impl = new LashClientImpl(); _impl->project = project; - _impl->id = id; - _impl->name = name; - - //g_app->info_msg("client created"); + _impl->id = id; + _impl->name = name; } LashClient::~LashClient() { delete _impl; - //g_app->info_msg("client destroyed"); } Project* @@ -68,16 +62,10 @@ LashClient::get_name() const } void -LashClient::do_rename(const string& name) +LashClient::set_name(const string& name) { if (_impl->name != name) { - //_impl->proxy->client_rename(_impl->id, name); + _impl->name = name; + _signal_renamed.emit(); } } - -void -LashClient::on_name_changed(const string& name) -{ - _impl->name = name; - _signal_renamed.emit(); -} diff --git a/src/LashClient.hpp b/src/LashClient.hpp index 6ae6a2b..bd18d6c 100644 --- a/src/LashClient.hpp +++ b/src/LashClient.hpp @@ -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 @@ -24,37 +23,28 @@ #include class LashClientImpl; -class LashProxy; -class LashProxyImpl; class Project; class LashClient { public: LashClient( - LashProxy* proxy, - Project* project, + Project* project, const std::string& id, const std::string& name); ~LashClient(); - Project* - get_project(); + Project* get_project(); - const std::string& get_id() const; + const std::string& get_id() const; const std::string& get_name() const; - void do_rename(const std::string& name); + void set_name(const std::string& name); sigc::signal _signal_renamed; private: - friend class LashProxyImpl; - - void - on_name_changed(const std::string& name); - LashClientImpl* _impl; }; diff --git a/src/LashProxy.cpp b/src/LashProxy.cpp index fb4fffc..02fd311 100644 --- a/src/LashProxy.cpp +++ b/src/LashProxy.cpp @@ -355,7 +355,7 @@ LashProxyImpl::dbus_message_hook( client = me->_session->find_client_by_id(client_id); if (client) { - client->on_name_changed(client_name); + client->set_name(client_name); } return DBUS_HANDLER_RESULT_HANDLED; @@ -491,12 +491,7 @@ LashProxyImpl::on_client_added( string id, string name) { - shared_ptr client( - new LashClient( - _interface, - project.get(), - id, - name)); + shared_ptr client(new LashClient(project.get(), id, name)); project->on_client_added(client); _session->client_add(client); -- cgit v1.2.1