]> git.0d.be Git - empathy.git/blobdiff - src/empathy-chat-window.c
use a single window, with tabs
[empathy.git] / src / empathy-chat-window.c
index 63b5c57549a7c01d9ae80e0eb73266e53aaf7eab..2f41d3d9b887d5b258dcf4b819727531701fd6cd 100644 (file)
  *          Rômulo Fernandes Machado <romulo@castorgroup.net>
  */
 
-#include <config.h>
-
-#include <string.h>
+#include "config.h"
+#include "empathy-chat-window.h"
 
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdkx.h>
 #include <glib/gi18n.h>
-#include <libnotify/notification.h>
-
-#include <libempathy/empathy-client-factory.h>
-#include <libempathy/empathy-contact.h>
-#include <libempathy/empathy-message.h>
-#include <libempathy/empathy-chatroom-manager.h>
-#include <libempathy/empathy-gsettings.h>
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-request-util.h>
-#include <libempathy/empathy-individual-manager.h>
-
-#include <libempathy-gtk/empathy-images.h>
-#include <libempathy-gtk/empathy-log-window.h>
-#include <libempathy-gtk/empathy-geometry.h>
-#include <libempathy-gtk/empathy-smiley-manager.h>
-#include <libempathy-gtk/empathy-sound-manager.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-notify-manager.h>
+#include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
-#include "empathy-chat-manager.h"
-#include "empathy-chat-window.h"
 #include "empathy-about-dialog.h"
+#include "empathy-chat-manager.h"
+#include "empathy-chatroom-manager.h"
+#include "empathy-client-factory.h"
+#include "empathy-geometry.h"
+#include "empathy-gsettings.h"
+#include "empathy-images.h"
 #include "empathy-invite-participant-dialog.h"
+#include "empathy-notify-manager.h"
+#include "empathy-request-util.h"
+#include "empathy-sound-manager.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
+#include "empathy-new-message-dialog.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CHAT
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 /* Macro to compare guint32 X timestamps, while accounting for wrapping around
  */
@@ -94,6 +84,8 @@ struct _EmpathyChatWindowPriv
   GtkUIManager *ui_manager;
   GtkAction *menu_conv_insert_smiley;
   GtkAction *menu_conv_favorite;
+  GtkAction *menu_conv_join_chat;
+  GtkAction *menu_conv_leave_chat;
   GtkAction *menu_conv_always_urgent;
   GtkAction *menu_conv_toggle_contacts;
 
@@ -179,7 +171,7 @@ static void empathy_chat_window_get_nb_chats (EmpathyChatWindow *self,
     guint *nb_rooms,
     guint *nb_private);
 
