LogWindow: better logic for the buttons sensitivity
[empathy-mirror.git] / libempathy-gtk / empathy-string-parser.h
blob78a822652a1b6645f80fd9877415f61e93e6b9f4
1 /*
2 * Copyright (C) 2010 Collabora Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Xavier Claessens <xclaesse@gmail.com>
21 #ifndef __EMPATHY_STRING_PARSER_H__
22 #define __EMPATHY_STRING_PARSER_H__
24 #include <glib.h>
26 G_BEGIN_DECLS
28 typedef struct _EmpathyStringParser EmpathyStringParser;
30 typedef void (*EmpathyStringReplace) (const gchar *text,
31 gssize len,
32 gpointer match_data,
33 gpointer user_data);
34 typedef void (*EmpathyStringMatch) (const gchar *text,
35 gssize len,
36 EmpathyStringReplace replace_func,
37 EmpathyStringParser *sub_parsers,
38 gpointer user_data);
40 struct _EmpathyStringParser {
41 EmpathyStringMatch match_func;
42 EmpathyStringReplace replace_func;
45 void
46 empathy_string_parser_substr (const gchar *text,
47 gssize len,
48 EmpathyStringParser *parsers,
49 gpointer user_data);
51 void
52 empathy_string_match_link (const gchar *text,
53 gssize len,
54 EmpathyStringReplace replace_func,
55 EmpathyStringParser *sub_parsers,
56 gpointer user_data);
58 void
59 empathy_string_match_smiley (const gchar *text,
60 gssize len,
61 EmpathyStringReplace replace_func,
62 EmpathyStringParser *sub_parsers,
63 gpointer user_data);
65 void
66 empathy_string_match_all (const gchar *text,
67 gssize len,
68 EmpathyStringReplace replace_func,
69 EmpathyStringParser *sub_parsers,
70 gpointer user_data);
72 /* Replace functions assume user_data is a GString */
73 void
74 empathy_string_replace_link (const gchar *text,
75 gssize len,
76 gpointer match_data,
77 gpointer user_data);
79 void
80 empathy_string_replace_escaped (const gchar *text,
81 gssize len,
82 gpointer match_data,
83 gpointer user_data);
85 /* Returns a new string with <a> html tag around links, and escape the rest.
86 * To be used with gtk_label_set_markup() for example */
87 gchar *
88 empathy_add_link_markup (const gchar *text);
90 G_END_DECLS
92 #endif /* __EMPATHY_STRING_PARSER_H__ */