[ekiga/gnome-2-26] Syntactic sugar for the chat stack too (FooPtr for gmref_ptr<Foo>)



commit 097ac147d8701a320ad6442bfbf2b220e01d75cd
Author: Julien Puydt <jpuydt src gnome org>
Date:   Tue Mar 24 21:08:39 2009 +0000

    Syntactic sugar for the chat stack too (FooPtr for gmref_ptr<Foo>)
    
    svn path=/trunk/; revision=7815
---
 lib/engine/chat/chat-core.cpp                      |    8 ++++----
 lib/engine/chat/chat-core.h                        |    8 ++++----
 lib/engine/chat/chat-multiple.h                    |    2 ++
 lib/engine/chat/chat-simple.h                      |    1 +
 lib/engine/chat/dialect-impl.h                     |    8 ++++----
 lib/engine/chat/dialect.h                          |   10 ++++++----
 lib/engine/components/echo/echo-dialect.cpp        |    2 +-
 lib/engine/components/echo/echo-dialect.h          |    3 +++
 lib/engine/components/echo/echo-simple.h           |    3 +++
 lib/engine/components/opal/sip-chat-simple.h       |    3 +++
 lib/engine/components/opal/sip-dialect.cpp         |    8 ++++----
 lib/engine/components/opal/sip-dialect.h           |    5 ++++-
 lib/engine/gui/gtk-frontend/chat-window.cpp        |   12 ++++++------
 lib/engine/gui/gtk-frontend/multiple-chat-page.cpp |    2 +-
 lib/engine/gui/gtk-frontend/multiple-chat-page.h   |    2 +-
 lib/engine/gui/gtk-frontend/simple-chat-page.cpp   |    2 +-
 lib/engine/gui/gtk-frontend/simple-chat-page.h     |    2 +-
 17 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/lib/engine/chat/chat-core.cpp b/lib/engine/chat/chat-core.cpp
index 7be4fa8..e6a6c40 100644
--- a/lib/engine/chat/chat-core.cpp
+++ b/lib/engine/chat/chat-core.cpp
@@ -42,7 +42,7 @@ Ekiga::ChatCore::~ChatCore ()
 }
 
 void
-Ekiga::ChatCore::add_dialect (gmref_ptr<Dialect> dialect)
+Ekiga::ChatCore::add_dialect (DialectPtr dialect)
 {
   dialects.push_back (dialect);
   dialect->questions.add_handler (questions.make_slot ());
@@ -50,11 +50,11 @@ Ekiga::ChatCore::add_dialect (gmref_ptr<Dialect> dialect)
 }
 
 void
-Ekiga::ChatCore::visit_dialects (sigc::slot1<bool, gmref_ptr<Dialect> > visitor)
+Ekiga::ChatCore::visit_dialects (sigc::slot1<bool, DialectPtr > visitor)
 {
   bool go_on = true;
 
-  for (std::list<gmref_ptr<Dialect> >::iterator iter = dialects.begin ();
+  for (std::list<DialectPtr >::iterator iter = dialects.begin ();
        iter != dialects.end () && go_on;
        iter++)
     go_on = visitor (*iter);
@@ -65,7 +65,7 @@ Ekiga::ChatCore::populate_menu (MenuBuilder &builder)
 {
   bool result = false;
 
-  for (std::list<gmref_ptr<Dialect> >::iterator iter = dialects.begin ();
+  for (std::list<DialectPtr >::iterator iter = dialects.begin ();
        iter != dialects.end ();
        ++iter)
     result = (*iter)->populate_menu (builder) || result;
diff --git a/lib/engine/chat/chat-core.h b/lib/engine/chat/chat-core.h
index 53d163a..c9e3543 100644
--- a/lib/engine/chat/chat-core.h
+++ b/lib/engine/chat/chat-core.h
@@ -88,23 +88,23 @@ namespace Ekiga
     /** Adds a dialect to the ContactCore service.
      * @param The dialect to be added.
      */
-    void add_dialect (gmref_ptr<Dialect> dialect);
+    void add_dialect (DialectPtr dialect);
 
     /** Triggers a callback for all Ekiga::Dialect dialects of the
      * ChatCore service.
      * @param The callback (the return value means "go on" and allows stopping
      * the visit)
      */
-    void visit_dialects (sigc::slot1<bool, gmref_ptr<Dialect> > visitor);
+    void visit_dialects (sigc::slot1<bool, DialectPtr > visitor);
 
     /** This signal is emitted when an Ekiga::Dialect has been added to
      * the ChatCore service.
      */
-    sigc::signal1<void, gmref_ptr<Dialect> > dialect_added;
+    sigc::signal1<void, DialectPtr > dialect_added;
 
   private:
 
-    std::list<gmref_ptr<Dialect> > dialects;
+    std::list<DialectPtr > dialects;
 
     /*** Misc ***/
   public:
diff --git a/lib/engine/chat/chat-multiple.h b/lib/engine/chat/chat-multiple.h
index 17e1993..168dc49 100644
--- a/lib/engine/chat/chat-multiple.h
+++ b/lib/engine/chat/chat-multiple.h
@@ -60,6 +60,8 @@ namespace Ekiga
     virtual HeapPtr get_heap () const = 0;
   };
 
+  typedef gmref_ptr<MultipleChat> MultipleChatPtr;
+
 };
 
 #endif
diff --git a/lib/engine/chat/chat-simple.h b/lib/engine/chat/chat-simple.h
index 1621309..dcc1add 100644
--- a/lib/engine/chat/chat-simple.h
+++ b/lib/engine/chat/chat-simple.h
@@ -60,6 +60,7 @@ namespace Ekiga
     virtual PresentityPtr get_presentity () const = 0;
   };
 
+  typedef gmref_ptr<SimpleChat> SimpleChatPtr;
 };
 
 #endif
