Fix #1061: meson fails to detect strverscmp
authorColin Clark <colin.clark@cclark.uk>
Mon, 20 Feb 2023 09:45:25 +0000 (09:45 +0000)
committerColin Clark <colin.clark@cclark.uk>
Mon, 20 Feb 2023 09:45:25 +0000 (09:45 +0000)
https://github.com/BestImageViewer/geeqie/issues/1061

Delete Sort By Number option. Use Natural Sort Order on
Edit/Preferences/File Filters instead.

12 files changed:
config.h.in
doc/docbook/GuideOptionsFiltering.xml
doc/docbook/GuideReferenceCollectionsShortcuts.xml
meson.build
scripts/geeqie.cppcheck
src/collect-table.cc
src/collect.cc
src/filedata.cc
src/main.h
src/menu.cc
src/preferences.cc
src/typedefs.h

index ab5e282..24f8ee0 100644 (file)
 /* Define to 1 if you have the <string.h> header file. */
 #define HAVE_STRING_H 1
 
-/* Define to 1 if you have the `strverscmp' function. */
-#mesondefine HAVE_STRVERSCMP
-
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #define HAVE_SYS_STAT_H 1
 
index 5cfead3..6c5e82c 100644 (file)
@@ -41,6 +41,7 @@
         </term>
         <listitem>
           <para>Files and folders are sorted with the dot '.' treated as a special case, so the order is e.g. "event.c" "event.h" "eventgenerator.c". Also, files containing numbers are sorted as "file1" "file5" "file10".</para>
+          <note>If this option is selected and a standard numerical sort is required and the files are in a single folder, a workaround is to put the files in a temporary collection and select Sort By Path</note>
         </listitem>
       </varlistentry>
       <varlistentry>
index 5c68fa7..e830cac 100644 (file)
@@ -42,7 +42,6 @@ keyboard shortcuts
 <row> <entry> <code>   Ctrl + <keycap>  S </keycap> </code> </entry> <entry>  Save collection as </entry> </row>
 <row> <entry> <code>   Ctrl + <keycap>  T </keycap> </code> </entry> <entry>  Show filename text </entry> </row>
 <row> <entry> <code>    <keycap>  N </keycap> </code> </entry> <entry>  Sort by name </entry> </row>
-<row> <entry> <code>    <keycap>  I </keycap> </code> </entry> <entry>  Sort by number </entry> </row>
 <row> <entry> <code>    <keycap>  D </keycap> </code> </entry> <entry>  Sort by date </entry> </row>
 <row> <entry> <code>    <keycap>  B </keycap> </code> </entry> <entry>  Sort by size </entry> </row>
 <row> <entry> <code>    <keycap>  P </keycap> </code> </entry> <entry>  Sort by path </entry> </row>
index 4552e8c..7d7efd8 100644 (file)
@@ -500,11 +500,6 @@ else
     summary({'nl_langinfo' : ['nl_langinfo not found - first weekday depends on locale:', false, 'first weekday defaults to Monday']}, section : 'Documentation', bool_yn : true)
 endif
 
-result = cc.has_function('strverscmp', prefix : '#include <string.h>')
-if result
-    conf_data.set('HAVE_STRVERSCMP', 1)
-endif
-
 conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
 conf_data.set_quoted('GQ_APPDIR', gq_appdir)
 conf_data.set_quoted('GQ_BINDIR', gq_bindir)
index 04e85b8..3dcf3df 100644 (file)
@@ -35,7 +35,6 @@
         <define name="HAVE_PDF"/>
         <define name="HAVE_RAW"/>
         <define name="HAVE_SPELL"/>
-        <define name="HAVE_STRVERSCMP"/>
         <define name="HAVE_TIFF"/>
         <define name="HAVE_WEBP"/>
     </defines>
