[empathy: 1/7] chat: add {get,set}_text methods



commit add05052afddb11b158dd08075ffbe2c0404692a
Author: Jonny Lamb <jonnylamb gnome org>
Date:   Mon May 16 10:35:56 2011 +0100

    chat: add {get,set}_text methods
    
    Signed-off-by: Jonny Lamb <jonnylamb gnome org>

 libempathy-gtk/empathy-chat.c |   23 +++++++++++++++++++++++
 libempathy-gtk/empathy-chat.h |    4 ++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 183b49b..59f2b3c 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -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);
+}
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 47892d6..0543f36 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -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__ */



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