#include "dupe.h"
#include "cache.h"
-#include "collect.h"
#include "collect-table.h"
#include "dnd.h"
-#include "editors.h"
#include "filedata.h"
#include "history-list.h"
#include "image-load.h"
#include "img-view.h"
-#include "layout.h"
#include "layout-image.h"
#include "layout-util.h"
#include "md5-util.h"
#include "utilops.h"
#include "window.h"
-#include <gdk/gdkkeysyms.h> /* for keyboard values */
-
-
#include <math.h>
{GDK_CONTROL_MASK, 'R', N_("Rename")},
{GDK_CONTROL_MASK, 'D', N_("Move to Trash")},
{GDK_SHIFT_MASK, GDK_KEY_Delete, N_("Delete")},
- {0, GDK_KEY_Delete, N_("Remove")},
+ {static_cast<GdkModifierType>(0), GDK_KEY_Delete, N_("Remove")},
{GDK_CONTROL_MASK, GDK_KEY_Delete, N_("Clear")},
{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_CONTROL_MASK, 'T', N_("Toggle thumbs")},
{GDK_CONTROL_MASK, 'W', N_("Close window")},
- {0, GDK_KEY_Return, N_("View")},
- {0, 'V', N_("View in new window")},
- {0, 'C', N_("Collection from selection")},
+ {static_cast<GdkModifierType>(0), GDK_KEY_Return, N_("View")},
+ {static_cast<GdkModifierType>(0), 'V', N_("View in new window")},
+ {static_cast<GdkModifierType>(0), 'C', N_("Collection from selection")},
{GDK_CONTROL_MASK, 'L', N_("Append list")},
- {0, '0', N_("Select none")},
- {0, '1', N_("Select group 1 duplicates")},
- {0, '2', N_("Select group 2 duplicates")},
- {0, 0, NULL}
+ {static_cast<GdkModifierType>(0), '0', N_("Select none")},
+ {static_cast<GdkModifierType>(0), '1', N_("Select group 1 duplicates")},
+ {static_cast<GdkModifierType>(0), '2', N_("Select group 2 duplicates")},
+ {static_cast<GdkModifierType>(0), 0, NULL}
};
/**
*/
static void dupe_comparison_func(gpointer d1, gpointer d2)
{
- DupeQueueItem *dqi = d1;
- DupeWindow *dw = d2;
+ DupeQueueItem *dqi = static_cast<DupeQueueItem *>(d1);
+ DupeWindow *dw = static_cast<DupeWindow *>(d2);
DupeSearchMatch *dsm;
DupeItem *di;
GList *matches = NULL;
GList *work = dqi->work;
while (work)
{
- di = work->data;
+ di = static_cast<DupeItem *>(work->data);
/* forward for second set, back for simple compare */
if (dw->second_set)
}
else
{
- cursor = gdk_cursor_new(icon);
+ cursor = gdk_cursor_new(static_cast<GdkCursorType>(icon));
}
gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
GList *work = list;
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
work = work->next;
dupe_item_free(di);
}
{
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
if (di->fd == fd) return di;
{
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
if (strcmp(di->fd->path, path) == 0) return di;
if (child->group)
{
- dm = child->group->data;
+ dm = static_cast<DupeMatch *>(child->group->data);
rank = (gint)floor(dm->rank);
}
else
text[DUPE_COLUMN_RANK] = g_strdup_printf("%d%s", rank, (di->second) ? " (2)" : "");
}
- text[DUPE_COLUMN_THUMB] = "";
+ text[DUPE_COLUMN_THUMB] = _("");
text[DUPE_COLUMN_NAME] = (gchar *)di->fd->name;
text[DUPE_COLUMN_SIZE] = text_from_size(di->fd->size);
text[DUPE_COLUMN_DATE] = (gchar *)text_from_time(di->fd->date);
work = g_list_last(dw->dupes);
while (work)
{
- DupeItem *parent = work->data;
+ DupeItem *parent = static_cast<DupeItem *>(work->data);
GList *temp;
dupe_listview_add(dw, parent, NULL);
temp = g_list_last(parent->group);
while (temp)
{
- DupeMatch *dm = temp->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(temp->data);
DupeItem *child;
child = dm->di;
work = slist;
while (work)
{
- GtkTreePath *tpath = work->data;
+ GtkTreePath *tpath = static_cast<GtkTreePath *>(work->data);
DupeItem *di = NULL;
GtkTreeIter iter;
work = slist;
while (!found && work)
{
- GtkTreePath *tpath = work->data;
+ GtkTreePath *tpath = static_cast<GtkTreePath *>(work->data);
DupeItem *di_n;
GtkTreeIter iter;
work = parent->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
if (dm->di == child) return dm;
work = work->next;
}
work = parent->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
work = work->next;
if (unlink_children) dupe_match_unlink_child(parent, dm->di);
work = child->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
if (!dr || dm->rank > dr->rank)
{
dr = dm;
work = parent->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
work = work->next;
rank += dm->rank;
c++;
work = child->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
if (g_list_find(dw->dupes, dm->di)) return dm->di;
work = work->next;
}
{
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
work = work->next;
dupe_match_link_clear(di, FALSE);
work = old_parent->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
dupe_match_unlink_child(old_parent, dm->di);
dupe_match_link_child(new_parent, dm->di, dm->rank);
work = work->next;
work = di->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
work = work->next;
log_printf(" %f %s\n", dm->rank, dm->di->fd->name);
work = list;
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
dupe_match_print_group(di);
work = work->next;
}
work = parent->group;
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
DupeItem *orphan;
work = work->next;
work = g_list_last(di->group);
while (work)
{
- DupeMatch *dm = work->data;
+ DupeMatch *dm = static_cast<DupeMatch *>(work->data);
work = work->prev;
list = dupe_match_unlink_by_rank(di, dm->di, list, dw);
}
work = list;
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
if (!di->second) list = dupe_match_group_filter(list, di, dw);
work = work->next;
if (di->second) list = g_list_remove(list, di);
work = list;
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
di->group = g_list_sort(di->group, dupe_match_sort_groups_cb);
work = work->next;
}
work = source_list;
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
if (di->group)
{
*/
static DUPE_CHECK_RESULT dupe_match_check(DupeItem *di1, DupeItem *di2, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
DupeMatchType mask = dw->match_mask;
if (mask & DUPE_MATCH_ALL)
static gint dupe_match_binary_search_cb(gconstpointer a, gconstpointer b)
{
const DupeItem *di1 = *((DupeItem **) a);
- const DupeItem *di2 = b;
+ const DupeItem *di2 = static_cast<const DupeItem *>(b);
DupeMatchType mask = param_match_mask;
if (mask & DUPE_MATCH_ALL)
{
const DupeItem *di1 = *((DupeItem **) a);
const DupeItem *di2 = *((DupeItem **) b);
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
DupeMatchType mask = dw->match_mask;
if (mask & DUPE_MATCH_ALL)
work = dw->list;
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
g_array_append_val(array_set1, di);
work = work->next;
}
for (i_set1 = 0; i_set1 <= (gint)(array_set1->len) - 1; i_set1++)
{
- DupeItem *di1 = g_array_index(array_set1, gpointer, i_set1);
+ DupeItem *di1 = static_cast<DupeItem *>(g_array_index(array_set1, gpointer, i_set1));
DupeItem *di2 = NULL;
/* If multiple identical entries in set 1, use the last one */
if (i_set1 < (gint)(array_set1->len) - 2)
{
- di2 = g_array_index(array_set1, gpointer, i_set1 + 1);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set1, gpointer, i_set1 + 1));
check_result = dupe_match_check(di1, di2, dw);
if (check_result == DUPE_MATCH || check_result == DUPE_NAME_MATCH)
{
match_found = FALSE;
for(i=0; i < array_set2->len; i++)
{
- di2 = g_array_index(array_set2, gpointer, i);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set2, gpointer, i));
check_result = dupe_match_check(di1, di2, dw);
if (check_result == DUPE_MATCH)
{
if (match_found)
{
- di2 = g_array_index(array_set2, gpointer, out_match_index);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set2, gpointer, out_match_index));
check_result = dupe_match_check(di1, di2, dw);
if (check_result == DUPE_MATCH || check_result == DUPE_NAME_MATCH)
break;
}
/* Look for multiple matches in set 2 for item di1 */
- di2 = g_array_index(array_set2, gpointer, i_set2);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set2, gpointer, i_set2));
check_result = dupe_match_check(di1, di2, dw);
while (check_result == DUPE_MATCH || check_result == DUPE_NAME_MATCH)
{
{
break;
}
- di2 = g_array_index(array_set2, gpointer, i_set2);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set2, gpointer, i_set2));
check_result = dupe_match_check(di1, di2, dw);
}
}
{
for (i_set1 = 0; i_set1 <= (gint)(array_set1->len) - 2; i_set1++)
{
- DupeItem *di1 = g_array_index(array_set1, gpointer, i_set1);
- DupeItem *di2 = g_array_index(array_set1, gpointer, i_set1 + 1);
+ DupeItem *di1 = static_cast<DupeItem *>(g_array_index(array_set1, gpointer, i_set1));
+ DupeItem *di2 = static_cast<DupeItem *>(g_array_index(array_set1, gpointer, i_set1 + 1));
check_result = dupe_match_check(di1, di2, dw);
if (check_result == DUPE_MATCH || check_result == DUPE_NAME_MATCH)
break;
}
/* Look for multiple matches for item di1 */
- di2 = g_array_index(array_set1, gpointer, i_set1 + 1);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set1, gpointer, i_set1 + 1));
check_result = dupe_match_check(di1, di2, dw);
while (check_result == DUPE_MATCH || check_result == DUPE_NAME_MATCH)
{
{
break;
}
- di2 = g_array_index(array_set1, gpointer, i_set1 + 1);
+ di2 = static_cast<DupeItem *>(g_array_index(array_set1, gpointer, i_set1 + 1));
check_result = dupe_match_check(di1, di2, dw);
}
}
static void dupe_thumb_error_cb(ThumbLoader *UNUSED(tl), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_thumb_do(dw);
dupe_thumb_step(dw);
static void dupe_thumb_done_cb(ThumbLoader *UNUSED(tl), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_thumb_do(dw);
dupe_thumb_step(dw);
static void dupe_check_stop_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_check_stop(dw);
}
static void dupe_loader_done_cb(ImageLoader *il, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GdkPixbuf *pixbuf;
pixbuf = image_loader_get_pixbuf(il);
if (dw->setup_point)
{
- DupeItem *di = dw->setup_point->data;
+ DupeItem *di = static_cast<DupeItem *>(dw->setup_point->data);
if (!di->simd)
{
while (dw->setup_point)
{
- DupeItem *di = dw->setup_point->data;
+ DupeItem *di = static_cast<DupeItem *>(dw->setup_point->data);
dw->setup_point = dupe_setup_point_step(dw, dw->setup_point);
dw->setup_n++;
while (dw->setup_point)
{
- DupeItem *di = dw->setup_point->data;
+ DupeItem *di = static_cast<DupeItem *>(dw->setup_point->data);
dw->setup_point = dupe_setup_point_step(dw, dw->setup_point);
dw->setup_n++;
*/
static gboolean dupe_check_cb(gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
DupeSearchMatch *search_match_list_item;
if (!dw->idle_id)
{
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (!dw->setup_done) /* Clear on 1st entry */
{
if (create_checksums_dimensions(dw, dw->list))
{
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
}
if (dw->second_list)
{
if (create_checksums_dimensions(dw, dw->second_list))
{
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
}
if ((dw->match_mask & DUPE_MATCH_SIM_HIGH ||
while (dw->setup_point)
{
- DupeItem *di = dw->setup_point->data;
+ DupeItem *di = static_cast<DupeItem *>(dw->setup_point->data);
if (!di->simd)
{
if (cache_sim_data_filled(di->simd))
{
image_sim_alternate_processing(di->simd);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
}
di->simd = image_sim_new();
image_loader_free(dw->img_loader);
dw->img_loader = NULL;
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
dw->idle_id = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
dw->setup_point = dupe_setup_point_step(dw, dw->setup_point);
dw->setup_n++;
}
- dw->setup_mask |= DUPE_MATCH_SIM_MED;
+ dw->setup_mask = static_cast<DupeMatchType>(dw->setup_mask | DUPE_MATCH_SIM_MED);
dupe_setup_reset(dw);
}
{
dupe_window_update_progress(dw, _("Comparing..."), 0.0, FALSE);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
if (dw->search_matches_sorted == NULL)
{
dw->setup_n++;
dupe_window_update_progress(dw, _("Sorting..."), 0.0, FALSE);
- search_match_list_item = dw->search_matches_sorted->data;
+ search_match_list_item = static_cast<DupeSearchMatch *>(dw->search_matches_sorted->data);
if (!dupe_match_link_exists(search_match_list_item->a, search_match_list_item->b))
{
if (dw->search_matches_sorted != NULL)
{
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
}
g_list_free(dw->search_matches);
{
dw->setup_count = 0;
dupe_window_update_progress(dw, _("Sorting..."), 1.0, TRUE);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
}
widget_set_cursor(dw->listview, -1);
- return FALSE;
+ return G_SOURCE_REMOVE;
/* The end */
}
dupe_array_check(dw);
}
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static void dupe_check_start(DupeWindow *dw)
dw->setup_count = g_list_length(dw->list);
if (dw->second_set) dw->setup_count += g_list_length(dw->second_list);
- dw->setup_mask = 0;
+ dw->setup_mask = DUPE_MATCH_NONE;
dupe_setup_reset(dw);
dw->working = g_list_last(dw->list);
static gboolean dupe_check_start_cb(gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_check_start(dw);
DupeItem *new_parent;
DupeMatch *dm;
- dm = parent->group->data;
+ dm = static_cast<DupeMatch *>(parent->group->data);
new_parent = dm->di;
dupe_match_reparent(dw, parent, new_parent);
dupe_listview_remove(dw, parent);
static gboolean dupe_files_add_queue_cb(gpointer data)
{
DupeItem *di = NULL;
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
FileData *fd;
GList *queue = dw->add_files_queue;
return FALSE;
}
- fd = queue->data;
+ fd = static_cast<FileData *>(queue->data);
if (fd)
{
if (isfile(fd->path))
work = g_list_first(dw->list);
while (work)
{
- di_list = work->data;
+ di_list = static_cast<DupeItem *>(work->data);
if (di_list->fd == di->fd)
{
return;
work = g_list_first(dw->second_list);
while (work)
{
- di_list = work->data;
+ di_list = static_cast<DupeItem *>(work->data);
if (di_list->fd == di->fd)
{
return;
for (GList *i = dw->list; i != NULL; i = i->next)
{
- DupeItem *di = i->data;
+ DupeItem *di = static_cast<DupeItem *>(i->data);
g_hash_table_add(dw->list_cache, di->fd);
}
for (GList *i = dw->second_list; i != NULL; i = i->next)
{
- DupeItem *di = i->data;
+ DupeItem *di = static_cast<DupeItem *>(i->data);
g_hash_table_add(dw->second_list_cache, di->fd);
}
work = list;
while (work)
{
- FileData *fd = work->data;
+ FileData *fd = static_cast<FileData *>(work->data);
work = work->next;
if (isdir(fd->path) && !recurse)
{
{
while (work)
{
- DupeItem *di = work->data;
+ DupeItem *di = static_cast<DupeItem *>(work->data);
if (di->fd == fd)
dupe_item_update(dw, di);
work = slist;
while (work)
{
- GtkTreePath *tpath = work->data;
+ GtkTreePath *tpath = static_cast<GtkTreePath *>(work->data);
DupeItem *di = NULL;
gtk_tree_model_get_iter(store, &iter, tpath);
{
DupeItem *di;
- di = work->data;
+ di = static_cast<DupeItem *>(work->data);
work = work->next;
dupe_item_remove(dw, di);
}
static void dupe_menu_view_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
if (dw->click_item) dupe_menu_view(dw, dw->click_item, dw->listview, FALSE);
}
static void dupe_menu_viewnew_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
if (dw->click_item) dupe_menu_view(dw, dw->click_item, dw->listview, TRUE);
}
static void dupe_menu_select_all_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GtkTreeSelection *selection;
options->duplicates_select_type = DUPE_SELECT_NONE;
static void dupe_menu_select_none_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GtkTreeSelection *selection;
options->duplicates_select_type = DUPE_SELECT_NONE;
static void dupe_menu_select_dupes_set1_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->duplicates_select_type = DUPE_SELECT_GROUP1;
dupe_listview_select_dupes(dw, DUPE_SELECT_GROUP1);
static void dupe_menu_select_dupes_set2_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->duplicates_select_type = DUPE_SELECT_GROUP2;
dupe_listview_select_dupes(dw, DUPE_SELECT_GROUP2);
static void dupe_menu_edit_cb(GtkWidget *widget, gpointer data)
{
DupeWindow *dw;
- const gchar *key = data;
+ const gchar *key = static_cast<const gchar *>(data);
- dw = submenu_item_get_data(widget);
+ dw = static_cast<DupeWindow *>(submenu_item_get_data(widget));
if (!dw) return;
dupe_window_edit_selected(dw, key);
static void dupe_menu_print_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
FileData *fd;
fd = (dw->click_item) ? dw->click_item->fd : NULL;
static void dupe_menu_copy_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
file_util_copy(NULL, dupe_listview_get_selection(dw, dw->listview), NULL, dw->window);
}
static void dupe_menu_move_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
file_util_move(NULL, dupe_listview_get_selection(dw, dw->listview), NULL, dw->window);
}
static void dupe_menu_rename_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
file_util_rename(NULL, dupe_listview_get_selection(dw, dw->listview), dw->window);
}
static void dupe_menu_delete_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->file_ops.safe_delete_enable = FALSE;
file_util_delete_notify_done(NULL, dupe_listview_get_selection(dw, dw->listview), dw->window, delete_finished_cb, dw);
static void dupe_menu_move_to_trash_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->file_ops.safe_delete_enable = TRUE;
file_util_delete_notify_done(NULL, dupe_listview_get_selection(dw, dw->listview), dw->window, delete_finished_cb, dw);
static void dupe_menu_copy_path_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
file_util_copy_path_list_to_clipboard(dupe_listview_get_selection(dw, dw->listview), TRUE);
}
static void dupe_menu_copy_path_unquoted_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
file_util_copy_path_list_to_clipboard(dupe_listview_get_selection(dw, dw->listview), FALSE);
}
static void dupe_menu_remove_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_window_remove_selection(dw, dw->listview);
}
static void dupe_menu_clear_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_window_clear(dw);
}
static void dupe_menu_close_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_window_close(dw);
}
static void dupe_menu_popup_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- GList *editmenu_fd_list = data;
+ GList *editmenu_fd_list = static_cast<GList *>(data);
filelist_free(editmenu_fd_list);
}
DupeWindow *dw;
GList *selection_list;
- dw = submenu_item_get_data(widget);
+ dw = static_cast<DupeWindow *>(submenu_item_get_data(widget));
selection_list = dupe_listview_get_selection(dw, dw->listview);
pop_menu_collections(selection_list, data);
static gboolean dupe_listview_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GtkTreeModel *store;
GtkTreePath *tpath;
GtkTreeIter iter;
static gboolean dupe_listview_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GtkTreeModel *store;
GtkTreePath *tpath;
GtkTreeIter iter;
static void dupe_second_menu_view_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
if (dw->click_item) dupe_menu_view(dw, dw->click_item, dw->second_listview, FALSE);
}
static void dupe_second_menu_viewnew_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
if (dw->click_item) dupe_menu_view(dw, dw->click_item, dw->second_listview, TRUE);
}
static void dupe_second_menu_select_all_cb(GtkWidget *UNUSED(widget), gpointer data)
{
GtkTreeSelection *selection;
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dw->second_listview));
gtk_tree_selection_select_all(selection);
static void dupe_second_menu_select_none_cb(GtkWidget *UNUSED(widget), gpointer data)
{
GtkTreeSelection *selection;
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dw->second_listview));
gtk_tree_selection_unselect_all(selection);
static void dupe_second_menu_remove_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_window_remove_selection(dw, dw->second_listview);
}
static void dupe_second_menu_clear_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_second_clear(dw);
dupe_window_recompare(dw);
static void dupe_second_set_toggle_cb(GtkWidget *widget, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dw->second_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
static void dupe_sort_totals_toggle_cb(GtkWidget *widget, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->sort_totals = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
dupe_window_recompare(dw);
static void dupe_menu_type_cb(GtkWidget *combo, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GtkTreeModel *store;
GtkTreeIter iter;
static void dupe_listview_color_cb(GtkTreeViewColumn *UNUSED(tree_column), GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
gboolean set;
gtk_tree_model_get(tree_model, iter, DUPE_COLUMN_COLOR, &set, -1);
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
if (!list) return;
- cell = list->data;
+ cell = static_cast<GtkCellRenderer *>(list->data);
g_list_free(list);
g_object_set(G_OBJECT(cell), "height", (thumb) ? options->thumbnails.max_height : -1, NULL);
static void dupe_window_show_thumb_cb(GtkWidget *widget, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dw->show_thumbs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
options->duplicates_thumbnails = dw->show_thumbs;
static void dupe_window_rotation_invariant_cb(GtkWidget *widget, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->rot_invariant_sim = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
dupe_window_recompare(dw);
static void dupe_window_custom_threshold_cb(GtkWidget *widget, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
DupeMatchType match_type;
GtkTreeModel *store;
gboolean valid;
static gboolean dupe_window_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
gboolean stop_signal = FALSE;
gboolean on_second;
GtkWidget *listview;
GList *last;
last = g_list_last(slist);
- tpath = last->data;
+ tpath = static_cast<GtkTreePath *>(last->data);
/* last is newest selected file */
gtk_tree_model_get_iter(store, &iter, tpath);
static gint dupe_window_close_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_window_close(dw);
static gint dupe_window_delete(GtkWidget *UNUSED(widget), GdkEvent *UNUSED(event), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_window_close(dw);
return TRUE;
static gint column_sort_cb(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
{
- GtkTreeSortable *sortable = data;
+ GtkTreeSortable *sortable = static_cast<GtkTreeSortable *>(data);
gint ret = 0;
gchar *rank_str_a, *rank_str_b;
gint rank_int_a;
static void column_clicked_cb(GtkWidget *UNUSED(widget), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
options->duplicates_match = DUPE_SELECT_NONE;
dupe_listview_select_dupes(dw, DUPE_SELECT_NONE);
geometry.base_width = DUPE_DEF_WIDTH;
geometry.base_height = DUPE_DEF_HEIGHT;
gtk_window_set_geometry_hints(GTK_WINDOW(dw->window), NULL, &geometry,
- GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
+ static_cast<GdkWindowHints>(GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE));
if (lw && options->save_window_positions)
{
static void confirm_dir_list_add(GtkWidget *UNUSED(widget), gpointer data)
{
- CDupeConfirmD *d = data;
+ CDupeConfirmD *d = static_cast<CDupeConfirmD *>(data);
GList *work;
dupe_window_add_files(d->dw, d->list, FALSE);
work = d->list;
while (work)
{
- FileData *fd = work->data;
+ FileData *fd = static_cast<FileData *>(work->data);
work = work->next;
if (isdir(fd->path))
{
static void confirm_dir_list_recurse(GtkWidget *UNUSED(widget), gpointer data)
{
- CDupeConfirmD *d = data;
+ CDupeConfirmD *d = static_cast<CDupeConfirmD *>(data);
dupe_window_add_files(d->dw, d->list, TRUE);
}
static void confirm_dir_list_skip(GtkWidget *UNUSED(widget), gpointer data)
{
- CDupeConfirmD *d = data;
+ CDupeConfirmD *d = static_cast<CDupeConfirmD *>(data);
dupe_window_add_files(d->dw, d->list, FALSE);
}
static void confirm_dir_list_destroy(GtkWidget *UNUSED(widget), gpointer data)
{
- CDupeConfirmD *d = data;
+ CDupeConfirmD *d = static_cast<CDupeConfirmD *>(data);
filelist_free(d->list);
g_free(d);
}
*/
static GtkTargetEntry dupe_drag_types[] = {
- { "text/uri-list", 0, TARGET_URI_LIST },
- { "text/plain", 0, TARGET_TEXT_PLAIN }
+ { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+ { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
};
static gint n_dupe_drag_types = 2;
static GtkTargetEntry dupe_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_dupe_drop_types = 2;
GtkSelectionData *selection_data, guint info,
guint UNUSED(time), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GList *list;
switch (info)
GtkSelectionData *selection_data, guint info,
guint UNUSED(time), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
GtkWidget *source;
GList *list = NULL;
GList *work;
work = list;
while (work)
{
- FileData *fd = work->data;
+ FileData *fd = static_cast<FileData *>(work->data);
if (isdir(fd->path))
{
GtkWidget *menu;
if (enable)
{
gtk_drag_dest_set(widget,
- 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),
dupe_drop_types, n_dupe_drop_types,
- GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+ static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK));
}
else
static void dupe_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_dest_set(dw->listview, FALSE);
dupe_dest_set(dw->second_listview, FALSE);
static void dupe_dnd_end(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
dupe_dest_set(dw->listview, TRUE);
dupe_dest_set(dw->second_listview, TRUE);
}
static void dupe_dnd_init(DupeWindow *dw)
{
- gtk_drag_source_set(dw->listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
+ gtk_drag_source_set(dw->listview, static_cast<GdkModifierType>(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK),
dupe_drag_types, n_dupe_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(dw->listview), "drag_data_get",
G_CALLBACK(dupe_dnd_data_set), dw);
g_signal_connect(G_OBJECT(dw->listview), "drag_begin",
g_signal_connect(G_OBJECT(dw->listview), "drag_data_received",
G_CALLBACK(dupe_dnd_data_get), dw);
- gtk_drag_source_set(dw->second_listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
+ gtk_drag_source_set(dw->second_listview, static_cast<GdkModifierType>(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK),
dupe_drag_types, n_dupe_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(dw->second_listview), "drag_data_get",
G_CALLBACK(dupe_dnd_data_set), dw);
g_signal_connect(G_OBJECT(dw->second_listview), "drag_begin",
static void dupe_notify_cb(FileData *fd, NotifyType type, gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
if (!(type & NOTIFY_CHANGE) || !fd->change) return;
*/
static void delete_finished_cb(gboolean success, const gchar *UNUSED(dest_path), gpointer data)
{
- DupeWindow *dw = data;
+ DupeWindow *dw = static_cast<DupeWindow *>(data);
if (!success)
{
static void export_duplicates_data_cancel_cb(FileDialog *UNUSED(fdlg), gpointer data)
{
- ExportDupesData *edd = data;
+ ExportDupesData *edd = static_cast<ExportDupesData *>(data);
export_duplicates_close(edd);
}
static void export_duplicates_data_save_cb(FileDialog *fdlg, gpointer data)
{
- ExportDupesData *edd = data;
+ ExportDupesData *edd = static_cast<ExportDupesData *>(data);
GError *error = NULL;
GtkTreeModel *store;
GtkTreeIter iter;
slist = gtk_tree_selection_get_selected_rows(selection, &store);
work = slist;
- tpath = work->data;
+ tpath = static_cast<GtkTreePath *>(work->data);
gtk_tree_model_get_iter(store, &iter, tpath);
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, DUPE_COLUMN_COLOR, &color_new, -1);
color_old = !color_new;
while (work)
{
- tpath = work->data;
+ tpath = static_cast<GtkTreePath *>(work->data);
gtk_tree_model_get_iter(store, &iter, tpath);
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, DUPE_COLUMN_POINTER, &di, -1);
output_string = g_string_append(output_string, sep);
g_free(name);
- output_string = g_string_append(output_string, g_strdup_printf("%"PRIu64, di->fd->size));
+ output_string = g_string_append(output_string, g_strdup_printf("%" PRIu64, di->fd->size));
output_string = g_string_append(output_string, sep);
output_string = g_string_append(output_string, text_from_time(di->fd->date));
output_string = g_string_append(output_string, sep);
static void pop_menu_export(GList *UNUSED(selection_list), gpointer dupe_window, gpointer data)
{
const gint index = GPOINTER_TO_INT(data);
- DupeWindow *dw = dupe_window;
- gchar *title = "Export duplicates data";
- gchar *default_path = "/tmp/";
+ DupeWindow *dw = static_cast<DupeWindow *>(dupe_window);
+ const gchar *title = "Export duplicates data";
+ const gchar *default_path = "/tmp/";
gchar *file_extension;
const gchar *stock_id;
ExportDupesData *edd;
DupeWindow *dw;
GList *selection_list;
- dw = submenu_item_get_data(widget);
+ dw = static_cast<DupeWindow *>(submenu_item_get_data(widget));
selection_list = dupe_listview_get_selection(dw, dw->listview);
pop_menu_export(selection_list, dw, data);