From 31bc1dec02317d93f72de7f525864c9716a1ed0b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 23 Jun 2005 20:44:27 +0000 Subject: [PATCH] Fix an error in the cache timeout logic. (#166601, Morten Welinder) 2005-06-23 Matthias Clasen * gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): Fix an error in the cache timeout logic. (#166601, Morten Welinder) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gtk/gtkfilesystemunix.c | 14 +++++++++----- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48f2512f78..b7adf589fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-06-23 Matthias Clasen + * gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): + Fix an error in the cache timeout logic. (#166601, Morten + Welinder) + * gtk/gtktreeview.c (gtk_tree_view_key_press): Change the keynav for header reordering and resizing to Alt-arrows and Shift-Alt-arrows, following a proposal by the keynav diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 48f2512f78..b7adf589fd 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2005-06-23 Matthias Clasen + * gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): + Fix an error in the cache timeout logic. (#166601, Morten + Welinder) + * gtk/gtktreeview.c (gtk_tree_view_key_press): Change the keynav for header reordering and resizing to Alt-arrows and Shift-Alt-arrows, following a proposal by the keynav diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 48f2512f78..b7adf589fd 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,9 @@ 2005-06-23 Matthias Clasen + * gtk/gtkfilesystemunix.c (gtk_file_system_unix_get_folder): + Fix an error in the cache timeout logic. (#166601, Morten + Welinder) + * gtk/gtktreeview.c (gtk_tree_view_key_press): Change the keynav for header reordering and resizing to Alt-arrows and Shift-Alt-arrows, following a proposal by the keynav diff --git a/gtk/gtkfilesystemunix.c b/gtk/gtkfilesystemunix.c index 097b9a82f3..49c298d8c3 100644 --- a/gtk/gtkfilesystemunix.c +++ b/gtk/gtkfilesystemunix.c @@ -405,7 +405,7 @@ gtk_file_system_unix_get_folder (GtkFileSystem *file_system, GtkFileFolderUnix *folder_unix; const char *filename; char *filename_copy; - time_t now = time (NULL); + gboolean set_asof = FALSE; system_unix = GTK_FILE_SYSTEM_UNIX (file_system); @@ -419,8 +419,8 @@ gtk_file_system_unix_get_folder (GtkFileSystem *file_system, if (folder_unix) { g_free (filename_copy); - if (now - folder_unix->asof >= FOLDER_CACHE_LIFETIME && - folder_unix->stat_info) + if (folder_unix->stat_info && + time (NULL) - folder_unix->asof >= FOLDER_CACHE_LIFETIME) { #if 0 g_print ("Cleaning out cached directory %s\n", filename); @@ -430,6 +430,7 @@ gtk_file_system_unix_get_folder (GtkFileSystem *file_system, folder_unix->have_mime_type = FALSE; folder_unix->have_stat = FALSE; folder_unix->have_hidden = FALSE; + set_asof = TRUE; } g_object_ref (folder_unix); @@ -486,11 +487,11 @@ gtk_file_system_unix_get_folder (GtkFileSystem *file_system, folder_unix->filename = filename_copy; folder_unix->types = types; folder_unix->stat_info = NULL; - folder_unix->asof = now; folder_unix->have_mime_type = FALSE; folder_unix->have_stat = FALSE; folder_unix->have_hidden = FALSE; - + set_asof = TRUE; + if ((system_unix->have_afs && system_unix->afs_statbuf.st_dev == statbuf.st_dev && system_unix->afs_statbuf.st_ino == statbuf.st_ino) || @@ -512,6 +513,9 @@ gtk_file_system_unix_get_folder (GtkFileSystem *file_system, if ((types & GTK_FILE_INFO_MIME_TYPE) != 0) fill_in_mime_type (folder_unix); + if (set_asof) + folder_unix->asof = time (NULL); + return GTK_FILE_FOLDER (folder_unix); }