1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2008 Collabora Ltd.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301 USA
20 * Authors: Xavier Claessens <xclaesse@gmail.com>
25 #include "empathy-chat-view.h"
26 #include "empathy-smiley-manager.h"
28 static void chat_view_base_init (gpointer klass);
31 empathy_chat_view_get_type (void)
33 static GType type = 0;
36 static const GTypeInfo type_info = {
37 sizeof (EmpathyChatViewIface),
42 type = g_type_register_static (G_TYPE_INTERFACE,
46 g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
53 chat_view_base_init (gpointer klass)
55 static gboolean initialized = FALSE;
63 empathy_chat_view_append_message (EmpathyChatView *view,
65 gboolean should_highlight)
67 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
69 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message) {
70 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message (view,
77 empathy_chat_view_append_event (EmpathyChatView *view,
80 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
82 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event) {
83 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event (view,
89 empathy_chat_view_append_event_markup (EmpathyChatView *view,
90 const gchar *markup_text,
91 const gchar *fallback_text)
93 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
95 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event_markup) {
96 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event_markup (view,
100 empathy_chat_view_append_event (view, fallback_text);
105 empathy_chat_view_edit_message (EmpathyChatView *view,
106 EmpathyMessage *message)
108 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
110 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->edit_message) {
111 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->edit_message (
117 empathy_chat_view_scroll (EmpathyChatView *view,
118 gboolean allow_scrolling)
120 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
122 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll) {
123 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll (view,
129 empathy_chat_view_scroll_down (EmpathyChatView *view)
131 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
133 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll_down) {
134 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll_down (view);
139 empathy_chat_view_get_has_selection (EmpathyChatView *view)
141 g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
143 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->get_has_selection) {
144 return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->get_has_selection (view);
150 empathy_chat_view_clear (EmpathyChatView *view)
152 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
154 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->clear) {
155 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->clear (view);
160 empathy_chat_view_find_previous (EmpathyChatView *view,
161 const gchar *search_criteria,
165 g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
167 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous) {
168 return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous (view,
177 empathy_chat_view_find_next (EmpathyChatView *view,
178 const gchar *search_criteria,
182 g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
184 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next) {
185 return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next (view,
195 empathy_chat_view_find_abilities (EmpathyChatView *view,
196 const gchar *search_criteria,
198 gboolean *can_do_previous,
199 gboolean *can_do_next)
201 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
203 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities) {
204 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities (view,
213 empathy_chat_view_highlight (EmpathyChatView *view,
217 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
219 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->highlight) {
220 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->highlight (view, text, match_case);
225 empathy_chat_view_copy_clipboard (EmpathyChatView *view)
227 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
229 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->copy_clipboard) {
230 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->copy_clipboard (view);
235 empathy_chat_view_focus_toggled (EmpathyChatView *view,
238 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
240 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->focus_toggled) {
241 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->focus_toggled (view, has_focus);
246 empathy_chat_view_message_acknowledged (EmpathyChatView *view,
247 EmpathyMessage *message)
249 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
251 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->message_acknowledged) {
252 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->message_acknowledged (view, message);