]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-chat.c
Merge branch 'gnome-3-8'
[empathy.git] / libempathy-gtk / empathy-chat.c
index 5a53867e21226e347e1769d2563caf3d4bcb1618..a7364e4ca64326f406c8ef83afd50d1b13309305 100644 (file)
  *          Xavier Claessens <xclaesse@gmail.com>
  */
 
-#include "config.h"
 /* for GCompletion */
 #define GLIB_DISABLE_DEPRECATION_WARNINGS 1
 
-#include <string.h>
-#include <stdlib.h>
+#include "config.h"
+#include "empathy-chat.h"
 
-#include <gdk/gdkkeysyms.h>
 #include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-
-#include <telepathy-glib/telepathy-glib.h>
-#include <telepathy-logger/telepathy-logger.h>
-#include <libempathy/empathy-gsettings.h>
-#include <libempathy/empathy-keyring.h>
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-request-util.h>
-#include <libempathy/empathy-chatroom-manager.h>
-#include <libempathy/empathy-client-factory.h>
+#include <tp-account-widgets/tpaw-keyring.h>
+#include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
-#include "empathy-chat.h"
-#include "empathy-spell.h"
+#include "empathy-client-factory.h"
+#include "empathy-gsettings.h"
 #include "empathy-individual-information-dialog.h"
 #include "empathy-individual-store-channel.h"
 #include "empathy-individual-view.h"
 #include "empathy-input-text-view.h"
+#include "empathy-request-util.h"
 #include "empathy-search-bar.h"
-#include "empathy-theme-manager.h"
-#include "empathy-theme-adium.h"
 #include "empathy-smiley-manager.h"
-#include "empathy-ui-utils.h"
+#include "empathy-spell.h"
 #include "empathy-string-parser.h"
-#include "extensions/extensions.h"
+#include "empathy-theme-manager.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
+#include "extensions.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CHAT
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 #define IS_ENTER(v) (v == GDK_KEY_Return || v == GDK_KEY_ISO_Enter || v == GDK_KEY_KP_Enter)
 #define COMPOSING_STOP_TIMEOUT 5
@@ -336,7 +329,7 @@ chat_new_connection_cb (TpAccount   *account,
 
        if (priv->tp_chat != NULL || account != priv->account ||
            priv->handle_type == TP_HANDLE_TYPE_NONE ||
-           EMP_STR_EMPTY (priv->id))
+           TPAW_STR_EMPTY (priv->id))
                return;
 
        g_object_ref (chat);
@@ -741,7 +734,7 @@ chat_command_msg_cb (GObject *source,
                goto OUT;
        }
 
