From f22e25d7352235c187059c4180c084cae3a28b74 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 3 Aug 2009 20:42:45 +0200 Subject: Bug #580895 - Kill libgnomeui/gnome-thumbnail.h --- widgets/misc/e-attachment.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'widgets') diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index e1afb45246..7d8984dba0 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -31,7 +31,11 @@ #include #include #include +#include +#include + +#include "e-util/e-icon-factory.h" #include "e-util/e-util.h" #include "e-util/e-mktemp.h" #include "e-attachment-store.h" @@ -99,6 +103,48 @@ enum { static gpointer parent_class; +static gboolean +create_system_thumbnail (EAttachment *attachment, GIcon **icon) +{ + GFile *file; + gchar *thumbnail = NULL; + + g_return_val_if_fail (attachment != NULL, FALSE); + g_return_val_if_fail (icon != NULL, FALSE); + + file = e_attachment_get_file (attachment); + + if (file && g_file_has_uri_scheme (file, "file")) { + gchar *path = g_file_get_path (file); + if (path) { + thumbnail = e_icon_factory_create_thumbnail (path); + g_free (path); + } + } + + if (thumbnail) { + GFile *gf = g_file_new_for_path (thumbnail); + + g_return_val_if_fail (gf != NULL, FALSE); + if (*icon) + g_object_unref (*icon); + + *icon = g_file_icon_new (gf); + g_object_unref (gf); + + if (file) { + GFileInfo *fi = e_attachment_get_file_info (attachment); + + if (fi) + g_file_info_set_attribute_byte_string (fi, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, thumbnail); + } + } + + g_free (thumbnail); + + return thumbnail != NULL; +} + static gchar * attachment_get_default_charset (void) { @@ -229,6 +275,10 @@ attachment_update_icon_column (EAttachment *attachment) icon = g_file_icon_new (file); g_object_unref (file); + /* try the system thumbnailer */ + } else if (create_system_thumbnail (attachment, &icon)) { + /* actually do nothing, just use the icon */ + /* Else use the standard icon for the content type. */ } else if (icon != NULL) g_object_ref (icon); -- cgit _and_yarn/devel/electron4/files/lodash.merge-4.6.2'>dependabot/npm_and_yarn/devel/electron4/files/lodash.merge-4.6.2 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* - add stage supportaz2014-01-303-6/+4
* Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-211-0/+1
* - Convert to new perl frameworkaz2013-08-061-6/+3
* - remove MD5ohauer2011-07-031-1/+0
* - Update to 1.21wen2009-11-222-4/+4
* - Update to 1.2wen2009-11-082-4/+4
* - Update to 1.1wen2009-11-033-5/+6
* - Update to 0.98miwi2009-03-242-4/+4