diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2010-03-03 22:48:07 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2010-03-03 23:18:45 +0800 |
commit | 2e9c6f70f0291f84b266915620930d97dec1a467 (patch) | |
tree | 350a0b64d476fe954b12be12876116121f82acb4 /libempathy-gtk | |
parent | 3e4bea3436209cca9ce685fdbacec7fcc11f1388 (diff) | |
download | gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.tar gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.tar.gz gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.tar.bz2 gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.tar.lz gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.tar.xz gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.tar.zst gsoc2013-empathy-2e9c6f70f0291f84b266915620930d97dec1a467.zip |
New function empathy_add_link_markup() to be used with gtk_label_set_markup()
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-string-parser.c | 16 | ||||
-rw-r--r-- | 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 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); +} + diff --git a/libempathy-gtk/empathy-string-parser.h b/libempathy-gtk/empathy-string-parser.h index db646d60b..aec741add 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__ */ |