[easytag] Do not scroll the log if the message is visible
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Do not scroll the log if the message is visible
- Date: Tue, 30 Jun 2015 16:55:34 +0000 (UTC)
commit 89461056b03a384ce0d2d7eedcc85dcdeeaccf3d
Author: David King <amigadave amigadave com>
Date: Tue Jun 30 17:53:52 2015 +0100
Do not scroll the log if the message is visible
Fix a TODO in Log_List_Set_Row_Visible().
src/log.c | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/src/log.c b/src/log.c
index cbb0c50..64984c1 100644
--- a/src/log.c
+++ b/src/log.c
@@ -169,25 +169,35 @@ et_log_area_new (void)
* Set a row visible in the log list (by scrolling the list)
*/
static void
-Log_List_Set_Row_Visible (EtLogArea *self, GtkTreeIter *rowIter)
+Log_List_Set_Row_Visible (EtLogArea *self,
+ GtkTreeIter *rowIter)
{
EtLogAreaPrivate *priv;
- /*
- * TODO: Make this only scroll to the row if it is not visible
- * (like in easytag GTK1)
- * See function gtk_tree_view_get_visible_rect() ??
- */
- GtkTreePath *rowPath;
+ GtkTreePath *start;
+ GtkTreePath *end;
priv = et_log_area_get_instance_private (self);
- g_return_if_fail (priv->log_model != NULL);
+ if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (priv->log_view),
+ &start, &end))
+ {
+ GtkTreePath *rowPath;
+
+ rowPath = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->log_model),
+ rowIter);
+
+ if ((gtk_tree_path_compare (rowPath, start) < 0)
+ || (gtk_tree_path_compare (rowPath, end) > 0))
+ {
+ /* rowPath is not is the visible range. */
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->log_view),
+ rowPath, NULL, FALSE, 0, 0);
+ }
- rowPath = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->log_model),
- rowIter);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->log_view), rowPath,
- NULL, FALSE, 0, 0);
- gtk_tree_path_free (rowPath);
+ gtk_tree_path_free (start);
+ gtk_tree_path_free (end);
+ gtk_tree_path_free (rowPath);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]