]> git.0d.be Git - empathy.git/commitdiff
chat: add {get,set}_text methods
authorJonny Lamb <jonnylamb@gnome.org>
Mon, 16 May 2011 09:35:56 +0000 (10:35 +0100)
committerJonny Lamb <jonnylamb@gnome.org>
Mon, 16 May 2011 09:35:56 +0000 (10:35 +0100)
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-chat.h

index 183b49bf9be72a6769228112d718633331225c14..59f2b3c09936e75c90068b4265c1fa79e9d9d008 100644 (file)
@@ -3921,3 +3921,26 @@ empathy_chat_get_n_messages_sending (EmpathyChat *self)
                return n_messages;
        }
 }
+
+gchar *
+empathy_chat_get_text (EmpathyChat *self)
+{
+       GtkTextBuffer *buffer;
+       GtkTextIter     start, end;
+
+       buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->input_text_view));
+
+       gtk_text_buffer_get_bounds (buffer, &start, &end);
+       return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+}
+
+void
+empathy_chat_set_text (EmpathyChat *self,
+                      const gchar *text)
+{
+       GtkTextBuffer *buffer;
+
+       buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->input_text_view));
+
+       gtk_text_buffer_set_text (buffer, text, -1);
+}
index 47892d6c99cedab421dc6d0b8de4457472a46849..0543f366123aee1a597495fd4d6fa34501351e92 100644 (file)
@@ -97,6 +97,10 @@ gboolean           empathy_chat_is_composing (EmpathyChat *chat);
 gboolean           empathy_chat_is_sms_channel       (EmpathyChat *self);
 guint              empathy_chat_get_n_messages_sending (EmpathyChat *self);
 
+gchar *            empathy_chat_get_text             (EmpathyChat *self);
+void               empathy_chat_set_text             (EmpathyChat *self,
+                                                      const gchar *text);
+
 G_END_DECLS
 
 #endif /* __EMPATHY_CHAT_H__ */