Sort headers using clang-tidy
[geeqie.git] / src / collect-table.cc
index df01347..12f38f5 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "main.h"
 #include "collect-table.h"
 
+#include <config.h>
+
 #include "cellrenderericon.h"
 #include "collect-dlg.h"
 #include "collect-io.h"
+#include "compat.h"
+#include "debug.h"
 #include "dnd.h"
 #include "dupe.h"
 #include "filedata.h"
 #include "img-view.h"
-#include "layout.h"
+#include "intl.h"
 #include "layout-image.h"
+#include "layout.h"
+#include "main-defines.h"
 #include "menu.h"
 #include "metadata.h"
+#include "misc.h"
 #include "pixbuf-util.h"
 #include "print.h"
-#include "utilops.h"
 #include "ui-fileops.h"
 #include "ui-menu.h"
 #include "ui-tree-edit.h"
 #include "uri-utils.h"
+#include "utilops.h"
 #include "view-file.h"
 
-#include "icons/marker.xpm"
-#define MARKER_WIDTH 26
-#define MARKER_HEIGHT 32
-
 /* between these, the icon width is increased by thumb_max_width / 2 */
-#define THUMB_MIN_ICON_WIDTH 128
-#define THUMB_MAX_ICON_WIDTH 150
-
-#define COLLECT_TABLE_MAX_COLUMNS 32
-#define THUMB_BORDER_PADDING 2
+enum {
+       THUMB_MIN_ICON_WIDTH = 128,
+       THUMB_MAX_ICON_WIDTH = 150
+};
 
-#define COLLECT_TABLE_TIP_DELAY 500
-#define COLLECT_TABLE_TIP_DELAY_PATH (COLLECT_TABLE_TIP_DELAY * 1.7)
+enum {
+       COLLECT_TABLE_MAX_COLUMNS = 32,
+       THUMB_BORDER_PADDING = 2
+};
 
+enum {
+       COLLECT_TABLE_TIP_DELAY = 500,
+       COLLECT_TABLE_TIP_DELAY_PATH = 850
+};
 
 enum {
        CTABLE_COLUMN_POINTER = 0,
        CTABLE_COLUMN_COUNT
 };
 
-#define INFO_SELECTED(x) (x->flag_mask & SELECTION_SELECTED)
+#define INFO_SELECTED(x) ((x)->flag_mask & SELECTION_SELECTED)
 
 
 static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gboolean force);
