ekiga r6502 - in trunk: . lib/engine/chat/echo lib/engine/chat/skel lib/engine/gui/gtk-frontend src/endpoints
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6502 - in trunk: . lib/engine/chat/echo lib/engine/chat/skel lib/engine/gui/gtk-frontend src/endpoints
- Date: Thu, 24 Jul 2008 21:42:35 +0000 (UTC)
Author: jpuydt
Date: Thu Jul 24 21:42:35 2008
New Revision: 6502
URL: http://svn.gnome.org/viewvc/ekiga?rev=6502&view=rev
Log:
Modified the way user could request a specific Chat in the stack, and simplified the way ChatWindow manages its sigc connections
Modified:
trunk/ChangeLog
trunk/lib/engine/chat/echo/echo-dialect.cpp
trunk/lib/engine/chat/skel/chat.h
trunk/lib/engine/chat/skel/dialect-impl.h
trunk/lib/engine/chat/skel/dialect.h
trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
trunk/src/endpoints/sip-dialect.cpp
Modified: trunk/lib/engine/chat/echo/echo-dialect.cpp
==============================================================================
--- trunk/lib/engine/chat/echo/echo-dialect.cpp (original)
+++ trunk/lib/engine/chat/echo/echo-dialect.cpp Thu Jul 24 21:42:35 2008
@@ -60,5 +60,7 @@
void
Echo::Dialect::new_chat ()
{
- add_simple_chat (true, new SimpleChat ());
+ SimpleChat* chat = new SimpleChat ();
+ add_simple_chat (chat);
+ chat->user_requested.emit ();
}
Modified: trunk/lib/engine/chat/skel/chat.h
==============================================================================
--- trunk/lib/engine/chat/skel/chat.h (original)
+++ trunk/lib/engine/chat/skel/chat.h Thu Jul 24 21:42:35 2008
@@ -112,6 +112,10 @@
*/
sigc::signal<void> updated;
+ /** This signal is emitted when the user requested to see this Chat
+ */
+ sigc::signal<void> user_requested;
+
/** This signal is emitted when the Chat has been removed.
*/
sigc::signal<void> removed;
Modified: trunk/lib/engine/chat/skel/dialect-impl.h
==============================================================================
--- trunk/lib/engine/chat/skel/dialect-impl.h (original)
+++ trunk/lib/engine/chat/skel/dialect-impl.h Thu Jul 24 21:42:35 2008
@@ -92,8 +92,7 @@
* @param The SimpleChat to be added.
* @return: The Ekiga::Dialect 'simple_chat_added' signal is emitted.
*/
- void add_simple_chat (bool user_request,
- SimpleChatType* chat);
+ void add_simple_chat (SimpleChatType* chat);
/** Removes a SimpleChat from the Ekiga::Dialect.
* @param The SimpleChat to be removed.
@@ -104,8 +103,7 @@
* @param The MultipleChat to be added.
* @return: The Ekiga::Dialect 'multiple_chat_added' signal is emitted.
*/
- void add_multiple_chat (bool user_request,
- MultipleChatType* chat);
+ void add_multiple_chat (MultipleChatType* chat);
/** Removes a MultipleChat from the Ekiga::Dialect.
* @param The MultipleChat to be removed.
@@ -201,11 +199,10 @@
template<typename SimpleChatType, typename MultipleChatType>
void
-Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::add_simple_chat (bool user_request,
- SimpleChatType* chat)
+Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::add_simple_chat (SimpleChatType* chat)
{
simple_chats.add_object (*chat);
- simple_chat_added.emit (user_request, *chat);
+ simple_chat_added.emit (*chat);
}
template<typename SimpleChatType, typename MultipleChatType>
@@ -217,10 +214,10 @@
template<typename SimpleChatType, typename MultipleChatType>
void
-Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::add_multiple_chat (bool user_request, MultipleChatType* chat)
+Ekiga::DialectImpl<SimpleChatType, MultipleChatType>::add_multiple_chat (MultipleChatType* chat)
{
multiple_chats.add_object (*chat);
- multiple_chat_added.emit (user_request, *chat);
+ multiple_chat_added.emit (*chat);
}
template<typename SimpleChatType, typename MultipleChatType>
Modified: trunk/lib/engine/chat/skel/dialect.h
==============================================================================
--- trunk/lib/engine/chat/skel/dialect.h (original)
+++ trunk/lib/engine/chat/skel/dialect.h Thu Jul 24 21:42:35 2008
@@ -70,16 +70,14 @@
virtual bool populate_menu (MenuBuilder &) = 0;
/** This signal is emitted when an Ekiga::SimpleChat has been added to
- * the dialect ; the boolean indicates whether the opening was from direct
- * user request.
+ * the dialect.
*/
- sigc::signal<void, bool, SimpleChat&> simple_chat_added;
+ sigc::signal<void, SimpleChat&> simple_chat_added;
/** This signal is emitted when an Ekiga::MultipleChat has been added to
- * the dialect ; the boolean indicates whether the opening was from direct
- * user request.
+ * the dialect.
*/
- sigc::signal<void, bool, MultipleChat&> multiple_chat_added;
+ sigc::signal<void, MultipleChat&> multiple_chat_added;
/** This chain allows the Dialect to present forms to the user.
*/
Modified: trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window.cpp Thu Jul 24 21:42:35 2008
@@ -45,9 +45,7 @@
{}
Ekiga::ChatCore& core;
- sigc::connection dialect_added_connection;
- std::list<sigc::connection> simple_chat_added_connections;
- std::list<sigc::connection> multiple_chat_added_connections;
+ std::list<sigc::connection> connections;
GtkWidget* notebook;
};
@@ -82,11 +80,11 @@
static bool on_dialect_added (ChatWindow* self,
Ekiga::Dialect& dialect);
static bool on_simple_chat_added (ChatWindow* self,
- bool on_user_request,
- Ekiga::SimpleChat &chat);
+ Ekiga::SimpleChat& chat);
static bool on_multiple_chat_added (ChatWindow* self,
- bool on_user_request,
- Ekiga::MultipleChat &chat);
+ Ekiga::MultipleChat& chat);
+static void on_some_chat_user_requested (ChatWindow* self,
+ GtkWidget* page);
/* helper (implementation) */
@@ -213,18 +211,17 @@
on_dialect_added (ChatWindow* self,
Ekiga::Dialect& dialect)
{
- self->priv->simple_chat_added_connections.push_front (dialect.simple_chat_added.connect (sigc::hide_return (sigc::bind<0> (sigc::ptr_fun (on_simple_chat_added), self))));
- self->priv->multiple_chat_added_connections.push_front (dialect.multiple_chat_added.connect (sigc::hide_return (sigc::bind<0> (sigc::ptr_fun (on_multiple_chat_added), self))));
+ 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))));
- dialect.visit_simple_chats (sigc::bind<0> (sigc::bind<0> (sigc::ptr_fun (on_simple_chat_added), self), false));
- dialect.visit_multiple_chats (sigc::bind<0> (sigc::bind<0> (sigc::ptr_fun (on_multiple_chat_added), self), false));
+ dialect.visit_simple_chats (sigc::bind<0> (sigc::ptr_fun (on_simple_chat_added), self));
+ dialect.visit_multiple_chats (sigc::bind<0> (sigc::ptr_fun (on_multiple_chat_added), self));
return true;
}
static bool
on_simple_chat_added (ChatWindow* self,
- bool on_user_request,
Ekiga::SimpleChat &chat)
{
GtkWidget* page = NULL;
@@ -244,19 +241,13 @@
g_signal_connect (page, "message-notice-event",
G_CALLBACK (on_message_notice_event), self);
- if (on_user_request) {
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), num);
- gtk_widget_show (GTK_WIDGET (self));
- gtk_window_present (GTK_WINDOW (self));
- }
+ self->priv->connections.push_front (chat.user_requested.connect (sigc::bind (sigc::ptr_fun (on_some_chat_user_requested), self, page)));
return true;
}
static bool
on_multiple_chat_added (ChatWindow* self,
- bool on_user_request,
Ekiga::MultipleChat &chat)
{
GtkWidget* page = NULL;
@@ -270,16 +261,24 @@
page, label);
gtk_widget_show_all (page);
- if (on_user_request) {
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), num);
- gtk_widget_show (GTK_WIDGET (self));
- gtk_window_present (GTK_WINDOW (self));
- }
+ self->priv->connections.push_front (chat.user_requested.connect (sigc::bind (sigc::ptr_fun (on_some_chat_user_requested), self, page)));
return true;
}
+static void
+on_some_chat_user_requested (ChatWindow* self,
+ GtkWidget* page)
+{
+ gint num;
+
+ num = gtk_notebook_page_num (GTK_NOTEBOOK (self->priv->notebook), page);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), num);
+ gtk_widget_show (GTK_WIDGET (self));
+ gtk_window_present (GTK_WINDOW (self));
+}
+
+
/* GObject code */
static void
@@ -299,17 +298,9 @@
self = CHAT_WINDOW (obj);
- self->priv->dialect_added_connection.disconnect ();
-
- for (std::list<sigc::connection>::iterator iter
- = self->priv->simple_chat_added_connections.begin ();
- iter != self->priv->simple_chat_added_connections.end ();
- ++iter)
- iter->disconnect ();
-
for (std::list<sigc::connection>::iterator iter
- = self->priv->multiple_chat_added_connections.begin ();
- iter != self->priv->multiple_chat_added_connections.end ();
+ = self->priv->connections.begin ();
+ iter != self->priv->connections.end ();
++iter)
iter->disconnect ();
@@ -406,7 +397,7 @@
g_signal_connect (result->priv->notebook, "switch-page",
G_CALLBACK (on_switch_page), result);
- result->priv->dialect_added_connection = core.dialect_added.connect (sigc::hide_return(sigc::bind<0>(sigc::ptr_fun (on_dialect_added), result)));
+ result->priv->connections.push_front (core.dialect_added.connect (sigc::hide_return(sigc::bind<0>(sigc::ptr_fun (on_dialect_added), result))));
core.visit_dialects (sigc::bind<0>(sigc::ptr_fun (on_dialect_added), result));
return (GtkWidget*)result;
Modified: trunk/src/endpoints/sip-dialect.cpp
==============================================================================
--- trunk/src/endpoints/sip-dialect.cpp (original)
+++ trunk/src/endpoints/sip-dialect.cpp Thu Jul 24 21:42:35 2008
@@ -114,8 +114,11 @@
if (result == NULL) {
result = new SimpleChat (core, name, uri, sigc::bind<0>(sender, uri));
- add_simple_chat (user_request, result);
+ add_simple_chat (result);
}
+ if (user_request)
+ result->user_requested.emit ();
+
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]