Sort headers using clang-tidy
[geeqie.git] / src / view-file / view-file-list.cc
index daa502e..bcd1145 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "main.h"
 #include "view-file-list.h"
 
+#include <config.h>
+
 #include "collect.h"
+#include "debug.h"
 #include "dnd.h"
 #include "img-view.h"
-#include "layout.h"
+#include "intl.h"
 #include "layout-image.h"
+#include "layout.h"
+#include "main-defines.h"
 #include "metadata.h"
 #include "misc.h"
-#include "utilops.h"
 #include "ui-fileops.h"
 #include "ui-misc.h"
 #include "ui-tree-edit.h"
 #include "uri-utils.h"
+#include "utilops.h"
 #include "view-file.h"
 
+#include <vector>
+
 /* Index to tree store */
 enum {
        FILE_COLUMN_POINTER = 0,
@@ -84,13 +90,13 @@ static void vflist_set_expanded(ViewFile *vf, GtkTreeIter *iter, gboolean expand
  *-----------------------------------------------------------------------------
  */
 struct ViewFileFindRowData {
-       FileData *fd;
+       const FileData *fd;
        GtkTreeIter *iter;
        gboolean found;
        gint row;
 };
 
-static gboolean vflist_find_row_cb(GtkTreeModel *model, GtkTreePath *UNUSED(path), GtkTreeIter *iter, gpointer data)
+static gboolean vflist_find_row_cb(GtkTreeModel *model, GtkTreePath *, GtkTreeIter *iter, gpointer data)
 {
        auto find = static_cast<ViewFileFindRowData *>(data);
        FileData *fd;
@@ -105,7 +111,7 @@ static gboolean vflist_find_row_cb(GtkTreeModel *model, GtkTreePath *UNUSED(path
        return FALSE;
 }
 
-static gint vflist_find_row(ViewFile *vf, FileData *fd, GtkTreeIter *iter)
+static gint vflist_find_row(const ViewFile *vf, const FileData *fd, GtkTreeIter *iter)
 {
        GtkTreeModel *store;
        ViewFileFindRowData data = {fd, iter, FALSE, 0};
@@ -121,7 +127,7 @@ static gint vflist_find_row(ViewFile *vf, FileData *fd, GtkTreeIter *iter)
        return -1;
 }
 
-static FileData *vflist_find_data_by_coord(ViewFile *vf, gint x, gint y, GtkTreeIter *UNUSED(iter))
+static FileData *vflist_find_data_by_coord(ViewFile *vf, gint x, gint y, GtkTreeIter *)
 {
        GtkTreePath *tpath;
        GtkTreeViewColumn *column;
@@ -144,7 +150,7 @@ static FileData *vflist_find_data_by_coord(ViewFile *vf, gint x, gint y, GtkTree
        return nullptr;
 }
 
-static gboolean vflist_store_clear_cb(GtkTreeModel *model, GtkTreePath *UNUSED(path), GtkTreeIter *iter, gpointer UNUSED(data))
+static gboolean vflist_store_clear_cb(GtkTreeModel *model, GtkTreePath *, GtkTreeIter *iter, gpointer)
 {
        FileData *fd;
        gtk_tree_model_get(model, iter, FILE_COLUMN_POINTER, &fd, -1);
@@ -165,10 +171,11 @@ static void vflist_store_clear(ViewFile *vf, gboolean unlock_files)
                {
                // unlock locked files in this directory
                filelist_read(vf->dir_fd, &files, nullptr);
-               while (files)
+               GList *work = files;
+               while (work)
                        {
-                       auto fd = static_cast<FileData *>(files->data);
-                       files = files->next;
+                       auto fd = static_cast<FileData *>(work->data);
+                       work = work->next;
                        file_data_unlock(fd);
                        file_data_unref(fd);  // undo the ref that got added in filelist_read
                        }
@@ -209,9 +216,9 @@ static void vflist_move_cursor(ViewFile *vf, GtkTreeIter *iter)
  *-----------------------------------------------------------------------------
  */
 
-static void vflist_dnd_get(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context),
-                          GtkSelectionData *selection_data, guint UNUSED(info),
-                          guint UNUSED(time), gpointer data)
+static void vflist_dnd_get(GtkWidget *, GdkDragContext *,
+                          GtkSelectionData *selection_data, guint,
+                          guint, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        GList *list = nullptr;
@@ -252,7 +259,7 @@ static void vflist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointe
                }
 }
 
-static void vflist_dnd_end(GtkWidget *UNUSED(widget), GdkDragContext *context, gpointer data)
+static void vflist_dnd_end(GtkWidget *, GdkDragContext *context, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -264,9 +271,9 @@ static void vflist_dnd_end(GtkWidget *UNUSED(widget), GdkDragContext *context, g
                }
 }
 
-static void vflist_drag_data_received(GtkWidget *UNUSED(entry_widget), GdkDragContext *UNUSED(context),
+static void vflist_drag_data_received(GtkWidget *, GdkDragContext *,
                                      int x, int y, GtkSelectionData *selection,
-                                     guint info, guint UNUSED(time), gpointer data)
+                                     guint info, guint, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -279,7 +286,7 @@ static void vflist_drag_data_received(GtkWidget *UNUSED(entry_widget), GdkDragCo
                        GList *kw_list = string_to_keywords_list(str);
 
                        metadata_append_list(fd, KEYWORD_KEY, kw_list);
-                       string_list_free(kw_list);
+                       g_list_free_full(kw_list, g_free);
                        g_free(str);
                }
        }
@@ -312,7 +319,7 @@ void vflist_dnd_init(ViewFile *vf)
 
 GList *vflist_selection_get_one(ViewFile *vf, FileData *fd)
 {
-       GList *list = g_list_append(nullptr, file_data_ref(fd));
+       GList *list = nullptr;
 
        if (fd->sidecar_files)
                {
@@ -329,20 +336,13 @@ GList *vflist_selection_get_one(ViewFile *vf, FileData *fd)
                        if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath))
                                {
                                /* unexpanded - add whole group */
-                               GList *work = fd->sidecar_files;
-                               while (work)
-                                       {
-                                       auto sfd = static_cast<FileData *>(work->data);
-                                       list = g_list_prepend(list, file_data_ref(sfd));
-                                       work = work->next;
-                                       }
+                               list = filelist_copy(fd->sidecar_files);
                                }
                        gtk_tree_path_free(tpath);
                        }
-               list = g_list_reverse(list);
                }
 
-       return list;
+       return g_list_prepend(list, file_data_ref(fd));
 }
 
 GList *vflist_pop_menu_file_list(ViewFile *vf)
@@ -357,7 +357,7 @@ GList *vflist_pop_menu_file_list(ViewFile *vf)
 }
 
 
-void vflist_pop_menu_view_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_pop_menu_view_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -375,7 +375,7 @@ void vflist_pop_menu_view_cb(GtkWidget *UNUSED(widget), gpointer data)
                }
 }
 
-void vflist_pop_menu_rename_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_pop_menu_rename_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        GList *list;
@@ -406,7 +406,7 @@ void vflist_pop_menu_rename_cb(GtkWidget *UNUSED(widget), gpointer data)
        file_util_rename(nullptr, list, vf->listview);
 }
 
-void vflist_pop_menu_thumbs_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_pop_menu_thumbs_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -423,7 +423,8 @@ void vflist_pop_menu_thumbs_cb(GtkWidget *UNUSED(widget), gpointer data)
 
 void vflist_star_rating_set(ViewFile *vf, gboolean enable)
 {
-       GList *columns, *work;
+       GList *columns;
+       GList *work;
 
        columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vf->listview));
 
@@ -456,7 +457,7 @@ void vflist_star_rating_set(ViewFile *vf, gboolean enable)
        g_list_free(columns);
 }
 
-void vflist_pop_menu_show_star_rating_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_pop_menu_show_star_rating_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -468,7 +469,7 @@ void vflist_pop_menu_show_star_rating_cb(GtkWidget *UNUSED(widget), gpointer dat
        vflist_star_rating_set(vf, options->show_star_rating);
 }
 
-void vflist_pop_menu_refresh_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_pop_menu_refresh_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -477,7 +478,7 @@ void vflist_pop_menu_refresh_cb(GtkWidget *UNUSED(widget), gpointer data)
        gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vf->listview));
 }
 
-void vflist_popup_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_popup_destroy_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vflist_color_set(vf, VFLIST(vf)->click_fd, FALSE);
@@ -492,7 +493,7 @@ void vflist_popup_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
  *-----------------------------------------------------------------------------
  */
 
-static gboolean vflist_row_rename_cb(TreeEditData *UNUSED(td), const gchar *old_name, const gchar *new_name, gpointer data)
+static gboolean vflist_row_rename_cb(TreeEditData *, const gchar *old_name, const gchar *new_name, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        gchar *new_path;
@@ -504,7 +505,7 @@ static gboolean vflist_row_rename_cb(TreeEditData *UNUSED(td), const gchar *old_
        if (strchr(new_name, G_DIR_SEPARATOR) != nullptr)
                {
                gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new_name);
-               file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vf->listview);
+               file_util_warning_dialog(_("Error renaming file"), text, GQ_ICON_DIALOG_ERROR, vf->listview);
                g_free(text);
                }
        else
@@ -764,7 +765,7 @@ static void vflist_select_idle_cancel(ViewFile *vf)
                }
 }
 
-static gboolean vflist_select_cb(GtkTreeSelection *UNUSED(selection), GtkTreeModel *store, GtkTreePath *tpath, gboolean path_currently_selected, gpointer data)
+static gboolean vflist_select_cb(GtkTreeSelection *, GtkTreeModel *store, GtkTreePath *tpath, gboolean path_currently_selected, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        GtkTreeIter iter;
@@ -792,13 +793,13 @@ static gboolean vflist_select_cb(GtkTreeSelection *UNUSED(selection), GtkTreeMod
        return TRUE;
 }
 
-static void vflist_expand_cb(GtkTreeView *UNUSED(tree_view), GtkTreeIter *iter, GtkTreePath *UNUSED(path), gpointer data)
+static void vflist_expand_cb(GtkTreeView *, GtkTreeIter *iter, GtkTreePath *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vflist_set_expanded(vf, iter, TRUE);
 }
 
-static void vflist_collapse_cb(GtkTreeView *UNUSED(tree_view), GtkTreeIter *iter, GtkTreePath *UNUSED(path), gpointer data)
+static void vflist_collapse_cb(GtkTreeView *, GtkTreeIter *iter, GtkTreePath *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vflist_set_expanded(vf, iter, FALSE);
@@ -1064,32 +1065,30 @@ static void vflist_setup_iter_recursive(ViewFile *vf, GtkTreeStore *store, GtkTr
        /* move the prepended entries to the correct position */
        if (num_prepended)
                {
-               gint i;
                gint num_total = num_prepended + num_ordered;
-               auto new_order = static_cast<gint *>(g_malloc(num_total * sizeof(gint)));
+               std::vector<gint> new_order;
+               new_order.reserve(num_total);
 
-               for (i = 0; i < num_total; i++)
+               for (gint i = 0; i < num_ordered; i++)
                        {
-                       if (i < num_ordered)
-                               new_order[i] = num_prepended + i;
-                       else
-                               new_order[i] = num_total - 1 - i;
+                       new_order.push_back(num_prepended + i);
                        }
-               gtk_tree_store_reorder(store, parent_iter, new_order);
-
-               g_free(new_order);
+               for (gint i = num_ordered; i < num_total; i++)
+                       {
+                       new_order.push_back(num_total - 1 - i);
+                       }
+               gtk_tree_store_reorder(store, parent_iter, new_order.data());
                }
 }
 
-void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend)
+void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend, gboolean case_sensitive)
 {
        gint i;
        GHashTable *fd_idx_hash = g_hash_table_new(nullptr, nullptr);
-       gint *new_order;
        GtkTreeStore *store;
        GList *work;
 
-       if (vf->sort_method == type && vf->sort_ascend == ascend) return;
+       if (vf->sort_method == type && vf->sort_ascend == ascend && vf->sort_case == case_sensitive) return;
        if (!vf->list) return;
 
        work = vf->list;
@@ -1104,25 +1103,24 @@ void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend)
 
        vf->sort_method = type;
        vf->sort_ascend = ascend;
+       vf->sort_case = case_sensitive;
 
-       vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend);
+       vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend, vf->sort_case);
 
-       new_order = static_cast<gint *>(g_malloc(i * sizeof(gint)));
+       std::vector<gint> new_order;
+       new_order.reserve(i);
 
        work = vf->list;
-       i = 0;
        while (work)
                {
                auto fd = static_cast<FileData *>(work->data);
-               new_order[i] = GPOINTER_TO_INT(g_hash_table_lookup(fd_idx_hash, fd));
-               i++;
+               new_order.push_back(GPOINTER_TO_INT(g_hash_table_lookup(fd_idx_hash, fd)));
                work = work->next;
                }
 
        store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)));
