Updated Czech translation
[empathy-mirror.git] / libempathy-gtk / empathy-chat-view.c
blobada66988522a6bd2f92dc4ab168c6b9d2d0483c7
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
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>
23 #include "config.h"
25 #include "empathy-chat-view.h"
26 #include "empathy-smiley-manager.h"
28 static void chat_view_base_init (gpointer klass);
30 GType
31 empathy_chat_view_get_type (void)
33 static GType type = 0;
35 if (!type) {
36 static const GTypeInfo type_info = {
37 sizeof (EmpathyChatViewIface),
38 chat_view_base_init,
39 NULL,
42 type = g_type_register_static (G_TYPE_INTERFACE,
43 "EmpathyChatView",
44 &type_info, 0);
46 g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
49 return type;
52 static void
53 chat_view_base_init (gpointer klass)
55 static gboolean initialized = FALSE;
57 if (!initialized) {
58 initialized = TRUE;
62 void
63 empathy_chat_view_append_message (EmpathyChatView *view,
64 EmpathyMessage *msg)
66 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
68 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message) {
69 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message (view,
70 msg);
74 void
75 empathy_chat_view_append_event (EmpathyChatView *view,
76 const gchar *str)
78 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
80 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event) {
81 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event (view,
82 str);
86 void
87 empathy_chat_view_scroll (EmpathyChatView *view,
88 gboolean allow_scrolling)
90 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
92 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll) {
93 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll (view,
94 allow_scrolling);
98 void
99 empathy_chat_view_scroll_down (EmpathyChatView *view)
101 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
103 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll_down) {
104 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll_down (view);
108 gboolean
109 empathy_chat_view_get_has_selection (EmpathyChatView *view)
111 g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
113 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->get_has_selection) {
114 return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->get_has_selection (view);
116 return FALSE;
119 void
120 empathy_chat_view_clear (EmpathyChatView *view)
122 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
124 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->clear) {
125 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->clear (view);
129 gboolean
130 empathy_chat_view_find_previous (EmpathyChatView *view,
131 const gchar *search_criteria,
132 gboolean new_search,
133 gboolean match_case)
135 g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
137 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous) {
138 return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous (view,
139 search_criteria,
140 new_search,
141 match_case);
143 return FALSE;
146 gboolean
147 empathy_chat_view_find_next (EmpathyChatView *view,
148 const gchar *search_criteria,
149 gboolean new_search,
150 gboolean match_case)
152 g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
154 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next) {
155 return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next (view,
156 search_criteria,
157 new_search,
158 match_case);
160 return FALSE;
164 void
165 empathy_chat_view_find_abilities (EmpathyChatView *view,
166 const gchar *search_criteria,
167 gboolean match_case,
168 gboolean *can_do_previous,
169 gboolean *can_do_next)
171 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
173 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities) {
174 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities (view,
175 search_criteria,
176 match_case,
177 can_do_previous,
178 can_do_next);
182 void
183 empathy_chat_view_highlight (EmpathyChatView *view,
184 const gchar *text,
185 gboolean match_case)
187 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
189 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->highlight) {
190 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->highlight (view, text, match_case);
194 void
195 empathy_chat_view_copy_clipboard (EmpathyChatView *view)
197 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
199 if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->copy_clipboard) {
200 EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->copy_clipboard (view);