-       if (!EMP_STR_EMPTY (data->message) && TP_IS_TEXT_CHANNEL (channel)) {
+       if (!TPAW_STR_EMPTY (data->message) && TP_IS_TEXT_CHANNEL (channel)) {
                TpTextChannel *text = (TpTextChannel *) channel;
                TpMessage *msg;
 
@@ -831,7 +824,7 @@ chat_command_join (EmpathyChat *chat,
        * https://bugs.freedesktop.org/show_bug.cgi?id=13422 */
        while (rooms[i] != NULL) {
                /* ignore empty strings */
-               if (!EMP_STR_EMPTY (rooms[i])) {
+               if (!TPAW_STR_EMPTY (rooms[i])) {
                        empathy_chat_join_muc (chat, rooms[i]);
                }
                i++;
@@ -1202,7 +1195,7 @@ chat_command_parse (const gchar *text, guint max_parts)
 
        /* Append last part if not empty */
        item = g_strstrip (g_strdup (text));
-       if (!EMP_STR_EMPTY (item)) {
+       if (!TPAW_STR_EMPTY (item)) {
                g_ptr_array_add (array, item);
                DEBUG ("\tITEM: \"%s\"", item);
        } else {
@@ -1230,7 +1223,7 @@ chat_send (EmpathyChat  *chat,
        TpMessage  *message;
        guint            i;
 
-       if (EMP_STR_EMPTY (msg)) {
+       if (TPAW_STR_EMPTY (msg)) {
                return;
        }
 
@@ -1682,13 +1675,13 @@ chat_subject_changed_cb (EmpathyChat *chat)
                priv->subject = g_strdup (empathy_tp_chat_get_subject (priv->tp_chat));
                g_object_notify (G_OBJECT (chat), "subject");
 
-               if (EMP_STR_EMPTY (priv->subject)) {
+               if (TPAW_STR_EMPTY (priv->subject)) {
                        gtk_widget_hide (priv->hbox_topic);
                } else {
                        gchar *markup_topic;
                        gchar *markup_text;
 
-                       markup_topic = empathy_add_link_markup (priv->subject);
+                       markup_topic = tpaw_add_link_markup (priv->subject);
                        markup_text = g_strdup_printf ("<span weight=\"bold\">%s</span> %s",
                                _("Topic:"), markup_topic);
 
@@ -1701,7 +1694,7 @@ chat_subject_changed_cb (EmpathyChat *chat)
                if (priv->block_events_timeout_id == 0) {
                        gchar *str = NULL;
 
-                       if (!EMP_STR_EMPTY (priv->subject)) {
+                       if (!TPAW_STR_EMPTY (priv->subject)) {
                                const gchar *actor = empathy_tp_chat_get_subject_actor (priv->tp_chat);
 
                                if (tp_str_empty (actor)) {
@@ -2420,7 +2413,7 @@ chat_input_populate_popup_cb (GtkTextView *view,
        /* Add the Send menu item. */
        gtk_text_buffer_get_bounds (buffer, &start, &end);
        str = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-       if (!EMP_STR_EMPTY (str)) {
+       if (!TPAW_STR_EMPTY (str)) {
                item = gtk_menu_item_new_with_mnemonic (_("_Send"));
                g_signal_connect (G_OBJECT (item), "activate",
                                  G_CALLBACK (chat_text_send_cb), chat);
@@ -2467,7 +2460,7 @@ chat_input_populate_popup_cb (GtkTextView *view,
                str = gtk_text_buffer_get_text (buffer,
                                                &start, &end, FALSE);
        }
-       if (!EMP_STR_EMPTY (str)) {
+       if (!TPAW_STR_EMPTY (str)) {
                chat_spell = chat_spell_new (chat, str, start, end);
                g_object_set_data_full (G_OBJECT (menu),
                                        "chat-spell", chat_spell,
@@ -2860,7 +2853,7 @@ build_part_message (guint           reason,
                g_string_append_printf (s, _("%s has left the room"), name);
        }
 
-       if (!EMP_STR_EMPTY (message)) {
+       if (!TPAW_STR_EMPTY (message)) {
                /* Note to translators: this string is appended to
                 * notifications like "foo has left the room", with the message
                 * given by the user living the room. If this poses a problem,
@@ -3260,7 +3253,7 @@ chat_create_ui (EmpathyChat *chat)
 
        filename = empathy_file_lookup ("empathy-chat.ui",
                                        "libempathy-gtk");
-       gui = empathy_builder_get_file (filename,
+       gui = tpaw_builder_get_file (filename,
                                        "chat_widget", &priv->widget,
                                        "hpaned", &priv->hpaned,
                                        "vbox_left", &priv->vbox_left,
@@ -3273,7 +3266,7 @@ chat_create_ui (EmpathyChat *chat)
                                        "info_bar_vbox", &priv->info_bar_vbox,
                                        NULL);
 
-       empathy_builder_connect (gui, chat,
+       tpaw_builder_connect (gui, chat,
                "expander_topic", "notify::expanded", chat_topic_expander_activate_cb,
                "label_topic", "size-allocate", chat_topic_label_size_allocate_cb,
                NULL);
@@ -3744,7 +3737,7 @@ remember_password_infobar_response_cb (GtkWidget *info_bar,
 
        if (response_id == GTK_RESPONSE_OK) {
                DEBUG ("Saving room password");
-               empathy_keyring_set_room_password_async (priv->account,
+               tpaw_keyring_set_room_password_async (priv->account,
                                                         empathy_tp_chat_get_id (priv->tp_chat),
                                                         data->password,
                                                         NULL, NULL);
@@ -3864,14 +3857,8 @@ provide_password_cb (GObject *tp_chat,
                return;
        }
 
-       if (empathy_keyring_is_available ()) {
-               /* ask whether they want to save the password */
-               chat_prompt_to_save_password (self, data);
-       } else {
-               /* Get rid of the password info bar finally */
-               gtk_widget_destroy (data->info_bar);
-               g_slice_free (PasswordData, data);
-       }
+    /* ask whether they want to save the password */
+    chat_prompt_to_save_password (self, data);
 
        /* Room joined */
        gtk_widget_set_sensitive (priv->hpaned, TRUE);
@@ -3937,7 +3924,7 @@ password_entry_changed_cb (GtkEditable *entry,
        str = gtk_entry_get_text (GTK_ENTRY (entry));
 
        gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
-           GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+           GTK_ENTRY_ICON_SECONDARY, !TPAW_STR_EMPTY (str));
 }
 
 static void
@@ -4086,7 +4073,7 @@ chat_room_got_password_cb (GObject *source,
        const gchar *password;
        GError *error = NULL;
 
-       password = empathy_keyring_get_room_password_finish (priv->account,
+       password = tpaw_keyring_get_room_password_finish (priv->account,
            result, &error);
 
        if (error != NULL) {
@@ -4108,7 +4095,7 @@ chat_password_needed_changed_cb (EmpathyChat *self)
        EmpathyChatPriv *priv = GET_PRIV (self);
 
        if (tp_channel_password_needed (TP_CHANNEL (priv->tp_chat))) {
-               empathy_keyring_get_room_password_async (priv->account,
+               tpaw_keyring_get_room_password_async (priv->account,
                                                         empathy_tp_chat_get_id (priv->tp_chat),
                                                         chat_room_got_password_cb, self);
        }
@@ -4310,7 +4297,7 @@ empathy_chat_get_contact_menu (EmpathyChat *chat)
        if (individual == NULL)
                return NULL;
 
-       menu = empathy_individual_menu_new (individual,
+       menu = empathy_individual_menu_new (individual, NULL,
                                         EMPATHY_INDIVIDUAL_FEATURE_CALL |
                                         EMPATHY_INDIVIDUAL_FEATURE_LOG |
                                         EMPATHY_INDIVIDUAL_FEATURE_INFO |