[Xfce4-commits] <thunar:master> Store GFiles in the list of files to scroll to.
Nick Schermer
noreply at xfce.org
Mon Oct 22 17:48:01 CEST 2012
Updating branch refs/heads/master
to edf2e8c4b5f770376d73a38b5f1c96032312d07b (commit)
from 3c9a18f548679a251b944c7caca40410d92a1b12 (commit)
commit edf2e8c4b5f770376d73a38b5f1c96032312d07b
Author: Nick Schermer <nick at xfce.org>
Date: Sun Oct 21 14:27:52 2012 +0200
Store GFiles in the list of files to scroll to.
This way we release ThunarFiles more often, saving a bit
to memory and making remote mount probing easier.
thunar/thunar-window.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 2d2ca0e..8a56f94 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -759,7 +759,7 @@ thunar_window_init (ThunarWindow *window)
window->preferences = thunar_preferences_get ();
/* allocate the scroll_to_files mapping */
- window->scroll_to_files = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref);
+ window->scroll_to_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, g_object_unref);
/* connect to the volume monitor */
window->device_monitor = thunar_device_monitor_get ();
@@ -2986,6 +2986,7 @@ thunar_window_set_current_directory (ThunarWindow *window,
ThunarFile *file;
ThunarFile *selected_file;
GList selected_files;
+ GFile *gfile;
_thunar_return_if_fail (THUNAR_IS_WINDOW (window));
_thunar_return_if_fail (current_directory == NULL || THUNAR_IS_FILE (current_directory));
@@ -3001,7 +3002,10 @@ thunar_window_set_current_directory (ThunarWindow *window,
if (window->view != NULL && thunar_view_get_visible_range (THUNAR_VIEW (window->view), &file, NULL))
{
/* add the file to our internal mapping of directories to scroll files */
- g_hash_table_replace (window->scroll_to_files, g_object_ref (G_OBJECT (window->current_directory)), file);
+ g_hash_table_replace (window->scroll_to_files,
+ g_object_ref (thunar_file_get_file (window->current_directory)),
+ g_object_ref (thunar_file_get_file (file)));
+ g_object_unref (file);
}
/* disconnect signals and release reference */
@@ -3046,9 +3050,13 @@ thunar_window_set_current_directory (ThunarWindow *window,
if (G_LIKELY (window->current_directory != NULL))
{
/* check if we have a scroll_to_file for the new directory and scroll to the file */
- file = g_hash_table_lookup (window->scroll_to_files, window->current_directory);
- if (G_LIKELY (file != NULL))
- thunar_window_scroll_to_file (window, file, FALSE, TRUE, 0.1f, 0.1f);
+ gfile = g_hash_table_lookup (window->scroll_to_files, thunar_file_get_file (window->current_directory));
+ if (G_LIKELY (gfile != NULL))
+ {
+ file = thunar_file_cache_lookup (gfile);
+ if (G_LIKELY (file != NULL))
+ thunar_window_scroll_to_file (window, file, FALSE, TRUE, 0.1f, 0.1f);
+ }
/* reset the selected files list */
selected_files.data = NULL;
More information about the Xfce4-commits
mailing list