[Xfce4-commits] <thunar:master> Revert "Remove image resolution from statusbar."
Nick Schermer
noreply at xfce.org
Mon Apr 29 20:10:01 CEST 2013
Updating branch refs/heads/master
to f35151a2fa4d72c5fa1995d11b29d1a8a6ac6e23 (commit)
from 682907934beaf00cfe8b48295ac3d758bb566930 (commit)
commit f35151a2fa4d72c5fa1995d11b29d1a8a6ac6e23
Author: Nick Schermer <nick at xfce.org>
Date: Mon Apr 29 20:02:24 2013 +0200
Revert "Remove image resolution from statusbar."
This reverts commit 34fdbb4a4b3ee4b3274389b58cd207d45f8349cc.
Add a hidden option to enable this (misc-image-size-in-statusbar)
to avoid the problems this causes for regular users.
thunar/thunar-list-model.c | 71 +++++++++++++++++++++++++++++++------------
thunar/thunar-preferences.c | 15 +++++++++
2 files changed, 66 insertions(+), 20 deletions(-)
diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index 43acdc9..33b36fd 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -34,6 +34,7 @@
#include <thunar/thunar-file-monitor.h>
#include <thunar/thunar-gobject-extensions.h>
#include <thunar/thunar-list-model.h>
+#include <thunar/thunar-preferences.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-user.h>
@@ -2135,26 +2136,31 @@ gchar*
thunar_list_model_get_statusbar_text (ThunarListModel *store,
GList *selected_items)
{
- const gchar *content_type;
- const gchar *original_path;
- GtkTreeIter iter;
- ThunarFile *file;
- guint64 size;
- guint64 size_summary;
- gint folder_count;
- gint non_folder_count;
- GList *lp;
- gchar *fspace_string;
- gchar *display_name;
- gchar *size_string;
- gchar *text;
- gchar *folder_text;
- gchar *non_folder_text;
- gchar *s;
- gchar *description;
- GSequenceIter *row;
- GSequenceIter *end;
- gint nrows;
+ const gchar *content_type;
+ const gchar *original_path;
+ GtkTreeIter iter;
+ ThunarFile *file;
+ guint64 size;
+ guint64 size_summary;
+ gint folder_count;
+ gint non_folder_count;
+ GList *lp;
+ gchar *absolute_path;
+ gchar *fspace_string;
+ gchar *display_name;
+ gchar *size_string;
+ gchar *text;
+ gchar *folder_text;
+ gchar *non_folder_text;
+ gchar *s;
+ gint height;
+ gint width;
+ gchar *description;
+ GSequenceIter *row;
+ GSequenceIter *end;
+ gint nrows;
+ ThunarPreferences *preferences;
+ gboolean show_image_size;
_thunar_return_val_if_fail (THUNAR_IS_LIST_MODEL (store), NULL);
@@ -2267,6 +2273,31 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
g_free (text);
text = s;
}
+ else if (thunar_file_is_local (file)
+ && thunar_file_is_regular (file)
+ && g_str_has_prefix (content_type, "image/")) /* bug #2913 */
+ {
+ /* check if the size should be visible in the statusbar, disabled by
+ * default to avoid high i/o */
+ preferences = thunar_preferences_get ();
+ g_object_get (preferences, "misc-image-size-in-statusbar", &show_image_size, NULL);
+ g_object_unref (preferences);
+
+ if (show_image_size)
+ {
+ /* check if we can determine the dimension of this file (only for image files) */
+ absolute_path = g_file_get_path (thunar_file_get_file (file));
+ if (absolute_path != NULL
+ && gdk_pixbuf_get_file_info (absolute_path, &width, &height) != NULL)
+ {
+ /* append the image dimensions to the statusbar text */
+ s = g_strdup_printf ("%s, %s %dx%d", text, _("Image Size:"), width, height);
+ g_free (text);
+ text = s;
+ }
+ g_free (absolute_path);
+ }
+ }
}
else
{
diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c
index e5d9fb9..41c07d8 100644
--- a/thunar/thunar-preferences.c
+++ b/thunar/thunar-preferences.c
@@ -78,6 +78,7 @@ enum
PROP_MISC_FOLDERS_FIRST,
PROP_MISC_FULL_PATH_IN_TITLE,
PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES,
+ PROP_MISC_IMAGE_SIZE_IN_STATUSBAR,
PROP_MISC_MIDDLE_CLICK_IN_TAB,
PROP_MISC_RECURSIVE_PERMISSIONS,
PROP_MISC_REMEMBER_GEOMETRY,
@@ -528,6 +529,20 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass)
EXO_PARAM_READWRITE);
/**
+ * ThunarPreferences:misc-image-size-in-statusbar:
+ *
+ * When a single image file is selected, show its size
+ * in the statusbar. This heavily increases I/O in image
+ * folders when moving the selection across files.
+ **/
+ preferences_props[PROP_MISC_IMAGE_SIZE_IN_STATUSBAR] =
+ g_param_spec_boolean ("misc-image-size-in-statusbar",
+ "MiscImageSizeInStatusbar",
+ NULL,
+ FALSE,
+ EXO_PARAM_READWRITE);
+
+ /**
* ThunarPreferences:misc-middle-click-in-tab:
*
* If middle click opens a folder in a new window (FALSE) or in a new window (TRUE);
More information about the Xfce4-commits
mailing list