/pidgin/main: b9372e71546e: Add an insert-smiley function.
Elliott Sales de Andrade
qulogic at pidgin.im
Tue Aug 14 04:03:27 EDT 2012
Changeset: b9372e71546ee17a9f4bef020a4188825647f72b
Author: Elliott Sales de Andrade <qulogic at pidgin.im>
Date: 2012-08-14 04:01 -0400
Branch: default
URL: http://hg.pidgin.im/pidgin/main/rev/b9372e71546e
Description:
Add an insert-smiley function.
Eventually, we'll need to make this tag a bit more standardized.
diffstat:
pidgin/gtkwebview.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diffs (39 lines):
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -632,6 +632,35 @@ gtk_webview_remove_smileys(GtkWebView *w
priv->default_smilies = gtk_smiley_tree_new();
}
+void
+gtk_webview_insert_smiley(GtkWebView *webview, const char *sml,
+ const char *smiley)
+{
+ GtkWebViewPriv *priv;
+ char *unescaped;
+ GtkWebViewSmiley *webview_smiley;
+
+ g_return_if_fail(webview != NULL);
+
+ priv = GTK_WEBVIEW_GET_PRIVATE(webview);
+
+ unescaped = purple_unescape_html(smiley);
+ webview_smiley = gtk_webview_smiley_find(webview, sml, unescaped);
+
+ if (priv->format_functions & GTK_WEBVIEW_SMILEY) {
+ char *tmp;
+ /* TODO Better smiley insertion... */
+ tmp = g_strdup_printf("<img isEmoticon src='purple-smiley:%p' alt='%s'>",
+ webview_smiley, smiley);
+ gtk_webview_append_html(webview, tmp);
+ g_free(tmp);
+ } else {
+ gtk_webview_append_html(webview, smiley);
+ }
+
+ g_free(unescaped);
+}
+
/******************************************************************************
* Helpers
*****************************************************************************/
More information about the Commits
mailing list