-G_DEFINE_TYPE (EmpathyChatWindow, empathy_chat_window, GTK_TYPE_WINDOW)
+G_DEFINE_TYPE (EmpathyChatWindow, empathy_chat_window, GTK_TYPE_BIN)
 
 static void
 chat_window_accel_cb (GtkAccelGroup *accelgroup,
@@ -322,7 +314,7 @@ confirm_close (EmpathyChatWindow *self,
     }
 
   dialog = gtk_message_dialog_new (
-    GTK_WINDOW (self),
+    GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
     GTK_MESSAGE_WARNING,
     GTK_BUTTONS_CANCEL,
@@ -390,15 +382,17 @@ chat_tab_style_updated_cb (GtkWidget *hbox,
   GtkWidget *button;
   int char_width, h, w;
   PangoContext *context;
-  const PangoFontDescription *font_desc;
+  PangoFontDescription *font_desc;
   PangoFontMetrics *metrics;
 
   button = g_object_get_data (G_OBJECT (user_data),
     "chat-window-tab-close-button");
   context = gtk_widget_get_pango_context (hbox);
 
-  font_desc = gtk_style_context_get_font (gtk_widget_get_style_context (hbox),
-      GTK_STATE_FLAG_NORMAL);
+  gtk_style_context_get (gtk_widget_get_style_context (hbox),
+      GTK_STATE_FLAG_NORMAL,
+      "font", &font_desc,
+      NULL);
 
   metrics = pango_context_get_metrics (context, font_desc,
     pango_context_get_language (context));
@@ -414,6 +408,7 @@ chat_tab_style_updated_cb (GtkWidget *hbox,
     12 * PANGO_PIXELS (char_width) + 2 * w, -1);
 
   gtk_widget_set_size_request (button, w, h);
+  pango_font_description_free (font_desc);
 }
 
 static GtkWidget *
@@ -604,6 +599,9 @@ chat_window_contact_menu_update (EmpathyChatWindow *self)
 {
   GtkWidget *menu, *submenu, *orig_submenu;
 
+  if (self->priv->current_chat == NULL)
+    return;
+
   if (self->priv->updating_menu)
     return;
   self->priv->updating_menu = TRUE;
@@ -732,7 +730,7 @@ chat_window_title_update (EmpathyChatWindow *self)
   gchar *name;
 
   name = get_window_title_name (self);
-  gtk_window_set_title (GTK_WINDOW (self), name);
+  //gtk_window_set_title (GTK_WINDOW (self), name);
   g_free (name);
 }
 
@@ -750,8 +748,8 @@ chat_window_icon_update (EmpathyChatWindow *self,
   /* Update window icon */
   if (new_messages)
     {
-      gtk_window_set_icon_name (GTK_WINDOW (self),
-          EMPATHY_IMAGE_MESSAGE);
+      //gtk_window_set_icon_name (GTK_WINDOW (self),
+      //    EMPATHY_IMAGE_MESSAGE);
     }
   else
     {
@@ -763,14 +761,14 @@ chat_window_icon_update (EmpathyChatWindow *self,
           remote_contact = empathy_chat_get_remote_contact (self->priv->current_chat);
           icon = empathy_pixbuf_avatar_from_contact_scaled (remote_contact,
               0, 0);
-          gtk_window_set_icon (GTK_WINDOW (self), icon);
+          //gtk_window_set_icon (GTK_WINDOW (self), icon);
 
           if (icon != NULL)
             g_object_unref (icon);
         }
       else
         {
-          gtk_window_set_icon_name (GTK_WINDOW (self), NULL);
+          //gtk_window_set_icon_name (GTK_WINDOW (self), NULL);
         }
     }
 }
@@ -971,10 +969,10 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
       g_free (tmp);
     }
 
-  if (!EMP_STR_EMPTY (status))
+  if (!TPAW_STR_EMPTY (status))
     append_markup_printf (tooltip, "\n<i>%s</i>", status);
 
-  if (!EMP_STR_EMPTY (subject))
+  if (!TPAW_STR_EMPTY (subject))
     append_markup_printf (tooltip, "\n<b>%s</b> %s",
         _("Topic:"), subject);
 
@@ -986,9 +984,9 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
       const gchar * const *types;
 
       types = empathy_contact_get_client_types (remote_contact);
-      if (types != NULL && !tp_strdiff (types[0], "phone"))
+      if (empathy_client_types_contains_mobile_device ((GStrv) types))
         {
-          /* I'm on a phone ! */
+          /* I'm on a mobile device ! */
           gchar *tmp = name;
 
           name = g_strdup_printf ("☎ %s", name);
@@ -1080,13 +1078,11 @@ chat_window_insert_smiley_activate_cb (EmpathySmileyManager *manager,
   EmpathyChatWindow *self = user_data;
   EmpathyChat *chat;
   GtkTextBuffer *buffer;
-  GtkTextIter iter;
 
   chat = self->priv->current_chat;
-
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (chat->input_text_view));
-  gtk_text_buffer_get_end_iter (buffer, &iter);
-  gtk_text_buffer_insert (buffer, &iter, smiley->str, -1);
+
+  empathy_chat_insert_smiley (buffer, smiley);
 }
 
 static void
@@ -1096,6 +1092,7 @@ chat_window_conv_activate_cb (GtkAction *action,
   gboolean is_room;
   gboolean active;
   EmpathyContact *remote_contact = NULL;
+  gboolean disconnected;
 
   /* Favorite room menu */
   is_room = empathy_chat_is_room (self->priv->current_chat);
@@ -1140,9 +1137,45 @@ chat_window_conv_activate_cb (GtkAction *action,
         GTK_TOGGLE_ACTION (self->priv->menu_conv_toggle_contacts), active);
     }
 
+  /* Menu-items to be visible for MUCs only */
   gtk_action_set_visible (self->priv->menu_conv_toggle_contacts,
       (remote_contact == NULL));
 
+  disconnected = (empathy_chat_get_tp_chat (self->priv->current_chat) == NULL);
+  if (disconnected)
+    {
+      gtk_action_set_visible (self->priv->menu_conv_join_chat, TRUE);
+      gtk_action_set_visible (self->priv->menu_conv_leave_chat, FALSE);
+    }
+  else
+    {
+      TpChannel *channel = NULL;
+      TpContact *self_contact = NULL;
+      TpHandle  self_handle = 0;
+
+      channel = (TpChannel *) (empathy_chat_get_tp_chat (
+          self->priv->current_chat));
+      self_contact = tp_channel_group_get_self_contact (channel);
+      if (self_contact == NULL)
+      {
+        /* The channel may not be a group */
+        gtk_action_set_visible (self->priv->menu_conv_leave_chat, FALSE);
+      }
+      else
+      {
+        self_handle = tp_contact_get_handle (self_contact);
+        /* There is sometimes a lag between the members-changed signal
+           emitted on tp-chat and invalidated signal being emitted on the channel.
+           Leave Chat menu-item should be sensitive only till our self-handle is
+           a part of channel-members */
+        gtk_action_set_visible (self->priv->menu_conv_leave_chat,
+            self_handle != 0);
+      }
+
+      /* Join Chat is insensitive for a connected chat */
+      gtk_action_set_visible (self->priv->menu_conv_join_chat, FALSE);
+    }
+
   if (remote_contact != NULL)
     g_object_unref (remote_contact);
 }
