Sort headers using clang-tidy
[geeqie.git] / src / view-file / view-file.cc
index c2e87aa..89b712c 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "main.h"
 #include "view-file.h"
 
+#include <config.h>
+
+#include "compat.h"
+#include "debug.h"
 #include "dupe.h"
 #include "history-list.h"
+#include "intl.h"
 #include "layout.h"
+#include "main-defines.h"
+#include "main.h"
 #include "menu.h"
 #include "misc.h"
 #include "pixbuf-util.h"
 #include "thumb.h"
-#include "ui-menu.h"
 #include "ui-fileops.h"
+#include "ui-menu.h"
 #include "ui-misc.h"
 #include "utilops.h"
-#include "view-file/view-file-list.h"
 #include "view-file/view-file-icon.h"
+#include "view-file/view-file-list.h"
 #include "window.h"
 
 /*
@@ -53,12 +59,12 @@ void vf_send_update(ViewFile *vf)
  *-----------------------------------------------------------------------------
  */
 
-void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend)
+void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend, gboolean case_sensitive)
 {
        switch (vf->type)
        {
-       case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend); break;
-       case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend); break;
+       case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend, case_sensitive); break;
+       case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend, case_sensitive); break;
        }
 }
 
@@ -111,15 +117,7 @@ guint vf_count(ViewFile *vf, gint64 *bytes)
 
 GList *vf_get_list(ViewFile *vf)
 {
-       GList *list = nullptr;
-       GList *work;
-       for (work = vf->list; work; work = work->next)
-               {
-               auto fd = static_cast<FileData *>(work->data);
-               list = g_list_prepend(list, file_data_ref(fd));
-               }
-
-       return g_list_reverse(list);
+       return filelist_copy(vf->list);
 }
 
 /*
@@ -364,7 +362,7 @@ static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data)
        }
 }
 
-static void vf_pop_menu_open_archive_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_open_archive_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        LayoutWindow *lw_new;
@@ -390,18 +388,18 @@ static void vf_pop_menu_open_archive_cb(GtkWidget *UNUSED(widget), gpointer data
                }
        else
                {
-               warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GTK_STOCK_DIALOG_WARNING, nullptr);
+               warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GQ_ICON_DIALOG_WARNING, nullptr);
                }
 }
 
-static void vf_pop_menu_copy_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_copy_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
        file_util_copy(nullptr, vf_pop_menu_file_list(vf), nullptr, vf->listview);
 }
 
-static void vf_pop_menu_move_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_move_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -419,7 +417,7 @@ static void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
        }
 }
 
-static void vf_pop_menu_delete_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_delete_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -427,7 +425,7 @@ static void vf_pop_menu_delete_cb(GtkWidget *UNUSED(widget), gpointer data)
        file_util_delete(nullptr, vf_pop_menu_file_list(vf), vf->listview);
 }
 
-static void vf_pop_menu_move_to_trash_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_move_to_trash_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -435,28 +433,28 @@ static void vf_pop_menu_move_to_trash_cb(GtkWidget *UNUSED(widget), gpointer dat
        file_util_delete(nullptr, vf_pop_menu_file_list(vf), vf->listview);
 }
 
-static void vf_pop_menu_copy_path_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_copy_path_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
        file_util_copy_path_list_to_clipboard(vf_pop_menu_file_list(vf), TRUE);
 }
 
-static void vf_pop_menu_copy_path_unquoted_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_copy_path_unquoted_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
        file_util_copy_path_list_to_clipboard(vf_pop_menu_file_list(vf), FALSE);
 }
 
-static void vf_pop_menu_enable_grouping_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_enable_grouping_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
        file_data_disable_grouping_list(vf_pop_menu_file_list(vf), FALSE);
 }
 
-static void vf_pop_menu_duplicates_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_duplicates_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        DupeWindow *dw;
@@ -465,7 +463,7 @@ static void vf_pop_menu_duplicates_cb(GtkWidget *UNUSED(widget), gpointer data)
        dupe_window_add_files(dw, vf_pop_menu_file_list(vf), FALSE);
 }
 
-static void vf_pop_menu_disable_grouping_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_disable_grouping_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
@@ -491,65 +489,79 @@ static void vf_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
 
        if (vf->layout)
                {
-               layout_sort_set(vf->layout, type, vf->sort_ascend);
+               layout_sort_set_files(vf->layout, type, vf->sort_ascend, vf->sort_case);
                }
        else
                {
-               vf_sort_set(vf, type, vf->sort_ascend);
+               vf_sort_set(vf, type, vf->sort_ascend, vf->sort_case);
                }
 }
 
-static void vf_pop_menu_sort_ascend_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_sort_ascend_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
        if (vf->layout)
                {
-               layout_sort_set(vf->layout, vf->sort_method, !vf->sort_ascend);
+               layout_sort_set_files(vf->layout, vf->sort_method, !vf->sort_ascend, vf->sort_case);
                }
        else
                {
-               vf_sort_set(vf, vf->sort_method, !vf->sort_ascend);
+               vf_sort_set(vf, vf->sort_method, !vf->sort_ascend, vf->sort_case);
                }
 }
 
-static void vf_pop_menu_sel_mark_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_sort_case_cb(GtkWidget *, gpointer data)
+{
+       auto vf = static_cast<ViewFile *>(data);
+
+       if (vf->layout)
+               {
+               layout_sort_set_files(vf->layout, vf->sort_method, vf->sort_ascend, !vf->sort_case);
+               }
+       else
+               {
+               vf_sort_set(vf, vf->sort_method, vf->sort_ascend, !vf->sort_case);
+               }
+}
+
+static void vf_pop_menu_sel_mark_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_SET);
 }
 
-static void vf_pop_menu_sel_mark_and_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_sel_mark_and_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_AND);
 }
 
-static void vf_pop_menu_sel_mark_or_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_sel_mark_or_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_OR);
 }
 
-static void vf_pop_menu_sel_mark_minus_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_sel_mark_minus_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_MINUS);
 }
 
-static void vf_pop_menu_set_mark_sel_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_set_mark_sel_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_selection_to_mark(vf, vf->active_mark, STM_MODE_SET);
 }
 
-static void vf_pop_menu_res_mark_sel_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_res_mark_sel_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_selection_to_mark(vf, vf->active_mark, STM_MODE_RESET);
 }
 
-static void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_selection_to_mark(vf, vf->active_mark, STM_MODE_TOGGLE);
@@ -558,7 +570,7 @@ static void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *UNUSED(widget), gpointer d
 static void vf_pop_menu_toggle_view_type_cb(GtkWidget *widget, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
-       auto  new_type = static_cast<FileViewType>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data")));
+       auto new_type = static_cast<FileViewType>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data")));
        if (!vf->layout) return;
 
        layout_views_set(vf->layout, vf->layout->options.dir_view_type, new_type);
@@ -692,13 +704,13 @@ GtkWidget *vf_pop_menu(ViewFile *vf)
        submenu_add_edit(menu, &item, G_CALLBACK(vf_pop_menu_edit_cb), vf, vf->editmenu_fd_list);
        gtk_widget_set_sensitive(item, active);
 
-       menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
+       menu_item_add_icon_sensitive(menu, _("View in _new window"), GQ_ICON_NEW, active,
                                      G_CALLBACK(vf_pop_menu_view_cb), vf);
 
-       menu_item_add_stock_sensitive(menu, _("Open archive"), GTK_STOCK_OPEN, active & class_archive, G_CALLBACK(vf_pop_menu_open_archive_cb), vf);
+       menu_item_add_icon_sensitive(menu, _("Open archive"), GQ_ICON_OPEN, active & class_archive, G_CALLBACK(vf_pop_menu_open_archive_cb), vf);
 
        menu_item_add_divider(menu);
-       menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
+       menu_item_add_icon_sensitive(menu, _("_Copy..."), GQ_ICON_COPY, active,
                                      G_CALLBACK(vf_pop_menu_copy_cb), vf);
        menu_item_add_sensitive(menu, _("_Move..."), active,
                                G_CALLBACK(vf_pop_menu_move_cb), vf);
@@ -709,13 +721,13 @@ GtkWidget *vf_pop_menu(ViewFile *vf)
        menu_item_add_sensitive(menu, _("_Copy path unquoted to clipboard"), active,
                                G_CALLBACK(vf_pop_menu_copy_path_unquoted_cb), vf);
        menu_item_add_divider(menu);
-       menu_item_add_stock_sensitive(menu,
+       menu_item_add_icon_sensitive(menu,
                                options->file_ops.confirm_move_to_trash ? _("Move to Trash...") :
-                                       _("Move to Trash"), PIXBUF_INLINE_ICON_TRASH, active,
+                                       _("Move to Trash"), GQ_ICON_DELETE, active,
                                G_CALLBACK(vf_pop_menu_move_to_trash_cb), vf);
-       menu_item_add_stock_sensitive(menu,
+       menu_item_add_icon_sensitive(menu,
                                options->file_ops.confirm_delete ? _("_Delete...") :
-                                       _("_Delete"), GTK_STOCK_DELETE, active,
+                                       _("_Delete"), GQ_ICON_DELETE_SHRED, active,
                                G_CALLBACK(vf_pop_menu_delete_cb), vf);
        menu_item_add_divider(menu);
 
@@ -725,7 +737,7 @@ GtkWidget *vf_pop_menu(ViewFile *vf)
                                G_CALLBACK(vf_pop_menu_disable_grouping_cb), vf);
 
        menu_item_add_divider(menu);
-       menu_item_add_stock_sensitive(menu, _("_Find duplicates..."), GTK_STOCK_FIND, active,
+       menu_item_add_icon_sensitive(menu, _("_Find duplicates..."), GQ_ICON_FIND, active,
                                G_CALLBACK(vf_pop_menu_duplicates_cb), vf);
        menu_item_add_divider(menu);
 
@@ -739,6 +751,8 @@ GtkWidget *vf_pop_menu(ViewFile *vf)
        menu_item_add_divider(submenu);
        menu_item_add_check(submenu, _("Ascending"), vf->sort_ascend,
                            G_CALLBACK(vf_pop_menu_sort_ascend_cb), vf);
+       menu_item_add_check(submenu, _("Case"), vf->sort_ascend,
+                           G_CALLBACK(vf_pop_menu_sort_case_cb), vf);
 
        item = menu_item_add(menu, _("_Sort"), nullptr, nullptr);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
@@ -773,7 +787,7 @@ GtkWidget *vf_pop_menu(ViewFile *vf)
                break;
        }
 
-       menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vf_pop_menu_refresh_cb), vf);
+       menu_item_add_icon(menu, _("Re_fresh"), GQ_ICON_REFRESH, G_CALLBACK(vf_pop_menu_refresh_cb), vf);
 
        return menu;
 }
@@ -820,7 +834,7 @@ static void vf_destroy_cb(GtkWidget *widget, gpointer data)
                {
                g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA,
                                                     0, 0, nullptr, nullptr, vf);
-               gtk_widget_destroy(vf->popup);
+               g_object_unref(vf->popup);
                }
 
        if (vf->read_metadata_in_idle_id)
@@ -832,14 +846,13 @@ static void vf_destroy_cb(GtkWidget *widget, gpointer data)
        g_free(vf);
 }
 
-static void vf_marks_filter_toggle_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_marks_filter_toggle_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf_refresh_idle(vf);
 }
 
-typedef struct _MarksTextEntry MarksTextEntry;
-struct _MarksTextEntry {
+struct MarksTextEntry {
        GenericDialog *gd;
        gint mark_no;
        GtkWidget *edit_widget;
@@ -860,7 +873,7 @@ static void vf_marks_tooltip_ok_cb(GenericDialog *gd, gpointer data)
        auto mte = static_cast<MarksTextEntry *>(data);
 
        g_free(options->marks_tooltips[mte->mark_no]);
-       options->marks_tooltips[mte->mark_no] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mte->edit_widget)));
+       options->marks_tooltips[mte->mark_no] = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(mte->edit_widget)));
 
        gtk_widget_set_tooltip_text(mte->parent, options->marks_tooltips[mte->mark_no]);
 
@@ -868,17 +881,16 @@ static void vf_marks_tooltip_ok_cb(GenericDialog *gd, gpointer data)
        generic_dialog_close(gd);
 }
 
-void vf_marks_filter_on_icon_press(GtkEntry *UNUSED(entry), GtkEntryIconPosition UNUSED(pos),
-                                                                       GdkEvent *UNUSED(event), gpointer userdata)
+void vf_marks_filter_on_icon_press(GtkEntry *, GtkEntryIconPosition, GdkEvent *, gpointer userdata)
 {
        auto mte = static_cast<MarksTextEntry *>(userdata);
 
        g_free(mte->text_entry);
        mte->text_entry = g_strdup("");
-       gtk_entry_set_text(GTK_ENTRY(mte->edit_widget), "");
+       gq_gtk_entry_set_text(GTK_ENTRY(mte->edit_widget), "");
 }
 
-static void vf_marks_tooltip_help_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
+static void vf_marks_tooltip_help_cb(GenericDialog *, gpointer)
 {
        help_window_show("GuideImageMarks.html");
 }
@@ -889,54 +901,51 @@ static gboolean vf_marks_tooltip_cb(GtkWidget *widget,
 {
        GtkWidget *table;
        gint i = GPOINTER_TO_INT(user_data);
-       MarksTextEntry *mte;
 
-       if (event->button == MOUSE_BUTTON_RIGHT)
-               {
-               mte = g_new0(MarksTextEntry, 1);
-               mte->mark_no = i;
-               mte->text_entry = g_strdup(options->marks_tooltips[i]);
-               mte->parent = widget;
-
-               mte->gd = generic_dialog_new(_("Mark text"), "mark_text",
-                                               widget, FALSE,
-                                               vf_marks_tooltip_cancel_cb, mte);
-               generic_dialog_add_message(mte->gd, GTK_STOCK_DIALOG_QUESTION, _("Set mark text"),
-                                           _("This will set or clear the mark text."), FALSE);
-               generic_dialog_add_button(mte->gd, GTK_STOCK_OK, nullptr,
-                                                       vf_marks_tooltip_ok_cb, TRUE);
-               generic_dialog_add_button(mte->gd, GTK_STOCK_HELP, nullptr,
-                                               vf_marks_tooltip_help_cb, FALSE);
-
-               table = pref_table_new(mte->gd->vbox, 3, 1, FALSE, TRUE);
-               pref_table_label(table, 0, 0, g_strdup_printf("%s%d", _("Mark "), mte->mark_no + 1), 1.0);
-               mte->edit_widget = gtk_entry_new();
-               gtk_widget_set_size_request(mte->edit_widget, 300, -1);
-               if (mte->text_entry)
-                       {
-                       gtk_entry_set_text(GTK_ENTRY(mte->edit_widget), mte->text_entry);
-                       }
-               gtk_table_attach_defaults(GTK_TABLE(table), mte->edit_widget, 1, 2, 0, 1);
-               generic_dialog_attach_default(mte->gd, mte->edit_widget);
+       if (event->button != MOUSE_BUTTON_RIGHT)
+               return FALSE;
 
-               gtk_entry_set_icon_from_stock(GTK_ENTRY(mte->edit_widget),
-                                                       GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
-               gtk_entry_set_icon_tooltip_text (GTK_ENTRY(mte->edit_widget),
-                                                       GTK_ENTRY_ICON_SECONDARY, "Clear");
-               g_signal_connect(GTK_ENTRY(mte->edit_widget), "icon-press",
-                                                       G_CALLBACK(vf_marks_filter_on_icon_press), mte);
+       auto mte = g_new0(MarksTextEntry, 1);
+       mte->mark_no = i;
+       mte->text_entry = g_strdup(options->marks_tooltips[i]);
+       mte->parent = widget;
+
+       mte->gd = generic_dialog_new(_("Mark text"), "mark_text",
+                                    widget, FALSE,
+                                    vf_marks_tooltip_cancel_cb, mte);
+       generic_dialog_add_message(mte->gd, GQ_ICON_DIALOG_QUESTION, _("Set mark text"),
+                                  _("This will set or clear the mark text."), FALSE);
+       generic_dialog_add_button(mte->gd, GQ_ICON_OK, "OK",
+                                 vf_marks_tooltip_ok_cb, TRUE);
+       generic_dialog_add_button(mte->gd, GQ_ICON_HELP, _("Help"),
+                                 vf_marks_tooltip_help_cb, FALSE);
+
+       table = pref_table_new(mte->gd->vbox, 3, 1, FALSE, TRUE);
+       pref_table_label(table, 0, 0, g_strdup_printf("%s%d", _("Mark "), mte->mark_no + 1), GTK_ALIGN_END);
+       mte->edit_widget = gtk_entry_new();
+       gtk_widget_set_size_request(mte->edit_widget, 300, -1);
+       if (mte->text_entry)
+               {
+               gq_gtk_entry_set_text(GTK_ENTRY(mte->edit_widget), mte->text_entry);
+               }
+       gq_gtk_grid_attach_default(GTK_GRID(table), mte->edit_widget, 1, 2, 0, 1);
+       generic_dialog_attach_default(mte->gd, mte->edit_widget);
 
-               gtk_widget_show(mte->edit_widget);
-               gtk_widget_grab_focus(mte->edit_widget);
-               gtk_widget_show(GTK_WIDGET(mte->gd->dialog));
+       gtk_entry_set_icon_from_icon_name(GTK_ENTRY(mte->edit_widget),
+                                     GTK_ENTRY_ICON_SECONDARY, GQ_ICON_CLEAR);
+       gtk_entry_set_icon_tooltip_text(GTK_ENTRY(mte->edit_widget),
+                                       GTK_ENTRY_ICON_SECONDARY, "Clear");
+       g_signal_connect(GTK_ENTRY(mte->edit_widget), "icon-press",
+                        G_CALLBACK(vf_marks_filter_on_icon_press), mte);
 
-               return TRUE;
-               }
+       gtk_widget_show(mte->edit_widget);
+       gtk_widget_grab_focus(mte->edit_widget);
+       gtk_widget_show(GTK_WIDGET(mte->gd->dialog));
 
-       return FALSE;
+       return TRUE;
 }
 
-static void vf_file_filter_save_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_file_filter_save_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        gchar *entry_text;
@@ -945,7 +954,7 @@ static void vf_file_filter_save_cb(GtkWidget *UNUSED(widget), gpointer data)
        gboolean text_found = FALSE;
        gint i;
 
-       entry_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(vf->file_filter.combo)))));
+       entry_text = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(vf->file_filter.combo)))));
 
        if (entry_text[0] == '\0' && vf->file_filter.last_selected >= 0)
                {
@@ -957,7 +966,7 @@ static void vf_file_filter_save_cb(GtkWidget *UNUSED(widget), gpointer data)
 
                gtk_combo_box_set_active(GTK_COMBO_BOX(vf->file_filter.combo), -1);
                vf->file_filter.last_selected = - 1;
-               gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(vf->file_filter.combo))), "");
+               gq_gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(vf->file_filter.combo))), "");
                vf->file_filter.count--;
                }
        else
@@ -995,14 +1004,14 @@ static void vf_file_filter_save_cb(GtkWidget *UNUSED(widget), gpointer data)
        g_free(entry_text);
 }
 
-static void vf_file_filter_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void vf_file_filter_cb(GtkWidget *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
 
        vf_refresh(vf);
 }
 
-static gboolean vf_file_filter_press_cb(GtkWidget *widget, GdkEventButton *UNUSED(bevent), gpointer data)
+static gboolean vf_file_filter_press_cb(GtkWidget *widget, GdkEventButton *, gpointer data)
 {
        auto vf = static_cast<ViewFile *>(data);
        vf->file_filter.last_selected = gtk_combo_box_get_active(GTK_COMBO_BOX(vf->file_filter.combo));
@@ -1022,7 +1031,7 @@ static GtkWidget *vf_marks_filter_init(ViewFile *vf)
        for (i = 0; i < FILEDATA_MARKS_SIZE ; i++)
                {
                GtkWidget *check = gtk_check_button_new();
-               gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
+               gq_gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
                g_signal_connect(G_OBJECT(check), "toggled",
                         G_CALLBACK(vf_marks_filter_toggle_cb), vf);
                g_signal_connect(G_OBJECT(check), "button_press_event",
@@ -1032,7 +1041,7 @@ static GtkWidget *vf_marks_filter_init(ViewFile *vf)
                gtk_widget_show(check);
                vf->filter_check[i] = check;
                }
-       gtk_container_add(GTK_CONTAINER(frame), hbox);
+       gq_gtk_container_add(GTK_WIDGET(frame), hbox);
        gtk_widget_show(hbox);
        return frame;
 }
@@ -1152,11 +1161,11 @@ static void case_sensitive_cb(GtkWidget *widget, gpointer data)
        vf_refresh(vf);
 }
 
-static void file_filter_clear_cb(GtkEntry *UNUSED(entry), GtkEntryIconPosition pos, GdkEvent *UNUSED(event), gpointer userdata)
+static void file_filter_clear_cb(GtkEntry *, GtkEntryIconPosition pos, GdkEvent *, gpointer userdata)
 {
        if (pos == GTK_ENTRY_ICON_SECONDARY)
                {
-               gtk_entry_set_text(GTK_ENTRY(userdata), "");
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), "");
                gtk_widget_grab_focus(GTK_WIDGET(userdata));
                }
 }
@@ -1181,7 +1190,7 @@ static GtkWidget *vf_file_filter_init(ViewFile *vf)
        gtk_widget_show((GTK_WIDGET(vf->file_filter.combo)));
        gtk_widget_set_tooltip_text(GTK_WIDGET(vf->file_filter.combo), _("Use regular expressions"));
 
-       gtk_entry_set_icon_from_stock(GTK_ENTRY(combo_entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
+       gtk_entry_set_icon_from_icon_name(GTK_ENTRY(combo_entry), GTK_ENTRY_ICON_SECONDARY, GQ_ICON_CLEAR);
        gtk_entry_set_icon_tooltip_text (GTK_ENTRY(combo_entry), GTK_ENTRY_ICON_SECONDARY, _("Clear"));
        g_signal_connect(GTK_ENTRY(combo_entry), "icon-press", G_CALLBACK(file_filter_clear_cb), combo_entry);
 
@@ -1204,35 +1213,35 @@ static GtkWidget *vf_file_filter_init(ViewFile *vf)
        g_signal_connect(G_OBJECT(combo_entry), "button_press_event",
                         G_CALLBACK(vf_file_filter_press_cb), vf);
 
-       gtk_box_pack_start(GTK_BOX(hbox), vf->file_filter.combo, FALSE, FALSE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(hbox), vf->file_filter.combo, FALSE, FALSE, 0);
        gtk_widget_show(vf->file_filter.combo);
-       gtk_container_add(GTK_CONTAINER(frame), hbox);
+       gq_gtk_container_add(GTK_WIDGET(frame), hbox);
        gtk_widget_show(hbox);
 
        case_sensitive = gtk_check_button_new_with_label(_("Case"));
-       gtk_box_pack_start(GTK_BOX(hbox), case_sensitive, FALSE, FALSE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(hbox), case_sensitive, FALSE, FALSE, 0);
        gtk_widget_set_tooltip_text(GTK_WIDGET(case_sensitive), _("Case sensitive"));
        g_signal_connect(G_OBJECT(case_sensitive), "clicked", G_CALLBACK(case_sensitive_cb), vf);
        gtk_widget_show(case_sensitive);
 
        menubar = gtk_menu_bar_new();
-       gtk_box_pack_start(GTK_BOX(hbox), menubar, FALSE, TRUE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(hbox), menubar, FALSE, TRUE, 0);
        gtk_widget_show(menubar);
 
        box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP);
-       icon = gtk_image_new_from_icon_name("pan-down", GTK_ICON_SIZE_MENU);
+       icon = gtk_image_new_from_icon_name(GQ_ICON_PAN_DOWN, GTK_ICON_SIZE_MENU);
        label = gtk_label_new(_("Class"));
 
-       gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
-       gtk_box_pack_end(GTK_BOX(box), icon, FALSE, FALSE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
+       gq_gtk_box_pack_end(GTK_BOX(box), icon, FALSE, FALSE, 0);
 
        menuitem = gtk_menu_item_new();
 
        gtk_widget_set_tooltip_text(GTK_WIDGET(menuitem), _("Select Class filter"));
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), class_filter_menu(vf));
        gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
-       gtk_container_add(GTK_CONTAINER(menuitem), box);
-       gtk_widget_show_all(menuitem);
+       gq_gtk_container_add(GTK_WIDGET(menuitem), box);
+       gq_gtk_widget_show_all(menuitem);
 
        return frame;
 }
@@ -1255,8 +1264,8 @@ ViewFile *vf_new(FileViewType type, FileData *dir_fd)
        vf->sort_ascend = TRUE;
        vf->read_metadata_in_idle_id = 0;
 
-       vf->scrolled = gtk_scrolled_window_new(nullptr, nullptr);
-       gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN);
+       vf->scrolled = gq_gtk_scrolled_window_new(nullptr, nullptr);
+       gq_gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->scrolled),
                                       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
@@ -1264,9 +1273,9 @@ ViewFile *vf_new(FileViewType type, FileData *dir_fd)
        vf->file_filter.frame = vf_file_filter_init(vf);
 
        vf->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-       gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vf->widget), vf->file_filter.frame, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(vf->widget), vf->file_filter.frame, FALSE, FALSE, 0);
+       gq_gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0);
        gtk_widget_show(vf->scrolled);
 
        g_signal_connect(G_OBJECT(vf->widget), "destroy",
@@ -1287,7 +1296,7 @@ ViewFile *vf_new(FileViewType type, FileData *dir_fd)
        g_signal_connect(G_OBJECT(vf->listview), "button_release_event",
                         G_CALLBACK(vf_release_cb), vf);
 
-       gtk_container_add(GTK_CONTAINER(vf->scrolled), vf->listview);
+       gq_gtk_container_add(GTK_WIDGET(vf->scrolled), vf->listview);
        gtk_widget_show(vf->listview);
 
        if (dir_fd) vf_set_fd(vf, dir_fd);
@@ -1560,12 +1569,10 @@ gboolean vf_stars_cb(gpointer data)
                        {
                        return G_SOURCE_CONTINUE;
                        }
-               else
-                       {
-                       vf->stars_filedata = nullptr;
-                       vf->stars_id = 0;
-                       return G_SOURCE_REMOVE;
-                       }
+
+               vf->stars_filedata = nullptr;
+               vf->stars_id = 0;
+               return G_SOURCE_REMOVE;
                }
 
        return G_SOURCE_REMOVE;
@@ -1601,19 +1608,21 @@ void vf_marks_set(ViewFile *vf, gboolean enable)
 
        vf_refresh_idle(vf);
 }
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+void vf_star_rating_set_unused(ViewFile *vf, gboolean enable)
+{
+       if (options->show_star_rating == enable) return;
+       options->show_star_rating = enable;
 
-//void vf_star_rating_set(ViewFile *vf, gboolean enable)
-//{
-       //if (options->show_star_rating == enable) return;
-       //options->show_star_rating = enable;
-
-       //switch (vf->type)
-               //{
-               //case FILEVIEW_LIST: vflist_star_rating_set(vf, enable); break;
-               //case FILEVIEW_ICON: vficon_star_rating_set(vf, enable); break;
-               //}
-       //vf_refresh_idle(vf);
-//}
+       switch (vf->type)
+               {
+               case FILEVIEW_LIST: vflist_star_rating_set(vf, enable); break;
+               case FILEVIEW_ICON: vficon_star_rating_set(vf, enable); break;
+               }
+       vf_refresh_idle(vf);
+}
+#pragma GCC diagnostic pop
 
 guint vf_marks_get_filter(ViewFile *vf)
 {
@@ -1639,26 +1648,26 @@ GRegex *vf_file_filter_get_filter(ViewFile *vf)
 
        if (!gtk_widget_get_visible(vf->file_filter.combo))
                {
-               return g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               return g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
        file_filter_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vf->file_filter.combo));
 
        if (file_filter_text[0] != '\0')
                {
-               ret = g_regex_new(file_filter_text, vf->file_filter.case_sensitive ? GRegexCompileFlags(0) : G_REGEX_CASELESS, GRegexMatchFlags(0), &error);
+               ret = g_regex_new(file_filter_text, vf->file_filter.case_sensitive ? static_cast<GRegexCompileFlags>(0) : G_REGEX_CASELESS, static_cast<GRegexMatchFlags>(0), &error);
                if (error)
                        {
                        log_printf("Error: could not compile regular expression %s\n%s\n", file_filter_text, error->message);
                        g_error_free(error);
                        error = nullptr;
-                       ret = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+                       ret = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                        }
                g_free(file_filter_text);
                }
        else
                {
-               ret = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), nullptr);
+               ret = g_regex_new("", static_cast<GRegexCompileFlags>(0), static_cast<GRegexMatchFlags>(0), nullptr);
                }
 
        return ret;
@@ -1738,7 +1747,7 @@ void vf_notify_cb(FileData *fd, NotifyType type, gpointer data)
        auto vf = static_cast<ViewFile *>(data);
        gboolean refresh;
 
-       auto  interested = static_cast<NotifyType>(NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING);
+       auto interested = static_cast<NotifyType>(NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING);
        if (vf->marks_enabled) interested = static_cast<NotifyType>(interested | NOTIFY_MARKS | NOTIFY_METADATA);
        /** @FIXME NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */
 
@@ -1839,8 +1848,6 @@ void vf_read_metadata_in_idle(ViewFile *vf)
                {
                vf->read_metadata_in_idle_id = g_idle_add_full(G_PRIORITY_LOW, vf_read_metadata_in_idle_cb, vf, vf_read_metadata_in_idle_finished_cb);
                }
-
-       return;
 }
 
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */