Skip to content

Commit

Permalink
Add the possibility to match duplicates on the name but ignoring the …
Browse files Browse the repository at this point in the history
…case.

A new item was added to types of match combo box in the Find duplicates dialog.
  • Loading branch information
Laurent Monin committed Apr 7, 2008
1 parent e0831fd commit da12ecf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/dupe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,10 @@ static gint dupe_match(DupeItem *a, DupeItem *b, DupeMatchType mask, gdouble *ra
{
if (strcmp(a->fd->name, b->fd->name) != 0) return FALSE;
}
if (mask & DUPE_MATCH_NAME_CI)
{
if (strcasecmp(a->fd->name, b->fd->name) != 0) return FALSE;
}
if (mask & DUPE_MATCH_SIZE)
{
if (a->fd->size != b->fd->size) return FALSE;
Expand Down Expand Up @@ -1796,7 +1800,7 @@ void dupe_window_add_files(DupeWindow *dw, GList *list, gint recurse)

static void dupe_item_update(DupeWindow *dw, DupeItem *di)
{
if ( (dw->match_mask & DUPE_MATCH_NAME) || (dw->match_mask & DUPE_MATCH_PATH) )
if ( (dw->match_mask & DUPE_MATCH_NAME) || (dw->match_mask & DUPE_MATCH_PATH || (dw->match_mask & DUPE_MATCH_NAME_CI)) )
{
/* only effects matches on name or path */
/*
Expand Down Expand Up @@ -2625,6 +2629,7 @@ static void dupe_menu_setup(DupeWindow *dw)
"text", DUPE_MENU_COLUMN_NAME, NULL);

dupe_menu_add_item(store, _("Name"), DUPE_MATCH_NAME, dw);
dupe_menu_add_item(store, _("Name case-insensitive"), DUPE_MATCH_NAME_CI, dw);
dupe_menu_add_item(store, _("Size"), DUPE_MATCH_SIZE, dw);
dupe_menu_add_item(store, _("Date"), DUPE_MATCH_DATE, dw);
dupe_menu_add_item(store, _("Dimensions"), DUPE_MATCH_DIM, dw);
Expand Down
3 changes: 2 additions & 1 deletion src/dupe.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ typedef enum
DUPE_MATCH_SIM_HIGH = 1 << 6, /* similarity */
DUPE_MATCH_SIM_MED = 1 << 7,
DUPE_MATCH_SIM_LOW = 1 << 8,
DUPE_MATCH_SIM_CUSTOM = 1 << 9
DUPE_MATCH_SIM_CUSTOM = 1 << 9,
DUPE_MATCH_NAME_CI = 1 << 10 /* same as name, but case insensitive */
} DupeMatchType;

typedef struct _DupeItem DupeItem;
Expand Down

0 comments on commit da12ecf

Please sign in to comment.