[gnome-commander] Show free space with the help of GIO instead of Gnome-VFS
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Show free space with the help of GIO instead of Gnome-VFS
- Date: Sun, 11 Jul 2021 21:45:32 +0000 (UTC)
commit 400c8ed6ae4d4b513fd9e90b6c02092f2abf43f3
Author: Uwe Scholz <u scholz83 gmx de>
Date: Tue Jul 6 22:58:45 2021 +0200
Show free space with the help of GIO instead of Gnome-VFS
src/gnome-cmd-dir.h | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-cmd-dir.h b/src/gnome-cmd-dir.h
index 58029ad0..a892aab7 100644
--- a/src/gnome-cmd-dir.h
+++ b/src/gnome-cmd-dir.h
@@ -151,13 +151,24 @@ inline gchar *gnome_cmd_dir_get_free_space (GnomeCmdDir *dir)
{
g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
- GnomeVFSFileSize free_space;
- GnomeVFSURI *uri = GNOME_CMD_FILE (dir)->get_uri();
- GnomeVFSResult res = gnome_vfs_get_volume_free_space (uri, &free_space);
- gnome_vfs_uri_unref (uri);
+ GError *error = nullptr;
- if (res!=GNOME_VFS_OK)
- return NULL;
+ auto gFileInfo = g_file_query_filesystem_info (GNOME_CMD_FILE (dir)->gFile,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+ nullptr,
+ &error);
- return gnome_vfs_format_file_size_for_display (free_space);
+ if (error)
+ {
+ g_warning("Could not g_file_query_filesystem_info %s: %s\n",
+ g_file_peek_path(GNOME_CMD_FILE (dir)->gFile), error->message);
+ g_error_free(error);
+ return nullptr;
+ }
+
+ auto freeSpace = g_file_info_get_attribute_uint64(gFileInfo, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+
+ g_object_unref(gFileInfo);
+
+ return g_format_size (freeSpace);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]