index fc846f4..df01347 100644 (file)
@@ -95,7 +95,6 @@ hard_coded_window_keys collection_window_keys[] = {
        {GDK_CONTROL_MASK, 'S', N_("Save collection as")},
        {GDK_CONTROL_MASK, 'T', N_("Show filename text")},
        {0, 'N', N_("Sort by name")},
-       {0, 'I', N_("Sort by number")},
        {0, 'D', N_("Sort by date")},
        {0, 'B', N_("Sort by size")},
        {0, 'P', N_("Sort by path")},
index 0984735..82a53a1 100644 (file)
@@ -183,11 +183,6 @@ static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
                        if (cia->fd->format_class < cib->fd->format_class) return -1;
                        if (cia->fd->format_class > cib->fd->format_class) return 1;
                        break;
-#ifdef HAVE_STRVERSCMP
-               case SORT_NUMBER:
-                       return strverscmp(cia->fd->name, cib->fd->name);
-                       break;
-#endif
                default:
                        break;
                }
@@ -1030,11 +1025,6 @@ static gboolean collection_window_keypress(GtkWidget *UNUSED(widget), GdkEventKe
                        case 'N': case 'n':
                                collection_set_sort_method(cw->cd, SORT_NAME);
                                break;
-#ifdef HAVE_STRVERSCMP
-                       case 'I': case 'i':
-                               collection_set_sort_method(cw->cd, SORT_NUMBER);
-                               break;
-#endif
                        case 'D': case 'd':
                                collection_set_sort_method(cw->cd, SORT_TIME);
                                break;
index f9356f5..5c165b7 100644 (file)
@@ -1157,12 +1157,6 @@ gint filelist_sort_compare_filedata(FileData *fa, FileData *fb)
                        if (fa->format_class > fb->format_class) return 1;
                        /* fall back to name */
                        break;
-#ifdef HAVE_STRVERSCMP
-               case SORT_NUMBER:
-                       ret = strverscmp(fa->name, fb->name);
-                       if (ret != 0) return ret;
-                       break;
-#endif
                default:
                        break;
                }
index 1ade3dd..a2e3dfb 100644 (file)
 
 #include <config.h>
 
-#ifdef HAVE_STRVERSCMP
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-#endif
-
 #include "intl.h"
 
 
index 1f266d3..1ded25a 100644 (file)
@@ -155,9 +155,6 @@ gchar *sort_type_get_text(SortType method)
                case SORT_PATH:
                        return _("Sort by path");
                        break;
-               case SORT_NUMBER:
-                       return _("Sort by number");
-                       break;
                case SORT_RATING:
                        return _("Sort by rating");
                        break;
@@ -204,9 +201,6 @@ GtkWidget *submenu_add_sort(GtkWidget *menu, GCallback func, gpointer data,
        g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
 
        submenu_add_sort_item(submenu, func, SORT_NAME, show_current, type);
-#ifdef HAVE_STRVERSCMP
-       submenu_add_sort_item(submenu, func, SORT_NUMBER, show_current, type);
-#endif
        submenu_add_sort_item(submenu, func, SORT_TIME, show_current, type);
        submenu_add_sort_item(submenu, func, SORT_CTIME, show_current, type);
        submenu_add_sort_item(submenu, func, SORT_EXIFTIME, show_current, type);
index 9fd6937..db16cd4 100644 (file)
@@ -2689,7 +2689,7 @@ static void config_tab_files(GtkWidget *notebook)
                              options->file_filter.show_parent_directory, &c_options->file_filter.show_parent_directory);
        pref_checkbox_new_int(group, _("Case sensitive sort"),
                              options->file_sort.case_sensitive, &c_options->file_sort.case_sensitive);
-       pref_checkbox_new_int(group, _("Natural sort order"),
+       pref_checkbox_new_int(group, _("Natural sort order - Requires restart"),
                                          options->file_sort.natural, &c_options->file_sort.natural);
        pref_checkbox_new_int(group, _("Disable file extension checks"),
                              options->file_filter.disable_file_extension_checks, &c_options->file_filter.disable_file_extension_checks);
index bbf6ca5..e49f65b 100644 (file)
@@ -83,7 +83,6 @@ typedef enum {
        SORT_TIME,
        SORT_CTIME,
        SORT_PATH,
-       SORT_NUMBER,
        SORT_EXIFTIME,
        SORT_EXIFTIMEDIGITIZED,
        SORT_RATING,