@@ -81,25 +88,27 @@ hard_coded_window_keys collection_window_keys[] = {
        {GDK_CONTROL_MASK, 'R', N_("Rename")},
        {GDK_CONTROL_MASK, 'D', N_("Move to Trash")},
        {GDK_CONTROL_MASK, 'W', N_("Close window")},
-       {0, GDK_KEY_Delete, N_("Remove")},
-       {0, GDK_KEY_Return, N_("View")},
-       {0, 'V', N_("View in new window")},
+       {static_cast<GdkModifierType>(0), GDK_KEY_Delete, N_("Remove")},
+       {static_cast<GdkModifierType>(0), GDK_KEY_Return, N_("View")},
+       {static_cast<GdkModifierType>(0), 'V', N_("View in new window")},
        {GDK_CONTROL_MASK, 'A', N_("Select all")},
-       {GDK_CONTROL_MASK + GDK_SHIFT_MASK, 'A', N_("Select none")},
+       {static_cast<GdkModifierType>(GDK_CONTROL_MASK + GDK_SHIFT_MASK), 'A', N_("Select none")},
        {GDK_MOD1_MASK, 'R', N_("Rectangular selection")},
-       {0, GDK_KEY_space, N_("Select single file")},
+       {static_cast<GdkModifierType>(0), GDK_KEY_space, N_("Select single file")},
        {GDK_CONTROL_MASK, GDK_KEY_space, N_("Toggle select image")},
        {GDK_CONTROL_MASK, 'L', N_("Append from file selection")},
-       {0, 'A', N_("Append from collection")},
-       {0, 'S', N_("Save collection")},
+       {static_cast<GdkModifierType>(0), 'A', N_("Append from collection")},
+       {static_cast<GdkModifierType>(0), 'S', N_("Save collection")},
        {GDK_CONTROL_MASK, 'S', N_("Save collection as")},
        {GDK_CONTROL_MASK, 'T', N_("Show filename text")},
-       {0, 'N', N_("Sort by name")},
-       {0, 'D', N_("Sort by date")},
-       {0, 'B', N_("Sort by size")},
-       {0, 'P', N_("Sort by path")},
+       {static_cast<GdkModifierType>(0), 'N', N_("Sort by name")},
+       {static_cast<GdkModifierType>(0), 'D', N_("Sort by date")},
+       {static_cast<GdkModifierType>(0), 'B', N_("Sort by size")},
+       {static_cast<GdkModifierType>(0), 'P', N_("Sort by path")},
        {GDK_SHIFT_MASK, 'P', N_("Print")},
-       {0, 0, NULL}
+       {GDK_MOD1_MASK, 'A', N_("Append (Append collection dialog)")},
+       {GDK_MOD1_MASK, 'D', N_("Discard (Close modified collection dialog)")},
+       {static_cast<GdkModifierType>(0), 0, nullptr}
 };
 
 /*
@@ -125,11 +134,12 @@ static gboolean collection_table_find_position(CollectTable *ct, CollectInfo *in
 static gboolean collection_table_find_iter(CollectTable *ct, CollectInfo *info, GtkTreeIter *iter, gint *column)
 {
        GtkTreeModel *store;
-       gint row, col;
+       gint row;
+       gint col;
 
        store = gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview));
        if (!collection_table_find_position(ct, info, &row, &col)) return FALSE;
-       if (!gtk_tree_model_iter_nth_child(store, iter, NULL, row)) return FALSE;
+       if (!gtk_tree_model_iter_nth_child(store, iter, nullptr, row)) return FALSE;
        if (column) *column = col;
 
        return TRUE;
@@ -140,22 +150,22 @@ static CollectInfo *collection_table_find_data(CollectTable *ct, gint row, gint
        GtkTreeModel *store;
        GtkTreeIter p;
 
-       if (row < 0 || col < 0) return NULL;
+       if (row < 0 || col < 0) return nullptr;
 
        store = gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview));
-       if (gtk_tree_model_iter_nth_child(store, &p, NULL, row))
+       if (gtk_tree_model_iter_nth_child(store, &p, nullptr, row))
                {
                GList *list;
 
                gtk_tree_model_get(store, &p, CTABLE_COLUMN_POINTER, &list, -1);
-               if (!list) return NULL;
+               if (!list) return nullptr;
 
                if (iter) *iter = p;
 
-               return g_list_nth_data(list, col);
+               return static_cast<CollectInfo *>(g_list_nth_data(list, col));
                }
 
-       return NULL;
+       return nullptr;
 }
 
 static CollectInfo *collection_table_find_data_by_coord(CollectTable *ct, gint x, gint y, GtkTreeIter *iter)
@@ -168,19 +178,19 @@ static CollectInfo *collection_table_find_data_by_coord(CollectTable *ct, gint x
        gint n;
 
        if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(ct->listview), x, y,
-                                          &tpath, &column, NULL, NULL))
-               return NULL;
+                                          &tpath, &column, nullptr, nullptr))
+               return nullptr;
 
        store = gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview));
        gtk_tree_model_get_iter(store, &row, tpath);
        gtk_tree_path_free(tpath);
 
        gtk_tree_model_get(store, &row, CTABLE_COLUMN_POINTER, &list, -1);
-       if (!list) return NULL;
+       if (!list) return nullptr;
 
        n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column), "column_number"));
        if (iter) *iter = row;
-       return g_list_nth_data(list, n);
+       return static_cast<CollectInfo *>(g_list_nth_data(list, n));
 }
 
 static guint collection_table_list_count(CollectTable *ct, gint64 *bytes)
@@ -193,7 +203,7 @@ static guint collection_table_list_count(CollectTable *ct, gint64 *bytes)
                work = ct->cd->list;
                while (work)
                        {
-                       CollectInfo *ci = work->data;
+                       auto ci = static_cast<CollectInfo *>(work->data);
                        work = work->next;
                        b += ci->fd->size;
                        }
@@ -214,7 +224,7 @@ static guint collection_table_selection_count(CollectTable *ct, gint64 *bytes)
                work = ct->selection;
                while (work)
                        {
-                       CollectInfo *ci = work->data;
+                       auto ci = static_cast<CollectInfo *>(work->data);
                        work = work->next;
                        b += ci->fd->size;
                        }
@@ -263,7 +273,7 @@ static void collection_table_update_status(CollectTable *ct)
 
 static void collection_table_update_extras(CollectTable *ct, gboolean loading, gdouble value)
 {
-       gchar *text;
+       const gchar *text;
 
        if (!ct->extra_label) return;
 
@@ -335,7 +345,7 @@ static void collection_table_selection_set(CollectTable *ct, CollectInfo *info,
                {
                GtkTreeIter row;
 
-               if (collection_table_find_iter(ct, info, &row, NULL))
+               if (collection_table_find_iter(ct, info, &row, nullptr))
                        {
                        gtk_tree_model_get(store, &row, CTABLE_COLUMN_POINTER, &list, -1);
                        if (list) gtk_list_store_set(GTK_LIST_STORE(store), &row, CTABLE_COLUMN_POINTER, list, -1);
@@ -347,14 +357,14 @@ static void collection_table_selection_add(CollectTable *ct, CollectInfo *info,
 {
        if (!info) return;
 
-       collection_table_selection_set(ct, info, info->flag_mask | mask, iter);
+       collection_table_selection_set(ct, info, static_cast<SelectionType>(info->flag_mask | mask), iter);
 }
 
 static void collection_table_selection_remove(CollectTable *ct, CollectInfo *info, SelectionType mask, GtkTreeIter *iter)
 {
        if (!info) return;
 
-       collection_table_selection_set(ct, info, info->flag_mask & ~mask, iter);
+       collection_table_selection_set(ct, info, static_cast<SelectionType>(info->flag_mask & ~mask), iter);
 }
 /*
  *-------------------------------------------------------------------
@@ -369,7 +379,7 @@ static void collection_table_verify_selections(CollectTable *ct)
        work = ct->selection;
        while (work)
                {
-               CollectInfo *info = work->data;
+               auto info = static_cast<CollectInfo *>(work->data);
                work = work->next;
                if (!g_list_find(ct->cd->list, info))
                        {
@@ -383,13 +393,13 @@ void collection_table_select_all(CollectTable *ct)
        GList *work;
 
        g_list_free(ct->selection);
-       ct->selection = NULL;
+       ct->selection = nullptr;
 
        work = ct->cd->list;
        while (work)
                {
                ct->selection = g_list_append(ct->selection, work->data);
-               collection_table_selection_add(ct, work->data, SELECTION_SELECTED, NULL);
+               collection_table_selection_add(ct, static_cast<CollectInfo *>(work->data), SELECTION_SELECTED, nullptr);
                work = work->next;
                }
 
@@ -403,12 +413,12 @@ void collection_table_unselect_all(CollectTable *ct)
        work = ct->selection;
        while (work)
                {
-               collection_table_selection_remove(ct, work->data, SELECTION_SELECTED, NULL);
+               collection_table_selection_remove(ct, static_cast<CollectInfo *>(work->data), SELECTION_SELECTED, nullptr);
                work = work->next;
                }
 
        g_list_free(ct->selection);
-       ct->selection = NULL;
+       ct->selection = nullptr;
 
        collection_table_update_status(ct);
 }
@@ -417,21 +427,21 @@ void collection_table_unselect_all(CollectTable *ct)
 static void collection_table_select_invert_all(CollectTable *ct)
 {
        GList *work;
-       GList *new_selection = NULL;
+       GList *new_selection = nullptr;
 
        work = ct->cd->list;
        while (work)
                {
-               CollectInfo *info = work->data;
+               auto info = static_cast<CollectInfo *>(work->data);
 
                if (INFO_SELECTED(info))
                        {
-                       collection_table_selection_remove(ct, info, SELECTION_SELECTED, NULL);
+                       collection_table_selection_remove(ct, info, SELECTION_SELECTED, nullptr);
                        }
                else
                        {
                        new_selection = g_list_append(new_selection, info);
-                       collection_table_selection_add(ct, info, SELECTION_SELECTED, NULL);
+                       collection_table_selection_add(ct, info, SELECTION_SELECTED, nullptr);
 
                        }
 
@@ -451,7 +461,7 @@ void collection_table_select(CollectTable *ct, CollectInfo *info)
        if (!info || INFO_SELECTED(info)) return;
 
        ct->selection = g_list_append(ct->selection, info);
-       collection_table_selection_add(ct, info, SELECTION_SELECTED, NULL);
+       collection_table_selection_add(ct, info, SELECTION_SELECTED, nullptr);
 
        collection_table_update_status(ct);
 }
@@ -463,7 +473,7 @@ static void collection_table_unselect(CollectTable *ct, CollectInfo *info)
        if (!info || !INFO_SELECTED(info) ) return;
 
        ct->selection = g_list_remove(ct->selection, info);
-       collection_table_selection_remove(ct, info, SELECTION_SELECTED, NULL);
+       collection_table_selection_remove(ct, info, SELECTION_SELECTED, nullptr);
 
        collection_table_update_status(ct);
 }
@@ -482,10 +492,13 @@ static void collection_table_select_util(CollectTable *ct, CollectInfo *info, gb
 
 static void collection_table_select_region_util(CollectTable *ct, CollectInfo *start, CollectInfo *end, gboolean select)
 {
-       gint row1, col1;
-       gint row2, col2;
+       gint row1;
+       gint col1;
+       gint row2;
+       gint col2;
        gint t;
-       gint i, j;
+       gint i;
+       gint j;
 
        if (!collection_table_find_position(ct, start, &row1, &col1) ||
            !collection_table_find_position(ct, end, &row2, &col2) ) return;
@@ -507,13 +520,13 @@ static void collection_table_select_region_util(CollectTable *ct, CollectInfo *s
                work = g_list_find(ct->cd->list, start);
                while (work)
                        {
-                       info = work->data;
+                       info = static_cast<CollectInfo *>(work->data);
                        collection_table_select_util(ct, info, select);
 
                        if (work->data != end)
                                work = work->next;
                        else
-                               work = NULL;
+                               work = nullptr;
                        }
                return;
                }
@@ -537,7 +550,7 @@ static void collection_table_select_region_util(CollectTable *ct, CollectInfo *s
                {
                for (j = col1; j <= col2; j++)
                        {
-                       CollectInfo *info = collection_table_find_data(ct, i, j, NULL);
+                       CollectInfo *info = collection_table_find_data(ct, i, j, nullptr);
                        if (info) collection_table_select_util(ct, info, select);
                        }
                }
@@ -562,7 +575,8 @@ static GList *collection_table_get_list(CollectTable *ct)
 static void tip_show(CollectTable *ct)
 {
        GtkWidget *label;
-       gint x, y;
+       gint x;
+       gint y;
        GdkDisplay *display;
        GdkSeat *seat;
        GdkDevice *device;
@@ -572,9 +586,9 @@ static void tip_show(CollectTable *ct)
        seat = gdk_display_get_default_seat(gdk_window_get_display(gtk_widget_get_window(ct->listview)));
        device = gdk_seat_get_pointer(seat);
        gdk_window_get_device_position(gtk_widget_get_window(ct->listview),
-                                                               device, &x, &y, NULL);
+                                                               device, &x, &y, nullptr);
 
-       ct->tip_info = collection_table_find_data_by_coord(ct, x, y, NULL);
+       ct->tip_info = collection_table_find_data_by_coord(ct, x, y, nullptr);
        if (!ct->tip_info) return;
 
        ct->tip_window = gtk_window_new(GTK_WINDOW_POPUP);
@@ -584,28 +598,28 @@ static void tip_show(CollectTable *ct)
        label = gtk_label_new(ct->show_text ? ct->tip_info->fd->path : ct->tip_info->fd->name);
 
        g_object_set_data(G_OBJECT(ct->tip_window), "tip_label", label);
-       gtk_container_add(GTK_CONTAINER(ct->tip_window), label);
+       gq_gtk_container_add(GTK_WIDGET(ct->tip_window), label);
        gtk_widget_show(label);
 
        display = gdk_display_get_default();
        seat = gdk_display_get_default_seat(display);
        device = gdk_seat_get_pointer(seat);
-       gdk_device_get_position(device, NULL, &x, &y);
+       gdk_device_get_position(device, nullptr, &x, &y);
 
        if (!gtk_widget_get_realized(ct->tip_window)) gtk_widget_realize(ct->tip_window);
-       gtk_window_move(GTK_WINDOW(ct->tip_window), x + 16, y + 16);
+       gq_gtk_window_move(GTK_WINDOW(ct->tip_window), x + 16, y + 16);
        gtk_widget_show(ct->tip_window);
 }
 
 static void tip_hide(CollectTable *ct)
 {
-       if (ct->tip_window) gtk_widget_destroy(ct->tip_window);
-       ct->tip_window = NULL;
+       if (ct->tip_window) gq_gtk_widget_destroy(ct->tip_window);
+       ct->tip_window = nullptr;
 }
 
 static gboolean tip_schedule_cb(gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        if (!ct->tip_delay_id) return FALSE;
 
@@ -649,10 +663,11 @@ static void tip_update(CollectTable *ct, CollectInfo *info)
 
        if (ct->tip_window)
                {
-               gint x, y;
-               gdk_device_get_position(device, NULL, &x, &y);
+               gint x;
+               gint y;
+               gdk_device_get_position(device, nullptr, &x, &y);
 
-               gtk_window_move(GTK_WINDOW(ct->tip_window), x + 16, y + 16);
+               gq_gtk_window_move(GTK_WINDOW(ct->tip_window), x + 16, y + 16);
 
                if (info != ct->tip_info)
                        {
@@ -665,7 +680,7 @@ static void tip_update(CollectTable *ct, CollectInfo *info)
                                return;
                                }
 
-                       label = g_object_get_data(G_OBJECT(ct->tip_window), "tip_label");
+                       label = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(ct->tip_window), "tip_label"));
                        gtk_label_set_text(GTK_LABEL(label), ct->show_text ? ct->tip_info->fd->path : ct->tip_info->fd->name);
                        }
                }
@@ -677,16 +692,16 @@ static void tip_update(CollectTable *ct, CollectInfo *info)
  *-------------------------------------------------------------------
  */
 
-static void collection_table_popup_save_as_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_save_as_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       collection_dialog_save_as(NULL, ct->cd);
+       collection_dialog_save_as(ct->cd);
 }
 
 static void collection_table_popup_save_cb(GtkWidget *widget, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        if (!ct->cd->path)
                {
@@ -702,75 +717,75 @@ static void collection_table_popup_save_cb(GtkWidget *widget, gpointer data)
 
 static GList *collection_table_popup_file_list(CollectTable *ct)
 {
-       if (!ct->click_info) return NULL;
+       if (!ct->click_info) return nullptr;
 
        if (INFO_SELECTED(ct->click_info))
                {
                return collection_table_selection_get_list(ct);
                }
 
-       return g_list_append(NULL, file_data_ref(ct->click_info->fd));
+       return g_list_append(nullptr, file_data_ref(ct->click_info->fd));
 }
 
 static void collection_table_popup_edit_cb(GtkWidget *widget, gpointer data)
 {
        CollectTable *ct;
-       const gchar *key = data;
+       auto key = static_cast<const gchar *>(data);
 
-       ct = submenu_item_get_data(widget);
+       ct = static_cast<CollectTable *>(submenu_item_get_data(widget));
 
        if (!ct) return;
 
-       file_util_start_editor_from_filelist(key, collection_table_popup_file_list(ct), NULL, ct->listview);
+       file_util_start_editor_from_filelist(key, collection_table_popup_file_list(ct), nullptr, ct->listview);
 }
 
-static void collection_table_popup_copy_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_copy_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       file_util_copy(NULL, collection_table_popup_file_list(ct), NULL, ct->listview);
+       file_util_copy(nullptr, collection_table_popup_file_list(ct), nullptr, ct->listview);
 }
 
-static void collection_table_popup_move_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_move_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       file_util_move(NULL, collection_table_popup_file_list(ct), NULL, ct->listview);
+       file_util_move(nullptr, collection_table_popup_file_list(ct), nullptr, ct->listview);
 }
 
-static void collection_table_popup_rename_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_rename_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       file_util_rename(NULL, collection_table_popup_file_list(ct), ct->listview);
+       file_util_rename(nullptr, collection_table_popup_file_list(ct), ct->listview);
 }
 
-static void collection_table_popup_delete_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_delete_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        options->file_ops.safe_delete_enable = FALSE;
-       file_util_delete(NULL, collection_table_popup_file_list(ct), ct->listview);
+       file_util_delete(nullptr, collection_table_popup_file_list(ct), ct->listview);
 }
 
-static void collection_table_popup_move_to_trash_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_move_to_trash_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        options->file_ops.safe_delete_enable = TRUE;
-       file_util_delete(NULL, collection_table_popup_file_list(ct), ct->listview);
+       file_util_delete(nullptr, collection_table_popup_file_list(ct), ct->listview);
 }
 
-static void collection_table_popup_copy_path_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_copy_path_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        file_util_copy_path_list_to_clipboard(collection_table_popup_file_list(ct), TRUE);
 }
 
-static void collection_table_popup_copy_path_unquoted_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_copy_path_unquoted_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        file_util_copy_path_list_to_clipboard(collection_table_popup_file_list(ct), FALSE);
 }
@@ -780,29 +795,29 @@ static void collection_table_popup_sort_cb(GtkWidget *widget, gpointer data)
        CollectTable *ct;
        SortType type;
 
-       ct = submenu_item_get_data(widget);
+       ct = static_cast<CollectTable *>(submenu_item_get_data(widget));
 
        if (!ct) return;
 
-       type = (SortType)GPOINTER_TO_INT(data);
+       type = static_cast<SortType>GPOINTER_TO_INT(data);
 
        collection_set_sort_method(ct->cd, type);
 }
 
-static void collection_table_popup_randomize_cb(GtkWidget *widget, gpointer UNUSED(data))
+static void collection_table_popup_randomize_cb(GtkWidget *widget, gpointer)
 {
        CollectTable *ct;
 
-       ct = submenu_item_get_data(widget);
+       ct = static_cast<CollectTable *>(submenu_item_get_data(widget));
 
        if (!ct) return;
 
        collection_randomize(ct->cd);
 }
 
-static void collection_table_popup_view_new_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_view_new_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        if (ct->click_info && g_list_find(ct->cd->list, ct->click_info))
                {
@@ -810,48 +825,48 @@ static void collection_table_popup_view_new_cb(GtkWidget *UNUSED(widget), gpoint
                }
 }
 
-static void collection_table_popup_view_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_view_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        if (ct->click_info && g_list_find(ct->cd->list, ct->click_info))
                {
-               layout_image_set_collection(NULL, ct->cd, ct->click_info);
+               layout_image_set_collection(nullptr, ct->cd, ct->click_info);
                }
 }
 
-static void collection_table_popup_selectall_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_selectall_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_select_all(ct);
        ct->prev_selection= ct->click_info;
 }
 
-static void collection_table_popup_unselectall_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_unselectall_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_unselect_all(ct);
        ct->prev_selection= ct->click_info;
 }
 
-static void collection_table_popup_select_invert_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_select_invert_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_select_invert_all(ct);
        ct->prev_selection= ct->click_info;
 }
 
-static void collection_table_popup_rectangular_selection_cb(GtkWidget *UNUSED(widget), gpointer UNUSED(data))
+static void collection_table_popup_rectangular_selection_cb(GtkWidget *, gpointer)
 {
        options->collections.rectangular_selection = !(options->collections.rectangular_selection);
 }
 
-static void collection_table_popup_remove_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_remove_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        GList *list;
 
        if (!ct->click_info) return;
@@ -862,18 +877,19 @@ static void collection_table_popup_remove_cb(GtkWidget *UNUSED(widget), gpointer
                }
        else
                {
-               list = g_list_append(NULL, ct->click_info);
+               list = g_list_append(nullptr, ct->click_info);
                }
 
        collection_remove_by_info_list(ct->cd, list);
+       collection_table_refresh(ct);
        g_list_free(list);
 }
 
-static void collection_table_popup_add_file_selection_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_add_file_selection_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        GList *list;
-       LayoutWindow *lw = NULL;
+       LayoutWindow *lw = nullptr;
 
        if (!layout_valid(&lw)) return;
 
@@ -886,25 +902,25 @@ static void collection_table_popup_add_file_selection_cb(GtkWidget *UNUSED(widge
                }
 }
 
-static void collection_table_popup_add_collection_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_add_collection_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       collection_dialog_append(NULL, ct->cd);
+       collection_dialog_append(ct->cd);
 }
 
-static void collection_table_popup_goto_original_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_goto_original_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        GList *list;
-       LayoutWindow *lw = NULL;
+       LayoutWindow *lw = nullptr;
        FileData *fd;
 
        if (!layout_valid(&lw)) return;
        list = collection_table_selection_get_list(ct);
        if (list)
                {
-               fd = list->data;
+               fd = static_cast<FileData *>(list->data);
                if (fd)
                        {
                        layout_set_fd(lw, fd);
@@ -913,53 +929,53 @@ static void collection_table_popup_goto_original_cb(GtkWidget *UNUSED(widget), g
        g_list_free(list);
 }
 
-static void collection_table_popup_find_dupes_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_find_dupes_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        DupeWindow *dw;
 
        dw = dupe_window_new();
        dupe_window_add_collection(dw, ct->cd);
 }
 
-static void collection_table_popup_print_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_print_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        FileData *fd;
 
-       fd = (ct->click_info) ? ct->click_info->fd : NULL;
+       fd = (ct->click_info) ? ct->click_info->fd : nullptr;
 
        print_window_new(fd, collection_table_selection_get_list(ct), collection_table_get_list(ct), gtk_widget_get_toplevel(ct->listview));
 }
 
-static void collection_table_popup_show_names_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_show_names_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_toggle_filenames(ct);
 }
 
-static void collection_table_popup_show_stars_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_show_stars_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_toggle_stars(ct);
 }
 
-static void collection_table_popup_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_popup_destroy_cb(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       collection_table_selection_remove(ct, ct->click_info, SELECTION_PRELIGHT, NULL);
-       ct->click_info = NULL;
-       ct->popup = NULL;
+       collection_table_selection_remove(ct, ct->click_info, SELECTION_PRELIGHT, nullptr);
+       ct->click_info = nullptr;
+       ct->popup = nullptr;
 
        filelist_free(ct->drop_list);
-       ct->drop_list = NULL;
-       ct->drop_info = NULL;
+       ct->drop_list = nullptr;
+       ct->drop_info = nullptr;
 
        filelist_free(ct->editmenu_fd_list);
-       ct->editmenu_fd_list = NULL;
+       ct->editmenu_fd_list = nullptr;
 }
 
 static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_icon)
@@ -982,21 +998,21 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic
 
        menu_item_add_sensitive(menu, _("_View"), over_icon,
                        G_CALLBACK(collection_table_popup_view_cb), ct);
-       menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, over_icon,
+       menu_item_add_icon_sensitive(menu, _("View in _new window"), GQ_ICON_NEW, over_icon,
                        G_CALLBACK(collection_table_popup_view_new_cb), ct);
