ekiga r7839 - in trunk: lib/engine/account lib/engine/components/opal lib/engine/presence src/gui



Author: jpuydt
Date: Tue Mar 31 19:37:34 2009
New Revision: 7839
URL: http://svn.gnome.org/viewvc/ekiga?rev=7839&view=rev

Log:
Reworked the account stack (now uses gmref_ptr)

Modified:
   trunk/lib/engine/account/account-core.cpp
   trunk/lib/engine/account/account-core.h
   trunk/lib/engine/account/account.h
   trunk/lib/engine/account/bank-impl.h
   trunk/lib/engine/account/bank.h
   trunk/lib/engine/components/opal/h323-endpoint.cpp
   trunk/lib/engine/components/opal/h323-endpoint.h
   trunk/lib/engine/components/opal/opal-account.cpp
   trunk/lib/engine/components/opal/opal-account.h
   trunk/lib/engine/components/opal/opal-bank.cpp
   trunk/lib/engine/components/opal/opal-bank.h
   trunk/lib/engine/components/opal/opal-main.cpp
   trunk/lib/engine/components/opal/sip-endpoint.cpp
   trunk/lib/engine/components/opal/sip-endpoint.h
   trunk/lib/engine/presence/presence-core.cpp
   trunk/lib/engine/presence/presence-core.h
   trunk/src/gui/accounts.cpp
   trunk/src/gui/assistant.cpp
   trunk/src/gui/main.cpp

Modified: trunk/lib/engine/account/account-core.cpp
==============================================================================
--- trunk/lib/engine/account/account-core.cpp	(original)
+++ trunk/lib/engine/account/account-core.cpp	Tue Mar 31 19:37:34 2009
@@ -50,7 +50,8 @@
 }
 
 
-bool Ekiga::AccountCore::populate_menu (MenuBuilder & builder)
+bool
+Ekiga::AccountCore::populate_menu (MenuBuilder & builder)
 {
   bool populated = false;
 
@@ -65,58 +66,54 @@
 }
 
 
-void Ekiga::AccountCore::add_bank (Bank &bank)
+void
+Ekiga::AccountCore::add_bank (BankPtr bank)
 {
-  banks.insert (&bank);
+  banks.push_back (bank);
 
-  bank.account_added.connect (account_added.make_slot ());
-  bank.account_removed.connect (account_removed.make_slot ());
-  bank.account_updated.connect (account_updated.make_slot ());
+  bank->account_added.connect (sigc::bind<0>(account_added.make_slot (), bank));
+  bank->account_removed.connect (sigc::bind<0>(account_removed.make_slot (), bank));
+  bank->account_updated.connect (sigc::bind<0>(account_updated.make_slot (), bank));
 
   bank_added.emit (bank);
 
-  bank.questions.add_handler (questions.make_slot ());
-  bank.registration_event.connect (sigc::mem_fun (this, &Ekiga::AccountCore::on_registration_event));
+  bank->questions.add_handler (questions.make_slot ());
+  bank->registration_event.connect (sigc::bind<0> (sigc::mem_fun (this, &Ekiga::AccountCore::on_registration_event), bank));
 }
 
 
-void Ekiga::AccountCore::remove_bank (Bank &bank)
-{
-  banks.erase (&bank);
-
-  bank_removed.emit (bank);
-
-  bank.questions.add_handler (questions.make_slot ());
-}
-
-
-void Ekiga::AccountCore::visit_banks (sigc::slot1<bool, Bank &> visitor)
+void
+Ekiga::AccountCore::visit_banks (sigc::slot1<bool, BankPtr> visitor)
 {
   bool go_on = true;
 
   for (bank_iterator iter = banks.begin ();
        iter != banks.end () && go_on;
        iter++)
-    go_on = visitor (*(*iter));
+    go_on = visitor (*iter);
 }
 
 
-void Ekiga::AccountCore::add_account_subscriber (AccountSubscriber &subscriber)
+void
+Ekiga::AccountCore::add_account_subscriber (AccountSubscriber &subscriber)
 {
   account_subscribers.insert (&subscriber);
 }
 
 
-void Ekiga::AccountCore::on_registration_event (const Ekiga::Account *account,
-                                                Ekiga::AccountCore::RegistrationState state,
-                                                const std::string info)
+void
+Ekiga::AccountCore::on_registration_event (BankPtr bank,
+					   AccountPtr account,
+					   Ekiga::Account::RegistrationState state,
+					   const std::string info)
 {
-  registration_event.emit (*account, state, info);
+  registration_event.emit (bank, account, state, info);
 }
 
 
