[Xfce4-commits] <ristretto:stephan/icon-bar> Define thumbnail-sizes
Stephan Arts
noreply at xfce.org
Thu Feb 2 19:54:01 CET 2012
Updating branch refs/heads/stephan/icon-bar
to 7849789b80e74dca4b086abb58ff638705b10bb5 (commit)
from 2e654d073c6361e4cb822c823a29fd562b354db8 (commit)
commit 7849789b80e74dca4b086abb58ff638705b10bb5
Author: Stephan Arts <stephan at xfce.org>
Date: Thu Feb 2 19:52:28 2012 +0100
Define thumbnail-sizes
src/image_list.c | 115 +++++++++++++++++++++++++++---------------------------
src/util.h | 8 ++++
2 files changed, 66 insertions(+), 57 deletions(-)
diff --git a/src/image_list.c b/src/image_list.c
index a0afc9d..428fc3b 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -15,7 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Sorting-algorithm taken from the thunar filemanager.
+ * Sorting-algorithm taken from the thunar filemanager.
+ * Copyright (c) Benedict Meurer <benny at xfce.org>
*/
#include <config.h>
@@ -1472,6 +1473,7 @@ image_list_model_get_value (
gchar *checksum = NULL;
gchar *thumbnail_path = NULL;
gchar *filename = NULL;
+ GdkPixbuf *thumbnail = NULL;
switch (column)
{
@@ -1497,77 +1499,76 @@ image_list_model_get_value (
switch (image_list->priv->thumbnail_size)
{
case THUMBNAIL_SIZE_VERY_SMALL:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 24,
- 24,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_VERY_SMALL_SIZE,
+ THUMBNAIL_SIZE_VERY_SMALL_SIZE,
+ TRUE,
+ NULL);
break;
case THUMBNAIL_SIZE_SMALLER:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 32,
- 32,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_SMALLER_SIZE,
+ THUMBNAIL_SIZE_SMALLER_SIZE,
+ TRUE,
+ NULL);
break;
case THUMBNAIL_SIZE_SMALL:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 48,
- 48,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_SMALL_SIZE,
+ THUMBNAIL_SIZE_SMALL_SIZE,
+ TRUE,
+ NULL);
break;
case THUMBNAIL_SIZE_NORMAL:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 64,
- 64,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_NORMAL_SIZE,
+ THUMBNAIL_SIZE_NORMAL_SIZE,
+ TRUE,
+ NULL);
break;
case THUMBNAIL_SIZE_LARGE:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 96,
- 96,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_LARGE_SIZE,
+ THUMBNAIL_SIZE_LARGE_SIZE,
+ TRUE,
+ NULL);
break;
case THUMBNAIL_SIZE_LARGER:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 128,
- 128,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_LARGER_SIZE,
+ THUMBNAIL_SIZE_LARGER_SIZE,
+ TRUE,
+ NULL);
break;
case THUMBNAIL_SIZE_VERY_LARGE:
- g_value_take_object (
- value,
- gdk_pixbuf_new_from_file_at_scale (
- thumbnail_path,
- 256,
- 256,
- TRUE,
- NULL));
+ thumbnail = gdk_pixbuf_new_from_file_at_scale (
+ thumbnail_path,
+ THUMBNAIL_SIZE_VERY_LARGE_SIZE,
+ THUMBNAIL_SIZE_VERY_LARGE_SIZE,
+ TRUE,
+ NULL);
break;
}
+ /* If we have a thumbnail, pass it on.
+ * If not, ask tumbler for one.
+ */
+ if (G_LIKELY (NULL != thumbnail))
+ {
+ g_value_take_object (
+ value,
+ thumbnail);
+ }
+ else
+ {
+ }
+
g_free (checksum);
g_free (filename);
g_free (thumbnail_path);
diff --git a/src/util.h b/src/util.h
index e7200af..ecb76a7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -58,4 +58,12 @@ typedef enum {
THUMBNAIL_SIZE_COUNT,
} RsttoThumbnailSize;
+#define THUMBNAIL_SIZE_VERY_SMALL_SIZE 24
+#define THUMBNAIL_SIZE_SMALLER_SIZE 32
+#define THUMBNAIL_SIZE_SMALL_SIZE 48
+#define THUMBNAIL_SIZE_NORMAL_SIZE 64
+#define THUMBNAIL_SIZE_LARGE_SIZE 96
+#define THUMBNAIL_SIZE_LARGER_SIZE 128
+#define THUMBNAIL_SIZE_VERY_LARGE_SIZE 256
+
#endif /* __RSTTO_UTIL_H__ */
More information about the Xfce4-commits
mailing list