static void empathy_chat_text_view_init (EmpathyChatTextView *view) { EmpathyChatTextViewPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (view, EMPATHY_TYPE_CHAT_TEXT_VIEW, EmpathyChatTextViewPriv); view->priv = priv; priv->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); priv->last_timestamp = 0; priv->allow_scrolling = TRUE; priv->smiley_manager = empathy_smiley_manager_dup_singleton (); g_object_set (view, "wrap-mode", GTK_WRAP_WORD_CHAR, "editable", FALSE, "cursor-visible", FALSE, NULL); priv->notify_system_fonts_id = empathy_conf_notify_add (empathy_conf_get (), "/desktop/gnome/interface/document_font_name", chat_text_view_notify_system_font_cb, view); chat_text_view_system_font_update (view); chat_text_view_create_tags (view); g_signal_connect (view, "populate-popup", G_CALLBACK (chat_text_view_populate_popup), NULL); }
static void empathy_chat_text_view_init (EmpathyChatTextView *view) { EmpathyChatTextViewPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (view, EMPATHY_TYPE_CHAT_TEXT_VIEW, EmpathyChatTextViewPriv); view->priv = priv; priv->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); priv->last_timestamp = 0; priv->allow_scrolling = TRUE; priv->smiley_manager = empathy_smiley_manager_dup_singleton (); g_object_set (view, "wrap-mode", GTK_WRAP_WORD_CHAR, "editable", FALSE, "cursor-visible", FALSE, NULL); priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA); priv->gsettings_desktop = g_settings_new ( EMPATHY_PREFS_DESKTOP_INTERFACE_SCHEMA); g_signal_connect (priv->gsettings_desktop, "changed::" EMPATHY_PREFS_DESKTOP_INTERFACE_DOCUMENT_FONT_NAME, G_CALLBACK (chat_text_view_notify_system_font_cb), view); chat_text_view_system_font_update (view); chat_text_view_create_tags (view); g_signal_connect (view, "populate-popup", G_CALLBACK (chat_text_view_populate_popup), NULL); }
void empathy_string_match_smiley (const gchar *text, gssize len, EmpathyStringReplace replace_func, EmpathyStringParser *sub_parsers, gpointer user_data) { guint last = 0; EmpathySmileyManager *smiley_manager; GSList *hits, *l; smiley_manager = empathy_smiley_manager_dup_singleton (); hits = empathy_smiley_manager_parse_len (smiley_manager, text, len); for (l = hits; l; l = l->next) { EmpathySmileyHit *hit = l->data; if (hit->start > last) { /* Append the text between last smiley (or the * start of the message) and this smiley */ empathy_string_parser_substr (text + last, hit->start - last, sub_parsers, user_data); } replace_func (text + hit->start, hit->end - hit->start, hit, user_data); last = hit->end; empathy_smiley_hit_free (hit); } g_slist_free (hits); g_object_unref (smiley_manager); empathy_string_parser_substr (text + last, len - last, sub_parsers, user_data); }