]> git.0d.be Git - empathy.git/commitdiff
Fix various warnings
authorXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 Apr 2008 09:42:11 +0000 (09:42 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 Apr 2008 09:42:11 +0000 (09:42 +0000)
svn path=/trunk/; revision=849

src/empathy-chat-window.c
src/empathy.c

index 3a761f59674cf61190569ab254edf9fef792e28e..6dd55cbae8b39ab2fe0554f5323fa340deff0ba4 100644 (file)
@@ -290,26 +290,37 @@ chat_window_update_menu (EmpathyChatWindow *window)
        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 @@ chat_window_update_chat (EmpathyChat *chat)
        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 @@ chat_window_update_chat (EmpathyChat *chat)
                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 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window,
        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 @@ empathy_chat_window_remove_chat (EmpathyChatWindow *window,
 
        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);
index c33c6929624d78cbff568388e4453d075f8dbdca..9ab0830dc43a6cc12bf0eb0b4acd9651fb69b3ab 100644 (file)
@@ -91,7 +91,6 @@ new_text_channel_cb (EmpathyChandler *chandler,
        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);
 }