Sort headers using clang-tidy
[geeqie.git] / src / preferences.cc
index 956b083..8b73b6c 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "main.h"
 #include "preferences.h"
 
+#include <config.h>
+
 #include "bar-keywords.h"
 #include "cache.h"
 #include "color-man.h"
+#include "compat.h"
+#include "debug.h"
 #include "editors.h"
 #include "filedata.h"
 #include "filefilter.h"
 #include "fullscreen.h"
-#include "image.h"
 #include "image-overlay.h"
+#include "image.h"
 #include "img-view.h"
+#include "intl.h"
 #include "layout-util.h"
+#include "main-defines.h"
+#include "main.h"
 #include "metadata.h"
 #include "misc.h"
 #include "osd.h"
 #include "slideshow.h"
 #include "toolbar.h"
 #include "trash.h"
-#include "utilops.h"
 #include "ui-fileops.h"
 #include "ui-misc.h"
 #include "ui-tabcomp.h"
+#include "utilops.h"
 #include "window.h"
 #include "zonedetect.h"
 
 #include <gspell/gspell.h>
 #endif
 
-#define EDITOR_NAME_MAX_LENGTH 32
-#define EDITOR_COMMAND_MAX_LENGTH 1024
+enum {
+       EDITOR_NAME_MAX_LENGTH = 32,
+       EDITOR_COMMAND_MAX_LENGTH = 1024
+};
 
 static void image_overlay_set_text_colors();
 
@@ -152,9 +160,13 @@ static GtkWidget *external_preview_extract_entry;
 static GtkWidget *sidecar_ext_entry;
 static GtkWidget *help_search_engine_entry;
 
+static GtkWidget *log_window_f1_entry;
 
