empathy r836 - in trunk: libempathy-gtk src



Author: xclaesse
Date: Wed Apr  2 10:41:40 2008
New Revision: 836
URL: http://svn.gnome.org/viewvc/empathy?rev=836&view=rev

Log:
Add empathy_chat_new and don't use empathy_group/private_* in empathy.c


Modified:
   trunk/libempathy-gtk/empathy-chat.c
   trunk/libempathy-gtk/empathy-chat.h
   trunk/src/empathy.c

Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c	(original)
+++ trunk/libempathy-gtk/empathy-chat.c	Wed Apr  2 10:41:40 2008
@@ -1281,6 +1281,12 @@
 				    NULL);
 }
 
+EmpathyChat *
+empathy_chat_new (EmpathyTpChat *tp_chat)
+{
+	return g_object_new (EMPATHY_TYPE_CHAT, "tp-chat", tp_chat, NULL);
+}
+
 gboolean
 empathy_chat_get_is_command (const gchar *str)
 {

Modified: trunk/libempathy-gtk/empathy-chat.h
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.h	(original)
+++ trunk/libempathy-gtk/empathy-chat.h	Wed Apr  2 10:41:40 2008
@@ -64,7 +64,7 @@
 };
 
 GType              empathy_chat_get_type              (void);
-
+EmpathyChat *      empathy_chat_new                   (EmpathyTpChat     *tp_chat);
 EmpathyChatView *  empathy_chat_get_view              (EmpathyChat       *chat);
 void               empathy_chat_clear                 (EmpathyChat       *chat);
 void               empathy_chat_scroll_down           (EmpathyChat       *chat);

Modified: trunk/src/empathy.c
==============================================================================
--- trunk/src/empathy.c	(original)
+++ trunk/src/empathy.c	Wed Apr  2 10:41:40 2008
@@ -45,8 +45,6 @@
 
 #include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-chat.h>
-#include <libempathy-gtk/empathy-private-chat.h>
-#include <libempathy-gtk/empathy-group-chat.h>
 
 #include "empathy-main-window.h"
 #include "empathy-status-icon.h"
@@ -79,11 +77,7 @@
 		/* The chat already exists */
 		if (!empathy_chat_is_connected (chat)) {
 			/* The chat died, give him the new text channel */
-			if (empathy_chat_is_group_chat (chat)) {
-				tp_chat = EMPATHY_TP_CHAT (empathy_tp_chatroom_new (account, tp_chan));
-			} else {
-				tp_chat = empathy_tp_chat_new (account, tp_chan);
-			}
+			tp_chat = empathy_tp_chat_new (account, tp_chan, TRUE);
 			empathy_chat_set_tp_chat (chat, tp_chat);
 			g_object_unref (tp_chat);
 		}
@@ -93,23 +87,8 @@
 		return;
 	}
 
-	if (tp_chan->handle_type == TP_HANDLE_TYPE_CONTACT) {
-		/* We have a new private chat channel */
-		tp_chat = empathy_tp_chat_new (account, tp_chan);
-		chat = EMPATHY_CHAT (empathy_private_chat_new (tp_chat));
-	}
-	else if (tp_chan->handle_type == TP_HANDLE_TYPE_ROOM) {
-		/* We have a new group chat channel */
-		tp_chat = EMPATHY_TP_CHAT (empathy_tp_chatroom_new (account, tp_chan));
-		chat = EMPATHY_CHAT (empathy_group_chat_new (EMPATHY_TP_CHATROOM (tp_chat)));
-	} else {
-		empathy_debug (DEBUG_DOMAIN,
-			       "Unknown handle type (%d) for Text channel",
-			       tp_chan->handle_type);
-		g_object_unref (account);
-		return;
-	}
-
+	tp_chat = empathy_tp_chat_new (account, tp_chan, TRUE);
+	chat = empathy_chat_new (tp_chat);
 	empathy_chat_window_present_chat (chat);
 
 	g_object_unref (chat);



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