-       menu_item_add_stock(menu, _("Go to original"), GTK_STOCK_FIND,
+       menu_item_add_icon(menu, _("Go to original"), GQ_ICON_FIND,
                        G_CALLBACK(collection_table_popup_goto_original_cb), ct);
        menu_item_add_divider(menu);
-       menu_item_add_stock_sensitive(menu, _("Rem_ove"), GTK_STOCK_REMOVE, over_icon,
+       menu_item_add_icon_sensitive(menu, _("Rem_ove"), GQ_ICON_REMOVE, over_icon,
                        G_CALLBACK(collection_table_popup_remove_cb), ct);
 
-       menu_item_add_stock(menu, _("Append from file selection"), GTK_STOCK_ADD,
+       menu_item_add_icon(menu, _("Append from file selection"), GQ_ICON_ADD,
                        G_CALLBACK(collection_table_popup_add_file_selection_cb), ct);
-       menu_item_add_stock(menu, _("Append from collection..."), GTK_STOCK_OPEN,
+       menu_item_add_icon(menu, _("Append from collection..."), GQ_ICON_OPEN,
                        G_CALLBACK(collection_table_popup_add_collection_cb), ct);
        menu_item_add_divider(menu);
 
-       item = menu_item_add(menu, _("_Selection"), NULL, NULL);
+       item = menu_item_add(menu, _("_Selection"), nullptr, nullptr);
        submenu = gtk_menu_new();
        menu_item_add(submenu, _("Select all"),
                        G_CALLBACK(collection_table_popup_selectall_cb), ct);
@@ -1016,7 +1032,7 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic
        gtk_widget_set_sensitive(item, over_icon);
 
        menu_item_add_divider(menu);
-       menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, over_icon,
+       menu_item_add_icon_sensitive(menu, _("_Copy..."), GQ_ICON_COPY, over_icon,
                        G_CALLBACK(collection_table_popup_copy_cb), ct);
        menu_item_add_sensitive(menu, _("_Move..."), over_icon,
                        G_CALLBACK(collection_table_popup_move_cb), ct);
@@ -1028,21 +1044,21 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic
                                G_CALLBACK(collection_table_popup_copy_path_unquoted_cb), ct);
 
        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, over_icon,
+                                       _("Move to Trash"), GQ_ICON_DELETE, over_icon,
                                G_CALLBACK(collection_table_popup_move_to_trash_cb), ct);
-       menu_item_add_stock_sensitive(menu,
+       menu_item_add_icon_sensitive(menu,
                                options->file_ops.confirm_delete ? _("_Delete...") :
-                                       _("_Delete"), GTK_STOCK_DELETE, over_icon,
+                                       _("_Delete"), GQ_ICON_DELETE_SHRED, over_icon,
                                G_CALLBACK(collection_table_popup_delete_cb), ct);
 
        menu_item_add_divider(menu);
-       submenu = submenu_add_sort(NULL, G_CALLBACK(collection_table_popup_sort_cb), ct, FALSE, TRUE, FALSE, 0);
+       submenu = submenu_add_sort(nullptr, G_CALLBACK(collection_table_popup_sort_cb), ct, FALSE, TRUE, FALSE, SORT_NONE);
        menu_item_add_divider(submenu);
        menu_item_add(submenu, _("Randomize"),
                        G_CALLBACK(collection_table_popup_randomize_cb), ct);
-       item = menu_item_add(menu, _("_Sort"), NULL, NULL);
+       item = menu_item_add(menu, _("_Sort"), nullptr, nullptr);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
 
        menu_item_add_check(menu, _("Show filename _text"), ct->show_text,
@@ -1050,14 +1066,14 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic
        menu_item_add_check(menu, _("Show star rating"), ct->show_stars,
                                G_CALLBACK(collection_table_popup_show_stars_cb), ct);
        menu_item_add_divider(menu);
-       menu_item_add_stock(menu, _("_Save collection"), GTK_STOCK_SAVE,
+       menu_item_add_icon(menu, _("_Save collection"), GQ_ICON_SAVE,
                        G_CALLBACK(collection_table_popup_save_cb), ct);
-       menu_item_add_stock(menu, _("Save collection _as..."), GTK_STOCK_SAVE_AS,
+       menu_item_add_icon(menu, _("Save collection _as..."), GQ_ICON_SAVE_AS,
                        G_CALLBACK(collection_table_popup_save_as_cb), ct);
        menu_item_add_divider(menu);
-       menu_item_add_stock(menu, _("_Find duplicates..."), GTK_STOCK_FIND,
+       menu_item_add_icon(menu, _("_Find duplicates..."), GQ_ICON_FIND,
                        G_CALLBACK(collection_table_popup_find_dupes_cb), ct);
-       menu_item_add_stock_sensitive(menu, _("Print..."), GTK_STOCK_PRINT, over_icon,
+       menu_item_add_icon_sensitive(menu, _("Print..."), GQ_ICON_PRINT, over_icon,
                        G_CALLBACK(collection_table_popup_print_cb), ct);
 
        return menu;
@@ -1071,7 +1087,8 @@ static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_ic
 void collection_table_set_focus(CollectTable *ct, CollectInfo *info)
 {
        GtkTreeIter iter;
-       gint row, col;
+       gint row;
+       gint col;
 
        if (g_list_find(ct->cd->list, ct->focus_info))
                {
@@ -1082,12 +1099,12 @@ void collection_table_set_focus(CollectTable *ct, CollectInfo *info)
                                                       &ct->focus_row, &ct->focus_column);
                        return;
                        }
-               collection_table_selection_remove(ct, ct->focus_info, SELECTION_FOCUS, NULL);
+               collection_table_selection_remove(ct, ct->focus_info, SELECTION_FOCUS, nullptr);
                }
 
        if (!collection_table_find_position(ct, info, &row, &col))
                {
-               ct->focus_info = NULL;
+               ct->focus_info = nullptr;
                ct->focus_row = -1;
                ct->focus_column = -1;
                return;
@@ -1096,9 +1113,9 @@ void collection_table_set_focus(CollectTable *ct, CollectInfo *info)
        ct->focus_info = info;
        ct->focus_row = row;
        ct->focus_column = col;
-       collection_table_selection_add(ct, ct->focus_info, SELECTION_FOCUS, NULL);
+       collection_table_selection_add(ct, ct->focus_info, SELECTION_FOCUS, nullptr);
 
-       if (collection_table_find_iter(ct, ct->focus_info, &iter, NULL))
+       if (collection_table_find_iter(ct, ct->focus_info, &iter, nullptr))
                {
                GtkTreePath *tpath;
                GtkTreeViewColumn *column;
@@ -1201,7 +1218,7 @@ static void collection_table_move_focus(CollectTable *ct, gint row, gint col, gb
                new_row = new_col = 0;
                }
 
-       collection_table_set_focus(ct, collection_table_find_data(ct, new_row, new_col, NULL));
+       collection_table_set_focus(ct, collection_table_find_data(ct, new_row, new_col, nullptr));
 }
 
 static void collection_table_update_focus(CollectTable *ct)
@@ -1231,8 +1248,8 @@ static gint page_height(CollectTable *ct)
        gint row_height;
        gint ret;
 
-       adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(ct->listview));
-       page_size = (gint)gtk_adjustment_get_page_increment(adj);
+       adj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(ct->listview));
+       page_size = static_cast<gint>(gtk_adjustment_get_page_increment(adj));
 
        row_height = options->thumbnails.max_height + THUMB_BORDER_PADDING * 2;
        if (ct->show_text) row_height += options->thumbnails.max_height / 3;
@@ -1245,7 +1262,7 @@ static gint page_height(CollectTable *ct)
 
 static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        gint focus_row = 0;
        gint focus_col = 0;
        CollectInfo *info;
@@ -1280,7 +1297,7 @@ static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *ev
                        focus_col = ct->columns - 1 - ct->focus_column;
                        break;
                case GDK_KEY_space:
-                       info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL);
+                       info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, nullptr);
                        if (info)
                                {
                                ct->click_info = info;
@@ -1300,14 +1317,14 @@ static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *ev
                        break;
                case GDK_KEY_Menu:
                case GDK_KEY_F10:
-                       info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL);
+                       info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, nullptr);
                        ct->click_info = info;
 
-                       collection_table_selection_add(ct, ct->click_info, SELECTION_PRELIGHT, NULL);
+                       collection_table_selection_add(ct, ct->click_info, SELECTION_PRELIGHT, nullptr);
                        tip_unschedule(ct);
 
-                       ct->popup = collection_table_popup_menu(ct, (info != NULL));
-                       gtk_menu_popup_at_widget(GTK_MENU(ct->popup), widget, GDK_GRAVITY_SOUTH, GDK_GRAVITY_CENTER, NULL);
+                       ct->popup = collection_table_popup_menu(ct, (info != nullptr));
+                       gtk_menu_popup_at_widget(GTK_MENU(ct->popup), widget, GDK_GRAVITY_SOUTH, GDK_GRAVITY_CENTER, nullptr);
 
                        break;
                default:
@@ -1320,9 +1337,9 @@ static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *ev
                CollectInfo *new_info;
                CollectInfo *old_info;
 
-               old_info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL);
+               old_info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, nullptr);
                collection_table_move_focus(ct, focus_row, focus_col, TRUE);
-               new_info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL);
+               new_info = collection_table_find_data(ct, ct->focus_row, ct->focus_column, nullptr);
 
                if (new_info != old_info)
                        {
@@ -1368,7 +1385,7 @@ static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *ev
 static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *source, gboolean *after, GdkRectangle *cell,
                                                 gboolean use_coord, gint x, gint y)
 {
-       CollectInfo *info = NULL;
+       CollectInfo *info = nullptr;
        GtkTreeModel *store;
        GtkTreeIter iter;
        GtkTreePath *tpath;
@@ -1383,7 +1400,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *
                seat = gdk_display_get_default_seat(gdk_window_get_display(gtk_widget_get_window(ct->listview)));
                device = gdk_seat_get_pointer(seat);
                gdk_window_get_device_position(gtk_widget_get_window(ct->listview),
-                                                                       device, &x, &y, NULL);
+                                                                       device, &x, &y, nullptr);
                }
 
        if (source)
