Sort headers using clang-tidy
[geeqie.git] / src / preferences.cc
index 8dd98fe..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();
 
@@ -155,8 +163,10 @@ 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
+};
 
 /*
  *-----------------------------------------------------------------------------
@@ -171,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);
@@ -186,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);
@@ -201,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);
 
@@ -238,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);
 
@@ -300,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;
@@ -880,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;
@@ -1596,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;
@@ -1618,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,
@@ -1689,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);
@@ -1747,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);
@@ -1956,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;
@@ -2395,6 +2419,7 @@ static void config_tab_windows(GtkWidget *notebook)
        GtkWidget *group;
        GtkWidget *subgroup;
        GtkWidget *button;
+       GtkWidget *checkbox;
        GtkWidget *ct_button;
        GtkWidget *spin;
 
@@ -2405,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);
@@ -2459,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;
@@ -2997,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)
 {
@@ -3095,7 +3124,8 @@ static gboolean keywords_find_file(gpointer data)
 
                return (G_SOURCE_CONTINUE);
                }
-       else if (kfd->list_dir)
+
+       if (kfd->list_dir)
                {
                FileData *fd;
 
@@ -3216,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;