bufferEmpty = YES;
g_idle_add_block(^{
- GtkTextView *chat_view;
GtkEntry *chat_entry;
GtkBuilder *builder = gtk_builder_new();
BOOL first = bufferEmpty;
if (OF_UNLIKELY(bufferEmpty)) bufferEmpty = NO;
- g_object_ref(chat_buffer);
g_idle_add_block(^{
- GtkTextIter endIter;
+ GtkTextIter end_iter;
+ GtkTextMark *insert_mark =
+ gtk_text_buffer_get_insert(chat_buffer);
+
if (OF_LIKELY(!first))
gtk_text_buffer_insert_at_cursor(chat_buffer, "\n", 1);
- gtk_text_buffer_get_end_iter(chat_buffer, &endIter);
- gtk_text_buffer_insert_with_tags_by_name(chat_buffer, &endIter,
+ gtk_text_buffer_get_end_iter(chat_buffer, &end_iter);
+ gtk_text_buffer_insert_with_tags_by_name(chat_buffer, &end_iter,
[sender UTF8String], [sender UTF8StringLength], "bold",
NULL);
- gtk_text_buffer_get_end_iter(chat_buffer, &endIter);
- gtk_text_buffer_insert_with_tags_by_name(chat_buffer, &endIter,
+ gtk_text_buffer_get_end_iter(chat_buffer, &end_iter);
+ gtk_text_buffer_insert_with_tags_by_name(chat_buffer, &end_iter,
": ", 2, "bold", NULL);
gtk_text_buffer_insert_at_cursor(chat_buffer, [text UTF8String],
[text UTF8StringLength]);
- g_object_unref(chat_buffer);
+
+ gtk_text_view_scroll_to_mark(chat_view, insert_mark, 0,
+ FALSE, 0, 0);
});
}
@end