diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index e76d91429..c925b9d62 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -86,6 +86,7 @@ #define WANT_HPANED 1 #include "gtkhpaned.h" +#include "gtktimeprivate.h" #include "gtkalias.h" @@ -156,9 +157,9 @@ typedef struct _PossibleCompletion PossibleCompletion; struct _CompletionDirSent { #ifndef G_PLATFORM_WIN32 - ino_t inode; + guint64 inode; gint64 mtime; - dev_t device; + guint64 device; #endif gint entry_count; @@ -329,7 +330,7 @@ static CompletionDir* open_ref_dir (gchar* text_to_complete, CompletionState* cmpl_state); #ifndef G_PLATFORM_WIN32 static gboolean check_dir (gchar *dir_name, - GStatBuf *result, + GtkStatBuf *result, gboolean *stat_subdirs); #endif static CompletionDir* open_dir (gchar* dir_name, @@ -341,11 +342,11 @@ static CompletionDir* open_user_dir (const gchar* text_to_complete, static CompletionDir* open_relative_dir (gchar* dir_name, CompletionDir* dir, CompletionState *cmpl_state); static CompletionDirSent* open_new_dir (gchar* dir_name, - GStatBuf *sbuf, + GtkStatBuf *sbuf, gboolean stat_subdirs); static gint correct_dir_fullname (CompletionDir* cmpl_dir); static gint correct_parent (CompletionDir* cmpl_dir, - GStatBuf *sbuf); + GtkStatBuf *sbuf); #ifndef G_PLATFORM_WIN32 static gchar* find_parent_dir_fullname (gchar* dirname); #endif @@ -2989,7 +2990,7 @@ open_relative_dir (gchar *dir_name, /* after the cache lookup fails, really open a new directory */ static CompletionDirSent* open_new_dir (gchar *dir_name, - GStatBuf *sbuf, + GtkStatBuf *sbuf, gboolean stat_subdirs) { CompletionDirSent *sent; @@ -2999,15 +3000,15 @@ open_new_dir (gchar *dir_name, gint entry_count = 0; gint n_entries = 0; gint i; - GStatBuf ent_sbuf; + GtkStatBuf ent_sbuf; GString *path; gchar *sys_dir_name; sent = g_new (CompletionDirSent, 1); #ifndef G_PLATFORM_WIN32 - sent->mtime = (gint64) sbuf->st_mtime; - sent->inode = sbuf->st_ino; - sent->device = sbuf->st_dev; + sent->mtime = sbuf->mtime; + sent->inode = sbuf->ino; + sent->device = sbuf->dev; #endif path = g_string_sized_new (2*MAXPATHLEN + 10); @@ -3079,7 +3080,7 @@ open_new_dir (gchar *dir_name, if (stat_subdirs) { /* Here we know path->str is a "system charset" string */ - if (g_stat (path->str, &ent_sbuf) >= 0 && S_ISDIR (ent_sbuf.st_mode)) + if (_gtk_stat (path->str, TRUE, &ent_sbuf) >= 0 && S_ISDIR (ent_sbuf.mode)) sent->entries[n_entries].is_dir = TRUE; else /* stat may fail, and we don't mind, since it could be a @@ -3106,7 +3107,7 @@ open_new_dir (gchar *dir_name, static gboolean check_dir (gchar *dir_name, - GStatBuf *result, + GtkStatBuf *result, gboolean *stat_subdirs) { /* A list of directories that we know only contain other directories. @@ -3117,7 +3118,7 @@ check_dir (gchar *dir_name, static struct { const gchar name[5]; gboolean present; - GStatBuf statbuf; + GtkStatBuf statbuf; } no_stat_dirs[] = { { "/afs", FALSE, { 0 } }, { "/net", FALSE, { 0 } } @@ -3133,7 +3134,7 @@ check_dir (gchar *dir_name, initialized = TRUE; for (i = 0; i < n_no_stat_dirs; i++) { - if (g_stat (no_stat_dirs[i].name, &no_stat_dirs[i].statbuf) == 0) + if (_gtk_stat (no_stat_dirs[i].name, TRUE, &no_stat_dirs[i].statbuf) == 0) no_stat_dirs[i].present = TRUE; } } @@ -3145,7 +3146,7 @@ check_dir (gchar *dir_name, return FALSE; } - if (g_stat (sys_dir_name, result) < 0) + if (_gtk_stat (sys_dir_name, TRUE, result) < 0) { g_free (sys_dir_name); cmpl_errno = errno; @@ -3157,8 +3158,8 @@ check_dir (gchar *dir_name, for (i = 0; i < n_no_stat_dirs; i++) { if (no_stat_dirs[i].present && - (no_stat_dirs[i].statbuf.st_dev == result->st_dev) && - (no_stat_dirs[i].statbuf.st_ino == result->st_ino)) + (no_stat_dirs[i].statbuf.dev == result->dev) && + (no_stat_dirs[i].statbuf.ino == result->ino)) { *stat_subdirs = FALSE; break; @@ -3176,7 +3177,7 @@ open_dir (gchar *dir_name, CompletionState *cmpl_state) { #ifndef G_PLATFORM_WIN32 - GStatBuf sbuf; + GtkStatBuf sbuf; gboolean stat_subdirs; GList* cdsl; #endif @@ -3192,9 +3193,9 @@ open_dir (gchar *dir_name, { sent = cdsl->data; - if (sent->inode == sbuf.st_ino && - sent->mtime == (gint64) sbuf.st_mtime && - sent->device == sbuf.st_dev) + if (sent->inode == sbuf.ino && + sent->mtime == sbuf.mtime && + sent->device == sbuf.dev) return attach_dir (sent, dir_name, cmpl_state); cdsl = cdsl->next; @@ -3242,7 +3243,7 @@ correct_dir_fullname (CompletionDir* cmpl_dir) gint length = strlen (cmpl_dir->fullname); gchar *first_slash = strchr (cmpl_dir->fullname, G_DIR_SEPARATOR); gchar *sys_filename; - GStatBuf sbuf; + GtkStatBuf sbuf; /* Does it end with /. (\.) ? */ if (length >= 2 && @@ -3287,7 +3288,7 @@ correct_dir_fullname (CompletionDir* cmpl_dir) return FALSE; } - if (g_stat (sys_filename, &sbuf) < 0) + if (_gtk_stat (sys_filename, TRUE, &sbuf) < 0) { g_free (sys_filename); cmpl_errno = errno; @@ -3321,7 +3322,7 @@ correct_dir_fullname (CompletionDir* cmpl_dir) return FALSE; } - if (g_stat (sys_filename, &sbuf) < 0) + if (_gtk_stat (sys_filename, TRUE, &sbuf) < 0) { g_free (sys_filename); cmpl_errno = errno; @@ -3342,9 +3343,9 @@ correct_dir_fullname (CompletionDir* cmpl_dir) static gint correct_parent (CompletionDir *cmpl_dir, - GStatBuf *sbuf) + GtkStatBuf *sbuf) { - GStatBuf parbuf; + GtkStatBuf parbuf; gchar *last_slash; gchar *first_slash; #ifndef G_PLATFORM_WIN32 @@ -3379,7 +3380,7 @@ correct_parent (CompletionDir *cmpl_dir, return FALSE; } - if (g_stat (sys_filename, &parbuf) < 0) + if (_gtk_stat (sys_filename, TRUE, &parbuf) < 0) { g_free (sys_filename); cmpl_errno = errno; @@ -3390,7 +3391,7 @@ correct_parent (CompletionDir *cmpl_dir, g_free (sys_filename); #ifndef G_PLATFORM_WIN32 /* No inode numbers on Win32 */ - if (parbuf.st_ino == sbuf->st_ino && parbuf.st_dev == sbuf->st_dev) + if (parbuf.ino == sbuf->ino && parbuf.dev == sbuf->dev) /* it wasn't a link */ return TRUE;