[gnome-commander] Create a GFile object out of a remote connection



commit 0f15a951b716fffd722a268cc1af2a27647e2e9f
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Sep 18 23:40:22 2021 +0200

    Create a GFile object out of a remote connection

 src/gnome-cmd-con-remote.cc | 14 ++++++++++++++
 src/gnome-cmd-con.cc        |  1 +
 2 files changed, 15 insertions(+)
---
diff --git a/src/gnome-cmd-con-remote.cc b/src/gnome-cmd-con-remote.cc
index fcfa8a86..a0f9ba0e 100644
--- a/src/gnome-cmd-con-remote.cc
+++ b/src/gnome-cmd-con-remote.cc
@@ -137,6 +137,19 @@ static GnomeVFSURI *remote_create_uri (GnomeCmdCon *con, GnomeCmdPath *path)
 }
 
 
+static GFile *remote_create_gfile (GnomeCmdCon *con, GnomeCmdPath *path)
+{
+    g_return_val_if_fail (con->uri != nullptr, nullptr);
+
+    auto *gFileTmp = g_file_new_for_uri (con->uri);
+    auto gFile = g_file_resolve_relative_path (gFileTmp, path->get_path());
+
+    g_object_unref (gFileTmp);
+
+    return gFile;
+}
+
+
 static GnomeCmdPath *remote_create_path (GnomeCmdCon *con, const gchar *path_str)
 {
     return new GnomeCmdPlainPath(path_str);
@@ -174,6 +187,7 @@ static void class_init (GnomeCmdConRemoteClass *klass)
     con_class->cancel_open = remote_cancel_open;
     con_class->open_is_needed = remote_open_is_needed;
     con_class->create_uri = remote_create_uri;
+    con_class->create_gfile = remote_create_gfile;
     con_class->create_path = remote_create_path;
 }
 
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 2329f854..101fcb99 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -170,6 +170,7 @@ static void class_init (GnomeCmdConClass *klass)
     klass->cancel_open = nullptr;
     klass->open_is_needed = nullptr;
     klass->create_uri = nullptr;
+    klass->create_gfile = nullptr;
     klass->create_path = nullptr;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]