[gnome-commander] focus_file: use GIO to get the filename



commit 72e933f9aec57319abc5cd37861ec78fe48771d4
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Thu May 20 23:26:27 2021 +0200

    focus_file: use GIO to get the filename

 src/dirlist.cc             | 2 +-
 src/gnome-cmd-file-list.cc | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/dirlist.cc b/src/dirlist.cc
index 2931b7b7..b4279196 100644
--- a/src/dirlist.cc
+++ b/src/dirlist.cc
@@ -149,7 +149,7 @@ void sync_list (GnomeCmdDir *dir)
     g_object_unref(gFileEnumerator);
     g_free (uri_str);
 
-    dir->state = dir->list_result==GNOME_VFS_OK ? GnomeCmdDir::STATE_LISTED : GnomeCmdDir::STATE_EMPTY;
+    dir->state = GnomeCmdDir::STATE_LISTING;
 }
 
 static void enumerate_children_callback(GObject *direnum, GAsyncResult *result, gpointer user_data)
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index cc808e13..7bbd1825 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2191,20 +2191,22 @@ void GnomeCmdFileList::focus_file(const gchar *file_to_focus, gboolean scroll_to
         auto f = static_cast<GnomeCmdFile*> (i->data);
 
         g_return_if_fail (f != nullptr);
-        g_return_if_fail (f->info != nullptr);
 
         gint row = get_row_from_file (f);
         if (row == -1)
             return;
 
-        if (strcmp (f->info->name, file_to_focus) == 0)
+        auto basename = g_file_get_basename(f->gFile);
+        if (strcmp (basename, file_to_focus) == 0)
         {
+            g_free(basename);
             priv->cur_file = row;
             focus_file_at_row (this, row);
             if (scroll_to_file)
                 gtk_clist_moveto (*this, row, 0, 0, 0);
             return;
         }
+        g_free(basename);
     }
 
     /* The file was not found, remember the filename in case the file gets


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