-       gtk_tree_store_reorder(store, nullptr, new_order);
+       gtk_tree_store_reorder(store, nullptr, new_order.data());
 
-       g_free(new_order);
        g_hash_table_destroy(fd_idx_hash);
 }
 
@@ -1362,7 +1360,8 @@ FileData *vflist_star_next_fd(ViewFile *vf)
 gint vflist_index_by_fd(ViewFile *vf, FileData *fd)
 {
        gint p = 0;
-       GList *work, *work2;
+       GList *work;
+       GList *work2;
 
        work = vf->list;
        while (work)
@@ -1417,19 +1416,21 @@ static gboolean vflist_row_is_selected(ViewFile *vf, FileData *fd)
                if (fd_n == fd) found = TRUE;
                work = work->next;
                }
-       g_list_foreach(slist, static_cast<GFunc>(tree_path_free_wrapper), nullptr);
-       g_list_free(slist);
+       g_list_free_full(slist, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
 
        return found;
 }
 
-//gboolean vflist_index_is_selected(ViewFile *vf, gint row)
-//{
-       //FileData *fd;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+gboolean vflist_index_is_selected_unused(ViewFile *vf, gint row)
+{
+       FileData *fd;
 
-       //fd = vf_index_get_data(vf, row);
-       //return vflist_row_is_selected(vf, fd);
-//}
+       fd = vf_index_get_data(vf, row);
+       return vflist_row_is_selected(vf, fd);
+}
+#pragma GCC diagnostic pop
 
 guint vflist_selection_count(ViewFile *vf, gint64 *bytes)
 {
@@ -1464,8 +1465,7 @@ guint vflist_selection_count(ViewFile *vf, gint64 *bytes)
                }
 
        count = g_list_length(slist);
-       g_list_foreach(slist, static_cast<GFunc>(tree_path_free_wrapper), nullptr);
-       g_list_free(slist);
+       g_list_free_full(slist, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
 
        return count;
 }
@@ -1476,12 +1476,10 @@ GList *vflist_selection_get_list(ViewFile *vf)
        GtkTreeSelection *selection;
        GList *slist;
        GList *list = nullptr;
-       GList *work;
 
        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vf->listview));
        slist = gtk_tree_selection_get_selected_rows(selection, &store);
-       work = slist;
-       while (work)
+       for (GList *work = g_list_last(slist); work; work = work->prev)
                {
                auto tpath = static_cast<GtkTreePath *>(work->data);
                FileData *fd;
@@ -1490,26 +1488,17 @@ GList *vflist_selection_get_list(ViewFile *vf)
                gtk_tree_model_get_iter(store, &iter, tpath);
                gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
 
-               list = g_list_prepend(list, file_data_ref(fd));
-
                if (!fd->parent && !gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath))
                        {
                        /* unexpanded - add whole group */
-                       GList *work2 = fd->sidecar_files;
-                       while (work2)
-                               {
-                               auto sfd = static_cast<FileData *>(work2->data);
-                               list = g_list_prepend(list, file_data_ref(sfd));
-                               work2 = work2->next;
-                               }
+                       list = g_list_concat(filelist_copy(fd->sidecar_files), list);
                        }
 
-               work = work->next;
+               list = g_list_prepend(list, file_data_ref(fd));
                }
-       g_list_foreach(slist, static_cast<GFunc>(tree_path_free_wrapper), nullptr);
-       g_list_free(slist);
+       g_list_free_full(slist, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
 
-       return g_list_reverse(list);
+       return list;
 }
 
 GList *vflist_selection_get_list_by_index(ViewFile *vf)
@@ -1536,8 +1525,7 @@ GList *vflist_selection_get_list_by_index(ViewFile *vf)
 
                work = work->next;
                }
-       g_list_foreach(slist, static_cast<GFunc>(tree_path_free_wrapper), nullptr);
-       g_list_free(slist);
+       g_list_free_full(slist, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
 
        return g_list_reverse(list);
 }
@@ -1711,7 +1699,8 @@ void vflist_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode)
        while (valid)
                {
                FileData *fd;
-               gboolean mark_val, selected;
+               gboolean mark_val;
+               gboolean selected;
                gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, -1);
 
                mark_val = file_data_get_mark(fd, n);
