From cf49ab7c7143f78471b0741eb05044e20b38a6fb Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 1 Jun 2008 18:50:42 +0100 Subject: [PATCH] Scan directories using GIO. Only partially implemented. --- ROX-Filer/src/dir.c | 118 ++++++++++++++++++------------- ROX-Filer/src/diritem.c | 175 ++++++++++++++++++++++++++++------------------ ROX-Filer/src/diritem.h | 1 + ROX-Filer/src/filer.c | 18 ++++- ROX-Filer/src/filer.h | 2 + ROX-Filer/src/main.c | 9 ++- ROX-Filer/src/run.c | 146 +++++++++++++++++++++----------------- ROX-Filer/src/run.h | 6 ++ ROX-Filer/src/usericons.c | 1 + 9 files changed, 292 insertions(+), 184 deletions(-) diff --git a/ROX-Filer/src/dir.c b/ROX-Filer/src/dir.c index fa820cfa..be5ebdfa 100644 --- a/ROX-Filer/src/dir.c +++ b/ROX-Filer/src/dir.c @@ -50,6 +50,7 @@ #include "config.h" +#include #include #include #include @@ -945,71 +946,59 @@ static Directory *dir_new(const char *pathname) return dir; } -/* Get the names of all files in the directory. - * Remove any DirItems that are no longer listed. - * Replace the recheck_list with the items found. - */ -static void dir_rescan(Directory *dir) +static void dir_rescan_internal(Directory *dir, GFile *pathname, GError **error) { + GFileInfo *info; + GFileEnumerator *iter; GPtrArray *names; - DIR *d; - struct dirent *ent; guint i; - const char *pathname; GList *next; - g_return_if_fail(dir != NULL); + info = g_file_query_info(pathname, "unix::*", G_FILE_QUERY_INFO_NONE, NULL, error); + if (!info) + return; + dir->stat_info.st_ino = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_UNIX_INODE); + dir->stat_info.st_dev = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_DEVICE); + g_object_unref(info); - pathname = dir->pathname; + iter = g_file_enumerate_children(pathname, "standard::*,unix::mode,thumbnail::path", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, error); + if (!iter) + return - dir->needs_update = FALSE; + dir_set_scanning(dir, TRUE); + dir_merge_new(dir); + gdk_flush(); names = g_ptr_array_new(); - read_globicons(); - mount_update(FALSE); - if (dir->error) - { - null_g_free(&dir->error); - dir_error_changed(dir); - } - - /* Saves statting the parent for each item... */ - if (mc_stat(pathname, &dir->stat_info)) + /* Make a list of all the names in the directory */ + while ((info = g_file_enumerator_next_file(iter, NULL, error))) { - dir->error = g_strdup_printf(_("Can't stat directory: %s"), - g_strerror(errno)); - dir_error_changed(dir); - return; /* Report on attach */ - } + const char *name; - d = mc_opendir(pathname); - if (!d) - { - dir->error = g_strdup_printf(_("Can't open directory: %s"), - g_strerror(errno)); - dir_error_changed(dir); - return; /* Report on attach */ - } + if (*error) + { + g_warning("Error scanning directory: %s", (*error)->message); + g_error_free(*error); + *error = NULL; + continue; + } - dir_set_scanning(dir, TRUE); - dir_merge_new(dir); - gdk_flush(); + name = g_file_info_get_attribute_byte_string(info, G_FILE_ATTRIBUTE_STANDARD_NAME); + g_return_if_fail(name != NULL); - /* Make a list of all the names in the directory */ - while ((ent = mc_readdir(d))) - { - if (ent->d_name[0] == '.') + if (name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))) + { + /* Skip '.' and '..' */ + } + else { - if (ent->d_name[1] == '\0') - continue; /* Ignore '.' */ - if (ent->d_name[1] == '.' && ent->d_name[2] == '\0') - continue; /* Ignore '..' */ + g_ptr_array_add(names, g_strdup(name)); } - g_ptr_array_add(names, g_strdup(ent->d_name)); + g_object_unref(info); } - mc_closedir(d); + g_object_unref(iter); /* Compare the list with the current DirItems, removing * any that are missing. @@ -1067,6 +1056,41 @@ static void dir_rescan(Directory *dir) dir_merge_new(dir); } +/* Get the names of all files in the directory. + * Remove any DirItems that are no longer listed. + * Replace the recheck_list with the items found. + */ +static void dir_rescan(Directory *dir) +{ + GError *error = NULL; + GFile *gfile; + + g_return_if_fail(dir != NULL); + + dir->needs_update = FALSE; + + read_globicons(); + mount_update(FALSE); + if (dir->error) + { + null_g_free(&dir->error); + dir_error_changed(dir); + } + + gfile = g_file_new_for_path(dir->pathname); + + dir_rescan_internal(dir, gfile, &error); + + g_object_unref(gfile); + + if (error) + { + dir->error = g_strdup(error->message); + dir_error_changed(dir); /* Report on attach */ + g_error_free(error); + } +} + #ifdef USE_DNOTIFY /* Signal handler - don't do anything dangerous here */ static void dnotify_handler(int sig, siginfo_t *si, void *data) diff --git a/ROX-Filer/src/diritem.c b/ROX-Filer/src/diritem.c index 7a24391d..28009a8b 100644 --- a/ROX-Filer/src/diritem.c +++ b/ROX-Filer/src/diritem.c @@ -26,6 +26,7 @@ #include "config.h" +#include #include #include #include @@ -53,8 +54,7 @@ time_t diritem_recent_time; /* Static prototypes */ -static void examine_dir(const guchar *path, DirItem *item, - struct stat *link_target); +static void examine_dir(const guchar *path, DirItem *item, GFileInfo *link_target); /**************************************************************** * EXTERNAL INTERFACE * @@ -66,11 +66,22 @@ void diritem_init(void) } /* Bring this item's structure uptodate. - * 'parent' is optional; it saves one stat() for directories. + * 'parent' is not used XXX */ void diritem_restat(const guchar *path, DirItem *item, struct stat *parent) { - struct stat info; + GFile *gfile; + + gfile = g_file_new_for_path(path); + diritem_restat_gfile(gfile, item); + g_object_unref(gfile); +} + +void diritem_restat_gfile(GFile *path, DirItem *item) +{ + GFileInfo *info; + GError *error = NULL; + guchar *target_path; /* For symlinks, this is the target, otherwise the original path */ if (item->_image) { @@ -80,65 +91,85 @@ void diritem_restat(const guchar *path, DirItem *item, struct stat *parent) item->flags = 0; item->mime_type = NULL; - if (mc_lstat(path, &info) == -1) - { - item->lstat_errno = errno; + info = g_file_query_info(path, "standard::size,unix::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error); + if (!info) { + g_warning("Can't stat: %s", error->message); + g_error_free(error); + + item->lstat_errno = errno; // XXX item->base_type = TYPE_ERROR; item->size = 0; item->mode = 0; item->mtime = item->ctime = item->atime = 0; item->uid = (uid_t) -1; item->gid = (gid_t) -1; + + item->mime_type = mime_type_from_base_type(item->base_type); + + return; } - else - { - guchar *target_path; - - item->lstat_errno = 0; - item->size = info.st_size; - item->mode = info.st_mode; - item->atime = info.st_atime; - item->ctime = info.st_ctime; - item->mtime = info.st_mtime; - item->uid = info.st_uid; - item->gid = info.st_gid; - if (ABOUT_NOW(item->mtime) || ABOUT_NOW(item->ctime)) - item->flags |= ITEM_FLAG_RECENT; - - if (xattr_have(path)) - item->flags |= ITEM_FLAG_HAS_XATTR; - - if (S_ISLNK(info.st_mode)) - { - if (mc_stat(path, &info)) - item->base_type = TYPE_ERROR; - else - item->base_type = - mode_to_base_type(info.st_mode); - item->flags |= ITEM_FLAG_SYMLINK; + /* Note: if path is a symlink the info currently holds the details of the symlink. + * But, a bit lower down, it will change to the details of the target. + */ + + item->lstat_errno = 0; + item->size = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_STANDARD_SIZE); + item->mode = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_MODE); + item->atime = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_TIME_ACCESS); + item->ctime = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_TIME_CHANGED); + item->mtime = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + item->uid = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_UID); + item->gid = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_GID); + + if (ABOUT_NOW(item->mtime) || ABOUT_NOW(item->ctime)) + item->flags |= ITEM_FLAG_RECENT; - target_path = pathdup(path); +#if 0 + if (xattr_have(path)) + item->flags |= ITEM_FLAG_HAS_XATTR; +#endif + + target_path = g_file_get_path(path); /* NULL if not a local path */ + + if (S_ISLNK(item->mode)) + { + char *link_target; + GFileInfo *target_info; + target_info = g_file_query_info(path, "standard::size,unix::*,standard::symlink-target", G_FILE_QUERY_INFO_NONE, NULL, NULL); + if (target_info == NULL) + { + item->base_type = TYPE_ERROR; } else { - item->base_type = mode_to_base_type(info.st_mode); - target_path = (guchar *) path; + item->base_type = mode_to_base_type(g_file_info_get_attribute_uint32(target_info, G_FILE_ATTRIBUTE_UNIX_MODE)); + g_object_unref(info); + info = target_info; } - if (item->base_type == TYPE_DIRECTORY) + item->flags |= ITEM_FLAG_SYMLINK; + + // TODO: resolve with GIO + link_target = pathdup(target_path); + if (link_target) { - if (mount_is_mounted(target_path, &info, - target_path == path ? parent : NULL)) - item->flags |= ITEM_FLAG_MOUNT_POINT - | ITEM_FLAG_MOUNTED; - else if (g_hash_table_lookup(fstab_mounts, - target_path)) - item->flags |= ITEM_FLAG_MOUNT_POINT; + g_free(target_path); + target_path = link_target; } + } + else + { + item->base_type = mode_to_base_type(item->mode); + } - if (path != target_path) - g_free(target_path); + if (item->base_type == TYPE_DIRECTORY) + { + if (g_file_info_get_attribute_boolean(info, G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT)) + item->flags |= ITEM_FLAG_MOUNT_POINT + | ITEM_FLAG_MOUNTED; + else if (target_path && g_hash_table_lookup(fstab_mounts, target_path)) + item->flags |= ITEM_FLAG_MOUNT_POINT; } if (item->base_type == TYPE_DIRECTORY) @@ -149,26 +180,20 @@ void diritem_restat(const guchar *path, DirItem *item, struct stat *parent) * of the *symlink*, but we really want the uid of the dir * to which the symlink points. */ - examine_dir(path, item, &info); + char *plain_path; + plain_path = g_file_get_path(path); + examine_dir(plain_path, item, info); + g_free(plain_path); } else if (item->base_type == TYPE_FILE) { - if (item->size == 0) + if (item->size == 0 || target_path == NULL) // TODO: target_path item->mime_type = text_plain; - else if (item->flags & ITEM_FLAG_SYMLINK) - { - guchar *link_path; - link_path = pathdup(path); - item->mime_type = type_from_path(link_path - ? link_path - : path); - g_free(link_path); - } else - item->mime_type = type_from_path(path); + item->mime_type = type_from_path(target_path); /* Note: for symlinks we need the mode of the target */ - if (info.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) + if (g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_MODE) & (S_IXUSR | S_IXGRP | S_IXOTH)) { /* Note that the flag is set for ALL executable * files, but the mime_type must also be executable @@ -195,18 +220,26 @@ void diritem_restat(const guchar *path, DirItem *item, struct stat *parent) if (!item->mime_type) item->mime_type = text_plain; - check_globicon(path, item); + if (target_path) + check_globicon(target_path, item); - if (item->mime_type == application_x_desktop && item->_image == NULL) + if (item->mime_type == application_x_desktop && item->_image == NULL && target_path) // TODO { - item->_image = g_fscache_lookup(desktop_icon_cache, path); + item->_image = g_fscache_lookup(desktop_icon_cache, target_path); } } else - check_globicon(path, item); + { + if (target_path) + check_globicon(target_path, item); + } if (!item->mime_type) item->mime_type = mime_type_from_base_type(item->base_type); + + g_object_unref(info); + + g_free(target_path); } DirItem *diritem_new(const guchar *leafname) @@ -262,25 +295,27 @@ void _diritem_get_image(DirItem *item) * link_target contains stat info for the link target for symlinks (or for the * item itself if not a link). */ -static void examine_dir(const guchar *path, DirItem *item, - struct stat *link_target) +static void examine_dir(const guchar *path, DirItem *item, GFileInfo *link_target) { struct stat info; static GString *tmp = NULL; - uid_t uid = link_target->st_uid; - + uid_t uid; + gint32 mode; + if (!tmp) tmp = g_string_new(NULL); check_globicon(path, item); + mode = g_file_info_get_attribute_uint32(link_target, G_FILE_ATTRIBUTE_UNIX_MODE); + if (item->flags & ITEM_FLAG_MOUNT_POINT) { item->mime_type = inode_mountpoint; return; /* Try to avoid automounter problems */ } - if (link_target->st_mode & S_IWOTH) + if (mode & S_IWOTH) return; /* Don't trust world-writable dirs */ /* Finding the icon: @@ -297,13 +332,15 @@ static void examine_dir(const guchar *path, DirItem *item, g_string_printf(tmp, "%s/.DirIcon", path); + uid = g_file_info_get_attribute_uint32(link_target, G_FILE_ATTRIBUTE_UNIX_UID); + if (item->_image) goto no_diricon; /* Already got an icon */ if (mc_lstat(tmp->str, &info) != 0 || info.st_uid != uid) goto no_diricon; /* Missing, or wrong owner */ - if (S_ISLNK(info.st_mode) && mc_stat(tmp->str, &info) != 0) + if (S_ISLNK(mode) && mc_stat(tmp->str, &info) != 0) goto no_diricon; /* Bad symlink */ if (info.st_size > MAX_ICON_SIZE || !S_ISREG(info.st_mode)) diff --git a/ROX-Filer/src/diritem.h b/ROX-Filer/src/diritem.h index ef111803..bffcca47 100644 --- a/ROX-Filer/src/diritem.h +++ b/ROX-Filer/src/diritem.h @@ -50,6 +50,7 @@ struct _DirItem void diritem_init(void); DirItem *diritem_new(const guchar *leafname); void diritem_restat(const guchar *path, DirItem *item, struct stat *parent); +void diritem_restat_gfile(GFile *path, DirItem *item); void _diritem_get_image(DirItem *item); void diritem_free(DirItem *item); diff --git a/ROX-Filer/src/filer.c b/ROX-Filer/src/filer.c index 444d0531..c65a9bd8 100644 --- a/ROX-Filer/src/filer.c +++ b/ROX-Filer/src/filer.c @@ -1379,8 +1379,19 @@ DirItem *filer_selected_item(FilerWindow *filer_window) * Returns the new filer window, or NULL on error. * Note: if unique windows is in use, may return an existing window. */ -FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, - const gchar *wm_class) +FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, const gchar *wm_class) +{ + GFile *gfile; + FilerWindow *retval; + + gfile = g_file_new_for_path(path); + retval = filer_opendir_gfile(gfile, src_win, wm_class); + g_object_unref(gfile); + + return retval; +} + +FilerWindow *filer_opendir_gfile(GFile *gfile, FilerWindow *src_win, const gchar *wm_class) { FilerWindow *filer_window; char *real_path; @@ -1390,6 +1401,9 @@ FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, GtkSortType s_order; Settings *dir_settings = NULL; gboolean force_resize = TRUE; + char *path; + + path = g_file_get_path(gfile); /// XXX: free /* Get the real pathname of the directory and copy it */ real_path = pathdup(path); diff --git a/ROX-Filer/src/filer.h b/ROX-Filer/src/filer.h index fed38982..f0deb2bd 100644 --- a/ROX-Filer/src/filer.h +++ b/ROX-Filer/src/filer.h @@ -6,6 +6,7 @@ #ifndef _FILER_H #define _FILER_H +#include #include enum { @@ -119,6 +120,7 @@ extern Option o_filer_size_limit; /* Prototypes */ void filer_init(void); FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, const gchar *wm_class); +FilerWindow *filer_opendir_gfile(GFile *path, FilerWindow *src_win, const gchar *wm_class); gboolean filer_update_dir(FilerWindow *filer_window, gboolean warning); void filer_update_all(void); DirItem *filer_selected_item(FilerWindow *filer_window); diff --git a/ROX-Filer/src/main.c b/ROX-Filer/src/main.c index 0522fee0..8638545d 100644 --- a/ROX-Filer/src/main.c +++ b/ROX-Filer/src/main.c @@ -41,6 +41,7 @@ # include #endif +#include #include #include /* For rox_x_error */ @@ -530,9 +531,13 @@ int main(int argc, char **argv) i = optind; while (i < argc) { - tmp = pathdup(argv[i++]); + GFile *gfile; - soap_add(body, "Run", "Filename", tmp, NULL, NULL); + gfile = g_file_new_for_commandline_arg(argv[i++]); + tmp = g_file_get_uri(gfile); + g_object_unref(gfile); + + soap_add(body, "RunURI", "URI", tmp, NULL, NULL); g_free(tmp); } diff --git a/ROX-Filer/src/run.c b/ROX-Filer/src/run.c index 6add9c15..3d2c5f75 100644 --- a/ROX-Filer/src/run.c +++ b/ROX-Filer/src/run.c @@ -21,6 +21,7 @@ #include "config.h" +#include #include #include #include @@ -42,7 +43,7 @@ /* Static prototypes */ static void write_data(gpointer data, gint fd, GdkInputCondition cond); -static gboolean follow_symlink(const char *full_path, +static gboolean follow_symlink(GFile *path, FilerWindow *filer_window, FilerWindow *src_window); static gboolean open_file(const guchar *path, MIME_type *type); @@ -257,8 +258,26 @@ gboolean run_diritem(const guchar *full_path, FilerWindow *src_window, gboolean edit) { + GFile *gfile; + gboolean retval; + + gfile = g_file_new_for_path(full_path); + retval = run_diritem_gfile(gfile, item, filer_window, src_window, edit); + g_object_unref(gfile); + + return retval; +} + +gboolean run_diritem_gfile(GFile *path, + DirItem *item, + FilerWindow *filer_window, + FilerWindow *src_window, + gboolean edit) +{ + const char *full_path = "TODO"; + if (item->flags & ITEM_FLAG_SYMLINK && edit) - return follow_symlink(full_path, filer_window, src_window); + return follow_symlink(path, filer_window, src_window); switch (item->base_type) { @@ -277,7 +296,7 @@ gboolean run_diritem(const guchar *full_path, else if (filer_window) filer_change_to(filer_window, full_path, NULL); else - filer_opendir(full_path, src_window, NULL); + filer_opendir_gfile(path, src_window, NULL); return TRUE; case TYPE_FILE: if (EXECUTABLE_FILE(item) && !edit) @@ -324,11 +343,25 @@ gboolean run_by_path(const guchar *full_path) return retval; } +/* Attempt to open this item */ +gboolean run_by_gfile(GFile *path) +{ + gboolean retval; + DirItem *item; + + /* XXX: Loads an image - wasteful */ + item = diritem_new(""); + diritem_restat_gfile(path, item); + retval = run_diritem_gfile(path, item, NULL, NULL, FALSE); + diritem_free(item); + + return retval; +} + /* Convert uri to path and call run_by_path() */ gboolean run_by_uri(const gchar *uri, gchar **errmsg) { gboolean retval; - gchar *tmp, *tmp2; gchar *scheme; gchar *cmd; @@ -340,22 +373,15 @@ gboolean run_by_uri(const gchar *uri, gchar **errmsg) return FALSE; } - if(strcmp(scheme, "file")==0) { - tmp=get_local_path((EscapedPath *) uri); - if(tmp) { - tmp2=pathdup(tmp); - retval=run_by_path(tmp2); - if(!retval) - *errmsg=g_strdup_printf(_("%s not accessable"), - tmp); - - g_free(tmp2); - g_free(tmp); + if(strcmp(scheme, "file")==0 || strcmp(scheme, "trash")==0) { + GFile *gfile; + gfile = g_file_new_for_uri(uri); - } else { - retval=FALSE; - *errmsg=g_strdup_printf(_("Non-local URL %s"), uri); - } + retval = run_by_gfile(gfile); + g_object_unref(gfile); + + if(!retval) + *errmsg=g_strdup_printf(_("%s not accessable"), uri); } else if((cmd=choices_find_xdg_path_load(scheme, "URI", SITE))) { DirItem *item; @@ -490,73 +516,65 @@ finish: close(fd); } +static char *g_file_readlink(GFile *symlink, GError **error) +{ + GFileInfo *info; + char *target; + + info = g_file_query_info(symlink, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, error); + if (*error) + return NULL; + + target = (char *) g_file_info_get_symlink_target(info); + if (target) + target = g_strdup(target); + + g_object_unref(info); + + return target; +} + /* Follow the link 'full_path' and display it in filer_window, or a * new window if that is NULL. */ -static gboolean follow_symlink(const char *full_path, +static gboolean follow_symlink(GFile *path, FilerWindow *filer_window, FilerWindow *src_window) { - char *real, *slash; - char *new_dir; - char path[MAXPATHLEN + 1]; - int got; + char *target, *leafname; + GFile *resolved, *new_dir; + GError *error = NULL; - got = readlink(full_path, path, MAXPATHLEN); - if (got < 0) - { - delayed_error(_("Could not read link: %s"), - g_strerror(errno)); - return FALSE; - } - - g_return_val_if_fail(got <= MAXPATHLEN, FALSE); - path[got] = '\0'; - - /* Make a relative path absolute */ - if (path[0] != '/') - { - guchar *tmp; - slash = strrchr(full_path, '/'); - g_return_val_if_fail(slash != NULL, FALSE); + target = g_file_readlink(path, &error); - tmp = g_strndup(full_path, slash - full_path); - real = pathdup(make_path(tmp, path)); - /* NB: full_path may be invalid here... */ - g_free(tmp); - } - else - real = pathdup(path); - - slash = strrchr(real, '/'); - if (!slash) + if (error) { - g_free(real); - delayed_error( - _("Broken symlink (or you don't have permission " - "to follow it): %s"), full_path); + delayed_error(_("Could not read link: %s"), error->message); + g_error_free(error); return FALSE; } - *slash = '\0'; + resolved = g_file_resolve_relative_path(path, target); + g_free(target); + target = NULL; - if (*real) - new_dir = real; - else - new_dir = "/"; + new_dir = g_file_get_parent(resolved); + leafname = g_file_get_basename(resolved); + g_object_unref(resolved); if (filer_window) - filer_change_to(filer_window, new_dir, slash + 1); + filer_change_to(filer_window, g_file_get_path(new_dir), leafname); /* XXX : free */ else { FilerWindow *new; - new = filer_opendir(new_dir, src_window, NULL); + new = filer_opendir_gfile(new_dir, src_window, NULL); if (new) - display_set_autoselect(new, slash + 1); + display_set_autoselect(new, leafname); } - g_free(real); + g_object_unref(new_dir); + g_free(leafname); return TRUE; } diff --git a/ROX-Filer/src/run.h b/ROX-Filer/src/run.h index 9c0d066a..71169cc9 100644 --- a/ROX-Filer/src/run.h +++ b/ROX-Filer/src/run.h @@ -12,12 +12,18 @@ void run_app(const char *path); void run_with_files(const char *path, GList *uri_list); void run_with_data(const char *path, gpointer data, gulong length); gboolean run_by_path(const guchar *full_path); +gboolean run_by_gfile(GFile *path); gboolean run_by_uri(const gchar *uri, gchar **errmsg); gboolean run_diritem(const guchar *full_path, DirItem *item, FilerWindow *filer_window, FilerWindow *src_window, gboolean edit); +gboolean run_diritem_gfile(GFile *path, + DirItem *item, + FilerWindow *filer_window, + FilerWindow *src_window, + gboolean edit); void open_to_show(const guchar *path); void examine(const guchar *path); void show_help_files(const char *dir); diff --git a/ROX-Filer/src/usericons.c b/ROX-Filer/src/usericons.c index 59b74926..c1d38d66 100644 --- a/ROX-Filer/src/usericons.c +++ b/ROX-Filer/src/usericons.c @@ -150,6 +150,7 @@ void check_globicon(const guchar *path, DirItem *item) { gchar *gi; + g_return_if_fail(path != NULL); g_return_if_fail(item && !item->_image); gi = g_hash_table_lookup(glob_icons, path); -- 2.11.4.GIT