-void Ekiga::AccountCore::on_mwi_event (const Ekiga::Account *account,
+void Ekiga::AccountCore::on_mwi_event (BankPtr bank,
+				       AccountPtr account,
                                        const std::string & info)
 {
-  mwi_event.emit (*account, info);
+  mwi_event.emit (bank, account, info);
 }

Modified: trunk/lib/engine/account/account-core.h
==============================================================================
--- trunk/lib/engine/account/account-core.h	(original)
+++ trunk/lib/engine/account/account-core.h	Tue Mar 31 19:37:34 2009
@@ -36,7 +36,7 @@
 #ifndef __ACCOUNT_CORE_H__
 #define __ACCOUNT_CORE_H__
 
-#include <set>
+#include <list>
 #include <iostream>
 
 #include "menu-builder.h"
@@ -44,18 +44,21 @@
 #include "chain-of-responsibility.h"
 #include "services.h"
 
+#include "bank.h"
 
 /* declaration of a few helper classes */
 namespace Ekiga
 {
-  class AccountSubscriber;
-  class Bank;
-  class Account;
-
-/**
- * @defgroup accounts 
- * @{
- */
+  class AccountSubscriber
+  {
+  public:
+    virtual ~AccountSubscriber () {}
+  };
+
+  /**
+   * @defgroup accounts
+   * @{
+   */
 
   /** Core object for address account support.
    *
@@ -96,12 +99,7 @@
     /** Adds a bank to the AccountCore service.
      * @param The bank to be added.
      */
-    void add_bank (Bank &bank);
-
-    /** Remove a bank to the AccountCore service.
-     * @param The bank to be removed.
-     */
-    void remove_bank (Bank &bank);
+    void add_bank (BankPtr bank);
 
 
     /** Triggers a callback for all Ekiga::Bank banks of the
@@ -109,44 +107,42 @@
      * @param The callback (the return value means "go on" and allows
      *  stopping the visit)
      */
-    void visit_banks (sigc::slot1<bool, Bank &> visitor);
+    void visit_banks (sigc::slot1<bool, BankPtr> visitor);
 
 
     /** This signal is emitted when a bank has been added to the core
      */
-    sigc::signal1<void, Bank &> bank_added;
+    sigc::signal1<void, BankPtr> bank_added;
 
     /** This signal is emitted when a bank has been removed from the core
      */
-    sigc::signal1<void, Bank &> bank_removed;
+    sigc::signal1<void, BankPtr> bank_removed;
 
     /** This signal is emitted when a account has been added to one of
      * the banks
      */
-    sigc::signal1<void, Account &> account_added;
+    sigc::signal2<void, BankPtr, AccountPtr> account_added;
 
     /** This signal is emitted when a account has been removed from one of
      * the banks
      */
-    sigc::signal1<void, Account &> account_removed;
+    sigc::signal2<void, BankPtr, AccountPtr> account_removed;
 
     /** This signal is emitted when a account has been updated in one of
      * the banks
      */
-    sigc::signal1<void, Account &> account_updated;
+    sigc::signal2<void, BankPtr, AccountPtr> account_updated;
 
   private:
 
-    std::set<Bank *> banks;
-    typedef std::set<Bank *>::iterator bank_iterator;
-    typedef std::set<Bank *>::const_iterator bank_const_iterator;
+    std::list<BankPtr> banks;
+    typedef std::list<BankPtr>::iterator bank_iterator;
+    typedef std::list<BankPtr>::const_iterator bank_const_iterator;
 
 
     /*** Misc ***/
 
   public:
-    typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } RegistrationState;
-
 
     /** Create the menu for the AccountCore and its actions.
      * @param A MenuBuilder object to populate.
@@ -166,18 +162,18 @@
 
 
     /** This signal is emitted when there is a new registration event
-     * @param: account is the account 
+     * @param: account is the account
      *         state is the state
      *         info contains information about the registration status
      */
-    sigc::signal3<void, const Ekiga::Account &, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
+    sigc::signal4<void, BankPtr, AccountPtr, Account::RegistrationState, std::string> registration_event;
 
 
     /** This signal is emitted when there is a new message waiting event
-     * @param: account is the account 
-     *         info contains information about the indication 
+     * @param: account is the account
+     *         info contains information about the indication
      */
-    sigc::signal2<void, const Ekiga::Account &, std::string> mwi_event;
+    sigc::signal3<void, BankPtr, AccountPtr, std::string> mwi_event;
 
 
     /*** Account Subscriber API ***/
@@ -195,40 +191,36 @@
     std::set<AccountSubscriber *> account_subscribers;
     typedef std::set<AccountSubscriber *>::iterator subscriber_iterator;
     typedef std::set<AccountSubscriber *>::const_iterator subscriber_const_iterator;
-    void on_registration_event (const Ekiga::Account *account,
-                                Ekiga::AccountCore::RegistrationState state,
+    void on_registration_event (BankPtr bank,
+				AccountPtr account,
+                                Account::RegistrationState state,
                                 const std::string info);
-    void on_mwi_event (const Ekiga::Account *account,
+    void on_mwi_event (BankPtr bank,
+		       AccountPtr account,
                        const std::string & info);
   };
 
 
-  class AccountSubscriber 
-  {
-public:
-    virtual ~AccountSubscriber () {}
-  };
-
-
   template<class T = Account>
   class AccountSubscriberImpl : public AccountSubscriber
   {
-public:
+  public:
     virtual ~AccountSubscriberImpl () {}
 
     virtual bool subscribe (const T & /*account*/);
     virtual bool unsubscribe (const T & /*account*/);
   };
 
-/**
- * @}
- */
+  /**
+   * @}
+   */
 };
 
 
 
 template<class T>
-bool Ekiga::AccountCore::subscribe_account (const T &account)
+bool
+Ekiga::AccountCore::subscribe_account (const T &account)
 {
   for (subscriber_iterator iter = account_subscribers.begin ();
        iter != account_subscribers.end ();
@@ -245,7 +237,8 @@
 
 
 template<class T>
-bool Ekiga::AccountCore::unsubscribe_account (const T &account)
+bool
+Ekiga::AccountCore::unsubscribe_account (const T &account)
 {
   for (subscriber_iterator iter = account_subscribers.begin ();
        iter != account_subscribers.end ();
@@ -262,14 +255,16 @@
 
 
 template<class T>
-bool Ekiga::AccountSubscriberImpl<T>::subscribe (const T & /*account*/)
+bool
+Ekiga::AccountSubscriberImpl<T>::subscribe (const T & /*account*/)
 {
   return false;
 }
 
 
 template<class T>
-bool Ekiga::AccountSubscriberImpl<T>::unsubscribe (const T & /*account*/)
+bool
+Ekiga::AccountSubscriberImpl<T>::unsubscribe (const T & /*account*/)
 {
   return false;
 }

Modified: trunk/lib/engine/account/account.h
==============================================================================
--- trunk/lib/engine/account/account.h	(original)
+++ trunk/lib/engine/account/account.h	Tue Mar 31 19:37:34 2009
@@ -29,7 +29,7 @@
  *                         ------------------------------------------
  *   begin                : written in 2008 by Damien Sandras
  *   copyright            : (c) 2008 by Damien Sandras
- *   description          : declaration of the interface of an AccountManager 
+ *   description          : declaration of the interface of an AccountManager
  *                          Account
  *
  */
@@ -41,8 +41,7 @@
 #include <map>
 #include <string>
 
-#include "account-core.h"
-
+#include "gmref.h"
 #include "chain-of-responsibility.h"
 #include "form-request.h"
 #include "menu-builder.h"
@@ -50,15 +49,17 @@
 namespace Ekiga
 {
 
-/**
- * @addtogroup accounts 
- * @{
- */
+  /**
+   * @addtogroup accounts
+   * @{
+   */
 
-  class Account
+  class Account: public virtual GmRefCounted
   {
   public:
 
+    typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } RegistrationState;
+
 
     /** The destructor.
      */
@@ -115,8 +116,8 @@
      * Ekiga::Account descendant.
      */
     virtual bool is_active () const = 0;
-    
-    
+
+
     /** Create the menu for that account and its actions.
      * This function is purely virtual and should be implemented by
      * the descendant of the Ekiga::Contact.
@@ -139,12 +140,12 @@
     sigc::signal0<void> removed;
 
 
-    /** This signal is emitted when there is a new registration event for 
+    /** This signal is emitted when there is a new registration event for
      *  the Account.
      * @param: state is the state
      *         info contains information about the registration status
      */
-    sigc::signal2<void, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
+    sigc::signal2<void, RegistrationState, std::string> registration_event;
 
 
     /** This signal is emitted when there is a new message waiting indication
@@ -158,9 +159,11 @@
     ChainOfResponsibility<FormRequest*> questions;
   };
 
-/**
- * @}
- */
+  typedef gmref_ptr<Account> AccountPtr;
+
+  /**
+   * @}
+   */
 
 };
 #endif

Modified: trunk/lib/engine/account/bank-impl.h
==============================================================================
--- trunk/lib/engine/account/bank-impl.h	(original)
+++ trunk/lib/engine/account/bank-impl.h	Tue Mar 31 19:37:34 2009
@@ -37,17 +37,12 @@
 #ifndef __BANK_IMPL_H__
 #define __BANK_IMPL_H__
 
-#include "config.h"
-#include "lister.h"
-#include "account-core.h"
-#include "account.h"
+#include "reflister.h"
 #include "bank.h"
-#include "gmconf.h"
+
 
 namespace Ekiga
 {
-  class AccountCore;
-
 /**
  * @addtogroup accounts
  * @{
@@ -59,7 +54,7 @@
    * bank: it will take care of implementing the external api, you
    * just have to decide when to add and remove accounts.
    *
-   * Any deleted BankImpl is automatically removed from the AccountCore. 
+   * Any deleted BankImpl is automatically removed from the AccountCore.
    * The implementor should not have to take care about that.
    *
    * You can remove a Account from an Ekiga::BankImpl in two ways:
@@ -76,36 +71,36 @@
    *    calling the appropriate api function to delete the account in your
    *    backend.
    */
-  template<class T = Account>
+  template<class AccountType = Account>
   class BankImpl:
     public Bank,
     public sigc::trackable,
-    protected Lister<T>
+    protected RefLister<AccountType>
   {
 
   public:
 
-    typedef typename Lister<T>::iterator iterator;
-    typedef typename Lister<T>::const_iterator const_iterator;
+    typedef typename RefLister<AccountType>::iterator iterator;
+    typedef typename RefLister<AccountType>::const_iterator const_iterator;
 
     /** The constructor
      */
-    BankImpl (ServiceCore &core);
+    BankImpl ();
 
     /** The destructor.
      */
-    virtual ~BankImpl ();
+    ~BankImpl ();
 
     /** Visit all accounts of the bank and trigger the given callback.
      * @param The callback (the return value means "go on" and allows
      *  stopping the visit)
      */
-    void visit_accounts (sigc::slot1<bool, Account &> visitor);
+    void visit_accounts (sigc::slot1<bool, AccountPtr> visitor);
 
-    /** This function be called when a new account has to be added to the Bank.
+    /** This function is called when a new account has to be added to the Bank.
      */
     void new_account ();
-  
+
     /** Returns an iterator to the first Account of the collection
      */
     iterator begin ();
@@ -131,24 +126,21 @@
      * when the account has been updated and the Ekiga::BankImpl 'account_removed' signal
      * will be emitted when the account has been removed from the Ekiga::BankImpl.
      */
-    void add_account (T &account);
+    void add_account (gmref_ptr<AccountType> account);
 
     /** Removes a account from the Ekiga::BankImpl.
      * @param: The account to be removed.
      * @return: The Ekiga::BankImpl 'account_removed' signal is emitted when the account
      * has been removed.
      */
-    void remove_account (T &account);
-
-    /** Save the bank to the GmConf key.
-     */
-    void save () const;
+    void remove_account (gmref_ptr<AccountType> account);
 
-  protected:
-    ServiceCore & core;
+    using RefLister<AccountType>::add_connection;
 
   private:
-    void on_registration_event (Ekiga::AccountCore::RegistrationState, std::string info, Ekiga::Account *account);
+    void on_registration_event (Ekiga::Account::RegistrationState,
+				std::string info,
+				gmref_ptr<AccountType> account);
   };
 
 /**
@@ -160,121 +152,86 @@
 
 /* here begins the code from the template functions */
 
-template<typename T>
-Ekiga::BankImpl<T>::BankImpl (Ekiga::ServiceCore & _core) : core (_core)
+template<typename AccountType>
+Ekiga::BankImpl<AccountType>::BankImpl ()
 {
   /* this is signal forwarding */
-  Lister<T>::object_added.connect (account_added.make_slot ());
-  Lister<T>::object_removed.connect (account_removed.make_slot ());
-  Lister<T>::object_updated.connect (account_updated.make_slot ());
-
-  GSList *accounts = gm_conf_get_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list");
-  GSList *accounts_iter = accounts;
-
-  while (accounts_iter) {
-
-    T *account = new T (core, (char *) accounts_iter->data);
-    add_account (*account);
-
-    accounts_iter = g_slist_next (accounts_iter);
-  }
-
-  g_slist_foreach (accounts, (GFunc) g_free, NULL);
-  g_slist_free (accounts);
-}
-
-
-template<typename T>
-Ekiga::BankImpl<T>::~BankImpl ()
-{
+  RefLister<AccountType>::object_added.connect (account_added.make_slot ());
+  RefLister<AccountType>::object_removed.connect (account_removed.make_slot ());
+  RefLister<AccountType>::object_updated.connect (account_updated.make_slot ());
 }
 
 
-template<typename T>
-void
-Ekiga::BankImpl<T>::save () const
+template<typename AccountType>
+Ekiga::BankImpl<AccountType>::~BankImpl ()
 {
-  GSList *accounts = NULL;
-
-  for (const_iterator it = begin ();
-       it != end ();
-       it++) {
-
-    std::string acct_str = (*it).as_string ();
-    if (!acct_str.empty ())
-      accounts = g_slist_append (accounts, g_strdup (acct_str.c_str ()));
-  }
-
-  gm_conf_set_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list", accounts);
-
-  g_slist_foreach (accounts, (GFunc) g_free, NULL);
-  g_slist_free (accounts);
 }
 
 
-template<typename T>
+template<typename AccountType>
 void
-Ekiga::BankImpl<T>::visit_accounts (sigc::slot1<bool, Account &> visitor)
+Ekiga::BankImpl<AccountType>::visit_accounts (sigc::slot1<bool, AccountPtr> visitor)
 {
-  Lister<T>::visit_objects (visitor);
+  RefLister<AccountType>::visit_objects (visitor);
 }
 
 
-template<typename T>
-typename Ekiga::BankImpl<T>::iterator
-Ekiga::BankImpl<T>::begin ()
+template<typename AccountType>
+typename Ekiga::BankImpl<AccountType>::iterator
+Ekiga::BankImpl<AccountType>::begin ()
 {
-  return Lister<T>::begin ();
+  return RefLister<AccountType>::begin ();
 }
 
 
-template<typename T>
-typename Ekiga::BankImpl<T>::iterator
-Ekiga::BankImpl<T>::end ()
+template<typename AccountType>
+typename Ekiga::BankImpl<AccountType>::iterator
+Ekiga::BankImpl<AccountType>::end ()
 {
-  return Lister<T>::end ();
+  return RefLister<AccountType>::end ();
 }
 
 
-template<typename T>
-typename Ekiga::BankImpl<T>::const_iterator
-Ekiga::BankImpl<T>::begin () const
+template<typename AccountType>
+typename Ekiga::BankImpl<AccountType>::const_iterator
+Ekiga::BankImpl<AccountType>::begin () const
 {
-  return Lister<T>::begin ();
+  return RefLister<AccountType>::begin ();
 }
 
 
-template<typename T>
-typename Ekiga::BankImpl<T>::const_iterator
-Ekiga::BankImpl<T>::end () const
+template<typename AccountType>
+typename Ekiga::BankImpl<AccountType>::const_iterator
+Ekiga::BankImpl<AccountType>::end () const
 {
-  return Lister<T>::end ();
+  return RefLister<AccountType>::end ();
 }
 
 
-template<typename T>
+template<typename AccountType>
 void
-Ekiga::BankImpl<T>::add_account (T &account)
+Ekiga::BankImpl<AccountType>::add_account (gmref_ptr<AccountType> account)
 {
   add_object (account);
 
-  account.questions.add_handler (questions.make_slot ());
-  account.trigger_saving.connect (sigc::mem_fun (this, &Ekiga::BankImpl<T>::save));
-  account.registration_event.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::BankImpl<T>::on_registration_event), &account));
+  account->questions.add_handler (questions.make_slot ());
+  account->registration_event.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::BankImpl<AccountType>::on_registration_event), account));
 }
 
 
