[gnome-commander] Fix the setup of GnomeCmdFile->gFile for remote connections
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Fix the setup of GnomeCmdFile->gFile for remote connections
- Date: Tue, 12 Oct 2021 20:06:48 +0000 (UTC)
commit 762e89ea881eb2e8c12ee5f67a95a4953f64f61c
Author: Uwe Scholz <u scholz83 gmx de>
Date: Tue Oct 12 22:02:49 2021 +0200
Fix the setup of GnomeCmdFile->gFile for remote connections
For this I had to change the type of the first argument of the setup method to GObject
src/gnome-cmd-dir.cc | 8 +++++---
src/gnome-cmd-file.cc | 25 +++++++++++++++++++------
src/gnome-cmd-file.h | 2 +-
3 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index bd8cd919..0ad8a403 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -267,7 +267,7 @@ GnomeCmdDir *gnome_cmd_dir_new_from_gfileinfo (GFileInfo *gFileInfo, GnomeCmdDir
}
dir = static_cast<GnomeCmdDir*> (g_object_new (GNOME_CMD_TYPE_DIR, nullptr));
- gnome_cmd_file_setup (GNOME_CMD_FILE (dir), gFileInfo, parent);
+ gnome_cmd_file_setup (G_OBJECT (dir), gFileInfo, parent);
dir->priv->con = con;
gnome_cmd_dir_set_path (dir, path);
@@ -298,9 +298,11 @@ GnomeCmdDir *gnome_cmd_dir_new_with_con (GnomeCmdCon *con)
dir = static_cast<GnomeCmdDir*> (g_object_new (GNOME_CMD_TYPE_DIR, nullptr));
gnome_cmd_dir_set_path (dir, con->base_path->clone());
- gnome_cmd_file_setup (GNOME_CMD_FILE (dir), con->base_gFileInfo, nullptr);
dir->priv->con = con;
+
+ gnome_cmd_file_setup (G_OBJECT(dir), con->base_gFileInfo, nullptr);
+
dir->priv->needs_mtime_update = FALSE;
gnome_cmd_con_add_to_cache (con, dir, uri_str);
@@ -345,7 +347,7 @@ GnomeCmdDir *gnome_cmd_dir_new (GnomeCmdCon *con, GnomeCmdPath *path, gboolean i
dir = static_cast<GnomeCmdDir*> (g_object_new (GNOME_CMD_TYPE_DIR, nullptr));
gnome_cmd_dir_set_path (dir, path);
- gnome_cmd_file_setup (GNOME_CMD_FILE (dir), gFileInfo, nullptr);
+ gnome_cmd_file_setup (G_OBJECT (dir), gFileInfo, nullptr);
dir->priv->con = con;
dir->priv->needs_mtime_update = FALSE;
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index 49bf521f..57ad963c 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -155,7 +155,7 @@ GnomeCmdFile *gnome_cmd_file_new (GFileInfo *gFileInfo, GnomeCmdDir *dir)
{
auto gnomeCmdFile = static_cast<GnomeCmdFile*> (g_object_new (GNOME_CMD_TYPE_FILE, nullptr));
- gnome_cmd_file_setup (gnomeCmdFile, gFileInfo, dir);
+ gnome_cmd_file_setup (G_OBJECT(gnomeCmdFile), gFileInfo, dir);
if(!gnomeCmdFile->gFile)
{
@@ -207,11 +207,13 @@ void GnomeCmdFile::invalidate_metadata()
}
-void gnome_cmd_file_setup (GnomeCmdFile *gnomeCmdFile, GFileInfo *gFileInfo, GnomeCmdDir *dir)
+void gnome_cmd_file_setup (GObject *gObject, GFileInfo *gFileInfo, GnomeCmdDir *parentDir)
{
- g_return_if_fail (gnomeCmdFile != nullptr);
+ g_return_if_fail (gObject != nullptr);
+ g_return_if_fail (GNOME_CMD_IS_FILE(gObject));
g_return_if_fail (gFileInfo != nullptr);
+ auto gnomeCmdFile = (GnomeCmdFile*) gObject;
gnomeCmdFile->gFileInfo = gFileInfo;
auto filename = g_file_info_get_attribute_string (gFileInfo, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
@@ -232,16 +234,27 @@ void gnome_cmd_file_setup (GnomeCmdFile *gnomeCmdFile, GFileInfo *gFileInfo, Gno
gnomeCmdFile->collate_key = g_utf8_collate_key_for_filename (utf8_name, -1);
g_free (utf8_name);
- if (dir)
+ if (parentDir)
{
- gnomeCmdFile->priv->dir_handle = gnome_cmd_dir_get_handle (dir);
+ gnomeCmdFile->priv->dir_handle = gnome_cmd_dir_get_handle (parentDir);
handle_ref (gnomeCmdFile->priv->dir_handle);
}
auto path = gnomeCmdFile->get_path();
if (path)
{
- auto con = gnome_cmd_dir_get_connection(dir);
+ 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 conUri = gnome_cmd_con_get_uri(con);
diff --git a/src/gnome-cmd-file.h b/src/gnome-cmd-file.h
index 1d300e69..1d945719 100644
--- a/src/gnome-cmd-file.h
+++ b/src/gnome-cmd-file.h
@@ -129,7 +129,7 @@ inline const gchar *GnomeCmdFile::get_name()
GnomeCmdFile *gnome_cmd_file_new_from_gfile (GFile *gFile);
GnomeCmdFile *gnome_cmd_file_new (const gchar *local_full_path);
GnomeCmdFile *gnome_cmd_file_new (GFileInfo *gFileInfo, GnomeCmdDir *dir);
-void gnome_cmd_file_setup (GnomeCmdFile *gnomeCmdFile, GFileInfo *gFileInfo, GnomeCmdDir *dir);
+void gnome_cmd_file_setup (GObject *gObject, GFileInfo *gFileInfo, GnomeCmdDir *dir);
inline GnomeCmdFile *gnome_cmd_file_ref (GnomeCmdFile *f)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]