[ekiga] Opal: More cleanups. More code moved out of opal-main.cpp.



commit 065025848f77bc3114d92d56387d9fe999987659
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Jan 18 10:00:57 2015 +0100

    Opal: More cleanups. More code moved out of opal-main.cpp.
    
    The Opal Bank is now handling itself the "ready" CallManager signal
    instead of having opal-main.cpp handling this.

 lib/engine/components/opal/opal-bank.cpp |   16 ++++++++++------
 lib/engine/components/opal/opal-bank.h   |    5 ++---
 lib/engine/components/opal/opal-main.cpp |    1 -
 3 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 4a79a90..377ee80 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -53,13 +53,14 @@
 
 Opal::Bank::Bank (Ekiga::ServiceCore& core,
                   Opal::CallManager& _call_manager):
-  is_call_manager_ready(false),
+  call_manager(_call_manager),
   presence_core(core.get<Ekiga::PresenceCore> ("presence-core")),
   notification_core(core.get<Ekiga::NotificationCore> ("notification-core")),
   personal_details(core.get<Ekiga::PersonalDetails> ("personal-details")),
-  audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core")),
-  call_manager(_call_manager)
+  audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core"))
 {
+  is_ready = false;
+
   std::list<std::string> accounts;
   protocols_settings = new Ekiga::Settings (PROTOCOLS_SCHEMA);
 
@@ -115,6 +116,9 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core,
 
   std::cout << "FIXME" << std::endl << std::flush;
   //sip_endpoint.mwi_event.connect (boost::bind(&Opal::Bank::on_mwi_event, this, _1, _2));
+
+  // Enable accounts when the manager is ready
+  call_manager.ready.connect (boost::bind (&Opal::Bank::set_ready, this));
 }
 
 
@@ -273,15 +277,15 @@ Opal::Bank::add (Account::Type acc_type,
   add_account (account);
   heap_added (account);
 
-  if (is_call_manager_ready && enabled)
+  if (is_ready && enabled)
     account->enable ();
 }
 
 
 void
-Opal::Bank::call_manager_ready ()
+Opal::Bank::set_ready ()
 {
-  is_call_manager_ready = true;
+  is_ready = true;
   for (iterator iter = begin ();
        iter != end ();
        ++iter) {
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index 9130163..65258e5 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -99,8 +99,6 @@ public:
      */
     AccountPtr find_account (const std::string& aor);
 
-    void call_manager_ready ();
-
     /* this object is an Ekiga::Cluster */
     void visit_heaps (boost::function1<bool, Ekiga::HeapPtr> visitor) const;
 
@@ -114,7 +112,8 @@ public:
     static void migrate_from_gconf (const std::list<std::string> old);
 
 private:
-    bool is_call_manager_ready;
+    void set_ready ();
+    bool is_ready;
 
     CallManager& call_manager;
 
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 9ab228d..a3f802d 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -118,7 +118,6 @@ struct OPALSpark: public Ekiga::Spark
       account_core->add_bank (bank);
       presence_core->add_cluster (bank);
       core.add (bank);
-      call_manager->ready.connect (boost::bind (&Opal::Bank::call_manager_ready, &*bank));
       call_manager->setup ();
       presence_core->add_presence_publisher (bank);
       presence_core->add_presence_fetcher (bank);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]