[gnome-commander] noop: Minor refactoring



commit 30545596f7c8151c4758423c31c92de21e0ee389
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Aug 28 13:31:34 2021 +0200

    noop: Minor refactoring

 src/gnome-cmd-dir.cc | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index 9742747a..521e8028 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -328,31 +328,29 @@ GnomeCmdDir *gnome_cmd_dir_new (GnomeCmdCon *con, GnomeCmdPath *path, gboolean i
         return dir;
     }
 
-    //ToDo. Verallgemeinere das mit _from_uri()!
     auto gFileTmp = g_file_new_for_path(path->get_path());
     auto gFileInfo = g_file_query_info(gFileTmp, "*", G_FILE_QUERY_INFO_NONE, nullptr, &error);
     g_object_unref(gFileTmp);
 
-    if (!error)
-    {
-        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);
-
-        dir->priv->con = con;
-        dir->priv->needs_mtime_update = FALSE;
-
-        gnome_cmd_con_add_to_cache (con, dir);
-    }
-    else
+    if (error)
     {
         if (!isStartup)
         {
             gnome_cmd_show_message (*main_win, path->get_display_path(), error->message);
             g_error_free(error);
         }
+        return nullptr;
     }
 
+    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);
+
+    dir->priv->con = con;
+    dir->priv->needs_mtime_update = FALSE;
+
+    gnome_cmd_con_add_to_cache (con, dir);
+
     return dir;
 }
 


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