diff --git a/lib/engine/chat/dialect-impl.h b/lib/engine/chat/dialect-impl.h
index 6d82eef..c6ce6b2 100644
--- a/lib/engine/chat/dialect-impl.h
+++ b/lib/engine/chat/dialect-impl.h
@@ -63,13 +63,13 @@ namespace Ekiga
      * @param: The callback (the return value means "go on" and allows
      * stopping the visit)
      */
-    void visit_simple_chats (sigc::slot1<bool, gmref_ptr<SimpleChat> > visitor);
+    void visit_simple_chats (sigc::slot1<bool, SimpleChatPtr > visitor);
 
     /** Triggers a callback for all multiple chats of the Dialect.
      * @param: The callback (the return value means "go on" and allows
      * stopping the visit)
      */
-    void visit_multiple_chats (sigc::slot1<bool, gmref_ptr<MultipleChat> > visitor);
+    void visit_multiple_chats (sigc::slot1<bool, MultipleChatPtr > visitor);
 
   protected:
 
@@ -159,7 +159,7 @@ Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::~DialectImpl ()
 
 template<typename SimpleChatType, typename MultipleChatType>
 void
-Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::visit_simple_chats (sigc::slot1<bool, gmref_ptr<SimpleChat> > visitor)
+Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::visit_simple_chats (sigc::slot1<bool, SimpleChatPtr > visitor)
 {
   bool go_on = true;
 
@@ -173,7 +173,7 @@ Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::visit_simple_chats (sigc::
 
 template<typename SimpleChatType, typename MultipleChatType>
 void
-Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::visit_multiple_chats (sigc::slot1<bool, gmref_ptr<MultipleChat> > visitor)
+Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::visit_multiple_chats (sigc::slot1<bool, MultipleChatPtr > visitor)
 {
   bool go_on = true;
 
diff --git a/lib/engine/chat/dialect.h b/lib/engine/chat/dialect.h
index 2a2102a..b9c414f 100644
--- a/lib/engine/chat/dialect.h
+++ b/lib/engine/chat/dialect.h
@@ -55,13 +55,13 @@ namespace Ekiga
      * @param: The callback (the return value means "go on" and allows
      * stopping the visit)
      */
-    virtual void visit_simple_chats (sigc::slot1<bool, gmref_ptr<SimpleChat> > visitor) = 0;
+    virtual void visit_simple_chats (sigc::slot1<bool, SimpleChatPtr > visitor) = 0;
 
     /** Triggers a callback for all multiple chats of the Dialect.
      * @param: The callback (the return value means "go on" and allows
      * stopping the visit)
      */
-    virtual void visit_multiple_chats (sigc::slot1<bool, gmref_ptr<MultipleChat> > visitor) = 0;
+    virtual void visit_multiple_chats (sigc::slot1<bool, MultipleChatPtr > visitor) = 0;
 
 
     /** Feed possible actions on this Dialect to the given MenuBuilder
@@ -72,18 +72,20 @@ namespace Ekiga
     /** This signal is emitted when an Ekiga::SimpleChat has been added to
      * the dialect.
      */
-    sigc::signal1<void, gmref_ptr<SimpleChat> > simple_chat_added;
+    sigc::signal1<void, SimpleChatPtr> simple_chat_added;
 
     /** This signal is emitted when an Ekiga::MultipleChat has been added to
      * the dialect.
      */
-    sigc::signal1<void, gmref_ptr<MultipleChat> > multiple_chat_added;
+    sigc::signal1<void, MultipleChatPtr> multiple_chat_added;
 
     /** This chain allows the Dialect to present forms to the user.
      */
     ChainOfResponsibility<FormRequest*> questions;
   };
 
+  typedef gmref_ptr<Dialect> DialectPtr;
+
 };
 
 #endif
diff --git a/lib/engine/components/echo/echo-dialect.cpp b/lib/engine/components/echo/echo-dialect.cpp
index d1c1661..f34480c 100644
--- a/lib/engine/components/echo/echo-dialect.cpp
+++ b/lib/engine/components/echo/echo-dialect.cpp
@@ -60,7 +60,7 @@ Echo::Dialect::populate_menu (Ekiga::MenuBuilder &builder)
 void
 Echo::Dialect::new_chat ()
 {
-  gmref_ptr<SimpleChat> chat (new SimpleChat);
+  SimpleChatPtr chat (new SimpleChat);
   add_simple_chat (chat);
   chat->user_requested.emit ();
 }
diff --git a/lib/engine/components/echo/echo-dialect.h b/lib/engine/components/echo/echo-dialect.h
index dfa4d83..907ec41 100644
--- a/lib/engine/components/echo/echo-dialect.h
+++ b/lib/engine/components/echo/echo-dialect.h
@@ -64,6 +64,9 @@ namespace Echo
 
     void new_chat ();
   };
