Commit 0fe23f3e authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

added the convenience function gth_image_new_for_pixbuf

parent 30e7b30b
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment