[gnome-commander] Use gio filetype to assign colors



commit 1ac0d21737da16b4ab466f5ed8c9900f749864a9
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sun Feb 21 22:56:49 2021 +0100

    Use gio filetype to assign colors

 src/ls_colors.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/ls_colors.cc b/src/ls_colors.cc
index 10ce0d63..6b86a862 100644
--- a/src/ls_colors.cc
+++ b/src/ls_colors.cc
@@ -34,7 +34,7 @@ using namespace std;
 
 
 static GHashTable *map;
-static LsColor *type_colors[8];
+static LsColor *type_colors[7];
 
 
 /*
@@ -201,7 +201,8 @@ void ls_colors_init ()
 
 LsColor *ls_colors_get (GnomeCmdFile *f)
 {
-    if (f->GetGfileAttributeUInt32(G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_SYMBOLIC_LINK)
+    auto fileType = f->GetGfileAttributeUInt32(G_FILE_ATTRIBUTE_STANDARD_TYPE);
+    if (fileType == G_FILE_TYPE_SYMBOLIC_LINK)
         return type_colors[G_FILE_TYPE_SYMBOLIC_LINK];
 
     LsColor *col = nullptr;
@@ -211,7 +212,7 @@ LsColor *ls_colors_get (GnomeCmdFile *f)
         col = static_cast<LsColor*> (g_hash_table_lookup (::map, ext));
 
     if (!col)
-        col = type_colors[f->info->type];
+        col = type_colors[fileType];
 
     return col;
 }


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