@@ -1224,7 +1257,7 @@ chat_window_invite_participant_activate_cb (GtkAction *action,
   tp_chat = empathy_chat_get_tp_chat (self->priv->current_chat);
 
   dialog = empathy_invite_participant_dialog_new (
-      GTK_WINDOW (self), tp_chat);
+      GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))), tp_chat);
 
   gtk_widget_show (dialog);
 
@@ -1251,6 +1284,29 @@ out:
   gtk_widget_destroy (dialog);
 }
 
+static void
+chat_window_join_chat_activate_cb (GtkAction *action,
+    EmpathyChatWindow *self)
+{
+    g_return_if_fail (self->priv->current_chat != NULL);
+
+    empathy_chat_join_muc (self->priv->current_chat,
+        empathy_chat_get_id (self->priv->current_chat));
+}
+
+static void
+chat_window_leave_chat_activate_cb (GtkAction *action,
+    EmpathyChatWindow *self)
+{
+    EmpathyTpChat * tp_chat;
+
+    g_return_if_fail (self->priv->current_chat != NULL);
+
+    tp_chat = empathy_chat_get_tp_chat (self->priv->current_chat);
+    if (tp_chat != NULL)
+        empathy_tp_chat_leave (tp_chat, "");
+}
+
 static void
 chat_window_close_activate_cb (GtkAction *action,
     EmpathyChatWindow *self)
@@ -1385,6 +1441,19 @@ chat_window_tabs_previous_activate_cb (GtkAction *action,
   gtk_notebook_prev_page (GTK_NOTEBOOK (self->priv->notebook));
 }
 
+void
+empathy_chat_window_next_tab (EmpathyChatWindow *self)
+{
+  chat_window_tabs_next_activate_cb (NULL, self);
+}
+
+void
+empathy_chat_window_prev_tab (EmpathyChatWindow *self)
+{
+  chat_window_tabs_previous_activate_cb (NULL, self);
+}
+
+
 static void
 chat_window_tabs_undo_close_tab_activate_cb (GtkAction *action,
     EmpathyChatWindow *self)
