summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-thumbnails.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2004-12-15 11:20:41 +0000
committerAlexander Larsson <alexl@src.gnome.org>2004-12-15 11:20:41 +0000
commitd48b6fc82484d51c48dd42ad8fe38fe7f1892c28 (patch)
tree5d154c6f81fce5db702a11f5782b078805add333 /libnautilus-private/nautilus-thumbnails.c
parent1c95a8010f8168f302668753ccd0ce3c6ceebda2 (diff)
downloadnautilus-d48b6fc82484d51c48dd42ad8fe38fe7f1892c28.tar.gz
Better handling of icon sizes, including framing of large file-as-icon
2004-12-15 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-icon-container.c: (nautilus_icon_container_update_icon): * libnautilus-private/nautilus-icon-factory.c: (load_icon_file): * libnautilus-private/nautilus-thumbnails.c: (nautilus_thumbnail_frame_image), (nautilus_thumbnail_load_framed_image): * libnautilus-private/nautilus-thumbnails.h: Better handling of icon sizes, including framing of large file-as-icon images. Patches from Jaap Haitsma <jaap@haitsma.org>
Diffstat (limited to 'libnautilus-private/nautilus-thumbnails.c')
-rw-r--r--libnautilus-private/nautilus-thumbnails.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/libnautilus-private/nautilus-thumbnails.c b/libnautilus-private/nautilus-thumbnails.c
index ad4704255..3645eca4b 100644
--- a/libnautilus-private/nautilus-thumbnails.c
+++ b/libnautilus-private/nautilus-thumbnails.c
@@ -225,30 +225,22 @@ nautilus_remove_thumbnail_for_file (const char *old_file_uri)
g_free (old_thumbnail_path);
}
-/* routine to load an image from the passed-in path, and then embed it in
- * a frame if necessary
- */
-GdkPixbuf *
-nautilus_thumbnail_load_framed_image (const char *path)
+void
+nautilus_thumbnail_frame_image (GdkPixbuf **pixbuf)
{
- GdkPixbuf *pixbuf, *pixbuf_with_frame, *frame;
+ GdkPixbuf *pixbuf_with_frame, *frame;
gboolean got_frame_offsets;
char *frame_offset_str;
int left_offset, top_offset, right_offset, bottom_offset;
char c;
-
- pixbuf = gdk_pixbuf_new_from_file (path, NULL);
- if (pixbuf == NULL) {
- return NULL;
- }
-
+
/* The pixbuf isn't already framed (i.e., it was not made by
* an old Nautilus), so we must embed it in a frame.
*/
frame = nautilus_icon_factory_get_thumbnail_frame ();
if (frame == NULL) {
- return pixbuf;
+ return;
}
got_frame_offsets = FALSE;
@@ -269,13 +261,28 @@ nautilus_thumbnail_load_framed_image (const char *path)
}
pixbuf_with_frame = eel_embed_image_in_frame
- (pixbuf, frame,
+ (*pixbuf, frame,
left_offset, top_offset, right_offset, bottom_offset);
- g_object_unref (pixbuf);
+ g_object_unref (*pixbuf);
- return pixbuf_with_frame;
+ *pixbuf=pixbuf_with_frame;
}
+/* routine to load an image from the passed-in path, and then embed it in
+ * a frame if necessary
+ */
+GdkPixbuf *
+nautilus_thumbnail_load_framed_image (const char *path)
+{
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+ if (pixbuf == NULL) {
+ return NULL;
+ }
+ nautilus_thumbnail_frame_image(&pixbuf);
+ return pixbuf;
+}
void
nautilus_thumbnail_remove_from_queue (const char *file_uri)