+
+  typedef gmref_ptr<Dialect> DialectPtr;
+
 };
 
 #endif
diff --git a/lib/engine/components/echo/echo-simple.h b/lib/engine/components/echo/echo-simple.h
index 8625a5f..1c6a307 100644
--- a/lib/engine/components/echo/echo-simple.h
+++ b/lib/engine/components/echo/echo-simple.h
@@ -66,6 +66,9 @@ namespace Echo
     std::list<gmref_ptr<Ekiga::ChatObserver> > observers;
     PresentityPtr presentity;
   };
+
+  typedef gmref_ptr<SimpleChat> SimpleChatPtr;
+
 };
 
 #endif
diff --git a/lib/engine/components/opal/sip-chat-simple.h b/lib/engine/components/opal/sip-chat-simple.h
index 60d005c..7a3de61 100644
--- a/lib/engine/components/opal/sip-chat-simple.h
+++ b/lib/engine/components/opal/sip-chat-simple.h
@@ -79,6 +79,9 @@ namespace SIP
     Ekiga::PresentityPtr presentity;
     std::string uri;
   };
+
+  typedef gmref_ptr<SimpleChat> SimpleChatPtr;
+
 };
 
 #endif
diff --git a/lib/engine/components/opal/sip-dialect.cpp b/lib/engine/components/opal/sip-dialect.cpp
index 40943a0..b4d4bc7 100644
--- a/lib/engine/components/opal/sip-dialect.cpp
+++ b/lib/engine/components/opal/sip-dialect.cpp
@@ -54,7 +54,7 @@ SIP::Dialect::push_message (const std::string uri,
 			    const std::string name,
 			    const std::string msg)
 {
-  gmref_ptr<SimpleChat> chat;
+  SimpleChatPtr chat;
 
   chat = open_chat_with (uri, name, false);
 
@@ -66,7 +66,7 @@ SIP::Dialect::push_notice (const std::string uri,
 			   const std::string name,
 			   const std::string msg)
 {
-  gmref_ptr<SimpleChat> chat;
+  SimpleChatPtr chat;
 
   chat = open_chat_with (uri, name, false);
 
@@ -91,7 +91,7 @@ SIP::Dialect::open_chat_with (std::string uri,
 			      std::string name,
 			      bool user_request)
 {
-  gmref_ptr<SimpleChat> result;
+  SimpleChatPtr result;
 
   for (simple_iterator iter = simple_begin ();
        iter != simple_end ();
@@ -101,7 +101,7 @@ SIP::Dialect::open_chat_with (std::string uri,
 
   if ( !result) {
 
-    result = gmref_ptr<SimpleChat> (new SimpleChat (core, name, uri, sigc::bind<0>(sender, uri)));
+    result = SimpleChatPtr (new SimpleChat (core, name, uri, sigc::bind<0>(sender, uri)));
     add_simple_chat (result);
   }
 
diff --git a/lib/engine/components/opal/sip-dialect.h b/lib/engine/components/opal/sip-dialect.h
index cc4e0f8..b047147 100644
--- a/lib/engine/components/opal/sip-dialect.h
+++ b/lib/engine/components/opal/sip-dialect.h
@@ -70,10 +70,13 @@ namespace SIP
     /* the strings are : uri then msg */
     sigc::slot2<bool, std::string, std::string> sender;
 
-    gmref_ptr<SimpleChat> open_chat_with (std::string uri,
+    SimpleChatPtr open_chat_with (std::string uri,
 					  std::string name,
 					  bool user_request);
   };
+
+  typedef gmref_ptr<Dialect> DialectPtr;
+
 };
 
 #endif
diff --git a/lib/engine/gui/gtk-frontend/chat-window.cpp b/lib/engine/gui/gtk-frontend/chat-window.cpp
index d656ffc..4529f3f 100644
--- a/lib/engine/gui/gtk-frontend/chat-window.cpp
+++ b/lib/engine/gui/gtk-frontend/chat-window.cpp
@@ -88,11 +88,11 @@ static void on_message_notice_event (GtkWidget* page,
 				     gpointer data);
 
 static bool on_dialect_added (ChatWindow* self,
-			      gmref_ptr<Ekiga::Dialect> dialect);
+			      Ekiga::DialectPtr dialect);
 static bool on_simple_chat_added (ChatWindow* self,
-				  gmref_ptr<Ekiga::SimpleChat> chat);
+				  Ekiga::SimpleChatPtr chat);
 static bool on_multiple_chat_added (ChatWindow* self,
-				    gmref_ptr<Ekiga::MultipleChat> chat);
+				    Ekiga::MultipleChatPtr chat);
 static void on_some_chat_user_requested (ChatWindow* self,
 					 GtkWidget* page);
 
@@ -265,7 +265,7 @@ on_message_notice_event (GtkWidget* page,
 
 static bool
 on_dialect_added (ChatWindow* self,
-		  gmref_ptr<Ekiga::Dialect> dialect)
+		  Ekiga::DialectPtr dialect)
 {
   self->priv->connections.push_front (dialect->simple_chat_added.connect (sigc::hide_return (sigc::bind<0> (sigc::ptr_fun (on_simple_chat_added), self))));
   self->priv->connections.push_front (dialect->multiple_chat_added.connect (sigc::hide_return (sigc::bind<0> (sigc::ptr_fun (on_multiple_chat_added), self))));
@@ -278,7 +278,7 @@ on_dialect_added (ChatWindow* self,
 
 static bool
 on_simple_chat_added (ChatWindow* self,
-		      gmref_ptr<Ekiga::SimpleChat> chat)
+		      Ekiga::SimpleChatPtr chat)
 {
   GtkWidget* page = NULL;
   GtkWidget* hbox = NULL;
@@ -326,7 +326,7 @@ on_simple_chat_added (ChatWindow* self,
 
 static bool
 on_multiple_chat_added (ChatWindow* self,
-			gmref_ptr<Ekiga::MultipleChat> chat)
+			Ekiga::MultipleChatPtr chat)
 {
   GtkWidget* page = NULL;
   GtkWidget* label = NULL;
diff --git a/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp b/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
index 64eb8b6..5cf64a3 100644
--- a/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
+++ b/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
@@ -133,7 +133,7 @@ multiple_chat_page_get_type ()
 /* implementation of the public api */
 
 GtkWidget*
-multiple_chat_page_new (gmref_ptr<Ekiga::MultipleChat> chat)
+multiple_chat_page_new (Ekiga::MultipleChatPtr chat)
 {
   MultipleChatPage* result = NULL;
   GtkWidget* area = NULL;
diff --git a/lib/engine/gui/gtk-frontend/multiple-chat-page.h b/lib/engine/gui/gtk-frontend/multiple-chat-page.h
index 095e2e5..cb6aa36 100644
--- a/lib/engine/gui/gtk-frontend/multiple-chat-page.h
+++ b/lib/engine/gui/gtk-frontend/multiple-chat-page.h
@@ -45,7 +45,7 @@ G_BEGIN_DECLS
 
 /* public api */
 
-GtkWidget* multiple_chat_page_new (gmref_ptr<Ekiga::MultipleChat> chat);
+GtkWidget* multiple_chat_page_new (Ekiga::MultipleChatPtr chat);
 
 /* GObject boilerplate */
 
diff --git a/lib/engine/gui/gtk-frontend/simple-chat-page.cpp b/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
index 8932c72..09c04de 100644
--- a/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
+++ b/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
@@ -162,7 +162,7 @@ simple_chat_page_get_type ()
 /* implementation of the public api */
 
 GtkWidget*
-simple_chat_page_new (gmref_ptr<Ekiga::SimpleChat> chat)
+simple_chat_page_new (Ekiga::SimpleChatPtr chat)
 {
   SimpleChatPage* result = NULL;
   GtkWidget* presentity_view = NULL;
diff --git a/lib/engine/gui/gtk-frontend/simple-chat-page.h b/lib/engine/gui/gtk-frontend/simple-chat-page.h
index fc9d65d..016ab38 100644
--- a/lib/engine/gui/gtk-frontend/simple-chat-page.h
+++ b/lib/engine/gui/gtk-frontend/simple-chat-page.h
@@ -45,7 +45,7 @@ G_BEGIN_DECLS
 
 /* public api */
 
-GtkWidget* simple_chat_page_new (gmref_ptr<Ekiga::SimpleChat> chat);
+GtkWidget* simple_chat_page_new (Ekiga::SimpleChatPtr chat);
 
 /* GObject boilerplate */
 



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