-#define CONFIG_WINDOW_DEF_WIDTH                700
-#define CONFIG_WINDOW_DEF_HEIGHT       600
+
+enum {
+       CONFIG_WINDOW_DEF_WIDTH =               700,
+       CONFIG_WINDOW_DEF_HEIGHT =      600
+};
 
 /*
  *-----------------------------------------------------------------------------
@@ -169,7 +181,8 @@ static void zoom_increment_cb(GtkWidget *spin, gpointer)
 
 static void slideshow_delay_hours_cb(GtkWidget *spin, gpointer)
 {
-       gint mins_secs_tenths, delay;
+       gint mins_secs_tenths;
+       gint delay;
 
        mins_secs_tenths = c_options->slideshow.delay %
                                                (3600 * SLIDESHOW_SUBSECOND_PRECISION);
@@ -184,7 +197,9 @@ static void slideshow_delay_hours_cb(GtkWidget *spin, gpointer)
 
 static void slideshow_delay_minutes_cb(GtkWidget *spin, gpointer)
 {
-       gint hours, secs_tenths, delay;
+       gint hours;
+       gint secs_tenths;
+       gint delay;
 
        hours = c_options->slideshow.delay / (3600 * SLIDESHOW_SUBSECOND_PRECISION);
        secs_tenths = c_options->slideshow.delay % (60 * SLIDESHOW_SUBSECOND_PRECISION);
@@ -199,7 +214,8 @@ static void slideshow_delay_minutes_cb(GtkWidget *spin, gpointer)
 
 static void slideshow_delay_seconds_cb(GtkWidget *spin, gpointer)
 {
-       gint hours_mins, delay;
+       gint hours_mins;
+       gint delay;
 
        hours_mins = c_options->slideshow.delay / (60 * SLIDESHOW_SUBSECOND_PRECISION);
 
@@ -223,7 +239,7 @@ void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(con
 
        g_free(*option);
        *option = nullptr;
-       buf = gtk_entry_get_text(GTK_ENTRY(entry));
+       buf = gq_gtk_entry_get_text(GTK_ENTRY(entry));
        if (buf && strlen(buf) > 0)
                {
                if (func)
@@ -236,7 +252,8 @@ void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(con
 
 static gboolean accel_apply_cb(GtkTreeModel *model, GtkTreePath *, GtkTreeIter *iter, gpointer)
 {
-       gchar *accel_path, *accel;
+       gchar *accel_path;
+       gchar *accel;
 
        gtk_tree_model_get(model, iter, AE_ACCEL, &accel_path, AE_KEY, &accel, -1);
 
@@ -298,8 +315,8 @@ static void config_window_apply()
        if (options->thumbnails.max_width != c_options->thumbnails.max_width
            || options->thumbnails.max_height != c_options->thumbnails.max_height
            || options->thumbnails.quality != c_options->thumbnails.quality)
-               {
-               thumb_format_changed = TRUE;
+               {
+               thumb_format_changed = TRUE;
                refresh = TRUE;
                options->thumbnails.max_width = c_options->thumbnails.max_width;
                options->thumbnails.max_height = c_options->thumbnails.max_height;
@@ -442,6 +459,7 @@ static void config_window_apply()
 
        options->show_predefined_keyword_tree = c_options->show_predefined_keyword_tree;
        options->expand_menu_toolbar = c_options->expand_menu_toolbar;
+       options->hamburger_menu = c_options->hamburger_menu;
 
        options->selectable_bars.menu_bar = c_options->selectable_bars.menu_bar;
        options->selectable_bars.tool_bar = c_options->selectable_bars.tool_bar;
@@ -465,8 +483,12 @@ static void config_window_apply()
 
        options->threads.duplicates = c_options->threads.duplicates > 0 ? c_options->threads.duplicates : -1;
 
+       options->alternate_similarity_algorithm.enabled = c_options->alternate_similarity_algorithm.enabled;
+       options->alternate_similarity_algorithm.grayscale = c_options->alternate_similarity_algorithm.grayscale;
+
 #ifdef DEBUG
        set_debug_level(debug_c);
+       config_entry_to_option(log_window_f1_entry, &options->log_window.action, nullptr);
 #endif
 
 #ifdef HAVE_LCMS
@@ -669,7 +691,7 @@ static void add_quality_menu(GtkWidget *table, gint column, gint row, const gcha
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(quality_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -696,7 +718,7 @@ static void add_dnd_default_action_selection_menu(GtkWidget *table, gint column,
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(dnd_default_action_selection_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -724,7 +746,7 @@ static void add_clipboard_selection_menu(GtkWidget *table, gint column, gint row
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(clipboard_selection_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -765,7 +787,7 @@ static void add_zoom_style_selection_menu(GtkWidget *table, gint column, gint ro
 
        g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(zoom_style_selection_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -834,7 +856,7 @@ static void add_mouse_selection_menu(GtkWidget *table, gint column, gint row, co
 
        g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(mouse_buttons_selection_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -873,7 +895,8 @@ static void add_thumb_size_menu(GtkWidget *table, gint column, gint row, gchar *
        current = -1;
        for (i = 0; static_cast<guint>(i) < sizeof(thumb_size_list) / sizeof(ThumbSize); i++)
                {
-               gint w, h;
+               gint w;
+               gint h;
                gchar *buf;
 
                w = thumb_size_list[i].w;
@@ -901,7 +924,7 @@ static void add_thumb_size_menu(GtkWidget *table, gint column, gint row, gchar *
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(thumb_size_menu_cb), NULL);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -1020,7 +1043,7 @@ static void add_stereo_mode_menu(GtkWidget *table, gint column, gint row, const
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(stereo_mode_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -1061,7 +1084,7 @@ static void add_video_menu(GtkWidget *table, gint column, gint row, const gchar
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(video_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 
@@ -1372,7 +1395,7 @@ static void filter_disable_cb(GtkWidget *widget, gpointer data)
 
 static void safe_delete_view_cb(GtkWidget *, gpointer)
 {
-       layout_set_path(nullptr, gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry)));
+       layout_set_path(nullptr, gq_gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry)));
 }
 
 static void safe_delete_clear_ok_cb(GenericDialog *, gpointer)
@@ -1393,7 +1416,7 @@ static void safe_delete_clear_cb(GtkWidget *widget, gpointer)
        entry = gtk_entry_new();
        gtk_widget_set_can_focus(entry, FALSE);
        gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
-       if (options->file_ops.safe_delete_path) gtk_entry_set_text(GTK_ENTRY(entry), options->file_ops.safe_delete_path);
+       if (options->file_ops.safe_delete_path) gq_gtk_entry_set_text(GTK_ENTRY(entry), options->file_ops.safe_delete_path);
        gq_gtk_box_pack_start(GTK_BOX(gd->vbox), entry, FALSE, FALSE, 0);
        gtk_widget_show(entry);
        gtk_widget_show(gd->dialog);
@@ -1589,7 +1612,8 @@ static void image_overlay_set_background_color_cb(GtkWidget *widget, gpointer)
 static void accel_store_populate()
 {
        LayoutWindow *lw;
-       GList *groups, *actions;
+       GList *groups;
+       GList *actions;
        GtkAction *action;
        const gchar *accel_path;
        GtkAccelKey key;
@@ -1611,7 +1635,10 @@ static void accel_store_populate()
                        accel_path = gtk_action_get_accel_path(action);
                        if (accel_path && gtk_accel_map_lookup_entry(accel_path, &key))
                                {
-                               gchar *label, *label2, *tooltip, *accel;
+                               gchar *label;
+                               gchar *label2;
+                               gchar *tooltip;
+                               gchar *accel;
                                g_object_get(action,
                                             "tooltip", &tooltip,
                                             "label", &label,
@@ -1682,7 +1709,8 @@ static void accel_store_edited_cb(GtkCellRendererAccel *, gchar *path_string, gu
        GtkTreeIter iter;
        gchar *acc;
        gchar *accel_path;
-       GtkAccelKey old_key, key;
+       GtkAccelKey old_key;
+       GtkAccelKey key;
        GtkTreePath *path = gtk_tree_path_new_from_string(path_string);
 
        gtk_tree_model_get_iter(model, &iter, path);
@@ -1740,7 +1768,8 @@ void accel_clear_selection(GtkTreeModel *, GtkTreePath *, GtkTreeIter *iter, gpo
 void accel_reset_selection(GtkTreeModel *model, GtkTreePath *, GtkTreeIter *iter, gpointer)
 {
        GtkAccelKey key;
-       gchar *accel_path, *accel;
+       gchar *accel_path;
+       gchar *accel;
 
        gtk_tree_model_get(model, iter, AE_ACCEL, &accel_path, -1);
        gtk_accel_map_lookup_entry(accel_path, &key);
@@ -1831,11 +1860,11 @@ static void help_search_engine_entry_icon_cb(GtkEntry *, GtkEntryIconPosition po
 {
        if (pos == GTK_ENTRY_ICON_PRIMARY)
                {
-               gtk_entry_set_text(GTK_ENTRY(userdata), HELP_SEARCH_ENGINE);
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), HELP_SEARCH_ENGINE);
                }
        else
                {
-               gtk_entry_set_text(GTK_ENTRY(userdata), "");
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), "");
                }
 }
 
@@ -1846,12 +1875,12 @@ static void star_rating_star_icon_cb(GtkEntry *, GtkEntryIconPosition pos, GdkEv
        if (pos == GTK_ENTRY_ICON_PRIMARY)
                {
                rating_symbol = g_strdup_printf("U+%X", STAR_RATING_STAR);
-               gtk_entry_set_text(GTK_ENTRY(userdata), rating_symbol);
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), rating_symbol);
                g_free(rating_symbol);
                }
        else
                {
-               gtk_entry_set_text(GTK_ENTRY(userdata), "U+");
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), "U+");
                gtk_widget_grab_focus(GTK_WIDGET(userdata));
                gtk_editable_select_region(GTK_EDITABLE(userdata), 2, 2);
                }
@@ -1864,12 +1893,12 @@ static void star_rating_rejected_icon_cb(GtkEntry *, GtkEntryIconPosition pos, G
        if (pos == GTK_ENTRY_ICON_PRIMARY)
                {
                rating_symbol = g_strdup_printf("U+%X", STAR_RATING_REJECTED);
-               gtk_entry_set_text(GTK_ENTRY(userdata), rating_symbol);
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), rating_symbol);
                g_free(rating_symbol);
                }
        else
                {
-               gtk_entry_set_text(GTK_ENTRY(userdata), "U+");
+               gq_gtk_entry_set_text(GTK_ENTRY(userdata), "U+");
                gtk_widget_grab_focus(GTK_WIDGET(userdata));
                gtk_editable_select_region(GTK_EDITABLE(userdata), 2, 2);
                }
@@ -1888,7 +1917,7 @@ static guint star_rating_symbol_test(GtkWidget *, gpointer data)
        list = gtk_container_get_children(hbox);
 
        hex_code_entry = static_cast<GtkEntry *>(g_list_nth_data(list, 2));
-       hex_code_full = g_strdup(gtk_entry_get_text(hex_code_entry));
+       hex_code_full = g_strdup(gq_gtk_entry_get_text(hex_code_entry));
 
        hex_code = g_strsplit(hex_code_full, "+", 2);
        if (hex_code[0] && hex_code[1])
@@ -1949,7 +1978,9 @@ static void config_tab_general(GtkWidget *notebook)
        GtkWidget *ct_button;
        GtkWidget *table;
        GtkWidget *spin;
-       gint hours, minutes, remainder;
+       gint hours;
+       gint minutes;
+       gint remainder;
        gdouble seconds;
        GtkWidget *star_rating_entry;
        GString *str;
@@ -2033,7 +2064,7 @@ static void config_tab_general(GtkWidget *notebook)
        pref_label_new(hbox, g_strdup(str->str));
        rating_symbol = g_strdup_printf("U+%X", options->star_rating.star);
        star_rating_entry = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(star_rating_entry), rating_symbol);
+       gq_gtk_entry_set_text(GTK_ENTRY(star_rating_entry), rating_symbol);
        gq_gtk_box_pack_start(GTK_BOX(hbox), star_rating_entry, FALSE, FALSE, 0);
        gtk_entry_set_width_chars(GTK_ENTRY(star_rating_entry), 15);
        gtk_widget_show(star_rating_entry);
@@ -2065,7 +2096,7 @@ static void config_tab_general(GtkWidget *notebook)
        pref_label_new(hbox, g_strdup(str->str));
        rating_symbol = g_strdup_printf("U+%X", options->star_rating.rejected);
        star_rating_entry = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(star_rating_entry), rating_symbol);
+       gq_gtk_entry_set_text(GTK_ENTRY(star_rating_entry), rating_symbol);
        gq_gtk_box_pack_start(GTK_BOX(hbox), star_rating_entry, FALSE, FALSE, 0);
        gtk_entry_set_width_chars(GTK_ENTRY(star_rating_entry), 15);
        gtk_widget_show(star_rating_entry);
@@ -2137,11 +2168,19 @@ static void config_tab_general(GtkWidget *notebook)
 
        pref_spacer(group, PREF_PAD_GROUP);
 
-       group = pref_group_new(vbox, FALSE, _("Expand menu and toolbar"), GTK_ORIENTATION_VERTICAL);
+       group = pref_group_new(vbox, FALSE, _("Menu style"), GTK_ORIENTATION_VERTICAL);
+
+       pref_checkbox_new_int(group, _("☰ style menu button (NOTE! Geeqie must be restarted for change to take effect)"),
+                               options->hamburger_menu, &c_options->hamburger_menu);
+       gtk_widget_set_tooltip_text(group, _("Use a ☰ style menu button instead of the classic style across the top of the frame"));
+
+       pref_spacer(group, PREF_PAD_GROUP);
+
+       group = pref_group_new(vbox, FALSE, _("Expand toolbar"), GTK_ORIENTATION_VERTICAL);
 
-       pref_checkbox_new_int(group, _("Expand menu and toolbar (NOTE! Geeqie must be restarted for change to take effect)"),
+       pref_checkbox_new_int(group, _("Expand menu/toolbar (NOTE! Geeqie must be restarted for change to take effect)"),
                                options->expand_menu_toolbar, &c_options->expand_menu_toolbar);
-       gtk_widget_set_tooltip_text(group, _("Expand the menu and toolbar to the full width of the window"));
+       gtk_widget_set_tooltip_text(group, _("Expand the menu/toolbar to the full width of the window"));
 
        pref_spacer(group, PREF_PAD_GROUP);
 
@@ -2222,7 +2261,7 @@ static void config_tab_general(GtkWidget *notebook)
        group = pref_group_new(vbox, FALSE, _("On-line help search engine"), GTK_ORIENTATION_VERTICAL);
 
        help_search_engine_entry = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(help_search_engine_entry), options->help_search_engine);
+       gq_gtk_entry_set_text(GTK_ENTRY(help_search_engine_entry), options->help_search_engine);
        gq_gtk_box_pack_start(GTK_BOX(group), help_search_engine_entry, FALSE, FALSE, 0);
        gtk_widget_show(help_search_engine_entry);
 
@@ -2380,6 +2419,7 @@ static void config_tab_windows(GtkWidget *notebook)
        GtkWidget *group;
        GtkWidget *subgroup;
        GtkWidget *button;
+       GtkWidget *checkbox;
        GtkWidget *ct_button;
        GtkWidget *spin;
 
@@ -2390,13 +2430,13 @@ static void config_tab_windows(GtkWidget *notebook)
        ct_button = pref_checkbox_new_int(group, _("Remember session"),
                                          options->save_window_positions, &c_options->save_window_positions);
 
-       button = pref_checkbox_new_int(group, _("Use saved window positions also for new windows"),
+       checkbox = pref_checkbox_new_int(group, _("Use saved window positions also for new windows"),
                                       options->use_saved_window_positions_for_new_windows, &c_options->use_saved_window_positions_for_new_windows);
-       pref_checkbox_link_sensitivity(ct_button, button);
+       pref_checkbox_link_sensitivity(ct_button, checkbox);
 
-       button = pref_checkbox_new_int(group, _("Remember window workspace"),
+       checkbox = pref_checkbox_new_int(group, _("Remember window workspace"),
                              options->save_window_workspace, &c_options->save_window_workspace);
-       pref_checkbox_link_sensitivity(ct_button, button);
+       pref_checkbox_link_sensitivity(ct_button, checkbox);
 
        pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"),
                              options->tools_restore_state, &c_options->tools_restore_state);
@@ -2444,7 +2484,9 @@ static void config_tab_windows(GtkWidget *notebook)
                              options->fullscreen.disable_saver, &c_options->fullscreen.disable_saver);
 }
 
-#define PRE_FORMATTED_COLUMNS 5
+enum {
+       PRE_FORMATTED_COLUMNS = 5
+};
 static void config_tab_osd(GtkWidget *notebook)
 {
        GtkWidget *hbox;
@@ -2684,7 +2726,7 @@ static void config_tab_files(GtkWidget *notebook)
        group = pref_group_new(vbox, FALSE, _("Grouping sidecar extensions"), GTK_ORIENTATION_VERTICAL);
 
        sidecar_ext_entry = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(sidecar_ext_entry), options->sidecar.ext);
+       gq_gtk_entry_set_text(GTK_ENTRY(sidecar_ext_entry), options->sidecar.ext);
        gq_gtk_box_pack_start(GTK_BOX(group), sidecar_ext_entry, FALSE, FALSE, 0);
        gtk_widget_show(sidecar_ext_entry);
 
@@ -2982,7 +3024,9 @@ struct KeywordFindData
        guint idle_id; /* event source id */
 };
 
