[gnome-commander] Use gFile in the GnomeCmdXfer class



commit 1787ab6931ff9f4689b18aaf73aad89d88e8bdaf
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sun Jun 27 23:15:47 2021 +0200

    Use gFile in the GnomeCmdXfer class
    
    This commit is needed because of commit b230cb5a. The migration is not done yet with this.

 src/gnome-cmd-xfer.cc | 24 ++++++++++--------------
 src/utils.cc          | 14 +++++++-------
 src/utils.h           |  4 ++--
 3 files changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/src/gnome-cmd-xfer.cc b/src/gnome-cmd-xfer.cc
index aecd2623..aa9bb31a 100644
--- a/src/gnome-cmd-xfer.cc
+++ b/src/gnome-cmd-xfer.cc
@@ -328,10 +328,10 @@ static gboolean update_xfer_gui_func (XferData *data)
                 for (; data->src_files; data->src_files = data->src_files->next)
                 {
                     auto f = static_cast<GnomeCmdFile*> (data->src_files->data);
-                    GnomeVFSURI *src_uri = f->get_uri();
-                    if (!gnome_vfs_uri_exists (src_uri))
+                    auto src_gFile = f->get_gfile();
+                    if (!g_file_query_exists (src_gFile, nullptr))
                         data->src_fl->remove_file(f);
-                    g_free (src_uri);
+                    g_free (src_gFile);
                 }
             }
 
@@ -361,21 +361,17 @@ static gboolean update_xfer_gui_func (XferData *data)
 }
 
 
-inline gboolean uri_is_parent_to_dir_or_equal (GnomeVFSURI *uri, GnomeCmdDir *dir)
+inline gboolean gfile_is_parent_to_dir_or_equal (GFile *gFile, GnomeCmdDir *dir)
 {
-    GnomeVFSURI *dir_uri = GNOME_CMD_FILE (dir)->get_uri ();
+    auto dir_gFile = GNOME_CMD_FILE (dir)->get_gfile ();
 
-    gboolean is_parent = gnome_vfs_uri_is_parent (uri, dir_uri, TRUE);
+    gboolean is_parent = g_file_has_parent (dir_gFile, gFile);
 
-    gchar *uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
-    gchar *dir_uri_str = gnome_vfs_uri_to_string (dir_uri, GNOME_VFS_URI_HIDE_PASSWORD);
-    gboolean is_equal = gnome_vfs_uris_match (uri_str, dir_uri_str);
+    gboolean are_equal = g_file_equal (gFile, dir_gFile);
 
-    g_free (uri_str);
-    g_free (dir_uri_str);
-    gnome_vfs_uri_unref (dir_uri);
+    g_object_unref (dir_gFile);
 
-    return is_parent || is_equal;
+    return is_parent || are_equal;
 }
 
 
@@ -500,7 +496,7 @@ gnome_cmd_xfer_start (GList *src_files,
     g_return_if_fail (src_files != nullptr);
     g_return_if_fail (GNOME_CMD_IS_DIR (to_dir));
 
-    GList *src_uri_list = file_list_to_uri_list (src_files);
+    GList *src_uri_list = file_list_to_gfile_list (src_files);
 
     gnome_cmd_xfer_uris_start (src_uri_list,
                                to_dir,
diff --git a/src/utils.cc b/src/utils.cc
index b951b7fe..10ab09c6 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -83,7 +83,7 @@ void DEBUG (gchar flag, const gchar *format, ...)
  * terminal window, if desired.
  * \param in_command Command to be executed.
  * \param dpath Directory in which the command should be executed.
- * \param term If TRUE, the command is executed in a terminal window. 
+ * \param term If TRUE, the command is executed in a terminal window.
  * \sa GnomeCmdData::Options::termexec
  */
 void run_command_indir (const gchar *in_command, const gchar *dpath, gboolean term)
@@ -766,22 +766,22 @@ GdkColor *gdk_color_new (gushort r, gushort g, gushort b)
 }
 
 
-GList *file_list_to_uri_list (GList *files)
+GList *file_list_to_gfile_list (GList *files)
 {
-    GList *uris = NULL;
+    GList *gFiles = NULL;
 
     for (; files; files = files->next)
     {
         GnomeCmdFile *f = GNOME_CMD_FILE (files->data);
-        GnomeVFSURI *uri = f->get_uri();
+        auto gFile = f->get_gfile();
 
-        if (!uri)
+        if (!gFile)
             g_warning ("NULL uri!!!");
         else
-            uris = g_list_append (uris, uri);
+            gFiles = g_list_append (gFiles, gFile);
     }
 
-    return uris;
+    return gFiles;
 }
 
 
diff --git a/src/utils.h b/src/utils.h
index 2ba5ce62..a56191e9 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file utils.h
  * @copyright (C) 2001-2006 Marcus Bjurman\n
  * @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -221,7 +221,7 @@ void remove_temp_download_dir ();
 
 gchar *unix_to_unc (const gchar *path);
 GdkColor *gdk_color_new (gushort r, gushort g, gushort b);
-GList *file_list_to_uri_list (GList *files);
+GList *file_list_to_gfile_list (GList *files);
 
 int is_dir_existing(const gchar *dpath);
 gboolean create_dir_if_needed (const gchar *dpath);


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