From 85969fb751e0da20008a66b8f81e8196131da4da Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 11 Jul 2005 10:59:04 +0000 Subject: added margin for visibility when scrolling summary. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@420 ee746299-78ed-0310-b773-934348b2243d --- src/gtkutils.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gtkutils.c b/src/gtkutils.c index 06b985e1..fb17d5c5 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -565,6 +565,7 @@ void gtkut_tree_view_scroll_to_cell(GtkTreeView *treeview, GtkTreePath *path) GdkRectangle cell_rect; GdkRectangle vis_rect; gint dest_x, dest_y; + gint margin = 0; if (!path) return; @@ -577,10 +578,16 @@ void gtkut_tree_view_scroll_to_cell(GtkTreeView *treeview, GtkTreePath *path) dest_x = vis_rect.x; dest_y = vis_rect.y; - if (cell_rect.y < vis_rect.y) - dest_y = cell_rect.y; - if (cell_rect.y + cell_rect.height > vis_rect.y + vis_rect.height) - dest_y = cell_rect.y + cell_rect.height - vis_rect.height; + /* add margin */ + if (cell_rect.height * 2 < vis_rect.height) + margin = cell_rect.height + 2; + + if (cell_rect.y < vis_rect.y + margin) + dest_y = cell_rect.y - margin; + if (cell_rect.y + cell_rect.height > + vis_rect.y + vis_rect.height - margin) + dest_y = cell_rect.y + cell_rect.height - vis_rect.height + + margin; gtk_tree_view_scroll_to_point(treeview, dest_x, dest_y); } -- cgit v1.2.3