@@ -1429,14 +1498,10 @@ chat_window_tabs_right_activate_cb (GtkAction *action,
   chat_window_menu_context_update (self, num_pages);
 }
 
-static EmpathyChatWindow *
+EmpathyChatWindow *
 empathy_chat_window_new (void)
 {
   return g_object_new (EMPATHY_TYPE_CHAT_WINDOW,
-      "default-width", 580,
-      "default-height", 480,
-      "title", _("Chat"),
-      "role", "chat",
       NULL);
 }
 
@@ -1466,7 +1531,7 @@ static void
 chat_window_help_about_activate_cb (GtkAction *action,
     EmpathyChatWindow *self)
 {
-  empathy_about_dialog_new (GTK_WINDOW (self));
+  empathy_about_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
 }
 
 static gboolean
@@ -1513,7 +1578,7 @@ static void
 chat_window_set_urgency_hint (EmpathyChatWindow *self,
     gboolean urgent)
 {
-  gtk_window_set_urgency_hint (GTK_WINDOW (self), urgent);
+  //gtk_window_set_urgency_hint (GTK_WINDOW (self), urgent);
 }
 
 static void
@@ -1574,13 +1639,13 @@ chat_window_show_or_update_notification (EmpathyChatWindow *self,
       const gchar *category = empathy_chat_is_room (chat)
         ? EMPATHY_NOTIFICATION_CATEGORY_MENTIONED
         : EMPATHY_NOTIFICATION_CATEGORY_CHAT;
-      notification = notify_notification_new (header, escaped, NULL);
+
+      notification = empathy_notify_manager_create_notification (header,
+          escaped, NULL);
 
       if (self->priv->notification == NULL)
         self->priv->notification = notification;
 
-      notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
-
       tp_g_signal_connect_object (notification, "closed",
             G_CALLBACK (chat_window_notification_closed_cb), self, 0);
 
@@ -1616,7 +1681,7 @@ empathy_chat_window_has_focus (EmpathyChatWindow *self)
 
   g_return_val_if_fail (EMPATHY_IS_CHAT_WINDOW (self), FALSE);
 
-  g_object_get (self, "has-toplevel-focus", &has_focus, NULL);
+  g_object_get ( gtk_widget_get_toplevel (GTK_WIDGET (self)), "has-toplevel-focus", &has_focus, NULL);
 
   return has_focus;
 }
@@ -1787,7 +1852,7 @@ notebook_create_window_cb (GtkNotebook *source,
   empathy_chat_window_move_chat (window, new_window, chat);
 
   gtk_widget_show (GTK_WIDGET (new_window));
-  gtk_window_move (GTK_WINDOW (new_window), x, y);
+  //gtk_window_move (GTK_WINDOW (new_window), x, y);
 
   return NULL;
 }
@@ -1913,6 +1978,9 @@ chat_window_focus_in_event_cb (GtkWidget *widget,
     GdkEvent *event,
     EmpathyChatWindow *self)
 {
+  if (self->priv->current_chat == NULL) {
+          return FALSE;
+  }
   empathy_chat_messages_read (self->priv->current_chat);
 
   chat_window_set_urgency_hint (self, FALSE);
@@ -2344,6 +2412,17 @@ empathy_chat_window_class_init (EmpathyChatWindowClass *klass)
   g_type_class_add_private (object_class, sizeof (EmpathyChatWindowPriv));
 }
 
+static void
+chat_window_chat_new_message_cb (GSimpleAction *action,
+    GVariant *parameter,
+    gpointer user_data)
+{
+  EmpathyChatWindow *self = user_data;
+
+  //empathy_new_message_dialog_show (GTK_WINDOW (self));
+}
+
+
 static void
 empathy_chat_window_init (EmpathyChatWindow *self)
 {
@@ -2354,6 +2433,7 @@ empathy_chat_window_init (EmpathyChatWindow *self)
   GtkWidget *submenu;
   guint i;
   GtkWidget *chat_vbox;
+  GtkWidget *main_box;
   gchar *filename;
   EmpathySmileyManager *smiley_manager;
 
@@ -2361,11 +2441,14 @@ empathy_chat_window_init (EmpathyChatWindow *self)
     EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv);
 
   filename = empathy_file_lookup ("empathy-chat-window.ui", "src");
