Sort headers using clang-tidy
[geeqie.git] / src / view-file / view-file-list.cc
index b036462..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>
@@ -419,7 +423,8 @@ void vflist_pop_menu_thumbs_cb(GtkWidget *, 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));
 
@@ -1355,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)
@@ -1693,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);
@@ -1895,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 +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)
 {
@@ -1952,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)
@@ -1962,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;
                }
@@ -1978,7 +1990,7 @@ static void vflist_listview_color_cb(GtkTreeViewColumn *, GtkCellRenderer *cell,
 
        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);
 }
 
@@ -2222,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));