ekiga r6464 - in trunk: . lib/engine/account/skel src/endpoints src/gui



Author: dsandras
Date: Wed Jul 16 18:11:11 2008
New Revision: 6464
URL: http://svn.gnome.org/viewvc/ekiga?rev=6464&view=rev

Log:
Fixed account removal.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/account/skel/bank-impl.h
   trunk/src/endpoints/opal-account.cpp
   trunk/src/endpoints/opal-account.h
   trunk/src/gui/accounts.cpp

Modified: trunk/lib/engine/account/skel/bank-impl.h
==============================================================================
--- trunk/lib/engine/account/skel/bank-impl.h	(original)
+++ trunk/lib/engine/account/skel/bank-impl.h	Wed Jul 16 18:11:11 2008
@@ -201,8 +201,12 @@
 
   for (const_iterator it = begin ();
        it != end ();
-       it++)
-    accounts = g_slist_append (accounts, g_strdup ((*it).as_string ().c_str ()));
+       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/ekiga/protocols/accounts_list", accounts);
 

Modified: trunk/src/endpoints/opal-account.cpp
==============================================================================
--- trunk/src/endpoints/opal-account.cpp	(original)
+++ trunk/src/endpoints/opal-account.cpp	Wed Jul 16 18:11:11 2008
@@ -52,6 +52,8 @@
                         const std::string & account)
 : core (_core)
 {
+  dead = false;
+
   int i = 0;
   char *pch = strtok ((char *) account.c_str (), "|");
   while (pch != NULL) {
@@ -119,6 +121,7 @@
                         unsigned _timeout)
 : core (_core)
 {
+  dead = false;
   enabled = _enabled;
   aid = (const char *) PGloballyUniqueID ().AsString ();
   name = _name;
@@ -141,6 +144,9 @@
 
 const std::string Opal::Account::as_string () const
 {
+  if (dead)
+    return "";
+
   std::stringstream str;
 
   str << enabled << "|1|" 
@@ -239,8 +245,14 @@
     
 void Opal::Account::remove ()
 {
+  dead = true;
+
+  trigger_saving.emit ();
+
+  removed.emit ();
 }
 
+
 bool Opal::Account::populate_menu (Ekiga::MenuBuilder &builder)
 {
   if (enabled)

Modified: trunk/src/endpoints/opal-account.h
==============================================================================
--- trunk/src/endpoints/opal-account.h	(original)
+++ trunk/src/endpoints/opal-account.h	Wed Jul 16 18:11:11 2008
@@ -104,6 +104,7 @@
 private:
     void on_edit_form_submitted (Ekiga::Form &result);
 
+    bool dead;
     bool enabled;
     unsigned timeout;
     std::string aid;

Modified: trunk/src/gui/accounts.cpp
==============================================================================
--- trunk/src/gui/accounts.cpp	(original)
+++ trunk/src/gui/accounts.cpp	Wed Jul 16 18:11:11 2008
@@ -290,6 +290,7 @@
                               GTK_SIGNAL_FUNC (g_object_unref),
                               (gpointer) builder.menu);
           }
+          g_object_ref_sink (G_OBJECT (builder.menu));
         }
       }
 
@@ -402,6 +403,41 @@
 }
 
 
+void
+gm_accounts_window_remove_account (GtkWidget *accounts_window,
+                                   Ekiga::Account & account)
+{
+  Ekiga::Account *caccount = NULL;
+
+  GtkTreeModel *model = NULL;
+
+  GtkTreeIter iter;
+
+  GmAccountsWindow *aw = NULL;
+
+  g_return_if_fail (accounts_window != NULL);
+
+  aw = gm_aw_get_aw (accounts_window);
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (aw->accounts_list));
+
+  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)){
+
+    do {
+
+      gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+			  COLUMN_ACCOUNT, &caccount, -1);
+      
+      if (caccount == &account) {
+
+        gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+        break;
+      }
+    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
+  }
+}
+
+
 static bool 
 visit_accounts (Ekiga::Account & account,
                 gpointer data)
@@ -429,6 +465,14 @@
 
 
 static void 
+on_account_removed (Ekiga::Account & account,
+                    gpointer data)
+{
+  gm_accounts_window_remove_account (GTK_WIDGET (data), account);
+}
+
+
+static void 
 on_bank_added (Ekiga::Bank & bank,
                gpointer data)
 {
@@ -610,6 +654,7 @@
   account_core->bank_added.connect (sigc::bind (sigc::ptr_fun (on_bank_added), window));
   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->registration_event.connect (sigc::bind (sigc::ptr_fun (on_registration_event), (gpointer) window));
   



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