Add the possibility to match duplicates on the name but ignoring the case.
authorLaurent Monin <geeqie@norz.org>
Mon, 7 Apr 2008 18:52:54 +0000 (18:52 +0000)
committerLaurent Monin <geeqie@norz.org>
Mon, 7 Apr 2008 18:52:54 +0000 (18:52 +0000)
A new item was added to types of match combo box in the Find duplicates dialog.

src/dupe.c
src/dupe.h

index 6d387f5..f0e4f60 100644 (file)
@@ -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;
@@ -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 */
 /*
@@ -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);
index ca1ef9e..a823d13 100644 (file)
@@ -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;