[gthumb: 56/129] added the convenience function gth_image_new_for_pixbuf
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 56/129] added the convenience function gth_image_new_for_pixbuf
- Date: Wed, 27 Apr 2011 20:55:05 +0000 (UTC)
commit 0fe23f3e207680f5e45d58bb7b9eed3deb3189e6
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Apr 21 22:20:52 2011 +0200
added the convenience function gth_image_new_for_pixbuf
extensions/flicker/dlg-import-from-flickr.c | 3 +--
extensions/picasaweb/dlg-import-from-picasaweb.c | 3 +--
extensions/raw_files/main.c | 6 ++----
gthumb/gth-image.c | 12 ++++++++++++
gthumb/gth-image.h | 1 +
gthumb/gth-thumb-loader.c | 6 ++----
gthumb/pixbuf-io.c | 6 ++----
7 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/extensions/flicker/dlg-import-from-flickr.c b/extensions/flicker/dlg-import-from-flickr.c
index 27954e4..8b33146 100644
--- a/extensions/flicker/dlg-import-from-flickr.c
+++ b/extensions/flicker/dlg-import-from-flickr.c
@@ -472,8 +472,7 @@ flickr_thumbnail_loader (GthFileData *file_data,
g_object_unref (pixbuf);
pixbuf = rotated;
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
}
g_object_unref (pixbuf);
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index 29be8fc..8a47af1 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -910,8 +910,7 @@ picasa_web_thumbnail_loader (GthFileData *file_data,
g_object_unref (pixbuf);
pixbuf = rotated;
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
}
g_object_unref (pixbuf);
diff --git a/extensions/raw_files/main.c b/extensions/raw_files/main.c
index b060627..41a4ea7 100644
--- a/extensions/raw_files/main.c
+++ b/extensions/raw_files/main.c
@@ -195,8 +195,7 @@ openraw_pixbuf_animation_new_from_file (GthFileData *file_data,
pixbuf = openraw_get_pixbuf_from_file (file_data, error);
if (pixbuf != NULL) {
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
}
@@ -423,8 +422,7 @@ openraw_pixbuf_animation_new_from_file (GthFileData *file_data,
}
if (pixbuf != NULL) {
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
}
diff --git a/gthumb/gth-image.c b/gthumb/gth-image.c
index 717e9ad..85b5968 100644
--- a/gthumb/gth-image.c
+++ b/gthumb/gth-image.c
@@ -137,6 +137,18 @@ gth_image_new (void)
}
+GthImage *
+gth_image_new_for_pixbuf (GdkPixbuf *value)
+{
+ GthImage *image;
+
+ image = gth_image_new ();
+ gth_image_set_pixbuf (image, value);
+
+ return image;
+}
+
+
void
gth_image_set_cairo_surface (GthImage *image,
cairo_surface_t *value)
diff --git a/gthumb/gth-image.h b/gthumb/gth-image.h
index 9230a3d..dd1a068 100644
--- a/gthumb/gth-image.h
+++ b/gthumb/gth-image.h
@@ -70,6 +70,7 @@ typedef GthImage * (*GthImageLoaderFunc) (GthFileData *file_data,
GType gth_image_get_type (void);
GthImage * gth_image_new (void);
+GthImage * gth_image_new_for_pixbuf (GdkPixbuf *value);
void gth_image_set_cairo_surface (GthImage *image,
cairo_surface_t *value);
cairo_surface_t * gth_image_get_cairo_surface (GthImage *image);
diff --git a/gthumb/gth-thumb-loader.c b/gthumb/gth-thumb-loader.c
index 17e2c60..0e222d6 100644
--- a/gthumb/gth-thumb-loader.c
+++ b/gthumb/gth-thumb-loader.c
@@ -196,8 +196,7 @@ generate_thumbnail (GthFileData *file_data,
if (error != NULL)
g_clear_error (error);
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
}
@@ -228,8 +227,7 @@ load_cached_thumbnail (GthFileData *file_data,
filename = g_file_get_path (file_data->file);
pixbuf = gdk_pixbuf_new_from_file (filename, error);
if (pixbuf != NULL) {
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
}
diff --git a/gthumb/pixbuf-io.c b/gthumb/pixbuf-io.c
index 9610ad0..29480c6 100644
--- a/gthumb/pixbuf-io.c
+++ b/gthumb/pixbuf-io.c
@@ -401,12 +401,10 @@ gth_pixbuf_new_from_file (GthFileData *file_data,
if (original_height != NULL)
*original_height = original_h;
- g_free (path);
-
- image = gth_image_new ();
- gth_image_set_pixbuf (image, pixbuf);
+ image = gth_image_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
+ g_free (path);
return image;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]