summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml176
-rw-r--r--.github/workflows/builds.yml2
-rw-r--r--.github/workflows/release.yml4
-rw-r--r--.travis.yml75
-rw-r--r--src/eom-file-chooser.c6
-rw-r--r--src/eom-image.c8
-rw-r--r--src/eom-jobs.c13
-rw-r--r--src/eom-jobs.h4
-rw-r--r--src/eom-list-store.c28
-rw-r--r--src/eom-list-store.h3
-rw-r--r--src/eom-metadata-sidebar.c5
-rw-r--r--src/eom-properties-dialog.c5
-rw-r--r--src/eom-thumb-view.c6
-rw-r--r--src/eom-thumbnail.c4
-rw-r--r--src/eom-util.c18
-rw-r--r--src/eom-util.h3
-rw-r--r--src/eom-window.c24
-rw-r--r--src/eom-window.h3
-rw-r--r--src/main.c5
19 files changed, 103 insertions, 289 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/workflows/builds.yml b/.github/workflows/builds.yml
index 43db606..8fbff34 100644
--- a/.github/workflows/builds.yml
+++ b/.github/workflows/builds.yml
@@ -71,7 +71,7 @@ jobs:
pacman --noconfirm -Sy git || true
echo "::endgroup::"
- name: Repository checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@v5
with:
submodules: "true"
- name: Install dependency packages
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8d60b7f..da6b141 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Repository checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@v5
with:
submodules: "true"
@@ -24,7 +24,7 @@ jobs:
run: .github/workflows/builds.sh meson
- name: Install GH CLI
- uses: dev-hanz-ops/[email protected]
+ uses: dev-hanz-ops/[email protected]
with:
gh-cli-version: 2.39.1
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/src/eom-file-chooser.c b/src/eom-file-chooser.c
index 5d82901..5c366fa 100644
--- a/src/eom-file-chooser.c
+++ b/src/eom-file-chooser.c
@@ -22,6 +22,7 @@
#include "eom-file-chooser.h"
#include "eom-config-keys.h"
#include "eom-pixbuf-util.h"
+#include "eom-util.h"
#include <stdlib.h>
@@ -333,7 +334,8 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
G_FILE_ATTRIBUTE_TIME_MODIFIED ","
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
g_object_unref (file);
@@ -352,7 +354,7 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
/* read files smaller than 100kb directly */
gchar *mime_type = g_content_type_get_mime_type (
- g_file_info_get_content_type (file_info));
+ eom_util_get_content_type_with_fallback (file_info));
if (G_LIKELY (mime_type)) {
gboolean can_thumbnail, has_failed;
diff --git a/src/eom-image.c b/src/eom-image.c
index f24b528..e9741ef 100644
--- a/src/eom-image.c
+++ b/src/eom-image.c
@@ -589,7 +589,8 @@ eom_image_get_file_info (EomImage *img,
file_info = g_file_query_info (img->priv->file,
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, error);
if (file_info == NULL) {
@@ -607,8 +608,9 @@ eom_image_get_file_info (EomImage *img,
if (bytes)
*bytes = g_file_info_get_size (file_info);
- if (mime_type)
- *mime_type = g_strdup (g_file_info_get_content_type (file_info));
+ if (mime_type) {
+ *mime_type = g_strdup (eom_util_get_content_type_with_fallback (file_info));
+ }
g_object_unref (file_info);
}
}
diff --git a/src/eom-jobs.c b/src/eom-jobs.c
index bde2517..0b51800 100644
--- a/src/eom-jobs.c
+++ b/src/eom-jobs.c
@@ -30,6 +30,7 @@
#include "eom-list-store.h"
#include "eom-thumbnail.h"
#include "eom-pixbuf-util.h"
+#include "eom-util.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -351,6 +352,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 +360,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);
}
@@ -383,7 +386,9 @@ filter_files (GSList *files, GList **file_list, GList **error_list)
if (file != NULL) {
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE","G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
type = G_FILE_TYPE_UNKNOWN;
@@ -395,7 +400,7 @@ filter_files (GSList *files, GList **file_list, GList **error_list)
if (G_UNLIKELY (type == G_FILE_TYPE_UNKNOWN)) {
const gchar *ctype;
- ctype = g_file_info_get_content_type (file_info);
+ ctype = eom_util_get_content_type_with_fallback (file_info);
/* If the content type is supported
adjust the file_type */
@@ -438,7 +443,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..9336614 100644
--- a/src/eom-list-store.c
+++ b/src/eom-list-store.c
@@ -26,6 +26,7 @@
#include "eom-image.h"
#include "eom-job-queue.h"
#include "eom-jobs.h"
+#include "eom-util.h"
#include <string.h>
@@ -34,7 +35,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);
@@ -377,12 +379,13 @@ file_monitor_changed_cb (GFileMonitor *monitor,
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
0, NULL, NULL);
if (file_info == NULL) {
break;
}
- mimetype = g_file_info_get_content_type (file_info);
+ mimetype = eom_util_get_content_type_with_fallback (file_info);
if (is_file_in_list_store_file (store, file, &iter)) {
if (eom_image_is_supported_mime_type (mimetype)) {
@@ -418,12 +421,13 @@ file_monitor_changed_cb (GFileMonitor *monitor,
if (!is_file_in_list_store_file (store, file, NULL)) {
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
0, NULL, NULL);
if (file_info == NULL) {
break;
}
- mimetype = g_file_info_get_content_type (file_info);
+ mimetype = eom_util_get_content_type_with_fallback (file_info);
if (eom_image_is_supported_mime_type (mimetype)) {
const gchar *caption;
@@ -436,12 +440,13 @@ file_monitor_changed_cb (GFileMonitor *monitor,
break;
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
break;
}
- mimetype = g_file_info_get_content_type (file_info);
+ mimetype = eom_util_get_content_type_with_fallback (file_info);
if (is_file_in_list_store_file (store, file, &iter) &&
eom_image_is_supported_mime_type (mimetype)) {
eom_list_store_thumbnail_refresh (store, &iter);
@@ -467,7 +472,7 @@ directory_visit (GFile *directory,
gboolean load_uri = FALSE;
const char *mime_type, *name;
- mime_type = g_file_info_get_content_type (children_info);
+ mime_type = eom_util_get_content_type_with_fallback (children_info);
name = g_file_info_get_name (children_info);
if (!g_str_has_prefix (name, ".")) {
@@ -511,6 +516,7 @@ eom_list_store_append_directory (EomListStore *store,
file_enumerator = g_file_enumerate_children (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
G_FILE_ATTRIBUTE_STANDARD_NAME,
0, NULL, NULL);
@@ -529,6 +535,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 +547,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;
@@ -563,6 +570,7 @@ eom_list_store_add_files (EomListStore *store, GList *file_list)
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE","
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE","
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
0, NULL, NULL);
if (file_info == NULL) {
@@ -576,7 +584,7 @@ eom_list_store_add_files (EomListStore *store, GList *file_list)
if (G_UNLIKELY (file_type == G_FILE_TYPE_UNKNOWN)) {
const gchar *ctype;
- ctype = g_file_info_get_content_type (file_info);
+ ctype = eom_util_get_content_type_with_fallback (file_info);
/* If the content type is supported adjust file_type */
if (eom_image_is_supported_mime_type (ctype))
@@ -624,7 +632,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-metadata-sidebar.c b/src/eom-metadata-sidebar.c
index 9b8fc8b..2dbde74 100644
--- a/src/eom-metadata-sidebar.c
+++ b/src/eom-metadata-sidebar.c
@@ -158,14 +158,15 @@ eom_metadata_sidebar_update_general_section (EomMetadataSidebar *sidebar)
file = eom_image_get_file (img);
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
str = g_strdup (_("Unknown"));
} else {
const gchar *mime_str;
- mime_str = g_file_info_get_content_type (file_info);
+ mime_str = eom_util_get_content_type_with_fallback (file_info);
str = g_content_type_get_description (mime_str);
g_object_unref (file_info);
}
diff --git a/src/eom-properties-dialog.c b/src/eom-properties-dialog.c
index 0bad997..480b3f7 100644
--- a/src/eom-properties-dialog.c
+++ b/src/eom-properties-dialog.c
@@ -173,12 +173,13 @@ pd_update_general_tab (EomPropertiesDialog *prop_dlg,
file = eom_image_get_file (image);
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL) {
type_str = g_strdup (_("Unknown"));
} else {
- mime_str = g_file_info_get_content_type (file_info);
+ mime_str = eom_util_get_content_type_with_fallback (file_info);
type_str = g_content_type_get_description (mime_str);
g_object_unref (file_info);
}
diff --git a/src/eom-thumb-view.c b/src/eom-thumb-view.c
index 0b28440..332d180 100644
--- a/src/eom-thumb-view.c
+++ b/src/eom-thumb-view.c
@@ -27,6 +27,7 @@
#include "eom-list-store.h"
#include "eom-image.h"
#include "eom-job-queue.h"
+#include "eom-util.h"
#ifdef HAVE_EXIF
#include "eom-exif-util.h"
@@ -494,7 +495,8 @@ thumbview_get_tooltip_string (EomImage *image)
file = eom_image_get_file (image);
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
g_object_unref (file);
if (file_info == NULL) {
@@ -502,7 +504,7 @@ thumbview_get_tooltip_string (EomImage *image)
return NULL;
}
- mime_str = g_file_info_get_content_type (file_info);
+ mime_str = eom_util_get_content_type_with_fallback (file_info);
if (G_UNLIKELY (mime_str == NULL)) {
g_free (bytes);
diff --git a/src/eom-thumbnail.c b/src/eom-thumbnail.c
index 6a278b3..30a5760 100644
--- a/src/eom-thumbnail.c
+++ b/src/eom-thumbnail.c
@@ -36,6 +36,7 @@
#include "eom-thumbnail.h"
#include "eom-list-store.h"
#include "eom-debug.h"
+#include "eom-util.h"
#define EOM_THUMB_ERROR eom_thumb_error_quark ()
@@ -161,6 +162,7 @@ eom_thumb_data_new (GFile *file, GError **error)
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE ","
G_FILE_ATTRIBUTE_TIME_MODIFIED ","
G_FILE_ATTRIBUTE_THUMBNAIL_PATH ","
G_FILE_ATTRIBUTE_THUMBNAILING_FAILED ","
@@ -176,7 +178,7 @@ eom_thumb_data_new (GFile *file, GError **error)
/* if available, copy data */
data->mtime = g_file_info_get_attribute_uint64 (file_info,
G_FILE_ATTRIBUTE_TIME_MODIFIED);
- data->mime_type = g_strdup (g_file_info_get_content_type (file_info));
+ data->mime_type = g_strdup (eom_util_get_content_type_with_fallback (file_info));
data->thumb_exists = (g_file_info_get_attribute_byte_string (file_info,
G_FILE_ATTRIBUTE_THUMBNAIL_PATH) != NULL);
diff --git a/src/eom-util.c b/src/eom-util.c
index e914223..a839f6f 100644
--- a/src/eom-util.c
+++ b/src/eom-util.c
@@ -482,3 +482,21 @@ eom_notebook_scroll_event_cb (GtkWidget *widget,
return TRUE;
}
+
+const char*
+eom_util_get_content_type_with_fallback (GFileInfo *file_info)
+{
+ g_return_val_if_fail (file_info != NULL, NULL);
+
+ if (g_file_info_has_attribute (file_info,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE))
+ return g_file_info_get_content_type (file_info);
+ else if (g_file_info_has_attribute (file_info,
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE))
+ return g_file_info_get_attribute_string (file_info,
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ else
+ g_warn_if_reached ();
+
+ return NULL;
+}
diff --git a/src/eom-util.h b/src/eom-util.h
index d08b88a..9f2c370 100644
--- a/src/eom-util.h
+++ b/src/eom-util.h
@@ -68,6 +68,9 @@ void eom_util_show_file_in_filemanager (GFile *file,
gboolean eom_notebook_scroll_event_cb (GtkWidget *notebook,
GdkEventScroll *event);
+G_GNUC_INTERNAL
+const char *eom_util_get_content_type_with_fallback (GFileInfo *file_info);
+
G_END_DECLS
#endif /* __EOM_UTIL_H__ */
diff --git a/src/eom-window.c b/src/eom-window.c
index fb01794..e24738b 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -738,7 +738,8 @@ add_file_to_recent_files (GFile *file)
return FALSE;
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL)
return FALSE;
@@ -746,7 +747,7 @@ add_file_to_recent_files (GFile *file)
recent_data = g_slice_new (GtkRecentData);
recent_data->display_name = NULL;
recent_data->description = NULL;
- recent_data->mime_type = (gchar *) g_file_info_get_content_type (file_info);
+ recent_data->mime_type = (gchar *) eom_util_get_content_type_with_fallback (file_info);
recent_data->app_name = EOM_RECENT_FILES_APP_NAME;
recent_data->app_exec = g_strjoin(" ", g_get_prgname (), "%u", NULL);
recent_data->groups = groups;
@@ -955,13 +956,14 @@ eom_window_update_openwith_menu (EomWindow *window, EomImage *image)
file = eom_image_get_file (image);
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
0, NULL, NULL);
if (file_info == NULL)
return;
else {
- mime_type = g_file_info_get_content_type (file_info);
+ mime_type = eom_util_get_content_type_with_fallback (file_info);
}
if (priv->open_with_menu_id != 0) {
@@ -5097,14 +5099,19 @@ eom_window_button_press (GtkWidget *widget, GdkEventButton *event)
EomWindow *window = EOM_WINDOW (widget);
gint result = FALSE;
+ /* We currently can't tell whether the old button codes (6, 7) are
+ * still in use. So we keep them in addition to the new ones (8, 9)
+ */
if (event->type == GDK_BUTTON_PRESS) {
switch (event->button) {
case 6:
+ case 8:
eom_thumb_view_select_single (EOM_THUMB_VIEW (window->priv->thumbview),
EOM_THUMB_VIEW_SELECT_LEFT);
result = TRUE;
break;
case 7:
+ case 9:
eom_thumb_view_select_single (EOM_THUMB_VIEW (window->priv->thumbview),
EOM_THUMB_VIEW_SELECT_RIGHT);
result = TRUE;
@@ -5329,9 +5336,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 +5479,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