ekiga r7304 - trunk/lib/engine/addressbook/skel
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7304 - trunk/lib/engine/addressbook/skel
- Date: Thu, 30 Oct 2008 15:18:05 +0000 (UTC)
Author: jpuydt
Date: Thu Oct 30 15:18:05 2008
New Revision: 7304
URL: http://svn.gnome.org/viewvc/ekiga?rev=7304&view=rev
Log:
Made the contact core api use gmref_ptr
Modified:
trunk/lib/engine/addressbook/skel/book-impl.h
trunk/lib/engine/addressbook/skel/book.h
trunk/lib/engine/addressbook/skel/contact-core.cpp
trunk/lib/engine/addressbook/skel/contact-core.h
trunk/lib/engine/addressbook/skel/contact.h
trunk/lib/engine/addressbook/skel/source-impl.h
trunk/lib/engine/addressbook/skel/source.h
Modified: trunk/lib/engine/addressbook/skel/book-impl.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/book-impl.h (original)
+++ trunk/lib/engine/addressbook/skel/book-impl.h Thu Oct 30 15:18:05 2008
@@ -37,7 +37,7 @@
#ifndef __BOOK_IMPL_H__
#define __BOOK_IMPL_H__
-#include "lister.h"
+#include "reflister.h"
#include "book.h"
@@ -74,13 +74,13 @@
class BookImpl:
public Book,
public sigc::trackable,
- protected Lister<ContactType>
+ protected RefLister<ContactType>
{
public:
- typedef typename Lister<ContactType>::iterator iterator;
- typedef typename Lister<ContactType>::const_iterator const_iterator;
+ // typedef typename Lister<ContactType>::iterator iterator;
+ //typedef typename Lister<ContactType>::const_iterator const_iterator;
/** The constructor
*/
@@ -95,25 +95,25 @@
* @param The callback (the return value means "go on" and allows
* stopping the visit)
*/
- void visit_contacts (sigc::slot<bool, Contact &> visitor);
+ void visit_contacts (sigc::slot<bool, gmref_ptr<Contact> > visitor);
protected:
/** Returns an iterator to the first Contact of the collection
*/
- iterator begin ();
+ // iterator begin ();
/** Returns an iterator to the last Contact of the collection
*/
- iterator end ();
+ //iterator end ();
/** Returns a const iterator to the first Contact of the collection
*/
- const_iterator begin () const;
+ //const_iterator begin () const;
/** Returns a const iterator to the last Contact of the collection
*/
- const_iterator end () const;
+ //const_iterator end () const;
/** Adds a contact to the Ekiga::Book.
* @param: The contact to be added.
@@ -122,7 +122,7 @@
* when the contact has been updated and the Ekiga::Book 'contact_removed' signal
* will be emitted when the contact has been removed from the Ekiga::Book.
*/
- void add_contact (ContactType &contact);
+ void add_contact (gmref_ptr<ContactType> contact);
/** Removes a contact from the Ekiga::Book.
@@ -130,7 +130,7 @@
* @return: The Ekiga::Book 'contact_removed' signal is emitted when the contact
* has been removed.
*/
- void remove_contact (ContactType &contact);
+ void remove_contact (gmref_ptr<ContactType> contact);
};
@@ -147,9 +147,9 @@
Ekiga::BookImpl<ContactType>::BookImpl ()
{
/* this is signal forwarding */
- Lister<ContactType>::object_added.connect (contact_added.make_slot ());
- Lister<ContactType>::object_removed.connect (contact_removed.make_slot ());
- Lister<ContactType>::object_updated.connect (contact_updated.make_slot ());
+ RefLister<ContactType>::object_added.connect (contact_added.make_slot ());
+ RefLister<ContactType>::object_removed.connect (contact_removed.make_slot ());
+ RefLister<ContactType>::object_updated.connect (contact_updated.make_slot ());
}
@@ -161,56 +161,56 @@
template<typename ContactType>
void
-Ekiga::BookImpl<ContactType>::visit_contacts (sigc::slot<bool, Contact &> visitor)
+Ekiga::BookImpl<ContactType>::visit_contacts (sigc::slot<bool, gmref_ptr<Contact> > visitor)
{
- Lister<ContactType>::visit_objects (visitor);
+ RefLister<ContactType>::visit_objects (visitor);
}
-template<typename ContactType>
-typename Ekiga::BookImpl<ContactType>::iterator
-Ekiga::BookImpl<ContactType>::begin ()
-{
- return Lister<ContactType>::begin ();
-}
+// template<typename ContactType>
+// typename Ekiga::BookImpl<ContactType>::iterator
+// Ekiga::BookImpl<ContactType>::begin ()
+// {
+// return Lister<ContactType>::begin ();
+// }
-template<typename ContactType>
-typename Ekiga::BookImpl<ContactType>::iterator
-Ekiga::BookImpl<ContactType>::end ()
-{
- return Lister<ContactType>::end ();
-}
+// template<typename ContactType>
+// typename Ekiga::BookImpl<ContactType>::iterator
+// Ekiga::BookImpl<ContactType>::end ()
+// {
+// return Lister<ContactType>::end ();
+// }
-template<typename ContactType>
-typename Ekiga::BookImpl<ContactType>::const_iterator
-Ekiga::BookImpl<ContactType>::begin () const
-{
- return Lister<ContactType>::begin ();
-}
+// template<typename ContactType>
+// typename Ekiga::BookImpl<ContactType>::const_iterator
+// Ekiga::BookImpl<ContactType>::begin () const
+// {
+// return Lister<ContactType>::begin ();
+// }
-template<typename ContactType>
-typename Ekiga::BookImpl<ContactType>::const_iterator
-Ekiga::BookImpl<ContactType>::end () const
-{
- return Lister<ContactType>::end ();
-}
+// template<typename ContactType>
+// typename Ekiga::BookImpl<ContactType>::const_iterator
+// Ekiga::BookImpl<ContactType>::end () const
+// {
+// return Lister<ContactType>::end ();
+// }
template<typename ContactType>
void
-Ekiga::BookImpl<ContactType>::add_contact (ContactType &contact)
+Ekiga::BookImpl<ContactType>::add_contact (gmref_ptr<ContactType> contact)
{
- contact.questions.add_handler (questions.make_slot ());
+ contact->questions.add_handler (questions.make_slot ());
add_object (contact);
}
template<typename ContactType>
void
-Ekiga::BookImpl<ContactType>::remove_contact (ContactType &contact)
+Ekiga::BookImpl<ContactType>::remove_contact (gmref_ptr<ContactType> contact)
{
remove_object (contact);
}
Modified: trunk/lib/engine/addressbook/skel/book.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/book.h (original)
+++ trunk/lib/engine/addressbook/skel/book.h Thu Oct 30 15:18:05 2008
@@ -40,7 +40,7 @@
namespace Ekiga {
- class Book
+ class Book: public virtual GmRefCounted
{
public:
@@ -63,7 +63,7 @@
* @param The callback (the return value means "go on" and allows
* stopping the visit)
*/
- virtual void visit_contacts (sigc::slot<bool, Contact &>) = 0;
+ virtual void visit_contacts (sigc::slot<bool, gmref_ptr<Contact> >) = 0;
/** Create the menu for that book and its actions.
@@ -118,17 +118,17 @@
/** This signal is emitted when a Contact has been added to the Book.
*/
- sigc::signal<void, Contact &> contact_added;
+ sigc::signal<void, gmref_ptr<Contact> > contact_added;
/** This signal is emitted when a Contact has been removed from the Book.
*/
- sigc::signal<void, Contact &> contact_removed;
+ sigc::signal<void, gmref_ptr<Contact> > contact_removed;
/** This signal is emitted when a Contact has been updated in the Book.
*/
- sigc::signal<void, Contact &> contact_updated;
+ sigc::signal<void, gmref_ptr<Contact> > contact_updated;
/** This chain allows the Book to present forms to the user
Modified: trunk/lib/engine/addressbook/skel/contact-core.cpp
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact-core.cpp (original)
+++ trunk/lib/engine/addressbook/skel/contact-core.cpp Thu Oct 30 15:18:05 2008
@@ -73,79 +73,27 @@
Ekiga::ContactCore::add_source (gmref_ptr<Source> source)
{
sources.push_back (source);
- source_added.emit (*source);
- source->book_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_added), source));
- source->book_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_removed), source));
- source->book_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_updated), source));
- source->contact_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_added), source));
- source->contact_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_removed), source));
- source->contact_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_updated), source));
+ source_added.emit (source);
+ source->book_added.connect (sigc::bind<0> (book_added.make_slot (), source));
+ source->book_removed.connect (sigc::bind<0> (book_removed.make_slot (), source));
+ source->book_updated.connect (sigc::bind<0> (book_updated.make_slot (), source));
+ source->contact_added.connect (sigc::bind<0> (contact_added.make_slot (), source));
+ source->contact_removed.connect (sigc::bind<0> (contact_removed.make_slot (), source));
+ source->contact_updated.connect (sigc::bind<0> (contact_updated.make_slot (), source));
source->questions.add_handler (questions.make_slot ());
}
void
-Ekiga::ContactCore::visit_sources (sigc::slot<bool, Source &> visitor)
+Ekiga::ContactCore::visit_sources (sigc::slot<bool, gmref_ptr<Source> > visitor)
{
bool go_on = true;
for (std::list<gmref_ptr<Source> >::iterator iter = sources.begin ();
iter != sources.end () && go_on;
++iter)
- go_on = visitor (*(*iter));
+ go_on = visitor (*iter);
}
-
-void
-Ekiga::ContactCore::on_book_added (Book &book,
- gmref_ptr<Source> source)
-{
- book_added.emit (*source, book);
-}
-
-
-void
-Ekiga::ContactCore::on_book_removed (Book &book,
- gmref_ptr<Source> source)
-{
- book_removed.emit (*source, book);
-}
-
-
-void
-Ekiga::ContactCore::on_book_updated (Book &book,
- gmref_ptr<Source> source)
-{
- book_updated.emit (*source, book);
-}
-
-
-void
-Ekiga::ContactCore::on_contact_added (Book &book,
- Contact &contact,
- gmref_ptr<Source> source)
-{
- contact_added.emit (*source, book, contact);
-}
-
-
-void
-Ekiga::ContactCore::on_contact_removed (Book &book,
- Contact &contact,
- gmref_ptr<Source> source)
-{
- contact_removed.emit (*source, book, contact);
-}
-
-
-void
-Ekiga::ContactCore::on_contact_updated (Book &book,
- Contact &contact,
- gmref_ptr<Source> source)
-{
- contact_updated.emit (*source, book, contact);
-}
-
-
void
Ekiga::ContactCore::add_contact_decorator (gmref_ptr<ContactDecorator> decorator)
{
@@ -154,7 +102,7 @@
bool
-Ekiga::ContactCore::populate_contact_menu (Contact &contact,
+Ekiga::ContactCore::populate_contact_menu (gmref_ptr<Contact> contact,
const std::string uri,
MenuBuilder &builder)
{
Modified: trunk/lib/engine/addressbook/skel/contact-core.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact-core.h (original)
+++ trunk/lib/engine/addressbook/skel/contact-core.h Thu Oct 30 15:18:05 2008
@@ -55,9 +55,9 @@
virtual ~ContactDecorator ()
{}
- virtual bool populate_menu (Contact &/*contact*/,
+ virtual bool populate_menu (gmref_ptr<Contact> /*contact*/,
const std::string /*uri*/,
- MenuBuilder &/*builder*/) = 0;
+ MenuBuilder& /*builder*/) = 0;
};
/** Core object for address book support.
@@ -108,56 +108,48 @@
* @param The callback (the return value means "go on" and allows
* stopping the visit)
*/
- void visit_sources (sigc::slot<bool, Source &> visitor);
+ void visit_sources (sigc::slot<bool, gmref_ptr<Source> > visitor);
/** This signal is emitted when a Ekiga::Source has been
* added to the ContactCore Service.
*/
- sigc::signal<void, Source &> source_added;
+ sigc::signal<void, gmref_ptr<Source> > source_added;
/** This signal is emitted when a book has been added to one of
* the sources
*/
- sigc::signal<void, Source &, Book &> book_added;
+ sigc::signal<void, gmref_ptr<Source>, gmref_ptr<Book> > book_added;
/** This signal is emitted when a book has been removed from one of
* the sources
*/
- sigc::signal<void, Source &, Book &> book_removed;
+ sigc::signal<void, gmref_ptr<Source>, gmref_ptr<Book> > book_removed;
/** This signal is emitted when a book has been updated in one of
* the sources
*/
- sigc::signal<void, Source &, Book &> book_updated;
+ sigc::signal<void, gmref_ptr<Source>, gmref_ptr<Book> > book_updated;
/** This signal is emitted when a contact has been added to one of
* the book of one of the sources
*/
- sigc::signal<void, Source &, Book &, Contact &> contact_added;
+ sigc::signal<void, gmref_ptr<Source>, gmref_ptr<Book>, gmref_ptr<Contact> > contact_added;
/** This signal is emitted when a contact has been removed from one of
* the book of one of the sources
*/
- sigc::signal<void, Source &, Book &, Contact &> contact_removed;
+ sigc::signal<void, gmref_ptr<Source>, gmref_ptr<Book>, gmref_ptr<Contact> > contact_removed;
/** This signal is emitted when a contact has been updated in one of
* the book of one of the sources
*/
- sigc::signal<void, Source &, Book &, Contact &> contact_updated;
+ sigc::signal<void, gmref_ptr<Source>, gmref_ptr<Book>, gmref_ptr<Contact> > contact_updated;
private:
std::list<gmref_ptr<Source> > sources;
- /* those functions are signal relayers */
- void on_book_added (Book &book, gmref_ptr<Source> source);
- void on_book_removed (Book &book, gmref_ptr<Source> source);
- void on_book_updated (Book &book, gmref_ptr<Source> source);
- void on_contact_added (Book &book, Contact &contact, gmref_ptr<Source> source);
- void on_contact_removed (Book &book, Contact &contact, gmref_ptr<Source> source);
- void on_contact_updated (Book &book, Contact &contact, gmref_ptr<Source> source);
-
/*** Contact Helpers ***/
public:
@@ -169,7 +161,7 @@
* @param The uri for which actions could be made available.
* @param A MenuBuilder object to populate.
*/
- bool populate_contact_menu (Contact &contact,
+ bool populate_contact_menu (gmref_ptr<Contact> contact,
const std::string uri,
MenuBuilder &builder);
Modified: trunk/lib/engine/addressbook/skel/contact.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact.h (original)
+++ trunk/lib/engine/addressbook/skel/contact.h Thu Oct 30 15:18:05 2008
@@ -41,6 +41,7 @@
#include <map>
#include <string>
+#include "gmref.h"
#include "chain-of-responsibility.h"
#include "form-request.h"
#include "menu-builder.h"
@@ -53,7 +54,7 @@
* @{
*/
- class Contact
+ class Contact: public virtual GmRefCounted
{
public:
Modified: trunk/lib/engine/addressbook/skel/source-impl.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/source-impl.h (original)
+++ trunk/lib/engine/addressbook/skel/source-impl.h Thu Oct 30 15:18:05 2008
@@ -38,9 +38,7 @@
#ifndef __SOURCE_IMPL_H__
#define __SOURCE_IMPL_H__
-#include <vector>
-
-#include "lister.h"
+#include "reflister.h"
#include "source.h"
@@ -82,13 +80,13 @@
class SourceImpl:
public Source,
public sigc::trackable,
- protected Lister<BookType>
+ protected RefLister<BookType>
{
public:
- typedef typename Lister<BookType>::iterator iterator;
- typedef typename Lister<BookType>::const_iterator const_iterator;
+ //typedef typename Lister<BookType>::iterator iterator;
+ //typedef typename Lister<BookType>::const_iterator const_iterator;
/** The constructor
*/
@@ -103,7 +101,7 @@
* @param The callback (the return value means "go on" and allows
* stopping the visit)
*/
- void visit_books (sigc::slot<bool, Book &> visitor);
+ void visit_books (sigc::slot<bool, gmref_ptr<Book> > visitor);
protected:
@@ -115,7 +113,7 @@
* 'book_removed' signal will be emitted when the Ekiga::Book has been
* removed from the Ekiga::Source.
*/
- void add_book (BookType &book);
+ void add_book (gmref_ptr<BookType> book);
/** Removes a book from the Ekiga::Source.
@@ -123,7 +121,7 @@
* @return: The Ekiga::Source 'book_removed' signal is emitted when the
* Ekiga::Book has been removed.
*/
- void remove_book (BookType &book);
+ void remove_book (gmref_ptr<BookType> book);
private:
@@ -133,7 +131,7 @@
* Ekiga::Book.
* @param: The Book to remove.
*/
- void common_removal_steps (BookType &book);
+ void common_removal_steps (gmref_ptr<BookType> book);
/** This callback is triggered when the 'updated' signal is emitted on an
@@ -141,7 +139,7 @@
* Ekiga::Book.
* @param: The updated book.
*/
- void on_book_updated (BookType *book);
+ void on_book_updated (gmref_ptr<BookType> book);
/** This callback is triggered when the 'removed' signal is emitted on an
@@ -149,35 +147,7 @@
* and takes care of the deletion of the book.
* @param: The removed book.
*/
- void on_book_removed (BookType *book);
-
-
- /** This callback is triggered when the 'contact_added' signal is emitted
- * on an Ekiga::Book in this source. Emits the Ekiga::Source
- * 'contact_added' signal.
- * @param: The contact and the book
- */
- void on_contact_added (Contact &contact,
- BookType *book);
-
-
- /** This callback is triggered when the 'contact_removed' signal is emitted
- * on an Ekiga::Book in this source. Emits the Ekiga::Source
- * 'contact_removed' signal.
- * @param: The contact and the book
- */
- void on_contact_removed (Contact &contact,
- BookType *book);
-
-
- /** This callback is triggered when the 'contact_updated' signal is emitted
- * on an Ekiga::Book in this source. Emits the Ekiga::Source
- * 'contact_updated' signal.
- * @param: The contact and the book
- */
- void on_contact_updated (Contact &contact,
- BookType *book);
-
+ void on_book_removed (gmref_ptr<BookType> book);
};
/**
@@ -194,9 +164,9 @@
Ekiga::SourceImpl<BookType>::SourceImpl ()
{
/* signal forwarding */
- Lister<BookType>::object_added.connect (book_added.make_slot ());
- Lister<BookType>::object_removed.connect (book_removed.make_slot ());
- Lister<BookType>::object_updated.connect (book_updated.make_slot ());
+ RefLister<BookType>::object_added.connect (book_added.make_slot ());
+ RefLister<BookType>::object_removed.connect (book_removed.make_slot ());
+ RefLister<BookType>::object_updated.connect (book_updated.make_slot ());
}
template<typename BookType>
@@ -207,60 +177,33 @@
template<typename BookType>
void
-Ekiga::SourceImpl<BookType>::visit_books (sigc::slot<bool, Book &> visitor)
+Ekiga::SourceImpl<BookType>::visit_books (sigc::slot<bool, gmref_ptr<Book> > visitor)
{
- Lister<BookType>::visit_objects (visitor);
+ RefLister<BookType>::visit_objects (visitor);
}
template<typename BookType>
void
-Ekiga::SourceImpl<BookType>::add_book (BookType &book)
+Ekiga::SourceImpl<BookType>::add_book (gmref_ptr<BookType> book)
{
- book.contact_added.connect (sigc::bind (sigc::mem_fun (this, &SourceImpl::on_contact_added), &book));
-
- book.contact_removed.connect (sigc::bind (sigc::mem_fun (this, &SourceImpl::on_contact_removed), &book));
-
- book.contact_updated.connect (sigc::bind (sigc::mem_fun (this, &SourceImpl::on_contact_updated), &book));
-
- book.questions.add_handler (questions.make_slot ());
-
add_object (book);
-}
+ add_connection (book, book->contact_added.connect (sigc::bind<0> (contact_added.make_slot (), book)));
-template<typename BookType>
-void
-Ekiga::SourceImpl<BookType>::remove_book (BookType &book)
-{
- remove_object (book);
-}
+ add_connection (book, book->contact_removed.connect (sigc::bind<0> (contact_removed.make_slot (), book)));
+ add_connection (book, book->contact_updated.connect (sigc::bind<0> (contact_updated.make_slot (), book)));
-template<typename BookType>
-void
-Ekiga::SourceImpl<BookType>::on_contact_added (Contact &contact,
- BookType *book)
-{
- contact_added.emit (*book, contact);
+ add_connection (book, book->questions.add_handler (questions.make_slot ()));
}
template<typename BookType>
void
-Ekiga::SourceImpl<BookType>::on_contact_removed (Contact &contact,
- BookType *book)
+Ekiga::SourceImpl<BookType>::remove_book (gmref_ptr<BookType> book)
{
- contact_removed.emit (*book, contact);
-}
-
-
-template<typename BookType>
-void
-Ekiga::SourceImpl<BookType>::on_contact_updated (Contact &contact,
- BookType *book)
-{
- contact_updated.emit (*book, contact);
+ remove_object (book);
}
#endif
Modified: trunk/lib/engine/addressbook/skel/source.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/source.h (original)
+++ trunk/lib/engine/addressbook/skel/source.h Thu Oct 30 15:18:05 2008
@@ -37,8 +37,6 @@
#ifndef __SOURCE_H__
#define __SOURCE_H__
-#include "gmref.h"
-
#include "book.h"
namespace Ekiga {
@@ -59,7 +57,7 @@
* @param The callback (the return value means "go on" and allows
* stopping the visit)
*/
- virtual void visit_books (sigc::slot<bool, Book &>) = 0;
+ virtual void visit_books (sigc::slot<bool, gmref_ptr<Book> >) = 0;
/** Create the menu for that source and its actions.
@@ -72,32 +70,32 @@
/** This signal is emitted when a Book has been added to the Source.
*/
- sigc::signal<void, Book &> book_added;
+ sigc::signal<void, gmref_ptr<Book> > book_added;
/** This signal is emitted when a Book has been updated in the Source.
*/
- sigc::signal<void, Book &> book_updated;
+ sigc::signal<void, gmref_ptr<Book> > book_updated;
/** This signal is emitted when a Book has been removed in the Source.
*/
- sigc::signal<void, Book &> book_removed;
+ sigc::signal<void, gmref_ptr<Book> > book_removed;
/** This signal is emitted when a Contact has been added to a book in
* this source.
*/
- sigc::signal<void, Book &, Contact &> contact_added;
+ sigc::signal<void, gmref_ptr<Book>, gmref_ptr<Contact> > contact_added;
/** This signal is emitted when a Contact has been removed from a book in
* this source.
*/
- sigc::signal<void, Book &, Contact &> contact_removed;
+ sigc::signal<void, gmref_ptr<Book>, gmref_ptr<Contact> > contact_removed;
/** This signal is emitted when a Contact has been updated in a book in
* this source
*/
- sigc::signal<void, Book &, Contact &> contact_updated;
+ sigc::signal<void, gmref_ptr<Book>, gmref_ptr<Contact> > contact_updated;
/** This chain allows the Source to present forms to the user
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]