-template<typename T>
+template<typename AccountType>
 void
-Ekiga::BankImpl<T>::remove_account (T &account)
+Ekiga::BankImpl<AccountType>::remove_account (gmref_ptr<AccountType> account)
 {
   remove_object (account);
 }
 
 
-template<typename T>
+template<typename AccountType>
 void
-Ekiga::BankImpl<T>::on_registration_event (Ekiga::AccountCore::RegistrationState state, std::string info, Ekiga::Account *account)
+Ekiga::BankImpl<AccountType>::on_registration_event (Ekiga::Account::RegistrationState state,
+						     std::string info,
+						     gmref_ptr<AccountType> account)
 {
   registration_event.emit (account, state, info);
 }

Modified: trunk/lib/engine/account/bank.h
==============================================================================
--- trunk/lib/engine/account/bank.h	(original)
+++ trunk/lib/engine/account/bank.h	Tue Mar 31 19:37:34 2009
@@ -38,20 +38,18 @@
 #define __BANK_H__
 
 #include "lister.h"
-#include "account-core.h"
 #include "account.h"
-#include "gmconf.h"
 
 namespace Ekiga
 {
   class AccountCore;
 
-/**
- * @addtogroup accounts
- * @{
- */
+  /**
+   * @addtogroup accounts
+   * @{
+   */
 
-  class Bank 
+  class Bank: public virtual GmRefCounted
   {
   public:
 
@@ -63,7 +61,7 @@
      * @param The callback (the return value means "go on" and allows
      *  stopping the visit)
      */
-    virtual void visit_accounts (sigc::slot1<bool, Account &> visitor) = 0;
+    virtual void visit_accounts (sigc::slot1<bool, AccountPtr> visitor) = 0;
 
 
     /** Create the menu for that Bank and its actions.
@@ -72,35 +70,37 @@
      * @param A MenuBuilder object to populate.
      */
     virtual bool populate_menu (MenuBuilder &) = 0;
-      
+
 
     /** This signal is emitted when a account has been added.
      */
-    sigc::signal1<void, Account &> account_added;
+    sigc::signal1<void, AccountPtr> account_added;
 
     /** This signal is emitted when a account has been removed.
      */
-    sigc::signal1<void, Account &> account_removed;
+    sigc::signal1<void, AccountPtr> account_removed;
 
     /** This signal is emitted when a account has been updated.
      */
-    sigc::signal1<void, Account &> account_updated;
+    sigc::signal1<void, AccountPtr> account_updated;
 
     /** This signal is emitted when there is a new registration event
-     * @param: account is the account 
+     * @param: account is the account
      *         state is the state
      *         info contains information about the registration status
      */
-    sigc::signal3<void, const Ekiga::Account *, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
+    sigc::signal3<void, Ekiga::AccountPtr, Account::RegistrationState, std::string> registration_event;
 
     /** This chain allows the BankImpl to present forms to the user
      */
     ChainOfResponsibility<FormRequest*> questions;
   };
 
-/**
- * @}
- */
+  typedef gmref_ptr<Bank> BankPtr;
+
+  /**
+   * @}
+   */
 
 };
 #endif

