[gnome-commander] When creating a new GnomeCmdFile instance, do not differ between local and non-local connection
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] When creating a new GnomeCmdFile instance, do not differ between local and non-local connection
- Date: Thu, 6 Jan 2022 22:27:53 +0000 (UTC)
commit 4cdb916d7e0c6c7a601f7bff14cb16d2ceb46e75
Author: Uwe Scholz <u scholz83 gmx de>
Date: Wed Jan 5 17:55:53 2022 +0100
When creating a new GnomeCmdFile instance, do not differ between local and non-local connection
src/gnome-cmd-file.cc | 43 +++++++++++++++----------------------------
1 file changed, 15 insertions(+), 28 deletions(-)
---
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index d5f64f9e..3bb504b4 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -274,34 +274,21 @@ void gnome_cmd_file_setup (GObject *gObject, GFileInfo *gFileInfo, GnomeCmdDir *
auto pathString = gnomeCmdFile->GetPathStringThroughParent();
if (pathString)
{
- GnomeCmdCon *con = nullptr;
- if (parentDir)
- {
- con = gnome_cmd_dir_get_connection(parentDir);
- }
- else
- {
- if (GNOME_CMD_IS_DIR(gObject))
- {
- con = gnome_cmd_dir_get_connection(GNOME_CMD_DIR(gObject));
- }
- }
- if (con && !con->is_local)
- {
- auto uriObject = g_uri_build(G_URI_FLAGS_NONE, con->scheme, nullptr,
- con->hostname, con->port, pathString, nullptr, nullptr);
- auto uriString = g_uri_to_string(uriObject);
- auto gFileFinal = g_file_new_for_uri (uriString);
-
- GNOME_CMD_FILE_BASE (gnomeCmdFile)->gFile = gFileFinal;
- gnomeCmdFile->gFile = GNOME_CMD_FILE_BASE (gnomeCmdFile)->gFile;
- g_free(uriString);
- }
- else
- {
- GNOME_CMD_FILE_BASE (gnomeCmdFile)->gFile = g_file_new_for_path(pathString);
- gnomeCmdFile->gFile = GNOME_CMD_FILE_BASE (gnomeCmdFile)->gFile;
- }
+ auto con = gnome_cmd_dir_get_connection(parentDir ? parentDir : GNOME_CMD_DIR(gObject));
+ auto gUri = g_uri_build(G_URI_FLAGS_NONE,
+ con && con->scheme ? con->scheme : "file",
+ nullptr,
+ con ? con->hostname : nullptr,
+ con ? con->port : -1,
+ pathString,
+ nullptr,
+ nullptr);
+
+ auto uriString = g_uri_to_string(gUri);
+ auto gFileFinal = g_file_new_for_uri (uriString);
+ GNOME_CMD_FILE_BASE (gnomeCmdFile)->gFile = gFileFinal;
+ gnomeCmdFile->gFile = GNOME_CMD_FILE_BASE (gnomeCmdFile)->gFile;
+ g_free(uriString);
g_free(pathString);
}
// EVERY GnomeCmdFile instance must have a gFile reference
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]