@@ -1791,8 +1780,7 @@ void vflist_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode)
 
                work = work->next;
                }
-       g_list_foreach(slist, static_cast<GFunc>(tree_path_free_wrapper), nullptr);
-       g_list_free(slist);
+       g_list_free_full(slist, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
 }
 
 /*
@@ -1914,12 +1902,12 @@ gboolean vflist_refresh(ViewFile *vf)
                ret = filelist_read(vf->dir_fd, &vf->list, nullptr);
 
                if (vf->marks_enabled)
-                       {
-                       // When marks are enabled, lock FileDatas so that we don't end up re-parsing XML
-                       // each time a mark is changed.
-                       file_data_lock_list(vf->list);
-                       }
-               else
+                       {
+                       // When marks are enabled, lock FileDatas so that we don't end up re-parsing XML
+                       // each time a mark is changed.
+                       file_data_lock_list(vf->list);
+                       }
+               else
                        {
                        /** @FIXME only do this when needed (aka when we just switched from */
                        /** @FIXME marks-enabled to marks-disabled) */
@@ -1936,7 +1924,7 @@ gboolean vflist_refresh(ViewFile *vf)
                file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM);
 
                DEBUG_1("%s vflist_refresh: sort", get_exec_time());
-               vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend);
+               vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend, vf->sort_case);
                }
 
        DEBUG_1("%s vflist_refresh: populate view", get_exec_time());
@@ -1955,7 +1943,9 @@ gboolean vflist_refresh(ViewFile *vf)
 
 /* this overrides the low default of a GtkCellRenderer from 100 to CELL_HEIGHT_OVERRIDE, something sane for our purposes */
 
-#define CELL_HEIGHT_OVERRIDE 512
+enum {
+       CELL_HEIGHT_OVERRIDE = 512
+};
 
 static void cell_renderer_height_override(GtkCellRenderer *renderer)
 {
@@ -1971,9 +1961,10 @@ static void cell_renderer_height_override(GtkCellRenderer *renderer)
                }
 }
 
-static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
+static GdkRGBA *vflist_listview_color_shifted(GtkWidget *widget)
 {
-       static GdkColor color;
+       static GdkRGBA color;
+       static GdkRGBA color_style;
        static GtkWidget *done = nullptr;
 
        if (done != widget)
@@ -1981,7 +1972,9 @@ static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
                GtkStyle *style;
 
                style = gtk_widget_get_style(widget);
-               memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color));
+               convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color_style);
+
+               memcpy(&color, &color_style, sizeof(color));
                shift_color(&color, -1, 0);
                done = widget;
                }
@@ -1989,7 +1982,7 @@ static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
        return &color;
 }
 
-static void vflist_listview_color_cb(GtkTreeViewColumn *UNUSED(tree_column), GtkCellRenderer *cell,
+static void vflist_listview_color_cb(GtkTreeViewColumn *, GtkCellRenderer *cell,
                                     GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
@@ -1997,7 +1990,7 @@ static void vflist_listview_color_cb(GtkTreeViewColumn *UNUSED(tree_column), Gtk
 
        gtk_tree_model_get(tree_model, iter, FILE_COLUMN_COLOR, &set, -1);
        g_object_set(G_OBJECT(cell),
-                    "cell-background-gdk", vflist_listview_color_shifted(vf->listview),
+                    "cell-background-rgba", vflist_listview_color_shifted(vf->listview),
                     "cell-background-set", set, NULL);
 }
 
@@ -2126,7 +2119,7 @@ gboolean vflist_set_fd(ViewFile *vf, FileData *dir_fd)
        return ret;
 }
 
-void vflist_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
+void vflist_destroy_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -2140,7 +2133,7 @@ void vflist_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
        filelist_free(vf->list);
 }
 
-ViewFile *vflist_new(ViewFile *vf, FileData *UNUSED(dir_fd))
+ViewFile *vflist_new(ViewFile *vf, FileData *)
 {
        GtkTreeStore *store;
        GtkTreeSelection *selection;
@@ -2241,7 +2234,8 @@ void vflist_thumb_set(ViewFile *vf, gboolean enable)
 
 void vflist_marks_set(ViewFile *vf, gboolean enable)
 {
-       GList *columns, *work;
+       GList *columns;
+       GList *work;
 
        columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vf->listview));