aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorVeena Katiyar <veenakatiyar0509@gmail.com>2013-11-18 03:09:18 +0800
committerChandni Verma <chandniverma2112@gmail.com>2013-11-18 03:14:50 +0800
commit25b40bf1b21a7c73a5b87649e3fb3536d64d0a97 (patch)
tree912a738bd9151fc66d46de0035ed2793a9874a4f /libempathy-gtk
parent8b783df8f293a93405b591522f5289006286f1f4 (diff)
downloadgsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.tar
gsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.tar.gz
gsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.tar.bz2
gsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.tar.lz
gsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.tar.xz
gsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.tar.zst
gsoc2013-empathy-25b40bf1b21a7c73a5b87649e3fb3536d64d0a97.zip
Insert smileys at the cursor position
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=685899
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat.c15
-rw-r--r--libempathy-gtk/empathy-chat.h3
2 files changed, 11 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index c6cc8e081..35f908b7b 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -46,7 +46,6 @@
#include "empathy-input-text-view.h"
#include "empathy-request-util.h"
#include "empathy-search-bar.h"
-#include "empathy-smiley-manager.h"
#include "empathy-spell.h"
#include "empathy-string-parser.h"
#include "empathy-theme-manager.h"
@@ -2095,6 +2094,13 @@ chat_input_has_focus_notify_cb (GtkWidget *widget,
empathy_theme_adium_focus_toggled (chat->view, gtk_widget_has_focus (widget));
}
+void
+empathy_chat_insert_smiley (GtkTextBuffer *buffer,
+ EmpathySmiley *smiley)
+{
+ gtk_text_buffer_insert_at_cursor (buffer, smiley->str, -1);
+}
+
static void
chat_insert_smiley_activate_cb (EmpathySmileyManager *manager,
EmpathySmiley *smiley,
@@ -2102,15 +2108,10 @@ chat_insert_smiley_activate_cb (EmpathySmileyManager *manager,
{
EmpathyChat *chat = EMPATHY_CHAT (user_data);
GtkTextBuffer *buffer;
- GtkTextIter iter;
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);
-
- gtk_text_buffer_get_end_iter (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter, " ", -1);
+ empathy_chat_insert_smiley (buffer, smiley);
}
typedef struct {
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 2a983622b..c73f5c1f9 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -33,6 +33,7 @@
#include "empathy-contact.h"
#include "empathy-theme-adium.h"
#include "empathy-tp-chat.h"
+#include "empathy-smiley-manager.h"
G_BEGIN_DECLS
@@ -98,6 +99,8 @@ guint empathy_chat_get_n_messages_sending (EmpathyChat *self);
gchar * empathy_chat_dup_text (EmpathyChat *self);
void empathy_chat_set_text (EmpathyChat *self,
const gchar *text);
+void empathy_chat_insert_smiley (GtkTextBuffer *buffer,
+ EmpathySmiley *smiley);
G_END_DECLS