From 3030a5e737c738c7b9466786c8696ee68c04f547 Mon Sep 17 00:00:00 2001 From: hiro Date: Thu, 7 Apr 2005 09:04:51 +0000 Subject: don't let GtkTreeView grab focus after opening a folder by button press. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@203 ee746299-78ed-0310-b773-934348b2243d --- src/folderview.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/folderview.c') diff --git a/src/folderview.c b/src/folderview.c index 05930860..15bcd746 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -1568,6 +1568,15 @@ static gboolean folderview_key_pressed(GtkWidget *widget, GdkEventKey *event, return FALSE; } +static gboolean folderview_focus_idle_func(gpointer data) +{ + FolderView *folderview = (FolderView *)data; + + GTK_WIDGET_SET_FLAGS(folderview->treeview, GTK_CAN_FOCUS); + + return FALSE; +} + static void folderview_selection_changed(GtkTreeSelection *selection, FolderView *folderview) { @@ -1624,6 +1633,13 @@ static void folderview_selection_changed(GtkTreeSelection *selection, gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(folderview->treeview), path, NULL, FALSE, 0.0, 0.0); + if (item->total > 0) { + /* don't let GtkTreeView::gtk_tree_view_button_press() + * grab focus */ + GTK_WIDGET_UNSET_FLAGS(folderview->treeview, + GTK_CAN_FOCUS); + g_idle_add(folderview_focus_idle_func, folderview); + } } else folderview_select_row_ref(folderview, folderview->opened); -- cgit v1.2.3