Commit 53103444 authored by Martin Wehner's avatar Martin Wehner Committed by Martin Wehner

Call reveal_selection in an idle callback to work around a bug in

2006-02-26  Martin Wehner  <martin.wehner@gmail.com>

	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_destroy), (reveal_selection_idle_callback),
	(done_loading):
	Call reveal_selection in an idle callback to work around a bug in
	GtkTreeView which produces buggy scroll states when the nodes have
	not yet been allocated. It would make the selection always the top
	row even when it should ignore alignment, among other oddities.
parent e40434df
2006-02-26 Martin Wehner <martin.wehner@gmail.com>
* src/file-manager/fm-directory-view.c:
(fm_directory_view_destroy), (reveal_selection_idle_callback),
(done_loading):
Call reveal_selection in an idle callback to work around a bug in
GtkTreeView which produces buggy scroll states when the nodes have
not yet been allocated. It would make the selection always the top
row even when it should ignore alignment, among other oddities.
2006-02-26 Christian Neumair <chris@gnome-de.org>
* src/nautilus-application.c: (nautilus_application_get_n_windows):
......
......@@ -208,7 +208,8 @@ struct FMDirectoryViewDetails
guint display_selection_idle_id;
guint update_menus_timeout_id;
guint update_status_idle_id;
guint reveal_selection_idle_id;
guint display_pending_source_id;
guint changes_timeout_id;
......@@ -2022,6 +2023,11 @@ fm_directory_view_destroy (GtkObject *object)
view->details->display_selection_idle_id = 0;
}
if (view->details->reveal_selection_idle_id != 0) {
g_source_remove (view->details->reveal_selection_idle_id);
view->details->reveal_selection_idle_id = 0;
}
if (view->details->delayed_rename_file_id != 0) {
g_source_remove (view->details->delayed_rename_file_id);
view->details->delayed_rename_file_id = 0;
......@@ -2335,6 +2341,18 @@ check_for_directory_hard_limit (FMDirectoryView *view)
}
}
static gboolean
reveal_selection_idle_callback (gpointer data)
{
FMDirectoryView *view;
view = FM_DIRECTORY_VIEW (data);
view->details->reveal_selection_idle_id = 0;
fm_directory_view_reveal_selection (view);
return FALSE;
}
static void
done_loading (FMDirectoryView *view)
......@@ -2366,7 +2384,18 @@ done_loading (FMDirectoryView *view)
view->details->selection_change_is_due_to_shell = TRUE;
fm_directory_view_set_selection (view, selection);
view->details->selection_change_is_due_to_shell = FALSE;
fm_directory_view_reveal_selection (view);
/* HACK: We should be able to directly call reveal_selection here, but at
* this point the GtkTreeView hasn't allocated the new nodes yet, and it
* has a bug in the scroll calculation dealing with this special case. It
* would always make the selection the top row, even if no scrolling would
* be neccessary to reveal it. So we let it allocate before revealing.
*/
if (view->details->reveal_selection_idle_id != 0) {
g_source_remove (view->details->reveal_selection_idle_id);
}
view->details->reveal_selection_idle_id =
g_idle_add (reveal_selection_idle_callback, view);
nautilus_file_list_free (selection);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment