aboutsummaryrefslogtreecommitdiff
path: root/src/gtkutils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-11 10:59:04 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-11 10:59:04 +0000
commit85969fb751e0da20008a66b8f81e8196131da4da (patch)
tree9b4af834d3e9597c060a9a2fd01aa4fbc26df445 /src/gtkutils.c
parent9000c702a7a812bec29171e6a13f9bcabfbbd2d2 (diff)
added margin for visibility when scrolling summary.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@420 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/gtkutils.c')
-rw-r--r--src/gtkutils.c15
1 files changed, 11 insertions, 4 deletions
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);
}