-#define KEYWORD_DIALOG_WIDTH 400
+enum {
+       KEYWORD_DIALOG_WIDTH = 400
+};
 
 static void keywords_find_folder(KeywordFindData *kfd, FileData *dir_fd)
 {
@@ -3029,7 +3073,7 @@ static void keywords_find_finish(KeywordFindData *kfd)
 {
        keywords_find_reset(kfd);
 
-       gtk_entry_set_text(GTK_ENTRY(kfd->progress), _("done"));
+       gq_gtk_entry_set_text(GTK_ENTRY(kfd->progress), _("done"));
        gtk_spinner_stop(GTK_SPINNER(kfd->spinner));
 
        gtk_widget_set_sensitive(kfd->group, TRUE);
@@ -3074,13 +3118,14 @@ static gboolean keywords_find_file(gpointer data)
                        keywords = keywords->next;
                        }
 
-               gtk_entry_set_text(GTK_ENTRY(kfd->progress), fd->path);
+               gq_gtk_entry_set_text(GTK_ENTRY(kfd->progress), fd->path);
                file_data_unref(fd);
                g_list_free_full(keywords, g_free);
 
                return (G_SOURCE_CONTINUE);
                }
-       else if (kfd->list_dir)
+
+       if (kfd->list_dir)
                {
                FileData *fd;
 
@@ -3106,7 +3151,7 @@ static void keywords_find_start_cb(GenericDialog *, gpointer data)
 
        if (kfd->list || !gtk_widget_get_sensitive(kfd->button_start)) return;
 
-       path = remove_trailing_slash((gtk_entry_get_text(GTK_ENTRY(kfd->entry))));
+       path = remove_trailing_slash((gq_gtk_entry_get_text(GTK_ENTRY(kfd->entry))));
        parse_out_relatives(path);
 
        if (!isdir(path))
@@ -3178,7 +3223,7 @@ static void keywords_find_dialog(GtkWidget *widget, const gchar *path)
        kfd->progress = gtk_entry_new();
        gtk_widget_set_can_focus(kfd->progress, FALSE);
        gtk_editable_set_editable(GTK_EDITABLE(kfd->progress), FALSE);
-       gtk_entry_set_text(GTK_ENTRY(kfd->progress), _("click start to begin"));
+       gq_gtk_entry_set_text(GTK_ENTRY(kfd->progress), _("click start to begin"));
        gq_gtk_box_pack_start(GTK_BOX(hbox), kfd->progress, TRUE, TRUE, 0);
        gtk_widget_show(kfd->progress);
 
@@ -3201,7 +3246,8 @@ static void keywords_find_cb(GtkWidget *widget, gpointer)
 
 static void config_tab_keywords_save()
 {
-       GtkTextIter start, end;
+       GtkTextIter start;
+       GtkTextIter end;
        GtkTextBuffer *buffer;
        GList *kw_list = nullptr;
        GList *work;
@@ -3364,7 +3410,7 @@ static void add_intent_menu(GtkWidget *table, gint column, gint row, const gchar
        g_signal_connect(G_OBJECT(combo), "changed",
                         G_CALLBACK(intent_menu_cb), option_c);
 
-       gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), combo, column + 1, column + 2, row, row + 1, GTK_SHRINK, static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(combo);
 }
 #endif
@@ -3386,7 +3432,7 @@ static void config_tab_color(GtkWidget *notebook)
 #endif
 
        table = pref_table_new(group, 3, COLOR_PROFILE_INPUTS + 1, FALSE, FALSE);
-       gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP);
+       gtk_grid_set_column_spacing(GTK_GRID(table), PREF_PAD_GAP);
 
        label = pref_table_label(table, 0, 0, _("Type"), GTK_ALIGN_START);
        pref_label_bold(label, TRUE, FALSE);