-  gui = empathy_builder_get_file (filename,
+  gui = tpaw_builder_get_file (filename,
       "chat_vbox", &chat_vbox,
+      "main_box", &main_box,
       "ui_manager", &self->priv->ui_manager,
       "menu_conv_insert_smiley", &self->priv->menu_conv_insert_smiley,
       "menu_conv_favorite", &self->priv->menu_conv_favorite,
+      "menu_conv_join_chat", &self->priv->menu_conv_join_chat,
+      "menu_conv_leave_chat", &self->priv->menu_conv_leave_chat,
       "menu_conv_always_urgent", &self->priv->menu_conv_always_urgent,
       "menu_conv_toggle_contacts", &self->priv->menu_conv_toggle_contacts,
       "menu_edit_cut", &self->priv->menu_edit_cut,
@@ -2381,13 +2464,15 @@ empathy_chat_window_init (EmpathyChatWindow *self)
       NULL);
   g_free (filename);
 
-  empathy_builder_connect (gui, self,
+  tpaw_builder_connect (gui, self,
       "menu_conv", "activate", chat_window_conv_activate_cb,
       "menu_conv_clear", "activate", chat_window_clear_activate_cb,
       "menu_conv_favorite", "toggled", chat_window_favorite_toggled_cb,
       "menu_conv_always_urgent", "toggled", chat_window_always_urgent_toggled_cb,
       "menu_conv_toggle_contacts", "toggled", chat_window_contacts_toggled_cb,
       "menu_conv_invite_participant", "activate", chat_window_invite_participant_activate_cb,
+      "menu_conv_join_chat", "activate", chat_window_join_chat_activate_cb,
+      "menu_conv_leave_chat", "activate", chat_window_leave_chat_activate_cb,
       "menu_conv_close", "activate", chat_window_close_activate_cb,
       "menu_edit", "activate", chat_window_edit_activate_cb,
       "menu_edit_cut", "activate", chat_window_cut_activate_cb,
@@ -2414,11 +2499,12 @@ empathy_chat_window_init (EmpathyChatWindow *self)
   self->priv->sound_mgr = empathy_sound_manager_dup_singleton ();
 
   self->priv->notebook = gtk_notebook_new ();
+  //gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->priv->notebook), FALSE);
 
   g_signal_connect (self->priv->notebook, "create-window",
       G_CALLBACK (notebook_create_window_cb), self);
 
-  gtk_container_add (GTK_CONTAINER (self), chat_vbox);
+  gtk_container_add (GTK_CONTAINER (self), main_box);
 
   gtk_notebook_set_group_name (GTK_NOTEBOOK (self->priv->notebook),
     "EmpathyChatWindow");
@@ -2427,9 +2513,10 @@ empathy_chat_window_init (EmpathyChatWindow *self)
   gtk_box_pack_start (GTK_BOX (chat_vbox), self->priv->notebook, TRUE, TRUE, 0);
   gtk_widget_show (self->priv->notebook);
 
+#if 0 /* no top level window yet at this point */
   /* Set up accels */
   accel_group = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (self), accel_group);
+  gtk_window_add_accel_group (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))), accel_group);
 
   for (i = 0; i < G_N_ELEMENTS (tab_accel_keys); i++)
     {
@@ -2441,6 +2528,7 @@ empathy_chat_window_init (EmpathyChatWindow *self)
     }
 
   g_object_unref (accel_group);
+#endif
 
   /* Set up drag target lists */
   self->priv->contact_targets = gtk_target_list_new (drag_types_dest_contact,
@@ -2524,6 +2612,7 @@ empathy_chat_window_get_default (gboolean room)
 
   separate_windows = g_settings_get_boolean (gsettings,
       EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS);
+  separate_windows = FALSE;
 
   g_object_unref (gsettings);
 
@@ -2538,6 +2627,7 @@ empathy_chat_window_get_default (gboolean room)
 
       chat_window = l->data;
 
+#if 0
       empathy_chat_window_get_nb_chats (chat_window, &nb_rooms, &nb_private);
 
       /* Skip the window if there aren't any rooms in it */
@@ -2547,6 +2637,7 @@ empathy_chat_window_get_default (gboolean room)
       /* Skip the window if there aren't any 1-1 chats in it */
       if (!room && nb_private == 0)
         continue;
+#endif
 
       return chat_window;
     }
@@ -2577,6 +2668,7 @@ empathy_chat_window_add_chat (EmpathyChatWindow *self,
 
       separate_windows = g_settings_get_boolean (self->priv->gsettings_ui,
           EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS);
+          separate_windows = FALSE;
 
       if (empathy_chat_is_room (chat))
         name = "room-window";
@@ -2586,24 +2678,24 @@ empathy_chat_window_add_chat (EmpathyChatWindow *self,
           gint x, y;
 
           /* Save current position of the window */
-          gtk_window_get_position (GTK_WINDOW (self), &x, &y);
+          //gtk_window_get_position (GTK_WINDOW (self), &x, &y);
 
           /* First bind to the 'generic' name. So new window for which we didn't
           * save a geometry yet will have the geometry of the last saved
           * window (bgo #601191). */
-          empathy_geometry_bind (GTK_WINDOW (self), name);
+          //empathy_geometry_bind (GTK_WINDOW (self), name);
 
           /* Restore previous position of the window so the newly created window
           * won't be in the same position as the latest saved window and so
           * completely hide it. */
-          gtk_window_move (GTK_WINDOW (self), x, y);
+          //gtk_window_move (GTK_WINDOW (self), x, y);
 
           /* Then bind it to the name of the contact/room so we'll save the
           * geometry specific to this window */
           name = empathy_chat_get_id (chat);
         }
 
-      empathy_geometry_bind (GTK_WINDOW (self), name);
+      //empathy_geometry_bind (GTK_WINDOW (self), name);
     }
 
   child = GTK_WIDGET (chat);
@@ -2728,7 +2820,7 @@ empathy_chat_window_find_chat (TpAccount *account,
 {
   GList *l;
 
-  g_return_val_if_fail (!EMP_STR_EMPTY (id), NULL);
+  g_return_val_if_fail (!TPAW_STR_EMPTY (id), NULL);
 
   for (l = chat_windows; l; l = l->next)
     {
@@ -2758,6 +2850,13 @@ empathy_chat_window_present_chat (EmpathyChat *chat,
   EmpathyChatWindow *self;
   guint32 x_timestamp;
 
+  if (chat == NULL) {
+    /* initial window */
+    self = empathy_chat_window_new ();
+    gtk_widget_show (GTK_WIDGET (self));
+    return self;
+  }
+
   g_return_val_if_fail (EMPATHY_IS_CHAT (chat), NULL);
 
   self = chat_window_find_chat (chat);
@@ -2799,11 +2898,11 @@ empathy_chat_window_present_chat (EmpathyChat *chat,
 
   empathy_chat_window_switch_to_chat (self, chat);
 
-  /* Don't use empathy_window_present_with_time () which would move the window
+  /* Don't use tpaw_window_present_with_time () which would move the window
    * to our current desktop but move to the window's desktop instead. This is
    * more coherent with Shell's 'app is ready' notication which moves the view
    * to the app desktop rather than moving the app itself. */
-  empathy_move_to_window_desktop (GTK_WINDOW (self), x_timestamp);
+  empathy_move_to_window_desktop (GTK_WINDOW (gtk_widget_get_toplevel(GTK_WIDGET(self))), x_timestamp);
 
   gtk_widget_grab_focus (chat->input_text_view);
   return self;