[gnome-commander] Rename ConnectionMethodID, adding a new one for being invalid



commit 99a544f4d25f9da3f3201e33bc5724af6bc45ef1
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Fri Sep 24 22:45:44 2021 +0200

    Rename ConnectionMethodID, adding a new one for being invalid

 src/gnome-cmd-con-device.cc |  2 +-
 src/gnome-cmd-con-home.cc   |  2 +-
 src/gnome-cmd-con.cc        |  2 +-
 src/gnome-cmd-con.h         | 14 ++++++++++----
 4 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-cmd-con-device.cc b/src/gnome-cmd-con-device.cc
index bd2f8ac9..901d6f66 100644
--- a/src/gnome-cmd-con-device.cc
+++ b/src/gnome-cmd-con-device.cc
@@ -456,7 +456,7 @@ static void init (GnomeCmdConDevice *dev_con)
 
     dev_con->priv = g_new0 (GnomeCmdConDevicePrivate, 1);
 
-    con->method = CON_LOCAL;
+    con->method = CON_FILE;
     con->should_remember_dir = TRUE;
     con->needs_open_visprog = FALSE;
     con->needs_list_visprog = FALSE;
diff --git a/src/gnome-cmd-con-home.cc b/src/gnome-cmd-con-home.cc
index 34645ea3..5329938a 100644
--- a/src/gnome-cmd-con-home.cc
+++ b/src/gnome-cmd-con-home.cc
@@ -112,7 +112,7 @@ static void init (GnomeCmdConHome *home_con)
 
     con->state = GnomeCmdCon::STATE_OPEN;
     con->alias = g_strdup (_("Home"));
-    con->method = CON_LOCAL;
+    con->method = CON_FILE;
     con->open_msg = g_strdup ("This should not be visible anywhere");
     con->should_remember_dir = TRUE;
     con->needs_open_visprog = FALSE;
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 101fcb99..5cffc19c 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -61,7 +61,7 @@ const gchar *icon_name[] = {"gnome-fs-ssh",            // CON_SSH
                             "gnome-fs-web",            // CON_DAV
                             "gnome-fs-web",            // CON_DAVS
                             "gnome-fs-network",        // CON_URI
-                            "gnome-fs-directory"};     // CON_LOCAL
+                            "gnome-fs-directory"};     // CON_FILE
 
 
 static void on_open_done (GnomeCmdCon *con)
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 3c6d7c24..624bdece 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -51,7 +51,8 @@ enum ConnectionMethodID        // Keep this order in sync with strings in gnome-
     CON_DAV,
     CON_DAVS,
     CON_URI,
-    CON_LOCAL      // CON_FILE ???
+    CON_FILE,
+    CON_INVALID
 };
 
 struct GnomeCmdCon
@@ -388,8 +389,10 @@ inline ConnectionMethodID gnome_cmd_con_get_scheme (GnomeVFSURI *uri)
     const gchar *scheme = gnome_vfs_uri_get_scheme (uri);       // do not g_free
     const gchar *user = gnome_vfs_uri_get_user_name (uri);      // do not g_free
 
-    return gnome_vfs_uri_is_local (uri) ? CON_LOCAL :
-           g_str_equal (scheme, "ftp")  ? (user && g_str_equal (user, "anonymous") ? CON_ANON_FTP : CON_FTP) 
:
+    return scheme == nullptr ? CON_INVALID :
+           g_str_equal (scheme, "file") ? CON_FILE :
+//           g_str_equal (scheme, "ftp")  ? (user && g_str_equal (user, "anonymous") ? CON_ANON_FTP : 
CON_FTP) :
+           g_str_equal (scheme, "ftp")  ? CON_FTP :
            g_str_equal (scheme, "sftp") ? CON_SSH :
            g_str_equal (scheme, "dav")  ? CON_DAV :
            g_str_equal (scheme, "davs") ? CON_DAVS :
@@ -460,7 +463,10 @@ inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID m
 
         case CON_URI:       return gnome_cmd_con_make_custom_uri (s, uri);
 
-        case CON_LOCAL:
+        // ToDo: Check if this is valid!
+        case CON_INVALID:   return s;
+
+        case CON_FILE:
         default:            return s;
     }
 }


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