Modified: trunk/lib/engine/components/opal/h323-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/h323-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/h323-endpoint.cpp	Tue Mar 31 19:37:34 2009
@@ -333,14 +333,14 @@
       /* Signal */
       Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &Opal::H323::EndPoint::registration_event_in_main),
 					       account,
-					       Ekiga::AccountCore::RegistrationFailed,
+					       Ekiga::Account::RegistrationFailed,
 					       info));
     }
     else {
 
       Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &Opal::H323::EndPoint::registration_event_in_main),
 					       account,
-					       Ekiga::AccountCore::Registered,
+					       Ekiga::Account::Registered,
 					       std::string ()));
     }
   }
@@ -352,7 +352,7 @@
     /* Signal */
     Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &Opal::H323::EndPoint::registration_event_in_main),
 					     account,
-					     Ekiga::AccountCore::Unregistered,
+					     Ekiga::Account::Unregistered,
 					     std::string ()));
   }
 }
@@ -446,7 +446,7 @@
 
 void
 Opal::H323::EndPoint::registration_event_in_main (Opal::Account& account,
-						  Ekiga::AccountCore::RegistrationState state,
+						  Ekiga::Account::RegistrationState state,
 						  const std::string msg)
 {
   account.registration_event.emit (state, msg);

Modified: trunk/lib/engine/components/opal/h323-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/h323-endpoint.h	(original)
+++ trunk/lib/engine/components/opal/h323-endpoint.h	Tue Mar 31 19:37:34 2009
@@ -125,7 +125,7 @@
       void on_transfer (std::string uri);
 
       void registration_event_in_main (Opal::Account& account,
-				       Ekiga::AccountCore::RegistrationState state,
+				       Ekiga::Account::RegistrationState state,
 				       const std::string msg);
 
       CallManager & manager;

Modified: trunk/lib/engine/components/opal/opal-account.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-account.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-account.cpp	Tue Mar 31 19:37:34 2009
@@ -442,15 +442,18 @@
 }
 
 
-void Opal::Account::on_consult (const std::string url)
+void
+Opal::Account::on_consult (const std::string url)
 {
   gm_open_uri (url.c_str ());
 }
 
-void Opal::Account::on_registration_event (Ekiga::AccountCore::RegistrationState state, std::string /*info*/)
+void
+Opal::Account::on_registration_event (Ekiga::Account::RegistrationState state,
+				      std::string /*info*/)
 {
   active = false;
 
-  if (state == Ekiga::AccountCore::Registered)
+  if (state == Ekiga::Account::Registered)
     active = true;
 }

Modified: trunk/lib/engine/components/opal/opal-account.h
==============================================================================
--- trunk/lib/engine/components/opal/opal-account.h	(original)
+++ trunk/lib/engine/components/opal/opal-account.h	Tue Mar 31 19:37:34 2009
@@ -140,7 +140,7 @@
     void on_consult (const std::string url);
     
     // Triggered for our own event
-    void on_registration_event (Ekiga::AccountCore::RegistrationState state, std::string info);
+    void on_registration_event (Ekiga::Account::RegistrationState state, std::string info);
 
     bool dead;
     bool active;
@@ -158,6 +158,8 @@
     Ekiga::ServiceCore & core;
   };
 
+  typedef gmref_ptr<Account> AccountPtr;
+
   /**
    * @}
    */

Modified: trunk/lib/engine/components/opal/opal-bank.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-bank.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-bank.cpp	Tue Mar 31 19:37:34 2009
@@ -35,6 +35,8 @@
  *
  */
 
+#include "config.h"
+
 #include <string.h>
 #include <stdlib.h>
 #include <iostream>
@@ -42,13 +44,33 @@
 
 #include <glib/gi18n.h>
 
+#include "gmconf.h"
 #include "menu-builder.h"
 
 #include "opal-bank.h"
 #include "form-request-simple.h"
 
+Opal::Bank::Bank (Ekiga::ServiceCore &_core): core(_core)
+{
+  GSList *accounts = gm_conf_get_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list");
+  GSList *accounts_iter = accounts;
+
+  while (accounts_iter) {
+
+    gmref_ptr<Account> account = gmref_ptr<Account> (new Account (core, (char *)accounts_iter->data));
+
+    add_account (account);
+    Ekiga::BankImpl<Account>::add_connection (account, account->trigger_saving.connect (sigc::mem_fun (this, &Opal::Bank::save)));
+    accounts_iter = g_slist_next (accounts_iter);
+  }
+
+  g_slist_foreach (accounts, (GFunc) g_free, NULL);
+  g_slist_free (accounts);
+}
 