@@ -1403,7 +1420,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *
                }
 
        if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(ct->listview), x, y,
-                                         &tpath, &column, NULL, NULL))
+                                         &tpath, &column, nullptr, nullptr))
                {
                GList *list;
                gint n;
@@ -1412,7 +1429,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *
                gtk_tree_model_get(store, &iter, CTABLE_COLUMN_POINTER, &list, -1);
 
                n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column), "column_number"));
-               info = g_list_nth_data(list, n);
+               info = static_cast<CollectInfo *>(g_list_nth_data(list, n));
 
                if (info)
                        {
@@ -1423,7 +1440,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *
                gtk_tree_path_free(tpath);
                }
 
-       if (info == NULL)
+       if (info == nullptr)
                {
                GList *work;
 
@@ -1432,7 +1449,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *
                        {
                        gint col;
 
-                       info = work->data;
+                       info = static_cast<CollectInfo *>(work->data);
                        *after = TRUE;
 
                        if (collection_table_find_iter(ct, info, &iter, &col))
@@ -1454,7 +1471,7 @@ static CollectInfo *collection_table_insert_point(CollectTable *ct, gint x, gint
        GdkRectangle cell;
        gboolean after = FALSE;
 
-       info = collection_table_insert_find(ct, NULL, &after, &cell, TRUE, x, y);
+       info = collection_table_insert_find(ct, nullptr, &after, &cell, TRUE, x, y);
 
        if (info && after)
                {
@@ -1463,11 +1480,11 @@ static CollectInfo *collection_table_insert_point(CollectTable *ct, gint x, gint
                work = g_list_find(ct->cd->list, info);
                if (work && work->next)
                        {
-                       info = work->next->data;
+                       info = static_cast<CollectInfo *>(work->next->data);
                        }
                else
                        {
-                       info = NULL;
+                       info = nullptr;
                        }
                }
 
@@ -1479,7 +1496,11 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
        gboolean after = FALSE;
        GdkRectangle cell;
        GdkWindow *parent;
-       gint x_parent, y_parent;
+       gint x_parent;
+       gint y_parent;
+       GError *error = nullptr;
+       GInputStream *in_stream;
+       GdkPixbuf *pb;
 
        parent = gtk_widget_get_window(gtk_widget_get_toplevel(ct->listview));
        gdk_window_get_position(parent, &x_parent, &y_parent);
@@ -1487,7 +1508,7 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
        if (!enable)
                {
                if (ct->marker_window) gdk_window_destroy(ct->marker_window);
-               ct->marker_window = NULL;
+               ct->marker_window = nullptr;
 
                return;
                }
@@ -1501,7 +1522,18 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
                {
                GdkWindowAttr attributes;
                gint attributes_mask;
-               GdkPixbuf *pb = gdk_pixbuf_new_from_xpm_data((const gchar **)marker_xpm);
+
+               in_stream = g_resources_open_stream(GQ_RESOURCE_PATH_ICONS "/gq-marker.xpm", G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
+               pb = gdk_pixbuf_new_from_stream(in_stream, nullptr, &error);
+               g_object_unref(in_stream);
+
+               if (error)
+                       {
+                       log_printf("warning: collection marker error: %s", error->message);
+                       g_error_free(error);
+                       return;
+                       }
+
                gint w = gdk_pixbuf_get_width(pb);
                gint h = gdk_pixbuf_get_height(pb);
 
@@ -1512,7 +1544,7 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
                attributes.event_mask = gtk_widget_get_events(ct->listview);
                attributes_mask = 0;
 
-               ct->marker_window = gdk_window_new(NULL, &attributes, attributes_mask);
+               ct->marker_window = gdk_window_new(nullptr, &attributes, attributes_mask);
 
                cairo_region_t *mask;
                cairo_pattern_t *pattern;
@@ -1520,8 +1552,9 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
                cairo_t *cr = cairo_create(img);
                gdk_cairo_set_source_pixbuf(cr, pb, 0, 0);
                cairo_paint(cr);
-               /** @FIXME this is a hack to get the background color */
-               //~ pattern = cairo_pattern_create_for_surface(img);
+               /** @FIXME this is a hack to get the background color
+                * pattern = cairo_pattern_create_for_surface(img);
+                */
                pattern = cairo_pattern_create_rgb (1.0, 0.0, 0.0);
                mask = gdk_cairo_region_create_from_surface(img);
                gdk_window_shape_combine_region(ct->marker_window, mask, 0, 0);
@@ -1535,8 +1568,10 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,
 
        if (info)
                {
-               gint x, y;
-               gint w, h;
+               gint x;
+               gint y;
+               gint w;
+               gint h;
 
                w = gdk_window_get_width(ct->marker_window);
                h = gdk_window_get_height(ct->marker_window);
@@ -1575,7 +1610,7 @@ static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gbo
 {
        CollectInfo *info;
 
-       info = collection_table_find_data_by_coord(ct, x, y, NULL);
+       info = collection_table_find_data_by_coord(ct, x, y, nullptr);
 
        if (drop_event)
                {
@@ -1590,19 +1625,21 @@ static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gbo
 
 static gboolean collection_table_auto_scroll_idle_cb(gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        GdkWindow *window;
-       gint x, y;
-       gint w, h;
+       gint x;
+       gint y;
+       gint w;
+       gint h;
        GdkSeat *seat;
        GdkDevice *device;
 
-       if (!ct->drop_idle_id) return FALSE;
+       if (!ct->drop_idle_id) return G_SOURCE_REMOVE;
 
        window = gtk_widget_get_window(ct->listview);
        seat = gdk_display_get_default_seat(gdk_window_get_display(window));
        device = gdk_seat_get_pointer(seat);
-       gdk_window_get_device_position(window, device, &x, &y, NULL);
+       gdk_window_get_device_position(window, device, &x, &y, nullptr);
 
        w = gdk_window_get_width(window);
        h = gdk_window_get_height(window);
@@ -1612,12 +1649,12 @@ static gboolean collection_table_auto_scroll_idle_cb(gpointer data)
                }
 
        ct->drop_idle_id = 0;
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
-static gboolean collection_table_auto_scroll_notify_cb(GtkWidget *UNUSED(widget), gint UNUSED(x), gint UNUSED(y), gpointer data)
+static gboolean collection_table_auto_scroll_notify_cb(GtkWidget *, gint, gint, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        if (!ct->drop_idle_id)
                {
@@ -1637,11 +1674,11 @@ static void collection_table_scroll(CollectTable *ct, gboolean scroll)
                        ct->drop_idle_id = 0;
                        }
                widget_auto_scroll_stop(ct->listview);
-               collection_table_insert_marker(ct, NULL, FALSE);
+               collection_table_insert_marker(ct, nullptr, FALSE);
                }
        else
                {
-               GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(ct->listview));
+               GtkAdjustment *adj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(ct->listview));
                widget_auto_scroll_start(ct->listview, adj, -1, options->thumbnails.max_height / 2,
                                         collection_table_auto_scroll_notify_cb, ct);
                }
@@ -1653,24 +1690,24 @@ static void collection_table_scroll(CollectTable *ct, gboolean scroll)
  *-------------------------------------------------------------------
  */
 
-static gboolean collection_table_motion_cb(GtkWidget *UNUSED(widget), GdkEventMotion *event, gpointer data)
+static gboolean collection_table_motion_cb(GtkWidget *, GdkEventMotion *event, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       collection_table_motion_update(ct, (gint)event->x, (gint)event->y, FALSE);
+       collection_table_motion_update(ct, static_cast<gint>(event->x), static_cast<gint>(event->y), FALSE);
 
        return FALSE;
 }
 
-static gboolean collection_table_press_cb(GtkWidget *UNUSED(widget), GdkEventButton *bevent, gpointer data)
+static gboolean collection_table_press_cb(GtkWidget *, GdkEventButton *bevent, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        GtkTreeIter iter;
        CollectInfo *info;
 
        tip_unschedule(ct);
 
-       info = collection_table_find_data_by_coord(ct, (gint)bevent->x, (gint)bevent->y, &iter);
+       info = collection_table_find_data_by_coord(ct, static_cast<gint>(bevent->x), static_cast<gint>(bevent->y), &iter);
 
        ct->click_info = info;
        collection_table_selection_add(ct, ct->click_info, SELECTION_PRELIGHT, &iter);
@@ -1682,7 +1719,7 @@ static gboolean collection_table_press_cb(GtkWidget *UNUSED(widget), GdkEventBut
                                {
                                if (info)
                                        {
-                                       layout_image_set_collection(NULL, ct->cd, info);
+                                       layout_image_set_collection(nullptr, ct->cd, info);
                                        }
                                }
                        else if (!gtk_widget_has_focus(ct->listview))
@@ -1691,8 +1728,8 @@ static gboolean collection_table_press_cb(GtkWidget *UNUSED(widget), GdkEventBut
                                }
                        break;
                case MOUSE_BUTTON_RIGHT:
-                       ct->popup = collection_table_popup_menu(ct, (info != NULL));
-                       gtk_menu_popup_at_pointer(GTK_MENU(ct->popup), NULL);
+                       ct->popup = collection_table_popup_menu(ct, (info != nullptr));
+                       gtk_menu_popup_at_pointer(GTK_MENU(ct->popup), nullptr);
                        break;
                default:
                        break;
@@ -1701,22 +1738,22 @@ static gboolean collection_table_press_cb(GtkWidget *UNUSED(widget), GdkEventBut
        return TRUE;
 }
 
-static gboolean collection_table_release_cb(GtkWidget *UNUSED(widget), GdkEventButton *bevent, gpointer data)
+static gboolean collection_table_release_cb(GtkWidget *, GdkEventButton *bevent, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        GtkTreeIter iter;
-       CollectInfo *info = NULL;
+       CollectInfo *info = nullptr;
 
        tip_schedule(ct);
 
-       if ((gint)bevent->x != 0 || (gint)bevent->y != 0)
+       if (static_cast<gint>(bevent->x) != 0 || static_cast<gint>(bevent->y) != 0)
                {
-               info = collection_table_find_data_by_coord(ct, (gint)bevent->x, (gint)bevent->y, &iter);
+               info = collection_table_find_data_by_coord(ct, static_cast<gint>(bevent->x), static_cast<gint>(bevent->y), &iter);
                }
 
        if (ct->click_info)
                {
-               collection_table_selection_remove(ct, ct->click_info, SELECTION_PRELIGHT, NULL);
+               collection_table_selection_remove(ct, ct->click_info, SELECTION_PRELIGHT, nullptr);
                }
 
        if (bevent->button == MOUSE_BUTTON_LEFT &&
@@ -1761,9 +1798,9 @@ static gboolean collection_table_release_cb(GtkWidget *UNUSED(widget), GdkEventB
        return TRUE;
 }
 
-static gboolean collection_table_leave_cb(GtkWidget *UNUSED(widget), GdkEventCrossing *UNUSED(event), gpointer data)
+static gboolean collection_table_leave_cb(GtkWidget *, GdkEventCrossing *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        tip_unschedule(ct);
        return FALSE;
@@ -1775,7 +1812,7 @@ static gboolean collection_table_leave_cb(GtkWidget *UNUSED(widget), GdkEventCro
  *-------------------------------------------------------------------
  */
 
-static gboolean collection_table_destroy_node_cb(GtkTreeModel *store, GtkTreePath *UNUSED(tpath), GtkTreeIter *iter, gpointer UNUSED(data))
+static gboolean collection_table_destroy_node_cb(GtkTreeModel *store, GtkTreePath *, GtkTreeIter *iter, gpointer)
 {
        GList *list;
 
@@ -1790,7 +1827,7 @@ static void collection_table_clear_store(CollectTable *ct)
        GtkTreeModel *store;
 
        store = gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview));
-       gtk_tree_model_foreach(store, collection_table_destroy_node_cb, NULL);
+       gtk_tree_model_foreach(store, collection_table_destroy_node_cb, nullptr);
 
        gtk_list_store_clear(GTK_LIST_STORE(store));
 }
@@ -1798,10 +1835,10 @@ static void collection_table_clear_store(CollectTable *ct)
 static GList *collection_table_add_row(CollectTable *ct, GtkTreeIter *iter)
 {
        GtkListStore *store;
-       GList *list = NULL;
+       GList *list = nullptr;
        gint i;
 
-       for (i = 0; i < ct->columns; i++) list = g_list_prepend(list, NULL);
+       for (i = 0; i < ct->columns; i++) list = g_list_prepend(list, nullptr);
 
        store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview)));
        gtk_list_store_append(store, iter);
@@ -1837,7 +1874,7 @@ static void collection_table_populate(CollectTable *ct, gboolean resize)
                        gtk_tree_view_column_set_fixed_width(column, thumb_width + (THUMB_BORDER_PADDING * 6));
 
                        list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
-                       cell = (list) ? list->data : NULL;
+                       cell = static_cast<GtkCellRenderer *>((list) ? list->data : nullptr);
                        g_list_free(list);
 
                        if (cell && GQV_IS_CELL_RENDERER_ICON(cell))
@@ -1874,7 +1911,7 @@ static void collection_table_populate(CollectTable *ct, gboolean resize)
        collection_table_update_status(ct);
 }
 
-static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint UNUSED(h), gboolean force)
+static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint, gboolean force)
 {
        gint new_cols;
        gint thumb_width;
@@ -1898,7 +1935,8 @@ static void collection_table_sync(CollectTable *ct)
        GtkTreeModel *store;
        GtkTreeIter iter;
        GList *work;
-       gint r, c;
+       gint r;
+       gint c;
 
        store = gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview));
 
@@ -1911,7 +1949,7 @@ static void collection_table_sync(CollectTable *ct)
                GList *list;
                r++;
                c = 0;
-               if (gtk_tree_model_iter_nth_child(store, &iter, NULL, r))
+               if (gtk_tree_model_iter_nth_child(store, &iter, nullptr, r))
                        {
                        gtk_tree_model_get(store, &iter, CTABLE_COLUMN_POINTER, &list, -1);
                        gtk_list_store_set(GTK_LIST_STORE(store), &iter, CTABLE_COLUMN_POINTER, list, -1);
@@ -1926,13 +1964,13 @@ static void collection_table_sync(CollectTable *ct)
                        CollectInfo *info;
                        if (work)
                                {
-                               info = work->data;
+                               info = static_cast<CollectInfo *>(work->data);
                                work = work->next;
                                c++;
                                }
                        else
                                {
-                               info = NULL;
+                               info = nullptr;
                                }
                        if (list)
                                {
@@ -1943,7 +1981,7 @@ static void collection_table_sync(CollectTable *ct)
                }
 
        r++;
-       while (gtk_tree_model_iter_nth_child(store, &iter, NULL, r))
+       while (gtk_tree_model_iter_nth_child(store, &iter, nullptr, r))
                {
                GList *list;
 
@@ -1960,14 +1998,14 @@ static void collection_table_sync(CollectTable *ct)
 
 static gboolean collection_table_sync_idle_cb(gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
-       if (!ct->sync_idle_id) return FALSE;
+       if (!ct->sync_idle_id) return G_SOURCE_REMOVE;
        g_source_remove(ct->sync_idle_id);
        ct->sync_idle_id = 0;
 
        collection_table_sync(ct);
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
 static void collection_table_sync_idle(CollectTable *ct)
@@ -1977,7 +2015,7 @@ static void collection_table_sync_idle(CollectTable *ct)
                /* high priority, the view needs to be resynced before a redraw
                 * may contain invalid pointers at this time
                 */
-               ct->sync_idle_id = g_idle_add_full(G_PRIORITY_HIGH, collection_table_sync_idle_cb, ct, NULL);
+               ct->sync_idle_id = g_idle_add_full(G_PRIORITY_HIGH, collection_table_sync_idle_cb, ct, nullptr);
                }
 }
 
@@ -1990,7 +2028,7 @@ void collection_table_add_filelist(CollectTable *ct, GList *list)
        work = list;
        while (work)
                {
-               collection_add(ct->cd, (FileData *)work->data, FALSE);
+               collection_add(ct->cd, static_cast<FileData *>(work->data), FALSE);
                work = work->next;
                }
 }
@@ -2004,7 +2042,7 @@ static void collection_table_insert_filelist(CollectTable *ct, GList *list, Coll
        work = list;
        while (work)
                {
-               collection_insert(ct->cd, (FileData *)work->data, insert_info, FALSE);
+               collection_insert(ct->cd, static_cast<FileData *>(work->data), insert_info, FALSE);
                work = work->next;
                }
 
@@ -2014,13 +2052,13 @@ static void collection_table_insert_filelist(CollectTable *ct, GList *list, Coll
 static void collection_table_move_by_info_list(CollectTable *ct, GList *info_list, gint row, gint col)
 {
        GList *work;
-       GList *insert_pos = NULL;
+       GList *insert_pos = nullptr;
        GList *temp;
        CollectInfo *info;
 
        if (!info_list) return;
 
-       info = collection_table_find_data(ct, row, col, NULL);
+       info = collection_table_find_data(ct, row, col, nullptr);
 
        if (!info_list->next && info_list->data == info) return;
 
@@ -2079,7 +2117,8 @@ static void collection_table_move_by_info_list(CollectTable *ct, GList *info_lis
 void collection_table_file_update(CollectTable *ct, CollectInfo *info)
 {
        GtkTreeIter iter;
-       gint row, col;
+       gint row;
+       gint col;
        gdouble value;
 
        if (!info)
@@ -2092,7 +2131,7 @@ void collection_table_file_update(CollectTable *ct, CollectInfo *info)
 
        if (ct->columns != 0 && ct->rows != 0)
                {
-               value = (gdouble)(row * ct->columns + col) / (ct->columns * ct->rows);
+               value = static_cast<gdouble>(row * ct->columns + col) / (ct->columns * ct->rows);
                }
        else
                {
@@ -2101,7 +2140,7 @@ void collection_table_file_update(CollectTable *ct, CollectInfo *info)
 
        collection_table_update_extras(ct, TRUE, value);
 
-       if (collection_table_find_iter(ct, info, &iter, NULL))
+       if (collection_table_find_iter(ct, info, &iter, nullptr))
                {
                GtkTreeModel *store;
                GList *list;
@@ -2112,12 +2151,12 @@ void collection_table_file_update(CollectTable *ct, CollectInfo *info)
                }
 }
 
-void collection_table_file_add(CollectTable *ct, CollectInfo *UNUSED(info))
+void collection_table_file_add(CollectTable *ct, CollectInfo *)
 {
        collection_table_sync_idle(ct);
 }
 
-void collection_table_file_insert(CollectTable *ct, CollectInfo *UNUSED(ci))
+void collection_table_file_insert(CollectTable *ct, CollectInfo *)
 {
        collection_table_sync_idle(ct);
 }
@@ -2149,7 +2188,7 @@ static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_f
        GList *f;
        GList *work;
 
-       if (!filelist_read(dir_fd, &f, recursive ? &d : NULL))
+       if (!filelist_read(dir_fd, &f, recursive ? &d : nullptr))
                return;
 
        f = filelist_filter(f, FALSE);
@@ -2163,7 +2202,7 @@ static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_f
        work = g_list_last(d);
        while (work)
                {
-               collection_table_add_dir_recursive(ct, (FileData *)work->data, TRUE);
+               collection_table_add_dir_recursive(ct, static_cast<FileData *>(work->data), TRUE);
                work = work->prev;
                }
 
@@ -2176,7 +2215,7 @@ static void confirm_dir_list_do(CollectTable *ct, GList *list, gboolean recursiv
        GList *work = list;
        while (work)
                {
-               FileData *fd = work->data;
+               auto fd = static_cast<FileData *>(work->data);
                work = work->next;
                if (isdir(fd->path)) collection_table_add_dir_recursive(ct, fd, recursive);
                }
@@ -2184,23 +2223,23 @@ static void confirm_dir_list_do(CollectTable *ct, GList *list, gboolean recursiv
 }
 
 
-static void confirm_dir_list_add(GtkWidget *UNUSED(widget), gpointer data)
+static void confirm_dir_list_add(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        confirm_dir_list_do(ct, ct->drop_list, FALSE);
 }
 
-static void confirm_dir_list_recurse(GtkWidget *UNUSED(widget), gpointer data)
+static void confirm_dir_list_recurse(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        confirm_dir_list_do(ct, ct->drop_list, TRUE);
 }
 
-static void confirm_dir_list_skip(GtkWidget *UNUSED(widget), gpointer data)
+static void confirm_dir_list_skip(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_insert_filelist(ct, ct->drop_list, ct->marker_info);
 }
@@ -2213,16 +2252,16 @@ static GtkWidget *collection_table_drop_menu(CollectTable *ct)
        g_signal_connect(G_OBJECT(menu), "destroy",
                         G_CALLBACK(collection_table_popup_destroy_cb), ct);
 
-       menu_item_add_stock(menu, _("Dropped list includes folders."), GTK_STOCK_DND_MULTIPLE, NULL, NULL);
+       menu_item_add_stock(menu, _("Dropped list includes folders."), GQ_ICON_DND, nullptr, nullptr);
        menu_item_add_divider(menu);
-       menu_item_add_stock(menu, _("_Add contents"), GTK_STOCK_OK,
+       menu_item_add_icon(menu, _("_Add contents"), GQ_ICON_OK,
                            G_CALLBACK(confirm_dir_list_add), ct);
-       menu_item_add_stock(menu, _("Add contents _recursive"), GTK_STOCK_ADD,
+       menu_item_add_icon(menu, _("Add contents _recursive"), GQ_ICON_ADD,
                            G_CALLBACK(confirm_dir_list_recurse), ct);
-       menu_item_add_stock(menu, _("_Skip folders"), GTK_STOCK_REMOVE,
+       menu_item_add_icon(menu, _("_Skip folders"), GQ_ICON_REMOVE,
                            G_CALLBACK(confirm_dir_list_skip), ct);
        menu_item_add_divider(menu);
-       menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, ct);
+       menu_item_add_icon(menu, _("Cancel"), GQ_ICON_CANCEL, nullptr, ct);
 
        return menu;
 }
@@ -2234,27 +2273,27 @@ static GtkWidget *collection_table_drop_menu(CollectTable *ct)
  */
 
 static GtkTargetEntry collection_drag_types[] = {
-       { TARGET_APP_COLLECTION_MEMBER_STRING, 0, TARGET_APP_COLLECTION_MEMBER },
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>(TARGET_APP_COLLECTION_MEMBER_STRING), 0, TARGET_APP_COLLECTION_MEMBER },
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_collection_drag_types = 3;
 
 static GtkTargetEntry collection_drop_types[] = {
-       { TARGET_APP_COLLECTION_MEMBER_STRING, 0, TARGET_APP_COLLECTION_MEMBER },
-       { "text/uri-list", 0, TARGET_URI_LIST }
+       { const_cast<gchar *>(TARGET_APP_COLLECTION_MEMBER_STRING), 0, TARGET_APP_COLLECTION_MEMBER },
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST }
 };
 static gint n_collection_drop_types = 2;
 
 
-static void collection_table_dnd_get(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context),
+static void collection_table_dnd_get(GtkWidget *, GdkDragContext *,
                                     GtkSelectionData *selection_data, guint info,
-                                    guint UNUSED(time), gpointer data)
+                                    guint, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
        gboolean selected;
-       GList *list = NULL;
-       gchar *uri_text = NULL;
+       GList *list = nullptr;
+       gchar *uri_text = nullptr;
        gint total;
 
        if (!ct->click_info) return;
@@ -2270,12 +2309,12 @@ static void collection_table_dnd_get(GtkWidget *UNUSED(widget), GdkDragContext *
                                }
                        else
                                {
-                               list = g_list_append(NULL, ct->click_info);
+                               list = g_list_append(nullptr, ct->click_info);
                                uri_text = collection_info_list_to_dnd_data(ct->cd, list, &total);
                                g_list_free(list);
                                }
                        gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
-                                               8, (guchar *)uri_text, total);
+                                               8, reinterpret_cast<guchar *>(uri_text), total);
                        g_free(uri_text);
                        break;
                case TARGET_URI_LIST:
@@ -2287,7 +2326,7 @@ static void collection_table_dnd_get(GtkWidget *UNUSED(widget), GdkDragContext *
                                }
                        else
                                {
-                               list = g_list_append(NULL, file_data_ref(ct->click_info->fd));
+                               list = g_list_append(nullptr, file_data_ref(ct->click_info->fd));
                                }
                        if (!list) return;
 
@@ -2298,14 +2337,14 @@ static void collection_table_dnd_get(GtkWidget *UNUSED(widget), GdkDragContext *
 }
 
 
-static void collection_table_dnd_receive(GtkWidget *UNUSED(widget), GdkDragContext *context,
+static void collection_table_dnd_receive(GtkWidget *, GdkDragContext *context,
                                          gint x, gint y,
                                          GtkSelectionData *selection_data, guint info,
-                                         guint UNUSED(time), gpointer data)
+                                         guint, gpointer data)
 {
-       CollectTable *ct = data;
-       GList *list = NULL;
-       GList *info_list = NULL;
+       auto ct = static_cast<CollectTable *>(data);
+       GList *list = nullptr;
+       GList *info_list = nullptr;
        CollectionData *source;
        CollectInfo *drop_info;
        GList *work;
@@ -2313,14 +2352,14 @@ static void collection_table_dnd_receive(GtkWidget *UNUSED(widget), GdkDragConte
        DEBUG_1("%s", gtk_selection_data_get_data(selection_data));
 
        collection_table_scroll(ct, FALSE);
-       collection_table_insert_marker(ct, NULL, FALSE);
+       collection_table_insert_marker(ct, nullptr, FALSE);
 
        drop_info = collection_table_insert_point(ct, x, y);
 
        switch (info)
                {
                case TARGET_APP_COLLECTION_MEMBER:
-                       source = collection_from_dnd_data((gchar *)gtk_selection_data_get_data(selection_data), &list, &info_list);
+                       source = collection_from_dnd_data(reinterpret_cast<const gchar *>(gtk_selection_data_get_data(selection_data)), &list, &info_list);
                        if (source)
                                {
                                if (source == ct->cd)
@@ -2330,7 +2369,7 @@ static void collection_table_dnd_receive(GtkWidget *UNUSED(widget), GdkDragConte
 
                                        /* it is a move within a collection */
                                        filelist_free(list);
-                                       list = NULL;
+                                       list = nullptr;
 
                                        if (!drop_info)
                                                {
@@ -2357,7 +2396,7 @@ static void collection_table_dnd_receive(GtkWidget *UNUSED(widget), GdkDragConte
                        work = list;
                        while (work)
                                {
-                               FileData *fd = work->data;
+                               auto fd = static_cast<FileData *>(work->data);
                                if (isdir(fd->path))
                                        {
                                        GtkWidget *menu;
@@ -2365,14 +2404,14 @@ static void collection_table_dnd_receive(GtkWidget *UNUSED(widget), GdkDragConte
                                        ct->drop_list = list;
                                        ct->drop_info = drop_info;
                                        menu = collection_table_drop_menu(ct);
-                                       gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
+                                       gtk_menu_popup_at_pointer(GTK_MENU(menu), nullptr);
                                        return;
                                        }
                                work = work->next;
                                }
                        break;
                default:
-                       list = NULL;
+                       list = nullptr;
                        break;
                }
 
@@ -2385,7 +2424,7 @@ static void collection_table_dnd_receive(GtkWidget *UNUSED(widget), GdkDragConte
 
 static void collection_table_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        if (ct->click_info && ct->click_info->pixbuf)
                {
@@ -2399,9 +2438,9 @@ static void collection_table_dnd_begin(GtkWidget *widget, GdkDragContext *contex
                }
 }
 
-static void collection_table_dnd_end(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context), gpointer data)
+static void collection_table_dnd_end(GtkWidget *, GdkDragContext *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        /* apparently a leave event is not generated on a drop */
        tip_unschedule(ct);
@@ -2409,10 +2448,9 @@ static void collection_table_dnd_end(GtkWidget *UNUSED(widget), GdkDragContext *
        collection_table_scroll(ct, FALSE);
 }
 
-static gint collection_table_dnd_motion(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context),
-                                       gint x, gint y, guint UNUSED(time), gpointer data)
+static gint collection_table_dnd_motion(GtkWidget *, GdkDragContext *, gint x, gint y, guint, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_motion_update(ct, x, y, TRUE);
        collection_table_scroll(ct, TRUE);
@@ -2420,18 +2458,18 @@ static gint collection_table_dnd_motion(GtkWidget *UNUSED(widget), GdkDragContex
        return FALSE;
 }
 
-static void collection_table_dnd_leave(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context), guint UNUSED(time), gpointer data)
+static void collection_table_dnd_leave(GtkWidget *, GdkDragContext *, guint, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_scroll(ct, FALSE);
 }
 
 static void collection_table_dnd_init(CollectTable *ct)
 {
-       gtk_drag_source_set(ct->listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
+       gtk_drag_source_set(ct->listview, static_cast<GdkModifierType>(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK),
                            collection_drag_types, n_collection_drag_types,
-                           GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+                           static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK));
        g_signal_connect(G_OBJECT(ct->listview), "drag_data_get",
                         G_CALLBACK(collection_table_dnd_get), ct);
        g_signal_connect(G_OBJECT(ct->listview), "drag_begin",
@@ -2440,9 +2478,9 @@ static void collection_table_dnd_init(CollectTable *ct)
                         G_CALLBACK(collection_table_dnd_end), ct);
 
        gtk_drag_dest_set(ct->listview,
-                         GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP,
+                         static_cast<GtkDestDefaults>(GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP),
                          collection_drop_types, n_collection_drop_types,
-                         GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+                         static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK));
        g_signal_connect(G_OBJECT(ct->listview), "drag_motion",
                         G_CALLBACK(collection_table_dnd_motion), ct);
        g_signal_connect(G_OBJECT(ct->listview), "drag_leave",
@@ -2457,25 +2495,26 @@ static void collection_table_dnd_init(CollectTable *ct)
  *-----------------------------------------------------------------------------
  */
 
-typedef struct _ColumnData ColumnData;
-struct _ColumnData
+struct ColumnData
 {
        CollectTable *ct;
        gint number;
 };
 
-static void collection_table_cell_data_cb(GtkTreeViewColumn *UNUSED(tree_column), GtkCellRenderer *cell,
+static void collection_table_cell_data_cb(GtkTreeViewColumn *, GtkCellRenderer *cell,
                                          GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
 {
-       ColumnData *cd = data;
+       auto cd = static_cast<ColumnData *>(data);
+       CollectInfo *info;
        CollectTable *ct;
-       GtkStyle *style;
+       gchar *display_text = nullptr;
+       gchar *star_rating = nullptr;
+       GdkRGBA color_bg;
+       GdkRGBA color_bg_style;
+       GdkRGBA color_fg;
+       GdkRGBA color_fg_style;
        GList *list;
-       CollectInfo *info;
-       GdkColor color_fg;
-       GdkColor color_bg;
-       gchar *star_rating = NULL;
-       gchar *display_text = NULL;
+       GtkStyle *style;
 
        ct = cd->ct;
 
@@ -2488,18 +2527,27 @@ static void collection_table_cell_data_cb(GtkTreeViewColumn *UNUSED(tree_column)
         */
        if (cd->number == COLLECT_TABLE_MAX_COLUMNS) return;
 
-       info = g_list_nth_data(list, cd->number);
+       info = static_cast<CollectInfo *>(g_list_nth_data(list, cd->number));
 
        style = gtk_widget_get_style(ct->listview);
        if (info && (info->flag_mask & SELECTION_SELECTED) )
                {
-               memcpy(&color_fg, &style->text[GTK_STATE_SELECTED], sizeof(color_fg));
-               memcpy(&color_bg, &style->base[GTK_STATE_SELECTED], sizeof(color_bg));
+               convert_gdkcolor_to_gdkrgba(&style->text[GTK_STATE_SELECTED], &color_fg_style);
+               convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_SELECTED], &color_bg_style);
+
+               memcpy(&color_fg, &color_fg_style, sizeof(color_fg));
+               memcpy(&color_bg, &color_bg_style, sizeof(color_bg));
                }
        else
                {
-               memcpy(&color_fg, &style->text[GTK_STATE_NORMAL], sizeof(color_fg));
-               memcpy(&color_bg, &style->base[GTK_STATE_NORMAL], sizeof(color_bg));
+               convert_gdkcolor_to_gdkrgba(&style->text[GTK_STATE_NORMAL], &color_fg_style);
+               convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color_bg_style);
+
+               memcpy(&color_fg, &color_fg_style, sizeof(color_fg));
+               memcpy(&color_bg, &color_bg_style, sizeof(color_bg));
+
+               memcpy(&color_fg, &color_fg_style, sizeof(color_fg));
+               memcpy(&color_bg, &color_bg_style, sizeof(color_bg));
                }
 
        if (info && (info->flag_mask & SELECTION_PRELIGHT))
@@ -2546,9 +2594,9 @@ static void collection_table_cell_data_cb(GtkTreeViewColumn *UNUSED(tree_column)
                        {
                        g_object_set(cell,      "pixbuf", info->pixbuf,
                                                "text",  display_text,
-                                               "cell-background-gdk", &color_bg,
+                                               "cell-background-rgba", &color_bg,
                                                "cell-background-set", TRUE,
-                                               "foreground-gdk", &color_fg,
+                                               "foreground-rgba", &color_fg,
                                                "foreground-set", TRUE,
                                                "has-focus", (ct->focus_info == info), NULL);
                        }
@@ -2600,9 +2648,9 @@ static void collection_table_append_column(CollectTable *ct, gint n)
  *-------------------------------------------------------------------
  */
 
-static void collection_table_destroy(GtkWidget *UNUSED(widget), gpointer data)
+static void collection_table_destroy(GtkWidget *, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        /* If there is no unsaved data, save the window geometry
         */
@@ -2617,8 +2665,8 @@ static void collection_table_destroy(GtkWidget *UNUSED(widget), gpointer data)
        if (ct->popup)
                {
                g_signal_handlers_disconnect_matched(G_OBJECT(ct->popup), G_SIGNAL_MATCH_DATA,
-                                                    0, 0, 0, NULL, ct);
-               gtk_widget_destroy(ct->popup);
+                                                    0, 0, nullptr, nullptr, ct);
+               g_object_unref(ct->popup);
                }
 
        if (ct->sync_idle_id) g_source_remove(ct->sync_idle_id);
@@ -2629,9 +2677,9 @@ static void collection_table_destroy(GtkWidget *UNUSED(widget), gpointer data)
        g_free(ct);
 }
 
-static void collection_table_sized(GtkWidget *UNUSED(widget), GtkAllocation *allocation, gpointer data)
+static void collection_table_sized(GtkWidget *, GtkAllocation *allocation, gpointer data)
 {
-       CollectTable *ct = data;
+       auto ct = static_cast<CollectTable *>(data);
 
        collection_table_populate_at_new_size(ct, allocation->width, allocation->height, FALSE);
 }
@@ -2649,8 +2697,8 @@ CollectTable *collection_table_new(CollectionData *cd)
        ct->show_text = options->show_icon_names;
        ct->show_stars = options->show_star_rating;
 
-       ct->scrolled = gtk_scrolled_window_new(NULL, NULL);
-       gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ct->scrolled), GTK_SHADOW_IN);
+       ct->scrolled = gq_gtk_scrolled_window_new(nullptr, nullptr);
+       gq_gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ct->scrolled), GTK_SHADOW_IN);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ct->scrolled),
                                       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
@@ -2681,13 +2729,13 @@ CollectTable *collection_table_new(CollectionData *cd)
        g_signal_connect(G_OBJECT(ct->listview), "key_press_event",
                         G_CALLBACK(collection_table_press_key_cb), ct);
 
-       gtk_container_add(GTK_CONTAINER(ct->scrolled), ct->listview);
+       gq_gtk_container_add(GTK_WIDGET(ct->scrolled), ct->listview);
        gtk_widget_show(ct->listview);
 
        collection_table_dnd_init(ct);
 
        gtk_widget_set_events(ct->listview, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK |
-                             GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK);
+                             static_cast<GdkEventMask>(GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK));
        g_signal_connect(G_OBJECT(ct->listview),"button_press_event",
                         G_CALLBACK(collection_table_press_cb), ct);
        g_signal_connect(G_OBJECT(ct->listview),"button_release_event",
@@ -2710,7 +2758,7 @@ void collection_table_set_labels(CollectTable *ct, GtkWidget *status, GtkWidget
 
 CollectInfo *collection_table_get_focus_info(CollectTable *ct)
 {
-       return collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL);
+       return collection_table_find_data(ct, ct->focus_row, ct->focus_column, nullptr);
 }
 
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */