[gnome-commander/ConfigurableFileListColumns: 7/26] Use fileListColumnLayouts struct for setting the file list column titles



commit 62da22e2b94562ca1f17339acd570cf69b73362e
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Fri May 3 22:36:57 2019 +0200

    Use fileListColumnLayouts struct for setting the file list column titles

 src/gnome-cmd-file-list.cc | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 7db188eb..caaea97e 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -676,7 +676,7 @@ void GnomeCmdFileList::create_column_titles()
 {
     gtk_clist_column_title_passive (*this, COLUMN_ICON);
 
-    for (gint ii = COLUMN_NAME; ii < NUM_COLUMNS; ii++)
+    for (guint ii = COLUMN_NAME; ii < NUM_COLUMNS; ii++)
     {
         GtkWidget *hbox, *pixmap;
 
@@ -688,7 +688,13 @@ void GnomeCmdFileList::create_column_titles()
         g_object_set_data_full (*this, "column-hbox", hbox, g_object_unref);
         gtk_widget_show (hbox);
 
-        priv->column_labels[ii] = gtk_label_new (_(file_list_column[ii].title));
+        guint actualColumn;
+        for (guint jj = COLUMN_NAME; jj < NUM_COLUMNS; jj++)
+        {
+            if (ii == gnome_cmd_data.fileListColumnLayouts[jj].position)
+                actualColumn = jj;
+        }
+        priv->column_labels[ii] = gtk_label_new (_(file_list_column[actualColumn].title));
         g_object_ref (priv->column_labels[ii]);
         g_object_set_data_full (*this, "column-label", priv->column_labels[ii], g_object_unref);
         gtk_widget_show (priv->column_labels[ii]);
@@ -704,10 +710,16 @@ void GnomeCmdFileList::create_column_titles()
         gtk_clist_set_column_widget (*this, ii, hbox);
     }
 
-    for (gint ii = COLUMN_ICON; ii < NUM_COLUMNS; ii++)
+    for (guint ii = COLUMN_ICON; ii < NUM_COLUMNS; ii++)
     {
+        guint actualColumn;
+        for (guint jj = COLUMN_NAME; jj < NUM_COLUMNS; jj++)
+        {
+            if (ii == gnome_cmd_data.fileListColumnLayouts[jj].position)
+                actualColumn = jj;
+        }
         gtk_clist_set_column_width (*this, ii, gnome_cmd_data.fileListColumnLayouts[ii].width);
-        gtk_clist_set_column_justification (*this, ii, file_list_column[ii].justification);
+        gtk_clist_set_column_justification (*this, ii, file_list_column[actualColumn].justification);
     }
     gtk_clist_column_titles_show (*this);
 }


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