@@ -3410,18 +3456,16 @@ static void config_tab_color(GtkWidget *notebook)
                gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_NAME_MAX_LENGTH);
                if (options->color_profile.input_name[i])
                        {
-                       gtk_entry_set_text(GTK_ENTRY(entry), options->color_profile.input_name[i]);
+                       gq_gtk_entry_set_text(GTK_ENTRY(entry), options->color_profile.input_name[i]);
                        }
-               gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i + 1, i + 2,
-                                static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
+               gq_gtk_grid_attach(GTK_GRID(table), entry, 1, 2, i + 1, i + 2, static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
                gtk_widget_show(entry);
                color_profile_input_name_entry[i] = entry;
 
                tabcomp = tab_completion_new(&entry, options->color_profile.input_file[i], nullptr, ".icc", "ICC Files", nullptr);
                tab_completion_add_select_button(entry, _("Select color profile"), FALSE);
                gtk_widget_set_size_request(entry, 160, -1);
-               gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, i + 1, i + 2,
-                                static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
+               gq_gtk_grid_attach(GTK_GRID(table), tabcomp, 2, 3, i + 1, i + 2, static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
                gtk_widget_show(tabcomp);
                color_profile_input_file_entry[i] = entry;
                }
@@ -3443,9 +3487,7 @@ static void config_tab_color(GtkWidget *notebook)
 #ifdef HAVE_LCMS
        add_intent_menu(table, 0, 1, _("Render Intent:"), options->color_profile.render_intent, &c_options->color_profile.render_intent);
 #endif
-       gtk_table_attach(GTK_TABLE(table), tabcomp, 1, 2,
-                        0, 1,
-                        static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), tabcomp, 1, 2, 0, 1, static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
 
        gtk_widget_show(tabcomp);
 }
