Deduplicate FILE_COLUMN_POINTER
authorArkadiy Illarionov <qarkai@gmail.com>
Sat, 9 Mar 2024 11:02:22 +0000 (14:02 +0300)
committerColin Clark <colin.clark@cclark.uk>
Sat, 9 Mar 2024 15:10:38 +0000 (15:10 +0000)
src/layout-image.cc
src/layout-util.cc
src/view-file.h
src/view-file/view-file-icon.cc
src/view-file/view-file-list.cc

index 9699e02..4745404 100644 (file)
 #include "utilops.h"
 #include "view-file.h"
 
-enum {
-       FILE_COLUMN_POINTER = 0
-};
-
 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw);
 static void layout_image_set_buttons(LayoutWindow *lw);
 static gboolean layout_image_animate_new_file(LayoutWindow *lw);
@@ -1263,7 +1259,7 @@ void layout_image_alter_orientation(LayoutWindow *lw, AlterType type)
                        {
                        tpath = static_cast<GtkTreePath *>(work->data);
                        gtk_tree_model_get_iter(store, &iter, tpath);
-                       gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+                       gtk_tree_model_get(store, &iter, VIEW_FILE_COLUMN_POINTER, &fd_n, -1);
                        work = work->next;
                        }
 
@@ -1312,7 +1308,7 @@ void layout_image_rating(LayoutWindow *lw, const gchar *rating)
                        {
                        tpath = static_cast<GtkTreePath *>(work->data);
                        gtk_tree_model_get_iter(store, &iter, tpath);
-                       gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+                       gtk_tree_model_get(store, &iter, VIEW_FILE_COLUMN_POINTER, &fd_n, -1);
                        work = work->next;
                        }
 
index d3b2f68..d1d619a 100644 (file)
@@ -83,7 +83,6 @@
 
 enum {
        MENU_EDIT_ACTION_OFFSET = 16,
-       FILE_COLUMN_POINTER = 0
 };
 
 static gboolean layout_bar_enabled(LayoutWindow *lw);
@@ -605,7 +604,7 @@ static void layout_menu_write_rotate(GtkToggleAction *, gpointer data, gboolean
                        {
                        tpath = static_cast<GtkTreePath *>(work->data);
                        gtk_tree_model_get_iter(store, &iter, tpath);
-                       gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+                       gtk_tree_model_get(store, &iter, VIEW_FILE_COLUMN_POINTER, &fd_n, -1);
                        work = work->next;
                        }
 
index 4039434..002e59c 100644 (file)
@@ -128,6 +128,8 @@ struct ViewFileInfoIcon
 #define VFLIST(_vf_) ((ViewFileInfoList *)(_vf_->info))
 #define VFICON(_vf_) ((ViewFileInfoIcon *)(_vf_->info))
 
+const gint VIEW_FILE_COLUMN_POINTER = 0; // @todo Use inline constexpr in C++17
+
 void vf_send_update(ViewFile *vf);
 
 ViewFile *vf_new(FileViewType type, FileData *dir_fd);
index 356e3db..1a61eac 100644 (file)
@@ -61,7 +61,7 @@ constexpr gint THUMB_BORDER_PADDING = 2;
 constexpr gint VFICON_TIP_DELAY = 500;
 
 enum {
-       FILE_COLUMN_POINTER = 0,
+       FILE_COLUMN_POINTER = VIEW_FILE_COLUMN_POINTER,
        FILE_COLUMN_COUNT
 };
 
index f42ac32..a941e7f 100644 (file)
@@ -48,7 +48,7 @@
 
 /* Index to tree store */
 enum {
-       FILE_COLUMN_POINTER = 0,
+       FILE_COLUMN_POINTER = VIEW_FILE_COLUMN_POINTER,
        FILE_COLUMN_VERSION,
        FILE_COLUMN_THUMB,
        FILE_COLUMN_FORMATTED,