[gnome-commander] When a new file is created, use GIO to retrieve information about it
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] When a new file is created, use GIO to retrieve information about it
- Date: Sun, 20 Jun 2021 21:58:01 +0000 (UTC)
commit bcee0c46fc11877a068206876e48b8f6467c71c9
Author: Uwe Scholz <u scholz83 gmx de>
Date: Sun Jun 20 23:56:10 2021 +0200
When a new file is created, use GIO to retrieve information about it
src/gnome-cmd-dir.cc | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index 0f4a89a0b..24da0154d 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -797,26 +797,25 @@ void gnome_cmd_dir_file_created (GnomeCmdDir *dir, const gchar *uri_str)
{
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
g_return_if_fail (uri_str != nullptr);
+ GError *error = nullptr;
if (file_already_exists (dir, uri_str))
return;
- GnomeVFSURI *uri = gnome_vfs_uri_new (uri_str);
- GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
- GnomeVFSFileInfoOptions infoOpts = (GnomeVFSFileInfoOptions)
(GNOME_VFS_FILE_INFO_FOLLOW_LINKS|GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
- GnomeVFSResult res = gnome_vfs_get_file_info_uri (uri, info, infoOpts);
- if (res != GNOME_VFS_OK)
+ auto gFile = g_file_new_for_uri (uri_str);
+ auto gFileInfo = g_file_query_info (gFile, "*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, nullptr, &error);
+ if (error)
{
- DEBUG ('t', "Could not retrieve file information for %s\n", uri_str);
+ DEBUG ('t', "Could not retrieve file information for %s, error: %s\n", uri_str, error->message);
+ g_error_free(error);
}
- gnome_vfs_uri_unref (uri);
GnomeCmdFile *f;
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- f = GNOME_CMD_FILE (gnome_cmd_dir_new_from_info (info, dir));
+ if (g_file_info_get_attribute_uint32 (gFileInfo, G_FILE_ATTRIBUTE_STANDARD_TYPE) ==
G_FILE_TYPE_DIRECTORY)
+ f = GNOME_CMD_FILE (gnome_cmd_dir_new_from_gfileinfo (gFileInfo, dir));
else
- f = gnome_cmd_file_new (info, dir);
+ f = gnome_cmd_file_new (gFileInfo, dir);
if (!f)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]