From ee8c16e7d70527760ebb2c5894dd85c545daa2e4 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Tue, 3 May 2011 11:55:59 +0100 Subject: LogWindow: scroll the events view to the end Where newest messages are. --- libempathy-gtk/empathy-log-window.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 2203ee241..21300cdd1 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -2292,9 +2292,13 @@ log_window_got_messages_for_date_cb (GObject *manager, gpointer user_data) { Ctx *ctx = user_data; + GtkTreeView *view; + GtkTreeModel *model; + GtkTreeIter iter; GList *events; GList *l; GError *error = NULL; + gint n; if (log_window == NULL) goto out; @@ -2363,6 +2367,19 @@ log_window_got_messages_for_date_cb (GObject *manager, } g_list_free (events); + view = GTK_TREE_VIEW (log_window->treeview_events); + model = gtk_tree_view_get_model (view); + n = gtk_tree_model_iter_n_children (model, NULL) - 1; + + if (n >= 0 && gtk_tree_model_iter_nth_child (model, &iter, NULL, n)) + { + GtkTreePath *path; + + path = gtk_tree_model_get_path (model, &iter); + gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0, 0); + gtk_tree_path_free (path); + } + out: ctx_free (ctx); -- cgit v1.2.3