ekiga r7683 - trunk/lib/engine/chat



Author: jpuydt
Date: Mon Feb 23 18:52:16 2009
New Revision: 7683
URL: http://svn.gnome.org/viewvc/ekiga?rev=7683&view=rev

Log:
Completed the dialect-impl code, thus fixing bug #572777

Modified:
   trunk/lib/engine/chat/dialect-impl.h

Modified: trunk/lib/engine/chat/dialect-impl.h
==============================================================================
--- trunk/lib/engine/chat/dialect-impl.h	(original)
+++ trunk/lib/engine/chat/dialect-impl.h	Mon Feb 23 18:52:16 2009
@@ -118,6 +118,10 @@
 
     std::map<gmref_ptr<SimpleChatType>, std::list<sigc::connection> > simple_chats;
     std::map<gmref_ptr<MultipleChatType>, std::list<sigc::connection> > multiple_chats;
+
+    void on_simple_chat_removed (gmref_ptr<SimpleChatType> chat);
+
+    void on_multiple_chat_removed (gmref_ptr<MultipleChatType> chat);
   };
 };
 
@@ -241,7 +245,7 @@
 void
 Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::add_simple_chat (gmref_ptr<SimpleChatType> chat)
 {
-  simple_chats[chat] = std::list<sigc::connection>();
+  simple_chats[chat].push_back (chat->removed.connect (sigc::bind (sigc::mem_fun(this, &Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::on_simple_chat_removed), chat)));
   simple_chat_added.emit (chat);
 }
 
@@ -249,14 +253,14 @@
 void
 Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::remove_simple_chat (gmref_ptr<SimpleChatType> chat)
 {
-  /* FIXME */
+  chat->removed.emit ();
 }
 
 template<typename SimpleChatType, typename MultipleChatType>
 void
 Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::add_multiple_chat (gmref_ptr<MultipleChatType> chat)
 {
-  multiple_chats[chat] = std::list<sigc::connection> ();
+  multiple_chats[chat].push_back (chat->removed.connect (sigc::bind (sigc::mem_fun(this, &Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::on_multiple_chat_removed), chat)));
   multiple_chat_added.emit (chat);
 }
 
@@ -264,7 +268,33 @@
 void
 Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::remove_multiple_chat (gmref_ptr<MultipleChatType> chat)
 {
-  /* FIXME */
+  chat->removed.emit ();
+}
+
+template<typename SimpleChatType, typename MultipleChatType>
+void
+Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::on_simple_chat_removed (gmref_ptr<SimpleChatType> chat)
+{
+  for (typename std::list<sigc::connection>::iterator iter = simple_chats[chat].begin ();
+       iter != simple_chats[chat].end ();
+       ++iter) {
+
+    iter->disconnect ();
+  }
+  simple_chats.erase (chat);
+}
+
+template<typename SimpleChatType, typename MultipleChatType>
+void
+Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::on_multiple_chat_removed (gmref_ptr<MultipleChatType> chat)
+{
+  for (typename std::list<sigc::connection>::iterator iter = multiple_chats[chat].begin ();
+       iter != multiple_chats[chat].end ();
+       ++iter) {
+
+    iter->disconnect ();
+  }
+  multiple_chats.erase (chat);
 }
 
 #endif



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