-bool Opal::Bank::populate_menu (Ekiga::MenuBuilder & builder)
+
+bool
+Opal::Bank::populate_menu (Ekiga::MenuBuilder & builder)
 {
   builder.add_action ("add", _("_Add an Ekiga.net Account"),
 		      sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::Ekiga, "", ""));
@@ -63,16 +85,17 @@
 }
 
 
-void Opal::Bank::new_account (Account::Type t,
-                              std::string username,
-                              std::string password)
+void
+Opal::Bank::new_account (Account::Type acc_type,
+			 std::string username,
+			 std::string password)
 {
-  Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted), t));
+  Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted), acc_type));
 
   request.title (_("Edit account"));
   request.instructions (_("Please update the following fields."));
 
-  switch (t) {
+  switch (acc_type) {
 
   case Opal::Account::Ekiga:
     request.link (_("Get an Ekiga.net SIP account"), "http://www.ekiga.net";);
@@ -122,7 +145,7 @@
     if (!questions.handle_request (&request)) {
 #ifdef __GNUC__
       std::cout << "Unhandled form request in "
-        << __PRETTY_FUNCTION__ << std::endl;
+		<< __PRETTY_FUNCTION__ << std::endl;
 #endif
     }
 }
@@ -130,30 +153,33 @@
 
 void Opal::Bank::on_new_account_form_submitted (bool submitted,
 						Ekiga::Form &result,
-                                                Account::Type t)
+                                                Account::Type acc_type)
 {
   if (!submitted)
     return;
 
   try {
 
-    Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,t));
+    Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,acc_type));
 
     std::string error;
