static void
chat_text_view_insert_text_with_emoticons (EmpathyChatTextView *view,
					   GtkTextIter         *iter,
					   const gchar         *str)
{
	EmpathyChatTextViewPriv *priv = GET_PRIV (view);
	gboolean                 use_smileys = FALSE;
	GSList                  *smileys, *l;

	empathy_conf_get_bool (empathy_conf_get (),
			       EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
			       &use_smileys);

	if (!use_smileys) {
		gtk_text_buffer_insert (priv->buffer, iter, str, -1);
		return;
	}

	smileys = empathy_smiley_manager_parse (priv->smiley_manager, str);
	for (l = smileys; l; l = l->next) {
		EmpathySmiley *smiley;

		smiley = l->data;
		if (smiley->pixbuf) {
			gtk_text_buffer_insert_pixbuf (priv->buffer, iter, smiley->pixbuf);
		} else {
			gtk_text_buffer_insert (priv->buffer, iter, smiley->str, -1);
		}
		empathy_smiley_free (smiley);
	}
	g_slist_free (smileys);
}
Пример #2
0
static void
smiley_manager_finalize (GObject *object)
{
	EmpathySmileyManagerPriv *priv = GET_PRIV (object);
	GSList                   *l;

	smiley_manager_tree_free (priv->tree);
	for (l = priv->smileys; l; l = l->next) {
		EmpathySmiley *smiley = l->data;

		/* The smiley got the ownership of the path */
		g_free ((gchar *) smiley->path);
		empathy_smiley_free (smiley);
	}
	g_slist_free (priv->smileys);
}