[empathy: 5/10] New function empathy_add_link_markup() to be used with gtk_label_set_markup()
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 5/10] New function empathy_add_link_markup() to be used with gtk_label_set_markup()
- Date: Thu, 4 Mar 2010 15:38:36 +0000 (UTC)
commit 2e9c6f70f0291f84b266915620930d97dec1a467
Author: Xavier Claessens <xclaesse gmail com>
Date: Wed Mar 3 15:48:07 2010 +0100
New function empathy_add_link_markup() to be used with gtk_label_set_markup()
libempathy-gtk/empathy-string-parser.c | 16 ++++++++++++++++
libempathy-gtk/empathy-string-parser.h | 3 +++
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c
index 1240edd..1f9f5f2 100644
--- a/libempathy-gtk/empathy-string-parser.c
+++ b/libempathy-gtk/empathy-string-parser.c
@@ -191,3 +191,19 @@ empathy_string_replace_escaped (const gchar *text,
g_free (escaped);
}
+gchar *
+empathy_add_link_markup (const gchar *text)
+{
+ static EmpathyStringParser parsers[] = {
+ {empathy_string_match_link, empathy_string_replace_link},
+ {empathy_string_match_all, empathy_string_replace_escaped},
+ {NULL, NULL}
+ };
+ GString *string;
+
+ string = g_string_sized_new (strlen (text));
+ empathy_string_parser_substr (text, -1, parsers, string);
+
+ return g_string_free (string, FALSE);
+}
+
diff --git a/libempathy-gtk/empathy-string-parser.h b/libempathy-gtk/empathy-string-parser.h
index db646d6..aec741a 100644
--- a/libempathy-gtk/empathy-string-parser.h
+++ b/libempathy-gtk/empathy-string-parser.h
@@ -82,6 +82,9 @@ empathy_string_replace_escaped (const gchar *text,
gpointer match_data,
gpointer user_data);
+gchar *
+empathy_add_link_markup (const gchar *text);
+
G_END_DECLS
#endif /* __EMPATHY_STRING_PARSER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]