-    std::string new_name = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
-    std::string new_host = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
+    std::string new_name = (acc_type == Opal::Account::SIP
+			    || acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
+    std::string new_host = (acc_type == Opal::Account::SIP
+			    || acc_type == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
     std::string new_user = result.text ("user");
-    std::string new_authentication_user = (t == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
+    std::string new_authentication_user = (acc_type == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
     std::string new_password = result.private_text ("password");
     bool new_enabled = result.boolean ("enabled");
-    unsigned new_timeout = atoi ((t == Opal::Account::SIP || t == Opal::Account::H323) ? 
+    unsigned new_timeout = atoi ((acc_type == Opal::Account::SIP
+				  || acc_type == Opal::Account::H323) ?
                                  result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
 
     result.visit (request);
 
-    if (new_name.empty ()) 
+    if (new_name.empty ())
       error = _("You did not supply a name for that account.");
-    else if (new_host.empty ()) 
+    else if (new_host.empty ())
       error = _("You did not supply a host to register to.");
     else if (new_user.empty ())
       error = _("You did not supply a user name for that account.");
@@ -166,13 +192,14 @@
       if (!questions.handle_request (&request)) {
 #ifdef __GNUC__
         std::cout << "Unhandled form request in "
-          << __PRETTY_FUNCTION__ << std::endl;
+		  << __PRETTY_FUNCTION__ << std::endl;
 #endif
       }
     }
     else {
 
-      add (t, new_name, new_host, new_user, new_authentication_user, new_password, new_enabled, new_timeout);
+      add (acc_type, new_name, new_host, new_user, new_authentication_user,
+	   new_password, new_enabled, new_timeout);
       save ();
     }
 
@@ -183,8 +210,8 @@
 }
 
 
-void Opal::Bank::add (Account::Type t,
-                      std::string name, 
+void Opal::Bank::add (Account::Type acc_type,
+                      std::string name,
                       std::string host,
                       std::string user,
                       std::string auth_user,
@@ -192,8 +219,13 @@
                       bool enabled,
                       unsigned timeout)
 {
-  Opal::Account *account = new Opal::Account (core, t, name, host, user, auth_user, password, enabled, timeout);
-  add_account (*account);
+  AccountPtr account = AccountPtr(new Opal::Account (core, acc_type, name,
+						     host, user, auth_user,
+						     password, enabled,
+						     timeout));
+  add_account (account);
+  Ekiga::BankImpl<Account>::add_connection (account, account->trigger_saving.connect (sigc::mem_fun (this, &Opal::Bank::save)));
+
   account->mwi_event.connect (sigc::bind<0> (mwi_event.make_slot (), account));
 }
 
@@ -204,27 +236,47 @@
        iter != end ();
        ++iter) {
 
-    if (iter->is_enabled ())
-      iter->enable ();
+    if ((*iter)->is_enabled ())
+      (*iter)->enable ();
   }
 }
 
-Opal::Account*
+Opal::AccountPtr
 Opal::Bank::find_account (const std::string& aor)
 {
-  Opal::Account* result = NULL;
+  AccountPtr result;
   bool found = false;
 
   for (iterator iter = begin ();
        !found && iter != end ();
        ++iter) {
 
-    if (iter->get_aor () == aor) {
+    if ((*iter)->get_aor () == aor) {
 
       found = true;
-      result = &*iter;
+      result = *iter;
     }
   }
 
   return result;
 }
+
+void
+Opal::Bank::save () const
+{
+  GSList *accounts = NULL;
+
+  for (const_iterator it = begin ();
+       it != end ();
+       it++) {
+
+    std::string acct_str = (*it)->as_string ();
+    if ( !acct_str.empty ())
+      accounts = g_slist_append (accounts, g_strdup (acct_str.c_str ()));
+  }
+
+  gm_conf_set_string_list ("/apps/" PACKAGE_NAME "/protocols/accounts_list", accounts);
+
+  g_slist_foreach (accounts, (GFunc) g_free, NULL);
+  g_slist_free (accounts);
+}

Modified: trunk/lib/engine/components/opal/opal-bank.h
==============================================================================
--- trunk/lib/engine/components/opal/opal-bank.h	(original)
+++ trunk/lib/engine/components/opal/opal-bank.h	Tue Mar 31 19:37:34 2009
@@ -54,7 +54,8 @@
       public Ekiga::Service
   {
 public:
-    Bank (Ekiga::ServiceCore &_core) : Ekiga::BankImpl<Opal::Account> (_core) {}
+
+    Bank (Ekiga::ServiceCore &_core);
 
     virtual ~Bank () { }
 
@@ -66,7 +67,7 @@
     const std::string get_description () const
     { return "\tStores the opal accounts"; }
 
-    void new_account (Account::Type t,
+    void new_account (Account::Type acc_type,
                       std::string username = "",
                       std::string password = "");
 
@@ -76,7 +77,7 @@
      * @return The Opal::Account if an Account was found, false otherwise.
      *         The returned account should not be freed.
      */
-    Opal::Account* find_account (const std::string& aor);
+    AccountPtr find_account (const std::string& aor);
 
 
     void call_manager_ready ();
@@ -85,14 +86,16 @@
      * @param: account is the account 
      *         info contains information about the indication 
      */
-    sigc::signal2<void, const Ekiga::Account *, std::string> mwi_event;
+    sigc::signal2<void, AccountPtr, std::string> mwi_event;
 
 private:
+    Ekiga::ServiceCore &core;
+
     void on_new_account_form_submitted (bool submitted,
 					Ekiga::Form& form,
-					Account::Type t);
+					Account::Type acc_type);
 
-    void add (Account::Type t,
+    void add (Account::Type acc_type,
               std::string name, 
               std::string host,
               std::string user,
@@ -100,6 +103,8 @@
               std::string password,
               bool enabled,
               unsigned timeout);
+
+    void save () const;
   };
 
   /**

Modified: trunk/lib/engine/components/opal/opal-main.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-main.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-main.cpp	Tue Mar 31 19:37:34 2009
@@ -108,9 +108,9 @@
 
       gmref_ptr<Opal::Bank> bank (new Bank (core));
 
-      account_core->add_bank (*bank);
+      account_core->add_bank (bank);
       core.add (bank);
-      call_manager->ready.connect (sigc::mem_fun (*bank, &Opal::Bank::call_manager_ready));
+      call_manager->ready.connect (sigc::mem_fun (&*bank, &Opal::Bank::call_manager_ready));
 
 #ifdef HAVE_SIP
       unsigned sip_port = gm_conf_get_int (SIP_KEY "listen_port");

Modified: trunk/lib/engine/components/opal/sip-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.cpp	Tue Mar 31 19:37:34 2009
@@ -181,7 +181,7 @@
 	 it != bank->end ();
 	 it++) {
 
-      if (it->get_protocol_name () == "SIP" && it->is_active ()) {
+      if ((*it)->get_protocol_name () == "SIP" && (*it)->is_active ()) {
 
 	std::stringstream uristr;
 	std::string str = uri;
@@ -199,10 +199,10 @@
 	else
 	  uristr << str;
 
-	uristr << "@" << it->get_host ();
+	uristr << "@" << (*it)->get_host ();
 
 	uris.push_back (uristr.str ());
-	accounts.push_back (it->get_name ());
+	accounts.push_back ((*it)->get_name ());
       }
     }
   } else {
@@ -675,7 +675,7 @@
   Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this,
 							  &Opal::Sip::EndPoint::registration_event_in_main),
 					   strm.str (),
-					   was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
+					   was_registering ? Ekiga::Account::Registered : Ekiga::Account::Unregistered,
 					   std::string ()));
 }
 
@@ -916,7 +916,7 @@
     Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this,
 							    &Opal::Sip::EndPoint::registration_event_in_main),
 					     strm.str (),
-					     wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
+					     wasRegistering ? Ekiga::Account::RegistrationFailed : Ekiga::Account::UnregistrationFailed,
 					     info));
   }
 }
@@ -1051,7 +1051,7 @@
       /* FIXME: this is the only place where we use the bank in a thread
        * can't we just return GetDefaultDisplayName () ?
        */
-      Opal::Account *account = bank->find_account ("Ekiga.net");
+      AccountPtr account = bank->find_account ("Ekiga.net");
 
       if (account)
         return SIPURL ("\"" + GetDefaultDisplayName () + "\" <" + PString(account->get_aor ()) + ">");
@@ -1190,12 +1190,12 @@
 
 void
 Opal::Sip::EndPoint::registration_event_in_main (const std::string aor,
-						 Ekiga::AccountCore::RegistrationState state,
+						 Ekiga::Account::RegistrationState state,
 						 const std::string msg)
 {
-  Opal::Account* account = bank->find_account (aor);
+  AccountPtr account = bank->find_account (aor);
 
-  if (account != 0) {
+  if (account) {
 
     account->registration_event.emit (state, msg);
   }
@@ -1231,7 +1231,7 @@
 Opal::Sip::EndPoint::mwi_received_in_main (const std::string aor,
 					   const std::string info)
 {
-  Opal::Account* account = bank->find_account (aor);
+  AccountPtr account = bank->find_account (aor);
 
   if (account) {
 

Modified: trunk/lib/engine/components/opal/sip-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.h	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.h	Tue Mar 31 19:37:34 2009
@@ -194,7 +194,7 @@
       void on_transfer (std::string uri);
 
       void registration_event_in_main (const std::string aor,
-				       Ekiga::AccountCore::RegistrationState state,
+				       Ekiga::Account::RegistrationState state,
 				       const std::string msg);
 
       void presence_status_in_main (std::string uri,

Modified: trunk/lib/engine/presence/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/presence-core.cpp	(original)
+++ trunk/lib/engine/presence/presence-core.cpp	Tue Mar 31 19:37:34 2009
@@ -259,11 +259,12 @@
 }
 
 void
-Ekiga::PresenceCore::on_registration_event (const Ekiga::Account& /*account*/,
-					    Ekiga::AccountCore::RegistrationState state,
+Ekiga::PresenceCore::on_registration_event (Ekiga::BankPtr /*bank*/,
+					    Ekiga::AccountPtr /*account*/,
+					    Ekiga::Account::RegistrationState state,
 					    std::string /*info*/,
 					    gmref_ptr<Ekiga::PersonalDetails> details)
 {
-  if (state == Ekiga::AccountCore::Registered)
+  if (state == Ekiga::Account::Registered)
     publish (details);
 }

Modified: trunk/lib/engine/presence/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/presence-core.h	(original)
+++ trunk/lib/engine/presence/presence-core.h	Tue Mar 31 19:37:34 2009
@@ -288,8 +288,9 @@
     std::list<gmref_ptr<PresencePublisher> > presence_publishers;
     void publish (gmref_ptr<PersonalDetails> details);
     void on_personal_details_updated (PersonalDetails &details);
-    void on_registration_event (const Ekiga::Account & account,
-				Ekiga::AccountCore::RegistrationState state,
+    void on_registration_event (Ekiga::BankPtr bank,
+				Ekiga::AccountPtr account,
+				Ekiga::Account::RegistrationState state,
                                 std::string info,
                                 gmref_ptr<Ekiga::PersonalDetails> details);
 

Modified: trunk/src/gui/accounts.cpp
==============================================================================
--- trunk/src/gui/accounts.cpp	(original)
+++ trunk/src/gui/accounts.cpp	Tue Mar 31 19:37:34 2009
@@ -83,7 +83,7 @@
 /* DESCRIPTION  : /
  * BEHAVIOR     : Returns a pointer to the private GmAccountsWindow structure
  *                used by the preferences window GMObject.
- * PRE          : The given GtkWidget pointer must be a preferences window 
+ * PRE          : The given GtkWidget pointer must be a preferences window
  * 		  GMObject.
  */
 static GmAccountsWindow *gm_aw_get_aw (GtkWidget *account_window);
@@ -150,7 +150,7 @@
 bool
 gm_accounts_window_update_account_state (GtkWidget *accounts_window,
 					 gboolean refreshing,
-                                         const Ekiga::Account & _account,
+					 Ekiga::AccountPtr _account,
 					 const gchar *status,
 					 const gchar *voicemails)
 {
@@ -181,7 +181,7 @@
 			  COLUMN_ACCOUNT, &account,
 			  -1);
 
-      if (account == &_account) {
+      if (account == _account.get ()) {
 
         gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
                             COLUMN_ACCOUNT_ERROR_MESSAGE, &error,
@@ -202,7 +202,7 @@
 			      COLUMN_ACCOUNT_VOICEMAILS, voicemails, -1);
           mwi_modified = (mwi == NULL) || strcmp (voicemails, mwi);
         }
-      
+
         g_free (error);
         g_free (mwi);
       }
@@ -215,9 +215,10 @@
 
 
 /* Engine callbacks */
-static void 
-on_registration_event (const Ekiga::Account & account,
-                       Ekiga::AccountCore::RegistrationState state,
+static void
+on_registration_event (Ekiga::BankPtr /*bank*/,
+		       Ekiga::AccountPtr account,
+                       Ekiga::Account::RegistrationState state,
                        std::string info,
                        gpointer window)
 {
@@ -225,43 +226,43 @@
   std::string status;
 
   switch (state) {
-  case Ekiga::AccountCore::Registered:
+  case Ekiga::Account::Registered:
     status = _("Registered");
     break;
 
-  case Ekiga::AccountCore::Unregistered:
+  case Ekiga::Account::Unregistered:
     status = _("Unregistered");
     break;
 
-  case Ekiga::AccountCore::UnregistrationFailed:
+  case Ekiga::Account::UnregistrationFailed:
     status = _("Could not unregister");
     if (!info.empty ())
       status = status + " (" + info + ")";
     break;
 
-  case Ekiga::AccountCore::RegistrationFailed:
+  case Ekiga::Account::RegistrationFailed:
     status = _("Could not register");
     if (!info.empty ())
       status = status + " (" + info + ")";
     break;
 
-  case Ekiga::AccountCore::Processing:
+  case Ekiga::Account::Processing:
     status = _("Processing...");
     is_processing = true;
   default:
     break;
   }
 
-  gm_accounts_window_update_account_state (GTK_WIDGET (window), is_processing, account, status.c_str (), NULL); 
+  gm_accounts_window_update_account_state (GTK_WIDGET (window), is_processing, account, status.c_str (), NULL);
 }
 
 
-static void 
-on_mwi_event (const Ekiga::Account* account,
+static void
+on_mwi_event (Ekiga::AccountPtr account,
               std::string mwi,
               gpointer self)
 {
-  if (gm_accounts_window_update_account_state (GTK_WIDGET (self), false, *account, NULL, mwi.c_str ())) {
+  if (gm_accounts_window_update_account_state (GTK_WIDGET (self), false, account, NULL, mwi.c_str ())) {
 
     std::string::size_type loc = mwi.find ("/", 0);
     if (loc != std::string::npos) {
@@ -433,7 +434,7 @@
 
     if (fixed)
       account->disable ();
-    else 
+    else
       account->enable ();
 
     gtk_list_store_set (GTK_LIST_STORE (model), &iter,
@@ -446,9 +447,9 @@
 }
 
 
-static void 
+static void
 gm_accounts_window_add_account (GtkWidget *window,
-                                Ekiga::Account & account)
+                                Ekiga::AccountPtr account)
 {
   GmAccountsWindow *aw = NULL;
   GtkTreeModel *model = NULL;
@@ -462,18 +463,18 @@
   model = gtk_tree_view_get_model (GTK_TREE_VIEW (aw->accounts_list));
 
   gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter, 
-                      COLUMN_ACCOUNT, &account,
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                      COLUMN_ACCOUNT, account.get (),
                       COLUMN_ACCOUNT_WEIGHT, PANGO_WEIGHT_NORMAL,
-                      COLUMN_ACCOUNT_ENABLED, account.is_enabled (),
-                      COLUMN_ACCOUNT_ACCOUNT_NAME, account.get_name ().c_str (),
-                      -1); 
+                      COLUMN_ACCOUNT_ENABLED, account->is_enabled (),
+                      COLUMN_ACCOUNT_ACCOUNT_NAME, account->get_name ().c_str (),
+                      -1);
 }
 
 
 void
 gm_accounts_window_update_account (GtkWidget *accounts_window,
-                                   Ekiga::Account & account)
+                                   Ekiga::AccountPtr account)
 {
   Ekiga::Account *caccount = NULL;
 
@@ -495,15 +496,15 @@
 
       gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
 			  COLUMN_ACCOUNT, &caccount, -1);
-      
-      if (caccount == &account) {
 
-        gtk_list_store_set (GTK_LIST_STORE (model), &iter, 
-                            COLUMN_ACCOUNT, &account,
+      if (caccount == account.get ()) {
+
+        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                            COLUMN_ACCOUNT, account.get (),
                             COLUMN_ACCOUNT_WEIGHT, PANGO_WEIGHT_NORMAL,
-                            COLUMN_ACCOUNT_ENABLED, account.is_enabled (),
-                            COLUMN_ACCOUNT_ACCOUNT_NAME, account.get_name ().c_str (),
-                            -1); 
+                            COLUMN_ACCOUNT_ENABLED, account->is_enabled (),
+                            COLUMN_ACCOUNT_ACCOUNT_NAME, account->get_name ().c_str (),
+                            -1);
         break;
       }
     } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
@@ -513,7 +514,7 @@
 
 void
 gm_accounts_window_remove_account (GtkWidget *accounts_window,
-                                   Ekiga::Account & account)
+                                   Ekiga::AccountPtr account)
 {
   Ekiga::Account *caccount = NULL;
 
@@ -535,8 +536,8 @@
 
       gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
 			  COLUMN_ACCOUNT, &caccount, -1);
-      
-      if (caccount == &account) {
+
+      if (caccount == account.get ()) {
 
         gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
         break;
@@ -546,8 +547,8 @@
 }
 
 
-static bool 
-visit_accounts (Ekiga::Account & account,
+static bool
+visit_accounts (Ekiga::AccountPtr account,
                 gpointer data)
 {
   gm_accounts_window_add_account (GTK_WIDGET (data), account);
@@ -557,34 +558,37 @@
 
 
 static void
-on_account_added (Ekiga::Account & account,
+on_account_added (Ekiga::BankPtr /*bank*/,
+		  Ekiga::AccountPtr account,
                   gpointer data)
 {
   gm_accounts_window_add_account (GTK_WIDGET (data), account);
 }
 
 
-static void 
-on_account_updated (Ekiga::Account & account,
+static void
+on_account_updated (Ekiga::BankPtr /*bank*/,
+		    Ekiga::AccountPtr account,
                     gpointer data)
 {
   gm_accounts_window_update_account (GTK_WIDGET (data), account);
 }
 
 
-static void 
-on_account_removed (Ekiga::Account & account,
+static void
+on_account_removed (Ekiga::BankPtr /*bank*/,
+		    Ekiga::AccountPtr account,
                     gpointer data)
 {
   gm_accounts_window_remove_account (GTK_WIDGET (data), account);
 }
 
 
-static void 
-on_bank_added (Ekiga::Bank & bank,
+static void
+on_bank_added (Ekiga::BankPtr bank,
                gpointer data)
 {
-  bank.visit_accounts (sigc::bind (sigc::ptr_fun (visit_accounts), data));
+  bank->visit_accounts (sigc::bind (sigc::ptr_fun (visit_accounts), data));
   populate_menu (GTK_WIDGET (data));
 }
 
@@ -646,7 +650,7 @@
   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
 
   aw = new GmAccountsWindow (core);
-  g_object_set_data_full (G_OBJECT (window), "GMObject", 
+  g_object_set_data_full (G_OBJECT (window), "GMObject",
 			  aw, gm_aw_destroy);
 
   /* The menu */
@@ -675,8 +679,8 @@
 				   G_TYPE_INT,
 				   G_TYPE_BOOLEAN, /* Enabled? */
 				   G_TYPE_STRING,  /* Account Name */
-				   G_TYPE_STRING,  /* VoiceMails */  
-				   G_TYPE_STRING,  /* Error Message */  
+				   G_TYPE_STRING,  /* VoiceMails */
+				   G_TYPE_STRING,  /* Error Message */
 				   G_TYPE_INT);    /* State */
 
   aw->accounts_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
@@ -695,7 +699,7 @@
    */
   column = gtk_tree_view_column_new_with_attributes (_("A"),
 						     renderer,
-						     "active", 
+						     "active",
 						     COLUMN_ACCOUNT_ENABLED,
 						     NULL);
   gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 25);
@@ -706,14 +710,14 @@
   		    (gpointer) window);
 
 
-  /* Add all text renderers, ie all except the 
+  /* Add all text renderers, ie all except the
    * "ACCOUNT_ENABLED/DEFAULT" columns */
   for (int i = COLUMN_ACCOUNT_ACCOUNT_NAME ; i < COLUMN_ACCOUNT_NUMBER - 1 ; i++) {
 
     renderer = gtk_cell_renderer_text_new ();
     column = gtk_tree_view_column_new_with_attributes (column_names [i],
 						       renderer,
-						       "text", 
+						       "text",
 						       i,
 						       "weight",
 						       COLUMN_ACCOUNT_WEIGHT,
@@ -727,11 +731,11 @@
 
   g_signal_connect (G_OBJECT (aw->accounts_list), "event_after",
 		    G_CALLBACK (account_clicked_cb), window);
-  
+
   /* The scrolled window with the accounts list store */
   scroll_window = gtk_scrolled_window_new (FALSE, FALSE);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_window), 
-				  GTK_POLICY_AUTOMATIC, 
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_window),
+				  GTK_POLICY_AUTOMATIC,
 				  GTK_POLICY_AUTOMATIC);
 
   event_box = gtk_event_box_new ();
@@ -741,7 +745,7 @@
 
   frame = gtk_frame_new (NULL);
   gtk_widget_set_size_request (GTK_WIDGET (frame), 250, 150);
-  gtk_container_set_border_width (GTK_CONTAINER (frame), 
+  gtk_container_set_border_width (GTK_CONTAINER (frame),
 				  2 * GNOMEMEETING_PAD_SMALL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
   gtk_container_add (GTK_CONTAINER (frame), scroll_window);
@@ -755,17 +759,17 @@
 
 
   /* Generic signals */
-  g_signal_connect_swapped (GTK_OBJECT (window), 
-			    "response", 
+  g_signal_connect_swapped (GTK_OBJECT (window),
+			    "response",
 			    G_CALLBACK (gnomemeeting_window_hide),
 			    (gpointer) window);
 
-  g_signal_connect (GTK_OBJECT (window), "delete-event", 
+  g_signal_connect (GTK_OBJECT (window), "delete-event",
 		    G_CALLBACK (delete_window_cb), NULL);
 
   gtk_widget_show_all (GTK_WIDGET (GTK_DIALOG (window)->vbox));
 
-  
+
   /* Engine Signals callbacks */
   // FIXME sigc::connection conn;
 
@@ -780,6 +784,6 @@
   bank->mwi_event.connect (sigc::bind (sigc::ptr_fun (on_mwi_event), (gpointer) window));
 
   account_core->visit_banks (sigc::bind_return (sigc::bind (sigc::ptr_fun (on_bank_added), window), true));
-  
+
   return window;
 }

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Tue Mar 31 19:37:34 2009
@@ -636,7 +636,7 @@
 prepare_ekiga_net_page (EkigaAssistant *assistant)
 {
   gmref_ptr<Opal::Bank> bank = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("ekiga.net");
+  Opal::AccountPtr account = bank->find_account ("ekiga.net");
 
   if (account && !account->get_username ().empty ())
     gtk_entry_set_text (GTK_ENTRY (assistant->priv->username), account->get_username ().c_str ());
@@ -653,8 +653,8 @@
 apply_ekiga_net_page (EkigaAssistant *assistant)
 {
   gmref_ptr<Opal::Bank> bank = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("ekiga.net");
-  bool new_account = (account == NULL);
+  Opal::AccountPtr account = bank->find_account ("ekiga.net");
+  bool new_account = !account;
 
   if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (assistant->priv->skip_ekiga_net))) {
 	if (new_account)
@@ -780,7 +780,7 @@
 prepare_ekiga_out_page (EkigaAssistant *assistant)
 {
   gmref_ptr<Opal::Bank> account_core = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = account_core->find_account ("sip.diamondcard.us");
+  Opal::AccountPtr account = account_core->find_account ("sip.diamondcard.us");
 
   if (account && !account->get_username ().empty ())
     gtk_entry_set_text (GTK_ENTRY (assistant->priv->dusername), account->get_username ().c_str ());
@@ -798,8 +798,8 @@
 {
   /* Some specific Opal stuff for the Ekiga.net account */
   gmref_ptr<Opal::Bank> bank = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("sip.diamondcard.us");
-  bool new_account = (account == NULL);
+  Opal::AccountPtr account = bank->find_account ("sip.diamondcard.us");
+  bool new_account = !account;
 
   if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (assistant->priv->skip_ekiga_out))) {
 	if (new_account)

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Tue Mar 31 19:37:34 2009
@@ -500,42 +500,44 @@
 /* 
  * Engine Callbacks 
  */
-static void on_registration_event (const Ekiga::Account & account,
-                                   Ekiga::AccountCore::RegistrationState state,
-                                   std::string /*info*/,
-                                   gpointer self)
+static void
+on_registration_event (Ekiga::BankPtr /*bank*/,
+		       Ekiga::AccountPtr account,
+		       Ekiga::Account::RegistrationState state,
+		       std::string /*info*/,
+		       gpointer self)
 {
   EkigaMainWindow *mw = NULL;
 
   gchar *msg = NULL;
-  std::string aor = account.get_aor ();
+  std::string aor = account->get_aor ();
 
   g_return_if_fail (EKIGA_IS_MAIN_WINDOW (self));
   mw = EKIGA_MAIN_WINDOW (self);
 
   switch (state) {
-  case Ekiga::AccountCore::Registered:
+  case Ekiga::Account::Registered:
     /* Translators: Is displayed once an account "%s" is registered. */
     msg = g_strdup_printf (_("Registered %s"), aor.c_str ()); 
-    if (std::find (mw->priv->accounts.begin (), mw->priv->accounts.end (), account.get_host ()) == mw->priv->accounts.end ())
-      mw->priv->accounts.push_back (account.get_host ());
+    if (std::find (mw->priv->accounts.begin (), mw->priv->accounts.end (), account->get_host ()) == mw->priv->accounts.end ())
+      mw->priv->accounts.push_back (account->get_host ());
     break;
 
-  case Ekiga::AccountCore::Unregistered:
+  case Ekiga::Account::Unregistered:
     /* Translators: Is displayed once an account "%s" is unregistered. */
     msg = g_strdup_printf (_("Unregistered %s"), aor.c_str ());
-    mw->priv->accounts.remove (account.get_host ());
+    mw->priv->accounts.remove (account->get_host ());
     break;
 
-  case Ekiga::AccountCore::UnregistrationFailed:
+  case Ekiga::Account::UnregistrationFailed:
     msg = g_strdup_printf (_("Could not unregister %s"), aor.c_str ());
     break;
 
-  case Ekiga::AccountCore::RegistrationFailed:
+  case Ekiga::Account::RegistrationFailed:
     msg = g_strdup_printf (_("Could not register %s"), aor.c_str ());
     break;
 
-  case Ekiga::AccountCore::Processing:
+  case Ekiga::Account::Processing:
   default:
     break;
   }



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