empathy r849 - trunk/src



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

Log:
Fix various warnings


Modified:
   trunk/src/empathy-chat-window.c
   trunk/src/empathy.c

Modified: trunk/src/empathy-chat-window.c
==============================================================================
--- trunk/src/empathy-chat-window.c	(original)
+++ trunk/src/empathy-chat-window.c	Wed Apr  2 10:42:11 2008
@@ -290,26 +290,37 @@
 	gtk_widget_set_sensitive (priv->menu_conv_insert_smiley, is_connected);
 }
 
-static void
-chat_window_update_title (EmpathyChatWindow *window)
+static const gchar *
+chat_window_get_chat_name (EmpathyChat *chat)
 {
-	EmpathyChatWindowPriv *priv = GET_PRIV (window);
-	EmpathyTpChat         *tp_chat;
-	EmpathyContact        *remote_contact;
-	const gchar           *name;
-	guint                  n_chats;
+	EmpathyTpChat  *tp_chat;
+	EmpathyContact *remote_contact = NULL;
+	const gchar    *name = NULL;
 
-	/* Get chat's name */
-	name = empathy_chat_get_name (priv->current_chat);
-	tp_chat = empathy_chat_get_tp_chat (priv->current_chat);
-	if (!name && tp_chat) {
-		remote_contact = empathy_tp_chat_get_remote_contact (tp_chat);
+	name = empathy_chat_get_name (chat);
+	if (!name) {
+		tp_chat = empathy_chat_get_tp_chat (chat);
+		if (tp_chat) {
+			remote_contact = empathy_tp_chat_get_remote_contact (tp_chat);
+		}
 		if (remote_contact) {
 			name = empathy_contact_get_name (remote_contact);
+		} else {
+			name = _("Conversation");
 		}
 	}
 
-	/* Update window title */
+	return name;
+}
+
+static void
+chat_window_update_title (EmpathyChatWindow *window)
+{
+	EmpathyChatWindowPriv *priv = GET_PRIV (window);
+	const gchar           *name;
+	guint                  n_chats;
+
+	name = chat_window_get_chat_name (priv->current_chat);
 	n_chats = g_list_length (priv->chats);
 	if (n_chats == 1) {
 		gtk_window_set_title (GTK_WINDOW (priv->dialog), name);
@@ -346,15 +357,12 @@
 	priv = GET_PRIV (window);
 
 	/* Get information */
-	name = empathy_chat_get_name (chat);
+	name = chat_window_get_chat_name (chat);
 	subject = empathy_chat_get_subject (chat);
 	tp_chat = empathy_chat_get_tp_chat (chat);
 	if (tp_chat) {
 		remote_contact = empathy_tp_chat_get_remote_contact (tp_chat);
 	}
-	if (!name && remote_contact) {
-		name = empathy_contact_get_name (remote_contact);
-	}
 
 	/* Update tab image */
 	if (g_list_find (priv->chats_new_msg, chat)) {
@@ -377,7 +385,8 @@
 		g_string_append_printf (tooltip, "%s\n%s",
 					empathy_contact_get_id (remote_contact),
 					empathy_contact_get_status (remote_contact));
-	} else {
+	}
+	else {
 		g_string_append (tooltip, name);
 	}
 	if (subject) {
@@ -1391,15 +1400,15 @@
 	child = GTK_WIDGET (chat);
 	label = chat_window_create_label (window, chat); 
 
-	g_signal_connect_swapped (chat, "notify::name",
-				  G_CALLBACK (chat_window_chat_notify_cb),
-				  window);
-	g_signal_connect_swapped (chat, "notify::subject",
-				  G_CALLBACK (chat_window_chat_notify_cb),
-				  window);
-	g_signal_connect_swapped (chat, "notify::tp-chat",
-				  G_CALLBACK (chat_window_chat_notify_cb),
-				  window);
+	g_signal_connect (chat, "notify::name",
+			  G_CALLBACK (chat_window_chat_notify_cb),
+			  NULL);
+	g_signal_connect (chat, "notify::subject",
+			  G_CALLBACK (chat_window_chat_notify_cb),
+			  NULL);
+	g_signal_connect (chat, "notify::tp-chat",
+			  G_CALLBACK (chat_window_chat_notify_cb),
+			  NULL);
 	chat_window_chat_notify_cb (chat);
 
 	gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), child, label);
@@ -1426,14 +1435,14 @@
 
 	priv = GET_PRIV (window);
 
+	g_signal_handlers_disconnect_by_func (chat,
+					      chat_window_chat_notify_cb,
+					      NULL);
+
 	position = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
 					  GTK_WIDGET (chat));
 	gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), position);
 
-	g_signal_handlers_disconnect_by_func (chat,
-					      chat_window_chat_notify_cb,
-					      window);
-
 	empathy_debug (DEBUG_DOMAIN, 
 		      "Chat removed (%d references)", 
 		      G_OBJECT (chat)->ref_count - 1);

Modified: trunk/src/empathy.c
==============================================================================
--- trunk/src/empathy.c	(original)
+++ trunk/src/empathy.c	Wed Apr  2 10:42:11 2008
@@ -91,7 +91,6 @@
 	chat = empathy_chat_new (tp_chat);
 	empathy_chat_window_present_chat (chat);
 
-	g_object_unref (chat);
 	g_object_unref (account);
 	g_object_unref (tp_chat);
 }



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