[gnome-commander] GnomeCmdPlainPath::get_parent - use GIO instead of GnomeVFS
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] GnomeCmdPlainPath::get_parent - use GIO instead of GnomeVFS
- Date: Mon, 22 Mar 2021 21:53:55 +0000 (UTC)
commit 0f8ea28348e955606fe0130b46b135099f8a4e58
Author: Uwe Scholz <u scholz83 gmx de>
Date: Mon Mar 22 22:52:39 2021 +0100
GnomeCmdPlainPath::get_parent - use GIO instead of GnomeVFS
src/gnome-cmd-plain-path.cc | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/gnome-cmd-plain-path.cc b/src/gnome-cmd-plain-path.cc
index debecd39..44f4acfe 100644
--- a/src/gnome-cmd-plain-path.cc
+++ b/src/gnome-cmd-plain-path.cc
@@ -29,20 +29,22 @@ using namespace std;
GnomeCmdPath *GnomeCmdPlainPath::get_parent()
{
- GnomeVFSURI *t = gnome_vfs_uri_new (G_DIR_SEPARATOR_S);
- GnomeVFSURI *u1 = gnome_vfs_uri_append_path (t, path);
- gnome_vfs_uri_unref (t);
+ auto fullPath = g_strconcat(G_DIR_SEPARATOR_S, path, nullptr);
+ auto gFileForPath = g_file_new_for_path(fullPath);
+ auto gFileParent = g_file_get_parent(gFileForPath);
+ g_object_unref(gFileForPath);
+ g_free(fullPath);
- GnomeVFSURI *u2 = gnome_vfs_uri_get_parent (u1);
- gnome_vfs_uri_unref (u1);
-
- if (!u2) return NULL;
+ if (!gFileParent)
+ {
+ return nullptr;
+ }
- gchar *s = gnome_vfs_uri_to_string (u2, GNOME_VFS_URI_HIDE_PASSWORD);
- gnome_vfs_uri_unref (u2);
+ auto pathString = g_file_get_path(gFileParent);
+ g_object_unref(gFileParent);
- GnomeCmdPath *parent_path = new GnomeCmdPlainPath (gnome_vfs_get_local_path_from_uri (s));
- g_free (s);
+ GnomeCmdPath *parent_path = new GnomeCmdPlainPath (pathString);
+ g_free (pathString);
return parent_path;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]