@@ -3645,6 +3687,14 @@ static void config_tab_behavior(GtkWidget *notebook)
 
        pref_spin_new_int(group, _("Log Window max. lines:"), nullptr,
                          1, 99999, 1, options->log_window_lines, &options->log_window_lines);
+
+       hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
+       pref_label_new(hbox, _("Log Window F1 command: "));
+       log_window_f1_entry = gtk_entry_new();
+       gq_gtk_entry_set_text(GTK_ENTRY(log_window_f1_entry), options->log_window.action);
+       gq_gtk_box_pack_start(GTK_BOX(hbox), log_window_f1_entry, FALSE, FALSE, 0);
+       gtk_entry_set_width_chars(GTK_ENTRY(log_window_f1_entry), 15);
+       gtk_widget_show(log_window_f1_entry);
 #endif
 }
 
@@ -3842,18 +3892,20 @@ static gint extension_sort_cb(gconstpointer a, gconstpointer b)
 
 static void config_tab_advanced(GtkWidget *notebook)
 {
-       GtkWidget *vbox;
-       GtkWidget *group;
-       GSList *formats_list;
-       GList *extensions_list = nullptr;
        gchar **extensions;
-       GtkWidget *tabcomp;
        GdkPixbufFormat *fm;
        gint i;
+       GList *extensions_list = nullptr;
+       GSList *formats_list;
        GString *types_string = g_string_new(nullptr);
-       GtkWidget *types_string_label;
-       GtkWidget *threads_string_label;
+       GtkWidget *alternate_checkbox;
        GtkWidget *dupes_threads_spin;
+       GtkWidget *group;
+       GtkWidget *subgroup;
+       GtkWidget *tabcomp;
+       GtkWidget *threads_string_label;
+       GtkWidget *types_string_label;
+       GtkWidget *vbox;
 
        vbox = scrolled_notebook_page(notebook, _("Advanced"));
        group = pref_group_new(vbox, FALSE, _("External preview extraction"), GTK_ORIENTATION_VERTICAL);
@@ -3926,13 +3978,27 @@ static void config_tab_advanced(GtkWidget *notebook)
        pref_line(vbox, PREF_PAD_SPACE);
        group = pref_group_new(vbox, FALSE, _("Thread pool limits"), GTK_ORIENTATION_VERTICAL);
 
-       threads_string_label = pref_label_new(group, "This option limits the number of threads (or cpu cores)\nthat Geeqie will use when running duplicate checks. The default value is 0, which means all available cores will be used.");
+       threads_string_label = pref_label_new(group, "This option limits the number of threads (or cpu cores) that Geeqie will use when running duplicate checks.\nThe value 0 means all available cores will be used.");
        gtk_label_set_line_wrap(GTK_LABEL(threads_string_label), TRUE);
 
        pref_spacer(vbox, PREF_PAD_GROUP);
 
        dupes_threads_spin = pref_spin_new_int(vbox, _("Duplicate check:"), _("max. threads"), 0, get_cpu_cores(), 1, options->threads.duplicates, &c_options->threads.duplicates);
        gtk_widget_set_tooltip_markup(dupes_threads_spin, _("Set to 0 for unlimited"));
+
+       pref_spacer(group, PREF_PAD_GROUP);
+
+       pref_line(vbox, PREF_PAD_SPACE);
+
+       group = pref_group_new(vbox, FALSE, _("Alternate similarity alogorithm"), GTK_ORIENTATION_VERTICAL);
+
+       alternate_checkbox = pref_checkbox_new_int(group, _("Enable alternate similarity algorithm"), options->alternate_similarity_algorithm.enabled, &c_options->alternate_similarity_algorithm.enabled);
+
+       subgroup = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
+       pref_checkbox_link_sensitivity(alternate_checkbox, subgroup);
+
+       alternate_checkbox = pref_checkbox_new_int(subgroup, _("Use grayscale"), options->alternate_similarity_algorithm.grayscale, &c_options->alternate_similarity_algorithm.grayscale);
+       gtk_widget_set_tooltip_text(alternate_checkbox, _("Reduce fingerprint to grayscale"));
 }
 
 /* stereo tab */
@@ -4031,7 +4097,7 @@ static void config_window_create(LayoutWindow *lw)
        if (options->save_dialog_window_positions)
                {
                gtk_window_resize(GTK_WINDOW(configwindow), lw->options.preferences_window.w, lw->options.preferences_window.h);
-               gtk_window_move(GTK_WINDOW(configwindow), lw->options.preferences_window.x, lw->options.preferences_window.y);
+               gq_gtk_window_move(GTK_WINDOW(configwindow), lw->options.preferences_window.x, lw->options.preferences_window.y);
                }
        else
                {