summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
15 files changed, 100 insertions, 35 deletions
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