summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml176
-rw-r--r--.github/dependabot.yml8
-rwxr-xr-x.github/workflows/archlinux.sh47
-rwxr-xr-x.github/workflows/builds.sh65
-rw-r--r--.github/workflows/builds.yml84
-rwxr-xr-x.github/workflows/debian.sh54
-rwxr-xr-x.github/workflows/fedora.sh46
-rw-r--r--.github/workflows/release.yml35
-rwxr-xr-x.github/workflows/ubuntu.sh54
-rw-r--r--.travis.yml75
-rw-r--r--NEWS9
-rw-r--r--configure.ac4
-rw-r--r--meson.build2
-rw-r--r--src/eom-jobs.c6
-rw-r--r--src/eom-jobs.h4
-rw-r--r--src/eom-list-store.c10
-rw-r--r--src/eom-list-store.h3
-rw-r--r--src/eom-window.c9
-rw-r--r--src/eom-window.h3
-rw-r--r--src/main.c5
20 files changed, 434 insertions, 265 deletions
diff --git a/.build.yml b/.build.yml
deleted file mode 100644
index 5dc8b20..0000000
--- a/.build.yml
+++ /dev/null
@@ -1,176 +0,0 @@
-##########################################################
-# THE FOLLOWING LINES IS USED BY docker-build
-##########################################################
-requires:
- archlinux:
- # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/eom
- - appstream-glib
- - autoconf-archive
- - clang
- - exempi
- - gcc
- - git
- - gobject-introspection
- - imagemagick
- - itstool
- - lcms2
- - libexif
- - libjpeg-turbo
- - libpeas
- - make
- - mate-desktop
- - mate-common
- - which
- - yelp-tools
-
- debian:
- # Useful URL: https://github.com/mate-desktop/debian-packages
- # Useful URL: https://salsa.debian.org/debian-mate-team/eom
- - autopoint
- - clang
- - clang-tools
- - cppcheck
- - git
- - gobject-introspection
- - gtk-doc-tools
- - libdconf-dev
- - libexempi-dev
- - libexif-dev
- - libgirepository1.0-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libjpeg-dev
- - liblcms2-dev
- - libmagickwand-dev
- - libmate-desktop-dev
- - libpeas-dev
- - librsvg2-dev
- - libstartup-notification0-dev
- - libxml2-dev
- - make
- - mate-common
- - shared-mime-info
- - x11proto-core-dev
- - yelp-tools
- - zlib1g-dev
-
- fedora:
- # Useful URL: https://src.fedoraproject.org/cgit/rpms/eom.git
- - autoconf-archive
- - clang
- - clang-analyzer
- - cppcheck-htmlreport
- - desktop-file-utils
- - exempi-devel
- - gcc
- - git
- - gobject-introspection-devel
- - gtk3-devel
- - ImageMagick-devel
- - lcms2-devel
- - libappstream-glib-devel
- - libexif-devel
- - libjpeg-turbo-devel
- - libpeas1-devel
- - librsvg2-devel
- - libxml2-devel
- - make
- - mate-common
- - mate-desktop-devel
- - redhat-rpm-config
- - zlib-devel
-
- ubuntu:
- - autopoint
- - clang
- - clang-tools
- - git
- - gobject-introspection
- - gtk-doc-tools
- - libdconf-dev
- - libexempi-dev
- - libexif-dev
- - libgirepository1.0-dev
- - libglib2.0-dev
- - libgtk-3-dev
- - libjpeg-dev
- - liblcms2-dev
- - libmagickwand-dev
- - libmate-desktop-dev
- - libpeas-dev
- - librsvg2-dev
- - libstartup-notification0-dev
- - libxml2-dev
- - make
- - mate-common
- - shared-mime-info
- - x11proto-core-dev
- - yelp-tools
- - zlib1g-dev
-
-variables:
- - 'CHECKERS="
- -enable-checker deadcode.DeadStores
- -enable-checker alpha.deadcode.UnreachableCode
- -enable-checker alpha.core.CastSize
- -enable-checker alpha.core.CastToStruct
- -enable-checker alpha.core.IdenticalExpr
- -enable-checker alpha.core.SizeofPtr
- -enable-checker alpha.security.ArrayBoundV2
- -enable-checker alpha.security.MallocOverflow
- -enable-checker alpha.security.ReturnPtrRange
- -enable-checker alpha.unix.SimpleStream
- -enable-checker alpha.unix.cstring.BufferOverlap
- -enable-checker alpha.unix.cstring.NotNullTerminated
- -enable-checker alpha.unix.cstring.OutOfBounds
- -enable-checker alpha.core.FixedAddr
- -enable-checker security.insecureAPI.strcpy"'
-
-before_scripts:
- - if [ ${DISTRO_NAME} == "debian" ];then
- - egrep -lRZ 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS' . | xargs -0 -l sed -i -e 's/G_GNUC_BEGIN_IGNORE_DEPRECATIONS/ /g'
- - egrep -lRZ 'G_GNUC_END_IGNORE_DEPRECATIONS' . | xargs -0 -l sed -i -e 's/G_GNUC_END_IGNORE_DEPRECATIONS/ /g'
- - fi
-
-build_scripts:
- - if [ ${DISTRO_NAME} == "debian" ];then
- - export CFLAGS+=" -Wsign-compare -Wunused-macros"
- - cppcheck --enable=warning,style,performance,portability,information,missingInclude .
- - fi
-
- - NOCONFIGURE=1 ./autogen.sh
- - scan-build $CHECKERS ./configure --enable-compile-warnings=maximum
- - if [ $CPU_COUNT -gt 1 ]; then
- - if [ ${DISTRO_NAME} == "debian" ];then
- - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $(( $CPU_COUNT + 1 ))
- - make clean
- - fi
- - scan-build $CHECKERS --keep-cc -o html-report make -j $(( $CPU_COUNT + 1 ))
- - else
- - if [ ${DISTRO_NAME} == "debian" ];then
- - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make
- - make clean
- - fi
- - scan-build $CHECKERS --keep-cc -o html-report make
- - fi
-
-after_scripts:
- - if [ ${DISTRO_NAME} == "fedora" ];then
- - cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude .
- - cppcheck-htmlreport --title=${REPO_NAME} --file=cppcheck.xml --report-dir=cppcheck-htmlreport
- - ./gen-index -l 20 -i https://github.com/mate-desktop/eom/raw/master/data/icons/16x16/apps/eom.png
- - fi
- - make distcheck
-
-releases:
- draft: false
- prerelease: false
- checksum: true
- file_glob: true
- files: eom-*.tar.xz
- github_release:
- tags: true
- overwrite: true
- base_version: 1.20.0
- notify_servers:
- - https://release.mate-desktop.org/release
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..80851cd
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,8 @@
+# Enable dependabot to keep our GHA pins automatically
+# updated, so we don't fall too far behind in the future
+version: 2
+updates:
+ - package-ecosystem: github-actions
+ directory: "/"
+ schedule:
+ interval: weekly
diff --git a/.github/workflows/archlinux.sh b/.github/workflows/archlinux.sh
new file mode 100755
index 0000000..0ba1ef7
--- /dev/null
+++ b/.github/workflows/archlinux.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/bash
+
+# Use grouped output messages
+infobegin() {
+ echo "::group::${1}"
+}
+infoend() {
+ echo "::endgroup::"
+}
+
+# Required packages on Archlinux
+requires=(
+ ccache # Use ccache to speed up build
+ clang # Build with clang on Archlinux
+ meson # Used for meson build
+)
+
+requires+=(
+ autoconf-archive
+ appstream-glib
+ autoconf-archive
+ desktop-file-utils
+ exempi
+ gcc
+ git
+ glib2-devel
+ gobject-introspection
+ imagemagick
+ itstool
+ lcms2
+ libexif
+ libjpeg-turbo
+ libpeas
+ make
+ mate-desktop
+ mate-common
+ which
+ yelp-tools
+)
+
+infobegin "Update system"
+pacman --noconfirm -Syu
+infoend
+
+infobegin "Install dependency packages"
+pacman --noconfirm -S ${requires[@]}
+infoend
diff --git a/.github/workflows/builds.sh b/.github/workflows/builds.sh
new file mode 100755
index 0000000..c80e76a
--- /dev/null
+++ b/.github/workflows/builds.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/bash
+
+set -e
+set -o pipefail
+
+CPUS=$(grep processor /proc/cpuinfo | wc -l)
+
+# Use grouped output messages
+infobegin() {
+ echo "::group::${1}"
+}
+infoend() {
+ echo "::endgroup::"
+}
+
+# Run meson first, then run autotools
+# Because meson dist requires a clean git workspace
+# Autotools will modify some files (such as po, etc.), making them dirty.
+if [[ -f meson.build && $1 == "meson" ]]; then
+
+ infobegin "Configure (meson)"
+ meson setup _build --prefix=/usr
+ infoend
+
+ infobegin "Build (meson)"
+ meson compile -C _build
+ infoend
+
+ infobegin "Test (meson)"
+ ninja -C _build test
+ infoend
+
+ infobegin "Dist (meson)"
+ # Git safedirectory stop ninja dist
+ # https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
+ # https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory
+ git config --global --add safe.directory ${PWD}
+ ninja -C _build dist
+ infoend
+fi
+
+if [[ -f autogen.sh && $1 == "autotools" ]]; then
+ infobegin "Configure (autotools)"
+ NOCONFIGURE=1 ./autogen.sh
+ ./configure --prefix=/usr --enable-compile-warnings=maximum || {
+ cat config.log
+ exit 1
+ }
+ infoend
+
+ infobegin "Build (autotools)"
+ make -j ${CPUS}
+ infoend
+
+ infobegin "Check (autotools)"
+ make -j ${CPUS} check || {
+ find -name test-suite.log -exec cat {} \;
+ exit 1
+ }
+ infoend
+
+ infobegin "Distcheck (autotools)"
+ make -j ${CPUS} distcheck
+ infoend
+fi
diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml
new file mode 100644
index 0000000..43db606
--- /dev/null
+++ b/.github/workflows/builds.yml
@@ -0,0 +1,84 @@
+name: CI Build
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+ workflow_dispatch:
+
+# cancel already running builds of the same branch or pull request
+concurrency:
+ group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.sha }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ name: ${{matrix.container}} (${{matrix.cc}} ${{matrix.build-system}})
+ runs-on: ubuntu-latest
+ container:
+ image: ${{matrix.container}}
+ volumes:
+ - /tmp/.cache
+ - /var/cache/apt
+
+ strategy:
+ fail-fast: false # don't cancel other jobs in the matrix if one fails
+ matrix:
+ container:
+ [
+ "debian:testing",
+ "fedora:latest",
+ "ubuntu:rolling",
+ "archlinux:latest",
+ ]
+ cc: ["gcc"]
+ cxx: ["g++"]
+ build-system: ["autotools", "meson"]
+ include:
+ - container: "archlinux:latest"
+ build-system: "autotools"
+ cc: "clang"
+ cxx: "clang++"
+ - container: "archlinux:latest"
+ build-system: "meson"
+ cc: "clang"
+ cxx: "clang++"
+
+ env:
+ # Speed up build with ccache
+ CC: ccache ${{ matrix.cc }}
+ CXX: ccache ${{ matrix.cxx }}
+ CONTAINER: ${{ matrix.container }}
+
+ steps:
+ - name: Setup environment variables
+ id: distro-name
+ shell: bash
+ run: |
+ split=(${CONTAINER//:/ })
+ distro=${split[0]}
+ short_sha=${SHA:0:8}
+ echo "DISTRO=$distro" | tee -a $GITHUB_ENV
+ - name: Install git command
+ shell: bash
+ run: |
+ echo "::group::Install git ..."
+ apt-get update -qq && apt-get install --assume-yes git || true
+ dnf update -y && dnf install -y git || true
+ pacman --noconfirm -Sy git || true
+ echo "::endgroup::"
+ - name: Repository checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: "true"
+ - name: Install dependency packages
+ run: .github/workflows/${{ env.DISTRO }}.sh
+ - name: Enable ccache to speed up builds
+ uses: hendrikmuhs/[email protected]
+ with:
+ key: ${{ env.DISTRO }}-${{ matrix.cc }}
+ - name: Build the source code
+ run: .github/workflows/builds.sh ${{ matrix.build-system }}
diff --git a/.github/workflows/debian.sh b/.github/workflows/debian.sh
new file mode 100755
index 0000000..f9bba4f
--- /dev/null
+++ b/.github/workflows/debian.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/bash
+
+# Use grouped output messages
+infobegin() {
+ echo "::group::${1}"
+}
+infoend() {
+ echo "::endgroup::"
+}
+
+# Required packages on Debian
+requires=(
+ ccache # Use ccache to speed up build
+ meson # Used for meson build
+)
+
+requires+=(
+ autoconf-archive
+ autopoint
+ desktop-file-utils
+ git
+ gobject-introspection
+ gtk-doc-tools
+ libdconf-dev
+ libexempi-dev
+ libexif-dev
+ libgirepository1.0-dev
+ libglib2.0-dev
+ libgtk-3-dev
+ libjpeg-dev
+ liblcms2-dev
+ libmagickwand-dev
+ libmate-desktop-dev
+ libpeas-dev
+ librsvg2-dev
+ libstartup-notification0-dev
+ libxml2-dev
+ make
+ mate-common
+ shared-mime-info
+ x11proto-core-dev
+ yelp-tools
+ zlib1g-dev
+)
+
+infobegin "Update system"
+apt-get update -qq
+infoend
+
+infobegin "Install dependency packages"
+env DEBIAN_FRONTEND=noninteractive \
+ apt-get install --assume-yes \
+ ${requires[@]}
+infoend
diff --git a/.github/workflows/fedora.sh b/.github/workflows/fedora.sh
new file mode 100755
index 0000000..4c1ffcf
--- /dev/null
+++ b/.github/workflows/fedora.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/bash
+
+# Use grouped output messages
+infobegin() {
+ echo "::group::${1}"
+}
+infoend() {
+ echo "::endgroup::"
+}
+
+# Required packages on Fedora
+requires=(
+ ccache # Use ccache to speed up build
+ meson # Used for meson build
+)
+
+requires+=(
+ autoconf-archive
+ desktop-file-utils
+ exempi-devel
+ gcc
+ git
+ gobject-introspection-devel
+ gtk3-devel
+ ImageMagick-devel
+ lcms2-devel
+ libappstream-glib-devel
+ libexif-devel
+ libjpeg-turbo-devel
+ libpeas1-devel
+ librsvg2-devel
+ libxml2-devel
+ make
+ mate-common
+ mate-desktop-devel
+ redhat-rpm-config
+ zlib-devel
+)
+
+infobegin "Update system"
+dnf update -y
+infoend
+
+infobegin "Install dependency packages"
+dnf install -y ${requires[@]}
+infoend
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..929b8ad
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,35 @@
+name: Release Version
+on:
+ push:
+ tags:
+ - "v*.*.*"
+
+env:
+ CACHE_PATH: /tmp/.cache
+
+jobs:
+ release:
+ name: Release New Version
+ runs-on: ubuntu-latest
+ steps:
+ - name: Repository checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: "true"
+
+ - name: Install dependency packages
+ run: sudo .github/workflows/ubuntu.sh
+
+ - name: Build the source code
+ run: .github/workflows/builds.sh meson
+
+ - name: Install GH CLI
+ uses: dev-hanz-ops/[email protected]
+ with:
+ gh-cli-version: 2.39.1
+
+ - name: Create github release
+ run: |
+ gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes _build/meson-dist/*
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/ubuntu.sh b/.github/workflows/ubuntu.sh
new file mode 100755
index 0000000..e55baa6
--- /dev/null
+++ b/.github/workflows/ubuntu.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/bash
+
+# Use grouped output messages
+infobegin() {
+ echo "::group::${1}"
+}
+infoend() {
+ echo "::endgroup::"
+}
+
+# Required packages on Ubuntu
+requires=(
+ ccache # Use ccache to speed up build
+ meson # Used for meson build
+)
+
+requires+=(
+ autoconf-archive
+ autopoint
+ desktop-file-utils
+ git
+ gobject-introspection
+ gtk-doc-tools
+ libdconf-dev
+ libexempi-dev
+ libexif-dev
+ libgirepository1.0-dev
+ libglib2.0-dev
+ libgtk-3-dev
+ libjpeg-dev
+ liblcms2-dev
+ libmagickwand-dev
+ libmate-desktop-dev
+ libpeas-dev
+ librsvg2-dev
+ libstartup-notification0-dev
+ libxml2-dev
+ make
+ mate-common
+ shared-mime-info
+ x11proto-core-dev
+ yelp-tools
+ zlib1g-dev
+)
+
+infobegin "Update system"
+apt-get update -y
+infoend
+
+infobegin "Install dependency packages"
+env DEBIAN_FRONTEND=noninteractive \
+ apt-get install --assume-yes \
+ ${requires[@]}
+infoend
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 45a3e6d..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-# vim: set ts=2 sts=2 sw=2 expandtab :
-dist: jammy
-language: shell
-os: linux
-services:
- - docker
-addons:
- apt:
- packages:
- - python3-pip
- - python3-setuptools
-
-branches:
- except:
- - gh-pages
-
-before_install:
- - curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build
- - curl -Ls -o gen-index https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/gen-index.sh
- - chmod +x docker-build gen-index
-
-install:
- - pip3 install PyGithub
- - ./docker-build --name ${DISTRO} --config .build.yml --install
-
-script:
- - ./docker-build --name ${DISTRO} --verbose --config .build.yml --build scripts
-
-notifications:
- irc:
- if: (tag OR branch = master) AND
- repo = mate-desktop/eom
- channels:
- - "irc.libera.chat#mate-dev"
- template:
- - "[%{repository_name}] %{author}: %{commit_subject}"
- - "[%{branch}] %{commit} %{message} %{build_url}"
- on_success: never
- on_failure: always
-
-deploy:
- - provider: pages
- edge: true
- token: $GITHUB_TOKEN
- keep_history: false
- committer_from_gh: true
- target_branch: gh-pages
- local_dir: html-report
- strategy: git
- on:
- all_branches: true
- condition: ${DISTRO} =~ ^fedora.*$
- - provider: script
- edge: true
- script: ./docker-build --verbose --config .build.yml --release github
- on:
- tags: true
- condition: "${TRAVIS_TAG} =~ ^v.*$ && ${DISTRO} =~ ^fedora.*$"
-
-after_success:
- - 'if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" && "$TRAVIS_PULL_REQUEST" != "false" && ${DISTRO} =~ ^fedora.*$ ]]; then
- REPO_SLUG_ARRAY=(${TRAVIS_REPO_SLUG//\// });
- REPO_NAME=${REPO_SLUG_ARRAY[1]};
- URL="https://${REPO_NAME}.mate-desktop.dev";
- COMMENT="Code analysis completed";
- curl -H "Authorization: token $GITHUB_TOKEN" -X POST
- -d "{\"state\": \"success\", \"description\": \"$COMMENT\", \"context\":\"scan-build\", \"target_url\": \"$URL\"}"
- https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA};
- fi'
-
-env:
-# - DISTRO="archlinux:latest"
- - DISTRO="debian:testing"
- - DISTRO="fedora:latest"
-# - DISTRO="ubuntu:rolling"
diff --git a/NEWS b/NEWS
index 321a678..af3a34a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+### eom 1.28.0
+
+ * Translations update
+ * eom-window: update image counter even if current thumbnail is for failured image
+ * meson: explicit dep on -lm as required for Fedora35
+ * fix building with new libxml 2.12.0
+ * fix warning in Serbian translations
+ * fix warning in Japanese translations
+
### eom 1.27.1
* Translations update
diff --git a/configure.ac b/configure.ac
index 7e57cf0..62dc453 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@ AC_PREREQ(2.59)
AC_CONFIG_MACRO_DIR([m4])
m4_define(eom_major_version, 1)
-m4_define(eom_minor_version, 27)
-m4_define(eom_micro_version, 1)
+m4_define(eom_minor_version, 28)
+m4_define(eom_micro_version, 0)
m4_define(eom_version, eom_major_version.eom_minor_version.eom_micro_version)
AC_INIT([eom], eom_version, https://github.com/mate-desktop/eom/issues, [eom], [https://mate-desktop.org])
diff --git a/meson.build b/meson.build
index 49bdbfd..608e62b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('eom','c',
- version: '1.27.1',
+ version: '1.28.0',
meson_version: '>=0.59.0',
license: 'GPLv2+',
)
diff --git a/src/eom-jobs.c b/src/eom-jobs.c
index bde2517..7104268 100644
--- a/src/eom-jobs.c
+++ b/src/eom-jobs.c
@@ -351,6 +351,7 @@ eom_job_model_class_init (EomJobModelClass *class)
/**
* eom_job_model_new:
* @file_list: (element-type GFile): a #GFile list
+ * @preserve_order: Flag to indicate whether to honor the order of input parameters.
*
* Creates a new #EomJob model.
*
@@ -358,13 +359,14 @@ eom_job_model_class_init (EomJobModelClass *class)
*/
EomJob *
-eom_job_model_new (GSList *file_list)
+eom_job_model_new (GSList *file_list, gboolean preserve_order)
{
EomJobModel *job;
job = g_object_new (EOM_TYPE_JOB_MODEL, NULL);
job->file_list = file_list;
+ job->preserve_order = preserve_order;
return EOM_JOB (job);
}
@@ -438,7 +440,7 @@ eom_job_model_run (EomJob *ejob)
job->store = EOM_LIST_STORE (eom_list_store_new ());
- eom_list_store_add_files (job->store, filtered_list);
+ eom_list_store_add_files (job->store, filtered_list, job->preserve_order);
g_list_free_full (filtered_list, g_object_unref);
g_list_free_full (error_list, g_free);
diff --git a/src/eom-jobs.h b/src/eom-jobs.h
index df2283e..37bc26e 100644
--- a/src/eom-jobs.h
+++ b/src/eom-jobs.h
@@ -163,6 +163,7 @@ struct _EomJobModel
EomJob parent;
EomListStore *store;
GSList *file_list;
+ gboolean preserve_order;
};
struct _EomJobModelClass
@@ -247,7 +248,8 @@ EomJob *eom_job_load_new (EomImage *image,
/* EomJobModel */
GType eom_job_model_get_type (void) G_GNUC_CONST;
-EomJob *eom_job_model_new (GSList *file_list);
+EomJob *eom_job_model_new (GSList *file_list,
+ gboolean preserve_order);
/* EomJobTransform */
GType eom_job_transform_get_type (void) G_GNUC_CONST;
diff --git a/src/eom-list-store.c b/src/eom-list-store.c
index 0115b1d..3d1a9c6 100644
--- a/src/eom-list-store.c
+++ b/src/eom-list-store.c
@@ -34,7 +34,8 @@ struct _EomListStorePrivate {
gint initial_image; /* The image that should be selected firstly by the view. */
GdkPixbuf *busy_image; /* Loading image icon */
GdkPixbuf *missing_image; /* Missing image icon */
- GMutex mutex; /* Mutex for saving the jobs in the model */
+ GMutex mutex; /* Mutex for saving the jobs in the model */
+ gboolean preserve_order; /* If TRUE, preserves the original order of files */
};
G_DEFINE_TYPE_WITH_PRIVATE (EomListStore, eom_list_store, GTK_TYPE_LIST_STORE);
@@ -529,6 +530,7 @@ eom_list_store_append_directory (EomListStore *store,
* eom_list_store_add_files:
* @store: An #EomListStore.
* @file_list: (element-type GFile): A %NULL-terminated list of #GFile's.
+ * @preserve_order: Flag to indicate whether to honor the order of input parameters.
*
* Adds a list of #GFile's to @store. The given list
* must be %NULL-terminated.
@@ -540,7 +542,7 @@ eom_list_store_append_directory (EomListStore *store,
*
**/
void
-eom_list_store_add_files (EomListStore *store, GList *file_list)
+eom_list_store_add_files (EomListStore *store, GList *file_list, gboolean preserve_order)
{
GList *it;
GFileInfo *file_info;
@@ -624,7 +626,11 @@ eom_list_store_add_files (EomListStore *store, GList *file_list)
g_free (caption);
}
+ /* Set the sort behaviour depending on the toggle option.
+ If preserve_order is TRUE, then preserve the order in which files were provided.
+ Otherwise, use the default sort function. */
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+ preserve_order ? GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID : \
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
diff --git a/src/eom-list-store.h b/src/eom-list-store.h
index 6536b10..bc5052b 100644
--- a/src/eom-list-store.h
+++ b/src/eom-list-store.h
@@ -81,7 +81,8 @@ void eom_list_store_append_image (EomListStore *store,
EomImage *image);
void eom_list_store_add_files (EomListStore *store,
- GList *file_list);
+ GList *file_list,
+ gboolean preserve_order);
void eom_list_store_remove_image (EomListStore *store,
EomImage *image);
diff --git a/src/eom-window.c b/src/eom-window.c
index fb01794..c039d67 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -5329,9 +5329,10 @@ eom_window_class_init (EomWindowClass *class)
* @flags: the initialization parameters for the new window.
*
*
- * Creates a new and empty #EomWindow. Use @flags to indicate
- * if the window should be initialized fullscreen, in slideshow mode,
- * and/or without the thumbnails collection visible. See #EomStartupFlags.
+ * Creates a new and empty #EomWindow. Use @flags to indicate if the window
+ * should be initialized fullscreen, in slideshow mode, and/or without the
+ * thumbnails collection visible. Use preserve-order to maintain
+ * the order of input parameters instead of sorting. See #EomStartupFlags.
*
* Returns: a newly created #EomWindow.
**/
@@ -5471,7 +5472,7 @@ eom_window_open_file_list (EomWindow *window, GSList *file_list)
g_slist_foreach (file_list, (GFunc) g_object_ref, NULL);
window->priv->file_list = file_list;
- job = eom_job_model_new (file_list);
+ job = eom_job_model_new (file_list, !!(window->priv->flags & EOM_STARTUP_PRESERVE_ORDER));
g_signal_connect (job, "finished",
G_CALLBACK (eom_job_model_cb),
diff --git a/src/eom-window.h b/src/eom-window.h
index 04e028b..cd1d7b5 100644
--- a/src/eom-window.h
+++ b/src/eom-window.h
@@ -78,7 +78,8 @@ typedef enum {
typedef enum {
EOM_STARTUP_FULLSCREEN = 1 << 0,
EOM_STARTUP_SLIDE_SHOW = 1 << 1,
- EOM_STARTUP_DISABLE_COLLECTION = 1 << 2
+ EOM_STARTUP_DISABLE_COLLECTION = 1 << 2,
+ EOM_STARTUP_PRESERVE_ORDER = 1 << 3
} EomStartupFlags;
struct _EomWindow {
diff --git a/src/main.c b/src/main.c
index 1c4d725..94487d8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,6 +52,7 @@ static gboolean fullscreen = FALSE;
static gboolean slide_show = FALSE;
static gboolean disable_collection = FALSE;
static gboolean force_new_instance = FALSE;
+static gboolean preserve_order = FALSE;
static gchar **startup_files = NULL;
static gboolean
@@ -71,6 +72,7 @@ static const GOptionEntry goption_options[] =
{ "disable-image-collection", 'c', 0, G_OPTION_ARG_NONE, &disable_collection, N_("Disable image collection"), NULL },
{ "slide-show", 's', 0, G_OPTION_ARG_NONE, &slide_show, N_("Open in slideshow mode"), NULL },
{ "new-instance", 'n', 0, G_OPTION_ARG_NONE, &force_new_instance, N_("Start a new instance instead of reusing an existing one"), NULL },
+ { "preserve-order", 'p', 0, G_OPTION_ARG_NONE, &preserve_order, N_("Preserve the input file order (disable default sorting)"), NULL },
{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
_print_version_and_exit, N_("Show the application's version"), NULL},
{ NULL }
@@ -87,6 +89,9 @@ set_startup_flags (void)
if (slide_show)
flags |= EOM_STARTUP_SLIDE_SHOW;
+
+ if (preserve_order)
+ flags |= EOM_STARTUP_PRESERVE_ORDER;
}
int