Commit 5d1809e4 authored by Margaux Clerc's avatar Margaux Clerc
Browse files

scroll to the end when load chat history

parent 3dcb6fd4
......@@ -129,6 +129,15 @@ void udpate_tab_chat_header(GtkWidget *chat_view,const LinphoneAddress *uri,Linp
gtk_widget_show_all(w);
}
static gboolean scroll_to_end(GtkTextView *w){
GtkTextBuffer *buffer=gtk_text_view_get_buffer(w);
GtkTextIter iter;
gtk_text_buffer_get_end_iter(buffer,&iter);
GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE);
gtk_text_view_scroll_mark_onscreen(w,mark);
return FALSE;
}
void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
gboolean me,LinphoneChatRoom *cr,LinphoneChatMessage *msg, gboolean hist){
GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview"));
......@@ -199,8 +208,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
}
gtk_text_buffer_get_end_iter(buffer,&iter);
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE);
gtk_text_view_scroll_mark_onscreen(text,mark);
g_idle_add((GSourceFunc)scroll_to_end,text);
ms_free(from_str);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment