Commit 42749a92 authored by Álvaro Peña's avatar Álvaro Peña

photo: added a useful function to get the higher resolution image for a photo.

parent c7d3286d
......@@ -52,6 +52,7 @@ struct _GFBGraphPhotoPrivate {
guint width;
guint height;
GList *images;
GFBGraphPhotoImage *hires_image;
};
static void gfbgraph_photo_init (GFBGraphPhoto *obj);
......@@ -513,3 +514,35 @@ gfbgraph_photo_get_images (GFBGraphPhoto *photo)
return photo->priv->images;
}
/**
* gfbgraph_photo_get_image_hires:
* @photo: a #GFBGraphPhoto.
*
* Returns: (transfer none): a #GFBGraphPhotoImage with the higher resolution available of the photo
**/
GFBGraphPhotoImage*
gfbgraph_photo_get_image_hires (GFBGraphPhoto *photo)
{
g_return_val_if_fail (GFBGRAPH_IS_PHOTO (photo), NULL);
if (photo->priv->hires_image == NULL) {
GList *images_list;
guint bigger_width;
GFBGraphPhotoImage *photo_image;
bigger_width = 0;
images_list = photo->priv->images;
while (images_list) {
photo_image = (GFBGraphPhotoImage *) images_list->data;
if (photo_image->width > bigger_width) {
photo->priv->hires_image = photo_image;
bigger_width = photo_image->width;
}
images_list = g_list_next (images_list);
}
}
return photo->priv->hires_image;
}
......@@ -65,6 +65,7 @@ const gchar* gfbgraph_photo_get_default_source_uri (GFBGraphPhoto *photo)
guint gfbgraph_photo_get_default_width (GFBGraphPhoto *photo);
guint gfbgraph_photo_get_default_height (GFBGraphPhoto *photo);
GList* gfbgraph_photo_get_images (GFBGraphPhoto *photo);
GFBGraphPhotoImage* gfbgraph_photo_get_image_hires (GFBGraphPhoto *photo);
G_END_DECLS
......
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