[ekiga] Simplified the chain of responsibility code
- From: Julien Puydt <jpuydt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [ekiga] Simplified the chain of responsibility code
- Date: Sun, 23 Aug 2009 08:53:05 +0000 (UTC)
commit ff4d8a3945516ac39f9cf08423f78ee9db6ea3a9
Author: Julien Puydt <jpuydt gnome org>
Date: Sun Aug 23 10:50:03 2009 +0200
Simplified the chain of responsibility code
lib/engine/account/account-core.cpp | 2 +-
lib/engine/account/bank-impl.h | 2 +-
lib/engine/addressbook/book-impl.h | 2 +-
lib/engine/addressbook/contact-core.cpp | 2 +-
lib/engine/addressbook/source-impl.h | 2 +-
lib/engine/chat/chat-core.cpp | 2 +-
lib/engine/components/evolution/evolution-book.cpp | 2 +-
.../components/evolution/evolution-contact.cpp | 4 ++--
lib/engine/components/ldap/ldap-book.cpp | 6 +++---
lib/engine/components/ldap/ldap-source.cpp | 4 ++--
lib/engine/components/local-roster/local-heap.cpp | 6 +++---
.../components/local-roster/local-presentity.cpp | 2 +-
lib/engine/components/opal/opal-account.cpp | 4 ++--
lib/engine/components/opal/opal-bank.cpp | 4 ++--
lib/engine/components/opal/opal-call-manager.cpp | 2 +-
lib/engine/framework/chain-of-responsibility.h | 20 ++++----------------
lib/engine/gui/gtk-frontend/roster-view-gtk.cpp | 2 +-
lib/engine/presence/cluster-impl.h | 2 +-
lib/engine/presence/heap-impl.h | 2 +-
lib/engine/presence/presence-core.cpp | 2 +-
src/gui/accounts.cpp | 2 +-
src/gui/main.cpp | 2 +-
22 files changed, 33 insertions(+), 45 deletions(-)
---
diff --git a/lib/engine/account/account-core.cpp b/lib/engine/account/account-core.cpp
index 4df8269..5934324 100644
--- a/lib/engine/account/account-core.cpp
+++ b/lib/engine/account/account-core.cpp
@@ -77,7 +77,7 @@ Ekiga::AccountCore::add_bank (BankPtr bank)
bank_added.emit (bank);
- bank->questions.add_handler (questions.make_slot ());
+ bank->questions.connect (questions.make_slot ());
}
diff --git a/lib/engine/account/bank-impl.h b/lib/engine/account/bank-impl.h
index cdc2130..e859f72 100644
--- a/lib/engine/account/bank-impl.h
+++ b/lib/engine/account/bank-impl.h
@@ -205,7 +205,7 @@ Ekiga::BankImpl<AccountType>::add_account (gmref_ptr<AccountType> account)
{
add_object (account);
- account->questions.add_handler (questions.make_slot ());
+ account->questions.connect (questions.make_slot ());
}
diff --git a/lib/engine/addressbook/book-impl.h b/lib/engine/addressbook/book-impl.h
index 42a510d..e67d02a 100644
--- a/lib/engine/addressbook/book-impl.h
+++ b/lib/engine/addressbook/book-impl.h
@@ -203,7 +203,7 @@ template<typename ContactType>
void
Ekiga::BookImpl<ContactType>::add_contact (gmref_ptr<ContactType> contact)
{
- contact->questions.add_handler (questions.make_slot ());
+ contact->questions.connect (questions.make_slot ());
add_object (contact);
}
diff --git a/lib/engine/addressbook/contact-core.cpp b/lib/engine/addressbook/contact-core.cpp
index 37ad750..1c5f9aa 100644
--- a/lib/engine/addressbook/contact-core.cpp
+++ b/lib/engine/addressbook/contact-core.cpp
@@ -83,7 +83,7 @@ Ekiga::ContactCore::add_source (SourcePtr source)
conns.push_back (source->contact_added.connect (sigc::bind<0> (contact_added.make_slot (), source)));
conns.push_back (source->contact_removed.connect (sigc::bind<0> (contact_removed.make_slot (), source)));
conns.push_back (source->contact_updated.connect (sigc::bind<0> (contact_updated.make_slot (), source)));
- source->questions.add_handler (questions.make_slot ());
+ source->questions.connect (questions.make_slot ());
}
void
diff --git a/lib/engine/addressbook/source-impl.h b/lib/engine/addressbook/source-impl.h
index 4aa613e..0344cc6 100644
--- a/lib/engine/addressbook/source-impl.h
+++ b/lib/engine/addressbook/source-impl.h
@@ -214,7 +214,7 @@ Ekiga::SourceImpl<BookType>::add_book (gmref_ptr<BookType> book)
add_connection (book, book->contact_updated.connect (sigc::bind<0> (contact_updated.make_slot (), book)));
- add_connection (book, book->questions.add_handler (questions.make_slot ()));
+ add_connection (book, book->questions.connect (questions.make_slot ()));
}
diff --git a/lib/engine/chat/chat-core.cpp b/lib/engine/chat/chat-core.cpp
index e6a6c40..1adbd0b 100644
--- a/lib/engine/chat/chat-core.cpp
+++ b/lib/engine/chat/chat-core.cpp
@@ -45,7 +45,7 @@ void
Ekiga::ChatCore::add_dialect (DialectPtr dialect)
{
dialects.push_back (dialect);
- dialect->questions.add_handler (questions.make_slot ());
+ dialect->questions.connect (questions.make_slot ());
dialect_added.emit (dialect);
}
diff --git a/lib/engine/components/evolution/evolution-book.cpp b/lib/engine/components/evolution/evolution-book.cpp
index 5ecc8a5..abe1321 100644
--- a/lib/engine/components/evolution/evolution-book.cpp
+++ b/lib/engine/components/evolution/evolution-book.cpp
@@ -326,7 +326,7 @@ Evolution::Book::new_contact_action ()
request->text ("cell", _("_Cell phone:"), "");
request->text ("pager", _("_Pager:"), "");
- questions.handle_request (request);
+ questions.emit (request);
}
void
diff --git a/lib/engine/components/evolution/evolution-contact.cpp b/lib/engine/components/evolution/evolution-contact.cpp
index b34583d..4faff35 100644
--- a/lib/engine/components/evolution/evolution-contact.cpp
+++ b/lib/engine/components/evolution/evolution-contact.cpp
@@ -323,7 +323,7 @@ Evolution::Contact::edit_action ()
request->text ("pager", _("_Pager:"), pager_uri);
}
- questions.handle_request (request);
+ questions.emit (request);
}
void
@@ -363,7 +363,7 @@ Evolution::Contact::remove_action ()
request->instructions (instructions);
g_free (instructions);
- questions.handle_request (request);
+ questions.emit (request);
}
void
diff --git a/lib/engine/components/ldap/ldap-book.cpp b/lib/engine/components/ldap/ldap-book.cpp
index c199f89..6ef7f2a 100644
--- a/lib/engine/components/ldap/ldap-book.cpp
+++ b/lib/engine/components/ldap/ldap-book.cpp
@@ -612,7 +612,7 @@ extern "C" {
/* Save a pointer for storing the form result */
ctx->book->saslform = &result;
- ctx->book->questions.handle_request (request);
+ ctx->book->questions.emit (request);
/* Extract answers from the result form */
for (i=0, in = (sasl_interact_t *)inter;
@@ -989,7 +989,7 @@ OPENLDAP::Book::edit ()
OPENLDAP::BookForm (request, bookinfo, std::string(_("Edit LDAP directory")));
- questions.handle_request (request);
+ questions.emit (request);
}
int
@@ -1100,7 +1100,7 @@ OPENLDAP::Book::on_edit_form_submitted (bool submitted,
result.visit (*request);
request->error (errmsg);
- questions.handle_request (request);
+ questions.emit (request);
return;
}
diff --git a/lib/engine/components/ldap/ldap-source.cpp b/lib/engine/components/ldap/ldap-source.cpp
index 147655c..b8ade6b 100644
--- a/lib/engine/components/ldap/ldap-source.cpp
+++ b/lib/engine/components/ldap/ldap-source.cpp
@@ -150,7 +150,7 @@ OPENLDAP::Source::new_book ()
OPENLDAP::BookInfoParse (bookinfo);
OPENLDAP::BookForm (request, bookinfo, _("Create LDAP directory"));
- questions.handle_request (request);
+ questions.emit (request);
}
void
@@ -185,7 +185,7 @@ OPENLDAP::Source::on_new_book_form_submitted (bool submitted,
result.visit (*request);
request->error (errmsg);
- questions.handle_request (request);
+ questions.emit (request);
return;
}
diff --git a/lib/engine/components/local-roster/local-heap.cpp b/lib/engine/components/local-roster/local-heap.cpp
index 4d916a8..c84a769 100644
--- a/lib/engine/components/local-roster/local-heap.cpp
+++ b/lib/engine/components/local-roster/local-heap.cpp
@@ -243,7 +243,7 @@ Local::Heap::new_presentity (const std::string name,
_("Put contact in groups:"),
std::set<std::string>(), groups);
- questions.handle_request (request);
+ questions.emit (request);
}
}
@@ -404,7 +404,7 @@ Local::Heap::new_presentity_form_submitted (bool submitted,
else
request->error (_("You already have a contact with this address!"));
- questions.handle_request (request);
+ questions.emit (request);
}
}
@@ -417,7 +417,7 @@ Local::Heap::on_rename_group (std::string name)
request->instructions (_("Please edit this group name"));
request->text ("name", _("Name:"), name);
- questions.handle_request (request);
+ questions.emit (request);
}
struct rename_group_form_submitted_helper
diff --git a/lib/engine/components/local-roster/local-presentity.cpp b/lib/engine/components/local-roster/local-presentity.cpp
index f327d9a..4d13cb4 100644
--- a/lib/engine/components/local-roster/local-presentity.cpp
+++ b/lib/engine/components/local-roster/local-presentity.cpp
@@ -246,7 +246,7 @@ Local::Presentity::edit_presentity ()
request->editable_set ("groups", _("Choose groups:"),
groups, all_groups);
- questions.handle_request (request);
+ questions.emit (request);
}
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 93207f5..7d6820b 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -403,7 +403,7 @@ void Opal::Account::edit ()
request->text ("timeout", _("Timeout:"), str.str ());
request->boolean ("enabled", _("Enable Account"), enabled);
- questions.handle_request (request);
+ questions.emit (request);
}
@@ -441,7 +441,7 @@ void Opal::Account::on_edit_form_submitted (bool submitted,
result.visit (*request);
request->error (error);
- questions.handle_request (request);
+ questions.emit (request);
}
else {
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 18fcba8..da36a95 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -141,7 +141,7 @@ Opal::Bank::new_account (Account::Type acc_type,
if (!username.empty () && !password.empty ())
request->submit (*request);
else
- questions.handle_request (request);
+ questions.emit (request);
}
@@ -181,7 +181,7 @@ void Opal::Bank::on_new_account_form_submitted (bool submitted,
if (!error.empty ()) {
request->error (error);
- questions.handle_request (request);
+ questions.emit (request);
}
else {
diff --git a/lib/engine/components/opal/opal-call-manager.cpp b/lib/engine/components/opal/opal-call-manager.cpp
index 9960276..72b6045 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -769,7 +769,7 @@ CallManager::ReportSTUNError (const std::string error)
gmref_ptr<Ekiga::CallCore> call_core = core.get ("call-core");
// notice we're in for an infinite loop if nobody ever reports to the user!
- if ( !call_core->errors.handle_request (error)) {
+ if ( !call_core->errors.emit (error)) {
Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &CallManager::ReportSTUNError),
error),
diff --git a/lib/engine/framework/chain-of-responsibility.h b/lib/engine/framework/chain-of-responsibility.h
index a7376dd..1abf5b3 100644
--- a/lib/engine/framework/chain-of-responsibility.h
+++ b/lib/engine/framework/chain-of-responsibility.h
@@ -67,7 +67,7 @@
* Ekiga::ChainOfResponsibility<T_request> chain;
*
* The handlers will register like this :
- * chain.add_handler (sigc::mem_fun (this, &Foo::request_handler));
+ * chain.connect (sigc::mem_fun (this, &Foo::request_handler));
*
* A request handler looks like :
* bool
@@ -82,10 +82,10 @@
* }
*
* Trying to get a request handled looks like :
- * chain.handle_request (request);
+ * chain.emit (request);
*
* or for better error reporting :
- * if (!chain.handle_request (request)) {
+ * if (!chain.emit (request)) {
*
* <report that you couldn't deal with a request>
* }
@@ -113,25 +113,13 @@ namespace Ekiga
}
};
+
template<typename T_request>
struct ChainOfResponsibility:
public sigc::signal1<bool,
T_request,
responsibility_accumulator>
{
- typedef typename sigc::signal1<bool,
- T_request,
- responsibility_accumulator>::iterator iterator;
- typedef typename sigc::signal1<bool,
- T_request,
- responsibility_accumulator>::slot_type slot_type;
-
- iterator add_handler (const slot_type& slot_)
- { return this->connect (slot_); }
-
- bool handle_request (typename sigc::type_trait<T_request>::take request)
- { return this->emit (request); }
-
};
};
diff --git a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
index 2057eac..e193ee2 100644
--- a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
@@ -1523,7 +1523,7 @@ roster_view_gtk_new (Ekiga::PresenceCore &core)
conn = core.presentity_removed.connect (sigc::bind (sigc::ptr_fun (on_presentity_removed),
(gpointer) self));
self->priv->connections.push_back (conn);
- conn = core.questions.add_handler (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) self));
+ conn = core.questions.connect (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) self));
self->priv->connections.push_back (conn);
core.visit_clusters (sigc::bind_return (sigc::bind (sigc::ptr_fun (on_cluster_added), (gpointer) self), true));
diff --git a/lib/engine/presence/cluster-impl.h b/lib/engine/presence/cluster-impl.h
index 9c36c3a..68fefad 100644
--- a/lib/engine/presence/cluster-impl.h
+++ b/lib/engine/presence/cluster-impl.h
@@ -145,7 +145,7 @@ Ekiga::ClusterImpl<HeapType>::add_heap (gmref_ptr<HeapType> heap)
add_connection (heap, heap->presentity_removed.connect (sigc::bind (sigc::mem_fun (this, &ClusterImpl::on_presentity_removed), heap)));
- add_connection (heap, heap->questions.add_handler (questions.make_slot ()));
+ add_connection (heap, heap->questions.connect (questions.make_slot ()));
add_object (heap);
}
diff --git a/lib/engine/presence/heap-impl.h b/lib/engine/presence/heap-impl.h
index 0e30f17..9d71f77 100644
--- a/lib/engine/presence/heap-impl.h
+++ b/lib/engine/presence/heap-impl.h
@@ -158,7 +158,7 @@ template<typename PresentityType>
void
Ekiga::HeapImpl<PresentityType>::add_presentity (gmref_ptr<PresentityType> presentity)
{
- presentity->questions.add_handler (questions.make_slot ());
+ presentity->questions.connect (questions.make_slot ());
add_object (presentity);
}
diff --git a/lib/engine/presence/presence-core.cpp b/lib/engine/presence/presence-core.cpp
index 80826a4..cd17db3 100644
--- a/lib/engine/presence/presence-core.cpp
+++ b/lib/engine/presence/presence-core.cpp
@@ -64,7 +64,7 @@ Ekiga::PresenceCore::add_cluster (ClusterPtr cluster)
conns.push_back (cluster->presentity_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::PresenceCore::on_presentity_added), cluster)));
conns.push_back (cluster->presentity_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::PresenceCore::on_presentity_updated), cluster)));
conns.push_back (cluster->presentity_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::PresenceCore::on_presentity_removed), cluster)));
- cluster->questions.add_handler (questions.make_slot ());
+ cluster->questions.connect (questions.make_slot ());
}
void
diff --git a/src/gui/accounts.cpp b/src/gui/accounts.cpp
index 39ffeb1..348bdcb 100644
--- a/src/gui/accounts.cpp
+++ b/src/gui/accounts.cpp
@@ -713,7 +713,7 @@ gm_accounts_window_new (Ekiga::ServiceCore &core)
account_core->account_added.connect (sigc::bind (sigc::ptr_fun (on_account_added), window));
account_core->account_updated.connect (sigc::bind (sigc::ptr_fun (on_account_updated), window));
account_core->account_removed.connect (sigc::bind (sigc::ptr_fun (on_account_removed), window));
- account_core->questions.add_handler (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) window));
+ account_core->questions.connect (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) window));
account_core->visit_banks (sigc::bind_return (sigc::bind (sigc::ptr_fun (on_bank_added), window), true));
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 80d478b..fdf3441 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -4052,7 +4052,7 @@ ekiga_main_window_connect_engine_signals (EkigaMainWindow *mw)
conn = call_core->stream_resumed.connect (sigc::bind (sigc::ptr_fun (on_stream_resumed_cb), (gpointer) mw));
mw->priv->connections.push_back (conn);
- conn = call_core->errors.add_handler (sigc::bind (sigc::ptr_fun (on_handle_errors), (gpointer) mw));
+ conn = call_core->errors.connect (sigc::bind (sigc::ptr_fun (on_handle_errors), (gpointer) mw));
mw->priv->connections.push_back (conn);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]