From 2e9c6f70f0291f84b266915620930d97dec1a467 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 3 Mar 2010 15:48:07 +0100 Subject: New function empathy_add_link_markup() to be used with gtk_label_set_markup() --- libempathy-gtk/empathy-string-parser.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libempathy-gtk/empathy-string-parser.c') diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c index 1240edd50..1f9f5f2ab 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); +} + -- cgit v1.2.3