[gthumb: 17/22] [picasaweb] view the photo previews when an album is selected
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb: 17/22] [picasaweb] view the photo previews when an album is selected
- Date: Sat, 30 Jan 2010 23:20:41 +0000 (UTC)
commit 10358c94b9c7581eeb1bded233e05b2ec8c2d222
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Jan 29 20:39:28 2010 +0100
[picasaweb] view the photo previews when an album is selected
extensions/file_viewer/gth-file-viewer-page.c | 2 +-
extensions/list_tools/gth-script.c | 2 +-
.../picasaweb/data/ui/import-from-picasaweb.ui | 8 +-
extensions/picasaweb/dlg-import-from-picasaweb.c | 229 +++++++++-
extensions/picasaweb/picasa-web-photo.c | 129 ++++++-
extensions/picasaweb/picasa-web-photo.h | 27 ++
extensions/picasaweb/picasa-web-types.h | 6 +
extensions/raw_files/main.c | 20 +-
gthumb/glib-utils.c | 11 +-
gthumb/gth-file-list.c | 11 +-
gthumb/gth-file-list.h | 102 +++--
gthumb/gth-icon-cache.c | 11 +-
gthumb/gth-image-loader.c | 2 +-
gthumb/gth-main.h | 5 +-
gthumb/gth-thumb-loader.c | 474 ++++++++++----------
gthumb/gth-thumb-loader.h | 33 +-
gthumb/pixbuf-io.c | 23 +-
gthumb/pixbuf-io.h | 10 +-
18 files changed, 742 insertions(+), 363 deletions(-)
---
diff --git a/extensions/file_viewer/gth-file-viewer-page.c b/extensions/file_viewer/gth-file-viewer-page.c
index 31211d5..344b264 100644
--- a/extensions/file_viewer/gth-file-viewer-page.c
+++ b/extensions/file_viewer/gth-file-viewer-page.c
@@ -106,7 +106,7 @@ gth_file_viewer_page_real_activate (GthViewerPage *base,
g_error_free (error);
}
- self->priv->thumb_loader = gth_thumb_loader_new (128, 128);
+ self->priv->thumb_loader = gth_thumb_loader_new (128);
self->priv->thumb_loader_ready_event =
g_signal_connect (G_OBJECT (self->priv->thumb_loader),
"ready",
diff --git a/extensions/list_tools/gth-script.c b/extensions/list_tools/gth-script.c
index ecb0443..3080446 100644
--- a/extensions/list_tools/gth-script.c
+++ b/extensions/list_tools/gth-script.c
@@ -624,7 +624,7 @@ ask_value (ReplaceData *replace_data,
gtk_widget_hide (_gtk_builder_get_widget (builder, "skip_button"));
g_object_ref (builder);
- thumb_loader = gth_thumb_loader_new (128, 128);
+ thumb_loader = gth_thumb_loader_new (128);
g_signal_connect (thumb_loader, "ready", G_CALLBACK (thumb_loader_ready_cb), builder);
gth_thumb_loader_set_file (thumb_loader, file_data);
gth_thumb_loader_load (thumb_loader);
diff --git a/extensions/picasaweb/data/ui/import-from-picasaweb.ui b/extensions/picasaweb/data/ui/import-from-picasaweb.ui
index 8044eac..937002e 100644
--- a/extensions/picasaweb/data/ui/import-from-picasaweb.ui
+++ b/extensions/picasaweb/data/ui/import-from-picasaweb.ui
@@ -14,7 +14,7 @@
</object>
<object class="GtkDialog" id="import_dialog">
<property name="border_width">5</property>
- <property name="title" translatable="yes">Import from Picasa Web Albums</property>
+ <property name="title" translatable="yes">Import</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@@ -50,6 +50,7 @@
<property name="spacing">6</property>
<child>
<object class="GtkComboBox" id="account_combobox">
+ <property name="width_request">300</property>
<property name="visible">True</property>
<property name="model">account_liststore</property>
<child>
@@ -143,7 +144,8 @@
<child>
<object class="GtkVBox" id="images_box">
<property name="width_request">460</property>
- <property name="height_request">220</property>
+ <property name="height_request">250</property>
+ <property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
@@ -215,7 +217,7 @@
</child>
<child>
<object class="GtkButton" id="download_button">
- <property name="label" translatable="yes">_Download</property>
+ <property name="label" translatable="yes">_Import</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index ed9b509..9382394 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -21,6 +21,7 @@
*/
#include <config.h>
+#define GDK_PIXBUF_ENABLE_BACKEND
#include <gtk/gtk.h>
#ifdef HAVE_GNOME_KEYRING
#include <gnome-keyring.h>
@@ -32,6 +33,7 @@
#include "picasa-account-properties-dialog.h"
#include "picasa-album-properties-dialog.h"
#include "picasa-web-album.h"
+#include "picasa-web-photo.h"
#include "picasa-web-service.h"
#include "picasa-web-user.h"
@@ -60,13 +62,14 @@ typedef struct {
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *progress_dialog;
- GtkWidget *list_view;
+ GtkWidget *file_list;
GList *accounts;
PicasaWebUser *user;
char *email;
char *password;
char *challange;
GList *albums;
+ GList *photos;
GoogleConnection *conn;
PicasaWebService *picasaweb;
GCancellable *cancellable;
@@ -83,6 +86,7 @@ import_dialog_destroy_cb (GtkWidget *widget,
_g_object_unref (data->picasaweb);
_g_object_unref (data->conn);
_g_object_list_unref (data->albums);
+ _g_object_list_unref (data->photos);
g_free (data->challange);
g_free (data->password);
g_free (data->email);
@@ -214,16 +218,23 @@ update_album_list (DialogData *data)
gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("album_liststore")));
for (scan = data->albums; scan; scan = scan->next) {
PicasaWebAlbum *album = scan->data;
+ char *used_bytes;
+
+ used_bytes = g_format_size_for_display (album->used_bytes);
gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter);
gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter,
ALBUM_DATA_COLUMN, album,
ALBUM_ICON_COLUMN, "file-catalog",
ALBUM_NAME_COLUMN, album->title,
+ ALBUM_SIZE_COLUMN, used_bytes,
-1);
+
+ g_free (used_bytes);
}
gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("album_combobox")), -1);
}
@@ -268,6 +279,7 @@ get_album_list (DialogData *data)
{
if (data->picasaweb == NULL)
data->picasaweb = picasa_web_service_new (data->conn);
+ gth_task_dialog (GTH_TASK (data->conn), FALSE);
picasa_web_service_list_albums (data->picasaweb,
"default",
data->cancellable,
@@ -662,10 +674,197 @@ account_combobox_changed_cb (GtkComboBox *widget,
}
+static void
+update_selection_status (DialogData *data)
+{
+ GthFileView *file_view;
+ GList *selected;
+ GList *file_list;
+ int n_selected;
+ goffset size_selected;
+ GList *scan;
+ char *size_selected_formatted;
+ char *text_selected;
+
+ file_view = (GthFileView *) gth_file_list_get_view (GTH_FILE_LIST (data->file_list));
+ selected = gth_file_selection_get_selected (GTH_FILE_SELECTION (file_view));
+ if (selected != NULL)
+ file_list = gth_file_list_get_files (GTH_FILE_LIST (data->file_list), selected);
+ else
+ file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_file_view_get_model (file_view)));
+ n_selected = 0;
+ size_selected = 0;
+ for (scan = file_list; scan; scan = scan->next) {
+ GthFileData *file_data = scan->data;
+
+ n_selected++;
+ size_selected += g_file_info_get_size (file_data->info);
+ }
+ _g_object_list_unref (file_list);
+ _gtk_tree_path_list_free (selected);
+
+ size_selected_formatted = g_format_size_for_display (size_selected);
+ text_selected = g_strdup_printf (g_dngettext (NULL, "%d file (%s)", "%d files (%s)", n_selected), n_selected, size_selected_formatted);
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("images_info_label")), text_selected);
+
+ g_free (text_selected);
+ g_free (size_selected_formatted);
+}
+
+
+static void
+list_photos_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object);
+ GError *error = NULL;
+ GList *list;
+ GList *scan;
+
+ gth_task_dialog (GTH_TASK (data->conn), TRUE);
+ _g_object_list_unref (data->photos);
+ data->photos = picasa_web_service_list_albums_finish (picasaweb, result, &error);
+ if (error != NULL) {
+ _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), &error);
+ gtk_widget_destroy (data->dialog);
+ return;
+ }
+
+ list = NULL;
+ for (scan = data->photos; scan; scan = scan->next) {
+ PicasaWebPhoto *photo = scan->data;
+ GthFileData *file_data;
+
+ file_data = gth_file_data_new_for_uri (photo->uri, photo->mime_type);
+ g_file_info_set_file_type (file_data->info, G_FILE_TYPE_REGULAR);
+ g_file_info_set_size (file_data->info, photo->size);
+ g_file_info_set_attribute_object (file_data->info, "gphoto::object", G_OBJECT (photo));
+
+ list = g_list_prepend (list, file_data);
+ }
+ gth_file_list_set_files (GTH_FILE_LIST (data->file_list), list);
+ update_selection_status (data);
+ gtk_widget_set_sensitive (GET_WIDGET ("download_button"), list != NULL);
+
+ _g_object_list_unref (list);
+}
+
+
+static void
+album_combobox_changed_cb (GtkComboBox *widget,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GtkTreeIter iter;
+ PicasaWebAlbum *album;
+
+ if (! gtk_combo_box_get_active_iter (widget, &iter)) {
+ gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("No album selected"));
+ return;
+ }
+
+ gtk_tree_model_get (gtk_combo_box_get_model (widget),
+ &iter,
+ ALBUM_DATA_COLUMN, &album,
+ -1);
+
+ gth_task_dialog (GTH_TASK (data->conn), FALSE);
+ picasa_web_service_list_photos (data->picasaweb,
+ album,
+ data->cancellable,
+ list_photos_ready_cb,
+ data);
+
+ g_object_unref (album);
+}
+
+
+GdkPixbufAnimation *
+picasa_web_thumbnail_loader (GthFileData *file_data,
+ GError **error,
+ gpointer data)
+{
+ GdkPixbufAnimation *animation = NULL;
+ GthThumbLoader *thumb_loader = data;
+ int requested_size;
+ PicasaWebPhoto *photo;
+ const char *uri;
+
+ photo = (PicasaWebPhoto *) g_file_info_get_attribute_object (file_data->info, "gphoto::object");
+ requested_size = gth_thumb_loader_get_requested_size (thumb_loader);
+ if (requested_size == 72)
+ uri = photo->thumbnail_72;
+ else if (requested_size == 144)
+ uri = photo->thumbnail_144;
+ else if (requested_size == 288)
+ uri = photo->thumbnail_288;
+ else
+ uri = NULL;
+
+ if (uri == NULL)
+ uri = photo->uri;
+
+ if (uri != NULL) {
+ GFile *file;
+ void *buffer;
+ gsize size;
+
+ file = g_file_new_for_uri (uri);
+ if (g_load_file_in_buffer (file, &buffer, &size, error)) {
+ GInputStream *stream;
+ GdkPixbuf *pixbuf;
+
+ stream = g_memory_input_stream_new_from_data (buffer, size, g_free);
+ pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error);
+ if (pixbuf != NULL)
+ animation = gdk_pixbuf_non_anim_new (pixbuf);
+
+ g_object_unref (stream);
+ }
+
+ g_object_unref (file);
+ }
+ else
+ *error = g_error_new_literal (GTH_ERROR, 0, "cannot generate the thumbnail");
+
+ return animation;
+}
+
+
+static int
+picasa_web_photo_position_func (GthFileData *a,
+ GthFileData *b)
+{
+ PicasaWebPhoto *photo_a;
+ PicasaWebPhoto *photo_b;
+
+ photo_a = (PicasaWebPhoto *) g_file_info_get_attribute_object (a->info, "gphoto::object");
+ photo_b = (PicasaWebPhoto *) g_file_info_get_attribute_object (b->info, "gphoto::object");
+
+ if (photo_a->position == photo_b->position)
+ return strcmp (photo_a->title, photo_b->title);
+ else if (photo_a->position > photo_b->position)
+ return 1;
+ else
+ return -1;
+}
+
+
+static void
+file_list_selection_changed_cb (GtkIconView *iconview,
+ gpointer user_data)
+{
+ update_selection_status ((DialogData *) user_data);
+}
+
+
void
dlg_import_from_picasaweb (GthBrowser *browser)
{
- DialogData *data;
+ DialogData *data;
+ GthThumbLoader *thumb_loader;
data = g_new0 (DialogData, 1);
data->browser = browser;
@@ -701,14 +900,18 @@ dlg_import_from_picasaweb (GthBrowser *browser)
/* Set the widget data */
- data->list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION);
- gth_file_list_set_thumb_size (GTH_FILE_LIST (data->list_view), 112);
- gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->list_view))), 0);
- gth_file_list_enable_thumbs (GTH_FILE_LIST (data->list_view), TRUE);
- gth_file_list_set_caption (GTH_FILE_LIST (data->list_view), "none");
- gth_file_list_set_sort_func (GTH_FILE_LIST (data->list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
- gtk_widget_show (data->list_view);
- gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), data->list_view, TRUE, TRUE, 0);
+ data->file_list = gth_file_list_new (GTH_FILE_LIST_TYPE_NORMAL);
+ thumb_loader = gth_file_list_get_thumb_loader (GTH_FILE_LIST (data->file_list));
+ gth_thumb_loader_use_cache (thumb_loader, FALSE);
+ gth_thumb_loader_set_loader (thumb_loader, picasa_web_thumbnail_loader);
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (data->file_list), PICASA_WEB_THUMB_SIZE_SMALL);
+ gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))), 0);
+ gth_file_list_enable_thumbs (GTH_FILE_LIST (data->file_list), TRUE);
+ gth_file_list_set_caption (GTH_FILE_LIST (data->file_list), "none");
+ gth_file_list_set_sort_func (GTH_FILE_LIST (data->file_list), picasa_web_photo_position_func, FALSE);
+ gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("No album selected"));
+ gtk_widget_show (data->file_list);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), data->file_list, TRUE, TRUE, 0);
gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
@@ -730,12 +933,14 @@ dlg_import_from_picasaweb (GthBrowser *browser)
"changed",
G_CALLBACK (account_combobox_changed_cb),
data);
- /* FIXME
g_signal_connect (GET_WIDGET ("album_combobox"),
"changed",
G_CALLBACK (album_combobox_changed_cb),
data);
- */
+ g_signal_connect (G_OBJECT (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))),
+ "selection_changed",
+ G_CALLBACK (file_list_selection_changed_cb),
+ data);
data->accounts = picasa_web_accounts_load_from_file (&data->email);
auto_select_account (data);
diff --git a/extensions/picasaweb/picasa-web-photo.c b/extensions/picasaweb/picasa-web-photo.c
index 52d324f..b2cbf10 100644
--- a/extensions/picasaweb/picasa-web-photo.c
+++ b/extensions/picasaweb/picasa-web-photo.c
@@ -103,7 +103,12 @@ picasa_web_photo_create_element (DomDomizable *base,
DomElement *group;
group = dom_document_create_element (doc, "media:group", NULL);
- dom_element_append_child (group, dom_document_create_element_with_text (doc, self->keywords, "media:keywords", NULL));
+ if (self->credit != NULL)
+ dom_element_append_child (group, dom_document_create_element_with_text (doc, self->credit, "media:credit", NULL));
+ if (self->description != NULL)
+ dom_element_append_child (group, dom_document_create_element_with_text (doc, self->description, "media:description", "type", "plain", NULL));
+ if (self->keywords != NULL)
+ dom_element_append_child (group, dom_document_create_element_with_text (doc, self->keywords, "media:keywords", NULL));
dom_element_append_child (element, group);
}
@@ -150,6 +155,7 @@ picasa_web_photo_load_from_element (DomDomizable *base,
}
else if (g_strcmp0 (node->tag_name, "content") == 0) {
picasa_web_photo_set_uri (self, dom_element_get_attribute (node, "src"));
+ picasa_web_photo_set_mime_type (self, dom_element_get_attribute (node, "type"));
}
else if (g_strcmp0 (node->tag_name, "gphoto:access") == 0) {
picasa_web_photo_set_access (self, dom_element_get_inner_text (node));
@@ -158,12 +164,43 @@ picasa_web_photo_load_from_element (DomDomizable *base,
DomElement *child;
for (child = node->first_child; child; child = child->next_sibling) {
+ if (g_strcmp0 (child->tag_name, "media:credit") == 0) {
+ picasa_web_photo_set_credit (self, dom_element_get_inner_text (child));
+ break;
+ }
+ if (g_strcmp0 (child->tag_name, "media:description") == 0) {
+ picasa_web_photo_set_description (self, dom_element_get_inner_text (child));
+ break;
+ }
if (g_strcmp0 (child->tag_name, "media:keywords") == 0) {
picasa_web_photo_set_keywords (self, dom_element_get_inner_text (child));
break;
}
+ if (g_strcmp0 (child->tag_name, "media:thumbnail") == 0) {
+ int width;
+ int height;
+
+ width = atoi (dom_element_get_attribute (child, "width"));
+ height = atoi (dom_element_get_attribute (child, "height"));
+
+ if ((width <= 72) && (height <= 72))
+ picasa_web_photo_set_thumbnail_72 (self, dom_element_get_attribute (child, "url"));
+ else if ((width <= 144) && (height <= 144))
+ picasa_web_photo_set_thumbnail_144 (self, dom_element_get_attribute (child, "url"));
+ else if ((width <= 288) && (height <= 288))
+ picasa_web_photo_set_thumbnail_288 (self, dom_element_get_attribute (child, "url"));
+ }
}
}
+ else if (g_strcmp0 (node->tag_name, "gphoto:position") == 0) {
+ picasa_web_photo_set_position (self, dom_element_get_inner_text (node));
+ }
+ else if (g_strcmp0 (node->tag_name, "gphoto:rotation") == 0) {
+ picasa_web_photo_set_rotation (self, dom_element_get_inner_text (node));
+ }
+ else if (g_strcmp0 (node->tag_name, "gphoto:size") == 0) {
+ picasa_web_photo_set_size (self, dom_element_get_inner_text (node));
+ }
}
}
@@ -291,6 +328,17 @@ picasa_web_photo_set_uri (PicasaWebPhoto *self,
void
+picasa_web_photo_set_mime_type (PicasaWebPhoto *self,
+ const char *value)
+{
+ g_free (self->mime_type);
+ self->mime_type = NULL;
+ if (value != NULL)
+ self->mime_type = g_strdup (value);
+}
+
+
+void
picasa_web_photo_set_access (PicasaWebPhoto *self,
const char *value)
{
@@ -310,6 +358,28 @@ picasa_web_photo_set_access (PicasaWebPhoto *self,
void
+picasa_web_photo_set_credit (PicasaWebPhoto *self,
+ const char *value)
+{
+ g_free (self->credit);
+ self->credit = NULL;
+ if (value != NULL)
+ self->credit = g_strdup (value);
+}
+
+
+void
+picasa_web_photo_set_description (PicasaWebPhoto *self,
+ const char *value)
+{
+ g_free (self->description);
+ self->description = NULL;
+ if (value != NULL)
+ self->description = g_strdup (value);
+}
+
+
+void
picasa_web_photo_set_keywords (PicasaWebPhoto *self,
const char *value)
{
@@ -318,3 +388,60 @@ picasa_web_photo_set_keywords (PicasaWebPhoto *self,
if (value != NULL)
self->keywords = g_strdup (value);
}
+
+
+void
+picasa_web_photo_set_thumbnail_72 (PicasaWebPhoto *self,
+ const char *value)
+{
+ g_free (self->thumbnail_72);
+ self->thumbnail_72 = NULL;
+ if (value != NULL)
+ self->thumbnail_72 = g_strdup (value);
+}
+
+
+void
+picasa_web_photo_set_thumbnail_144 (PicasaWebPhoto *self,
+ const char *value)
+{
+ g_free (self->thumbnail_144);
+ self->thumbnail_144 = NULL;
+ if (value != NULL)
+ self->thumbnail_144 = g_strdup (value);
+}
+
+
+void
+picasa_web_photo_set_thumbnail_288 (PicasaWebPhoto *self,
+ const char *value)
+{
+ g_free (self->thumbnail_288);
+ self->thumbnail_288 = NULL;
+ if (value != NULL)
+ self->thumbnail_288 = g_strdup (value);
+}
+
+
+void
+picasa_web_photo_set_position (PicasaWebPhoto *self,
+ const char *value)
+{
+ sscanf (value, "%f", &self->position);
+}
+
+
+void
+picasa_web_photo_set_rotation (PicasaWebPhoto *self,
+ const char *value)
+{
+ sscanf (value, "%u", &self->rotation);
+}
+
+
+void
+picasa_web_photo_set_size (PicasaWebPhoto *self,
+ const char *value)
+{
+ self->size = g_ascii_strtoull (value, NULL, 10);
+}
diff --git a/extensions/picasaweb/picasa-web-photo.h b/extensions/picasaweb/picasa-web-photo.h
index 007c002..ec6e3b3 100644
--- a/extensions/picasaweb/picasa-web-photo.h
+++ b/extensions/picasaweb/picasa-web-photo.h
@@ -50,8 +50,17 @@ struct _PicasaWebPhoto {
char *title;
char *summary;
char *uri;
+ char *mime_type;
PicasaWebAccess access;
+ char *credit;
+ char *description;
char *keywords;
+ char *thumbnail_72;
+ char *thumbnail_144;
+ char *thumbnail_288;
+ float position;
+ guint32 rotation;
+ goffset size;
};
struct _PicasaWebPhotoClass {
@@ -72,10 +81,28 @@ void picasa_web_photo_set_summary (PicasaWebPhoto *self,
const char *value);
void picasa_web_photo_set_uri (PicasaWebPhoto *self,
const char *value);
+void picasa_web_photo_set_mime_type (PicasaWebPhoto *self,
+ const char *value);
void picasa_web_photo_set_access (PicasaWebPhoto *self,
const char *value);
+void picasa_web_photo_set_credit (PicasaWebPhoto *self,
+ const char *value);
+void picasa_web_photo_set_description (PicasaWebPhoto *self,
+ const char *value);
void picasa_web_photo_set_keywords (PicasaWebPhoto *self,
const char *value);
+void picasa_web_photo_set_thumbnail_72 (PicasaWebPhoto *self,
+ const char *value);
+void picasa_web_photo_set_thumbnail_144 (PicasaWebPhoto *self,
+ const char *value);
+void picasa_web_photo_set_thumbnail_288 (PicasaWebPhoto *self,
+ const char *value);
+void picasa_web_photo_set_position (PicasaWebPhoto *self,
+ const char *value);
+void picasa_web_photo_set_rotation (PicasaWebPhoto *self,
+ const char *value);
+void picasa_web_photo_set_size (PicasaWebPhoto *self,
+ const char *value);
G_END_DECLS
diff --git a/extensions/picasaweb/picasa-web-types.h b/extensions/picasaweb/picasa-web-types.h
index fe2f030..3f926b0 100644
--- a/extensions/picasaweb/picasa-web-types.h
+++ b/extensions/picasaweb/picasa-web-types.h
@@ -30,4 +30,10 @@ typedef enum {
PICASA_WEB_ACCESS_VISIBLE
} PicasaWebAccess;
+typedef enum {
+ PICASA_WEB_THUMB_SIZE_SMALL = 72,
+ PICASA_WEB_THUMB_SIZE_MEDIUM = 144,
+ PICASA_WEB_THUMB_SIZE_LARGE = 288
+} PicasaWebThumbSize;
+
#endif /* PICASA_WEB_TYPES_H */
diff --git a/extensions/raw_files/main.c b/extensions/raw_files/main.c
index 8f145d1..4d3a526 100644
--- a/extensions/raw_files/main.c
+++ b/extensions/raw_files/main.c
@@ -184,15 +184,14 @@ openraw_get_pixbuf_from_file (GthFileData *file_data,
static GdkPixbufAnimation *
openraw_pixbuf_animation_new_from_file (GthFileData *file_data,
- GError **error,
- int requested_width,
- int requested_height)
+ int requested_size,
+ GError **error)
{
GdkPixbufAnimation *animation;
GdkPixbuf *pixbuf;
- if ((requested_width == 0) || (requested_height == 0))
- pixbuf = openraw_extract_thumbnail_from_file (file_data, requested_width, error);
+ if (requested_size == 0)
+ pixbuf = openraw_extract_thumbnail_from_file (file_data, requested_size, error);
else
pixbuf = openraw_get_pixbuf_from_file (file_data, error);
@@ -272,9 +271,8 @@ get_file_mtime (const char *path)
static GdkPixbufAnimation *
openraw_pixbuf_animation_new_from_file (GthFileData *file_data,
- GError **error,
- int requested_width,
- int requested_height)
+ int requested_size,
+ GError **error)
{
GdkPixbufAnimation *animation;
GdkPixbuf *pixbuf;
@@ -288,7 +286,7 @@ openraw_pixbuf_animation_new_from_file (GthFileData *file_data,
char *local_file_esc;
char *command = NULL;
- is_thumbnail = requested_width > 0;
+ is_thumbnail = requested_size > 0;
is_raw = _g_mime_type_is_raw (gth_file_data_get_mime_type (file_data));
is_hdr = _g_mime_type_is_hdr (gth_file_data_get_mime_type (file_data));
@@ -383,8 +381,8 @@ openraw_pixbuf_animation_new_from_file (GthFileData *file_data,
if (is_thumbnail)
resize_command = g_strdup_printf (" | pfssize --maxx %d --maxy %d",
- requested_width,
- requested_height);
+ requested_size,
+ requested_size);
else
resize_command = g_strdup_printf (" ");
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index 81e6022..fcc1158 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -2021,15 +2021,8 @@ resolve_symlinks (GFile *file,
}
path = g_file_get_path (file);
- if (path == NULL) {
- char *uri;
-
- uri = g_file_get_uri (file);
- *error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "No local pathname for file: %s.", uri);
- g_free (uri);
-
- return NULL;
- }
+ if (path == NULL)
+ return g_file_dup (file);
resolved = g_file_new_for_path (G_DIR_SEPARATOR_S);
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index 5d0c359..8107c34 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -483,7 +483,7 @@ gth_file_list_construct (GthFileList *file_list,
/* thumbnail loader */
- file_list->priv->thumb_loader = gth_thumb_loader_new (file_list->priv->thumb_size, file_list->priv->thumb_size);
+ file_list->priv->thumb_loader = gth_thumb_loader_new (file_list->priv->thumb_size);
g_signal_connect (G_OBJECT (file_list->priv->thumb_loader),
"ready",
G_CALLBACK (thumb_loader_ready_cb),
@@ -713,6 +713,13 @@ gth_file_list_cancel (GthFileList *file_list,
}
+GthThumbLoader *
+gth_file_list_get_thumb_loader (GthFileList *file_list)
+{
+ return file_list->priv->thumb_loader;
+}
+
+
static void
gfl_clear_list (GthFileList *file_list,
const char *message)
@@ -1115,7 +1122,7 @@ gth_file_list_set_thumb_size (GthFileList *file_list,
int size)
{
file_list->priv->thumb_size = size;
- gth_thumb_loader_set_thumb_size (file_list->priv->thumb_loader, size, size);
+ gth_thumb_loader_set_requested_size (file_list->priv->thumb_loader, size);
gth_icon_cache_free (file_list->priv->icon_cache);
file_list->priv->icon_cache = gth_icon_cache_new (gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (file_list))), size / 2);
diff --git a/gthumb/gth-file-list.h b/gthumb/gth-file-list.h
index d176166..3c6454a 100644
--- a/gthumb/gth-file-list.h
+++ b/gthumb/gth-file-list.h
@@ -28,6 +28,7 @@
#include "gth-file-source.h"
#include "gth-file-store.h"
#include "gth-test.h"
+#include "gth-thumb-loader.h"
G_BEGIN_DECLS
@@ -58,56 +59,57 @@ struct _GthFileListClass {
GtkVBoxClass __parent;
};
-GType gth_file_list_get_type (void);
-GtkWidget * gth_file_list_new (GthFileListType list_type);
-void gth_file_list_cancel (GthFileList *file_list,
- DataFunc done_func,
- gpointer user_data);
-void gth_file_list_set_files (GthFileList *file_list,
- GList *list);
-GList * gth_file_list_get_files (GthFileList *file_list,
- GList *tree_path_list);
-void gth_file_list_clear (GthFileList *file_list,
- const char *message);
-void gth_file_list_add_files (GthFileList *file_list,
- GList *list /* GthFileData */);
-void gth_file_list_delete_files (GthFileList *file_list,
- GList *list /* GFile */);
-void gth_file_list_update_files (GthFileList *file_list,
- GList *list /* GthFileData */);
-void gth_file_list_rename_file (GthFileList *file_list,
- GFile *file,
- GthFileData *file_data);
-void gth_file_list_set_filter (GthFileList *file_list,
- GthTest *filter);
-void gth_file_list_set_sort_func (GthFileList *file_list,
- GthFileDataCompFunc cmp_func,
- gboolean inverse_sort);
-void gth_file_list_enable_thumbs (GthFileList *file_list,
- gboolean enable);
-void gth_file_list_set_thumb_size (GthFileList *file_list,
- int size);
-void gth_file_list_set_caption (GthFileList *file_list,
- const char *attribute);
-GtkWidget * gth_file_list_get_view (GthFileList *file_list);
-GtkWidget * gth_file_list_get_empty_view (GthFileList *file_list);
-GtkAdjustment * gth_file_list_get_vadjustment (GthFileList *file_list);
-int gth_file_list_first_file (GthFileList *file_list,
- gboolean skip_broken,
- gboolean only_selected);
-int gth_file_list_last_file (GthFileList *file_list,
- gboolean skip_broken,
- gboolean only_selected);
-int gth_file_list_next_file (GthFileList *file_list,
- int pos,
- gboolean skip_broken,
- gboolean only_selected,
- gboolean wrap);
-int gth_file_list_prev_file (GthFileList *file_list,
- int pos,
- gboolean skip_broken,
- gboolean only_selected,
- gboolean wrap);
+GType gth_file_list_get_type (void);
+GtkWidget * gth_file_list_new (GthFileListType list_type);
+void gth_file_list_cancel (GthFileList *file_list,
+ DataFunc done_func,
+ gpointer user_data);
+GthThumbLoader * gth_file_list_get_thumb_loader (GthFileList *file_list);
+void gth_file_list_set_files (GthFileList *file_list,
+ GList *list);
+GList * gth_file_list_get_files (GthFileList *file_list,
+ GList *tree_path_list);
+void gth_file_list_clear (GthFileList *file_list,
+ const char *message);
+void gth_file_list_add_files (GthFileList *file_list,
+ GList *list /* GthFileData */);
+void gth_file_list_delete_files (GthFileList *file_list,
+ GList *list /* GFile */);
+void gth_file_list_update_files (GthFileList *file_list,
+ GList *list /* GthFileData */);
+void gth_file_list_rename_file (GthFileList *file_list,
+ GFile *file,
+ GthFileData *file_data);
+void gth_file_list_set_filter (GthFileList *file_list,
+ GthTest *filter);
+void gth_file_list_set_sort_func (GthFileList *file_list,
+ GthFileDataCompFunc cmp_func,
+ gboolean inverse_sort);
+void gth_file_list_enable_thumbs (GthFileList *file_list,
+ gboolean enable);
+void gth_file_list_set_thumb_size (GthFileList *file_list,
+ int size);
+void gth_file_list_set_caption (GthFileList *file_list,
+ const char *attribute);
+GtkWidget * gth_file_list_get_view (GthFileList *file_list);
+GtkWidget * gth_file_list_get_empty_view (GthFileList *file_list);
+GtkAdjustment * gth_file_list_get_vadjustment (GthFileList *file_list);
+int gth_file_list_first_file (GthFileList *file_list,
+ gboolean skip_broken,
+ gboolean only_selected);
+int gth_file_list_last_file (GthFileList *file_list,
+ gboolean skip_broken,
+ gboolean only_selected);
+int gth_file_list_next_file (GthFileList *file_list,
+ int pos,
+ gboolean skip_broken,
+ gboolean only_selected,
+ gboolean wrap);
+int gth_file_list_prev_file (GthFileList *file_list,
+ int pos,
+ gboolean skip_broken,
+ gboolean only_selected,
+ gboolean wrap);
G_END_DECLS
diff --git a/gthumb/gth-icon-cache.c b/gthumb/gth-icon-cache.c
index de68c92..8f5b6e4 100644
--- a/gthumb/gth-icon-cache.c
+++ b/gthumb/gth-icon-cache.c
@@ -135,7 +135,16 @@ gth_icon_cache_get_pixbuf (GthIconCache *icon_cache,
return pixbuf;
}
- pixbuf = _g_icon_get_pixbuf (icon, icon_cache->icon_size, icon_cache->icon_theme);
+ if (icon == NULL) {
+ GIcon *unknown_icon;
+
+ unknown_icon = g_themed_icon_new ("missing-image");
+ pixbuf = _g_icon_get_pixbuf (unknown_icon, icon_cache->icon_size, icon_cache->icon_theme);
+
+ g_object_unref (unknown_icon);
+ }
+ else
+ pixbuf = _g_icon_get_pixbuf (icon, icon_cache->icon_size, icon_cache->icon_theme);
g_hash_table_insert (icon_cache->cache, (gpointer) key, g_object_ref (pixbuf));
performance (DEBUG_INFO, "done (not cached)");
diff --git a/gthumb/gth-image-loader.c b/gthumb/gth-image-loader.c
index 8022f13..143c7e7 100644
--- a/gthumb/gth-image-loader.c
+++ b/gthumb/gth-image-loader.c
@@ -231,7 +231,7 @@ load_image_thread (void *thread_data)
loader = gth_main_get_pixbuf_loader (gth_file_data_get_mime_type (file));
if (loader != NULL)
- animation = loader (file, &error, -1, -1);
+ animation = loader (file, -1, &error);
else
error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("No suitable loader available for this file type"));
}
diff --git a/gthumb/gth-main.h b/gthumb/gth-main.h
index 89687d5..0682a7c 100644
--- a/gthumb/gth-main.h
+++ b/gthumb/gth-main.h
@@ -51,9 +51,8 @@ typedef struct _GthMainPrivate GthMainPrivate;
typedef struct _GthMainClass GthMainClass;
typedef GdkPixbufAnimation* (*PixbufLoader) (GthFileData *file_data,
- GError **error,
- int requested_width,
- int requested_height);
+ int requested_size,
+ GError **error);
struct _GthMain {
GObject __parent;
diff --git a/gthumb/gth-thumb-loader.c b/gthumb/gth-thumb-loader.c
index ca9b6ac..de2bf20 100644
--- a/gthumb/gth-thumb-loader.c
+++ b/gthumb/gth-thumb-loader.c
@@ -49,29 +49,28 @@
struct _GthThumbLoaderPrivateData
{
- GthFileData *file;
+ GthFileData *file_data;
GthImageLoader *iloader;
GdkPixbuf *pixbuf; /* Contains the final (scaled
* if necessary) image when
* done. */
guint use_cache : 1;
- guint from_cache : 1;
+ guint loading_from_cache : 1;
guint save_thumbnails : 1;
- int max_w;
- int max_h;
- int cache_max_w;
- int cache_max_h;
+ int requested_size;
+ int cache_max_size;
goffset max_file_size; /* If the file size is greater
* than this the thumbnail
* will not be created, for
* functionality reasons. */
-
- GnomeDesktopThumbnailSize thumb_size;
- GnomeDesktopThumbnailFactory *thumb_factory;
- char *thumbnailer_tmpfile;
- GPid thumbnailer_pid;
- guint thumbnailer_watch;
- guint thumbnailer_timeout;
+ GnomeDesktopThumbnailSize
+ thumb_size;
+ GnomeDesktopThumbnailFactory
+ *thumb_factory;
+ char *thumbnailer_tmpfile;
+ GPid thumbnailer_pid;
+ guint thumbnailer_watch;
+ guint thumbnailer_timeout;
};
@@ -88,20 +87,20 @@ static guint gth_thumb_loader_signals[LAST_SIGNAL] = { 0 };
static void
gth_thumb_loader_finalize (GObject *object)
{
- GthThumbLoader *tloader;
+ GthThumbLoader *self;
g_return_if_fail (object != NULL);
g_return_if_fail (GTH_IS_THUMB_LOADER (object));
- tloader = GTH_THUMB_LOADER (object);
+ self = GTH_THUMB_LOADER (object);
- if (tloader->priv != NULL) {
- g_free (tloader->priv->thumbnailer_tmpfile);
- _g_object_unref (tloader->priv->pixbuf);
- g_object_unref (tloader->priv->iloader);
- g_object_unref (tloader->priv->file);
- g_free (tloader->priv);
- tloader->priv = NULL;
+ if (self->priv != NULL) {
+ g_free (self->priv->thumbnailer_tmpfile);
+ _g_object_unref (self->priv->pixbuf);
+ g_object_unref (self->priv->iloader);
+ g_object_unref (self->priv->file_data);
+ g_free (self->priv);
+ self->priv = NULL;
}
/* Chain up */
@@ -132,15 +131,15 @@ gth_thumb_loader_class_init (GthThumbLoaderClass *class)
static void
-gth_thumb_loader_init (GthThumbLoader *tloader)
+gth_thumb_loader_init (GthThumbLoader *self)
{
- tloader->priv = g_new0 (GthThumbLoaderPrivateData, 1);
- tloader->priv->file = NULL;
- tloader->priv->pixbuf = NULL;
- tloader->priv->use_cache = TRUE;
- tloader->priv->save_thumbnails = TRUE;
- tloader->priv->from_cache = FALSE;
- tloader->priv->max_file_size = 0;
+ self->priv = g_new0 (GthThumbLoaderPrivateData, 1);
+ self->priv->file_data = NULL;
+ self->priv->pixbuf = NULL;
+ self->priv->use_cache = TRUE;
+ self->priv->save_thumbnails = TRUE;
+ self->priv->loading_from_cache = FALSE;
+ self->priv->max_file_size = 0;
}
@@ -175,24 +174,22 @@ gth_thumb_loader_get_type (void)
static int
normalize_thumb (int *width,
int *height,
- int max_width,
- int max_height,
- int cache_max_w,
- int cache_max_h)
+ int max_size,
+ int cache_max_size)
{
gboolean modified;
- float max_w = max_width;
- float max_h = max_height;
+ float max_w = max_size;
+ float max_h = max_size;
float w = *width;
float h = *height;
float factor;
int new_width, new_height;
- if ((max_width > cache_max_w) && (max_height > cache_max_h)) {
- if ((*width < cache_max_w - 1) && (*height < cache_max_h - 1))
+ if (max_size > cache_max_size) {
+ if ((*width < cache_max_size - 1) && (*height < cache_max_size - 1))
return FALSE;
}
- else if ((*width < max_width - 1) && (*height < max_height - 1))
+ else if ((*width < max_size - 1) && (*height < max_size - 1))
return FALSE;
factor = MIN (max_w / w, max_h / h);
@@ -209,19 +206,19 @@ normalize_thumb (int *width,
static gboolean
-_gth_thumb_loader_save_to_cache (GthThumbLoader *tloader)
+_gth_thumb_loader_save_to_cache (GthThumbLoader *self)
{
char *uri;
char *cache_path;
GFile *cache_file;
GFile *cache_dir;
- if ((tloader == NULL) || (tloader->priv->pixbuf == NULL))
+ if ((self == NULL) || (self->priv->pixbuf == NULL))
return FALSE;
- uri = g_file_get_uri (tloader->priv->file->file);
+ uri = g_file_get_uri (self->priv->file_data->file);
- if (g_file_is_native (tloader->priv->file->file)) {
+ if (g_file_is_native (self->priv->file_data->file)) {
char *cache_base_uri;
/* Do not save thumbnails from the user's thumbnail directory,
@@ -236,7 +233,7 @@ _gth_thumb_loader_save_to_cache (GthThumbLoader *tloader)
g_free (cache_base_uri);
}
- cache_path = gnome_desktop_thumbnail_path_for_uri (uri, tloader->priv->thumb_size);
+ cache_path = gnome_desktop_thumbnail_path_for_uri (uri, self->priv->thumb_size);
if (cache_path == NULL) {
g_free (uri);
return FALSE;
@@ -248,11 +245,11 @@ _gth_thumb_loader_save_to_cache (GthThumbLoader *tloader)
if (_g_directory_make (cache_dir, THUMBNAIL_DIR_PERMISSIONS, NULL)) {
char *uri;
- uri = g_file_get_uri (tloader->priv->file->file);
- gnome_desktop_thumbnail_factory_save_thumbnail (tloader->priv->thumb_factory,
- tloader->priv->pixbuf,
+ uri = g_file_get_uri (self->priv->file_data->file);
+ gnome_desktop_thumbnail_factory_save_thumbnail (self->priv->thumb_factory,
+ self->priv->pixbuf,
uri,
- gth_file_data_get_mtime (tloader->priv->file));
+ gth_file_data_get_mtime (self->priv->file_data));
g_free (uri);
}
@@ -270,75 +267,80 @@ image_loader_loaded (GthImageLoader *iloader,
GdkPixbuf *pixbuf,
gpointer data)
{
- GthThumbLoader *tloader = data;
+ GthThumbLoader *self = data;
int width, height;
gboolean modified;
- if (tloader->priv->pixbuf != NULL) {
- g_object_unref (tloader->priv->pixbuf);
- tloader->priv->pixbuf = NULL;
+ if (self->priv->pixbuf != NULL) {
+ g_object_unref (self->priv->pixbuf);
+ self->priv->pixbuf = NULL;
}
if (pixbuf == NULL) {
char *uri;
- uri = g_file_get_uri (tloader->priv->file->file);
- gnome_desktop_thumbnail_factory_create_failed_thumbnail (tloader->priv->thumb_factory,
+ uri = g_file_get_uri (self->priv->file_data->file);
+ gnome_desktop_thumbnail_factory_create_failed_thumbnail (self->priv->thumb_factory,
uri,
- gth_file_data_get_mtime (tloader->priv->file));
- g_signal_emit (G_OBJECT (tloader), gth_thumb_loader_signals[READY], 0, NULL);
+ gth_file_data_get_mtime (self->priv->file_data));
+ g_signal_emit (G_OBJECT (self), gth_thumb_loader_signals[READY], 0, NULL);
g_free (uri);
return;
}
g_object_ref (pixbuf);
- tloader->priv->pixbuf = pixbuf;
+ self->priv->pixbuf = pixbuf;
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
- if (tloader->priv->use_cache) {
+ if (self->priv->use_cache) {
/* Thumbnails are always saved with the same size, then
* scaled if necessary. */
/* Check whether to scale. */
+
modified = scale_keeping_ratio (&width,
&height,
- tloader->priv->cache_max_w,
- tloader->priv->cache_max_h,
+ self->priv->cache_max_size,
+ self->priv->cache_max_size,
FALSE);
if (modified) {
- g_object_unref (tloader->priv->pixbuf);
- tloader->priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ g_object_unref (self->priv->pixbuf);
+ self->priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
}
/* Save the thumbnail if necessary. */
- if (tloader->priv->save_thumbnails && ! tloader->priv->from_cache)
- _gth_thumb_loader_save_to_cache (tloader);
+
+ if (self->priv->save_thumbnails && ! self->priv->loading_from_cache)
+ _gth_thumb_loader_save_to_cache (self);
/* Scale if the user wants a different size. */
+
modified = normalize_thumb (&width,
&height,
- tloader->priv->max_w,
- tloader->priv->max_h,
- tloader->priv->cache_max_w,
- tloader->priv->cache_max_h);
+ self->priv->requested_size,
+ self->priv->cache_max_size);
if (modified) {
- pixbuf = tloader->priv->pixbuf;
- tloader->priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ pixbuf = self->priv->pixbuf;
+ self->priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
}
}
else {
- modified = scale_keeping_ratio (&width, &height, tloader->priv->max_w, tloader->priv->max_h, FALSE);
+ modified = scale_keeping_ratio (&width,
+ &height,
+ self->priv->requested_size,
+ self->priv->requested_size,
+ FALSE);
if (modified) {
- g_object_unref (tloader->priv->pixbuf);
- tloader->priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ g_object_unref (self->priv->pixbuf);
+ self->priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
}
}
- g_signal_emit (G_OBJECT (tloader), gth_thumb_loader_signals[READY], 0, NULL);
+ g_signal_emit (G_OBJECT (self), gth_thumb_loader_signals[READY], 0, NULL);
}
@@ -347,50 +349,50 @@ image_loader_error (GthImageLoader *iloader,
GError *error,
gpointer data)
{
- GthThumbLoader *tloader = data;
+ GthThumbLoader *self = data;
g_return_if_fail (error != NULL);
- if (! tloader->priv->from_cache) {
+ if (! self->priv->loading_from_cache) {
char *uri;
- if (tloader->priv->pixbuf != NULL) {
- g_object_unref (tloader->priv->pixbuf);
- tloader->priv->pixbuf = NULL;
+ if (self->priv->pixbuf != NULL) {
+ g_object_unref (self->priv->pixbuf);
+ self->priv->pixbuf = NULL;
}
- uri = g_file_get_uri (tloader->priv->file->file);
- gnome_desktop_thumbnail_factory_create_failed_thumbnail (tloader->priv->thumb_factory,
+ uri = g_file_get_uri (self->priv->file_data->file);
+ gnome_desktop_thumbnail_factory_create_failed_thumbnail (self->priv->thumb_factory,
uri,
- gth_file_data_get_mtime (tloader->priv->file));
+ gth_file_data_get_mtime (self->priv->file_data));
g_free (uri);
- g_signal_emit (G_OBJECT (tloader), gth_thumb_loader_signals[READY], 0, error);
+ g_signal_emit (G_OBJECT (self), gth_thumb_loader_signals[READY], 0, error);
+
return;
}
- g_error_free (error);
-
- /* Try to load the original image if cache version failed. */
+ /* ! loading_from_cache : try to load the original image if cache version failed. */
- tloader->priv->from_cache = FALSE;
- gth_image_loader_set_file_data (tloader->priv->iloader, tloader->priv->file);
- gth_image_loader_load (tloader->priv->iloader);
+ g_error_free (error);
+ self->priv->loading_from_cache = FALSE;
+ gth_image_loader_set_file_data (self->priv->iloader, self->priv->file_data);
+ gth_image_loader_load (self->priv->iloader);
}
static gboolean
kill_thumbnailer_cb (gpointer data)
{
- GthThumbLoader *tloader = data;
+ GthThumbLoader *self = data;
- g_source_remove (tloader->priv->thumbnailer_timeout);
- tloader->priv->thumbnailer_timeout = 0;
+ g_source_remove (self->priv->thumbnailer_timeout);
+ self->priv->thumbnailer_timeout = 0;
- if (tloader->priv->thumbnailer_pid != 0) {
- /*g_source_remove (tloader->priv->thumbnailer_watch);
- tloader->priv->thumbnailer_watch = 0;*/
- kill (tloader->priv->thumbnailer_pid, SIGTERM);
- /*tloader->priv->thumbnailer_pid = 0;*/
+ if (self->priv->thumbnailer_pid != 0) {
+ /*g_source_remove (self->priv->thumbnailer_watch);
+ self->priv->thumbnailer_watch = 0;*/
+ kill (self->priv->thumbnailer_pid, SIGTERM);
+ /*self->priv->thumbnailer_pid = 0;*/
}
return FALSE;
@@ -402,18 +404,18 @@ watch_thumbnailer_cb (GPid pid,
int status,
gpointer data)
{
- GthThumbLoader *tloader = data;
+ GthThumbLoader *self = data;
GdkPixbuf *pixbuf;
GError *error;
- if (tloader->priv->thumbnailer_timeout != 0) {
- g_source_remove (tloader->priv->thumbnailer_timeout);
- tloader->priv->thumbnailer_timeout = 0;
+ if (self->priv->thumbnailer_timeout != 0) {
+ g_source_remove (self->priv->thumbnailer_timeout);
+ self->priv->thumbnailer_timeout = 0;
}
g_spawn_close_pid (pid);
- tloader->priv->thumbnailer_pid = 0;
- tloader->priv->thumbnailer_watch = 0;
+ self->priv->thumbnailer_pid = 0;
+ self->priv->thumbnailer_watch = 0;
if (status != 0) {
error = g_error_new_literal (GTH_ERROR, 0, "cannot generate the thumbnail");
@@ -421,8 +423,8 @@ watch_thumbnailer_cb (GPid pid,
return;
}
- pixbuf = gnome_desktop_thumbnail_factory_load_from_tempfile (tloader->priv->thumb_factory,
- &tloader->priv->thumbnailer_tmpfile);
+ pixbuf = gnome_desktop_thumbnail_factory_load_from_tempfile (self->priv->thumb_factory,
+ &self->priv->thumbnailer_tmpfile);
if (pixbuf != NULL) {
image_loader_loaded (NULL, pixbuf, data);
g_object_unref (pixbuf);
@@ -439,15 +441,17 @@ image_loader_ready_cb (GthImageLoader *iloader,
GError *error,
gpointer data)
{
- GthThumbLoader *tloader = data;
+ GthThumbLoader *self = data;
char *uri;
if (error == NULL) {
- image_loader_loaded (iloader, gth_image_loader_get_pixbuf (tloader->priv->iloader), data);
+ image_loader_loaded (iloader, gth_image_loader_get_pixbuf (self->priv->iloader), data);
return;
}
- if (tloader->priv->from_cache) {
+ /* error != NULL */
+
+ if (self->priv->loading_from_cache) {
image_loader_error (iloader, error, data);
return;
}
@@ -455,22 +459,22 @@ image_loader_ready_cb (GthImageLoader *iloader,
/* try with the system thumbnailer as fallback */
g_clear_error (&error);
- g_free (tloader->priv->thumbnailer_tmpfile);
- tloader->priv->thumbnailer_tmpfile = NULL;
- uri = g_file_get_uri (tloader->priv->file->file);
- if (gnome_desktop_thumbnail_factory_generate_thumbnail_async (tloader->priv->thumb_factory,
+ g_free (self->priv->thumbnailer_tmpfile);
+ self->priv->thumbnailer_tmpfile = NULL;
+ uri = g_file_get_uri (self->priv->file_data->file);
+ if (gnome_desktop_thumbnail_factory_generate_thumbnail_async (self->priv->thumb_factory,
uri,
- gth_file_data_get_mime_type (tloader->priv->file),
- &tloader->priv->thumbnailer_pid,
- &tloader->priv->thumbnailer_tmpfile,
+ gth_file_data_get_mime_type (self->priv->file_data),
+ &self->priv->thumbnailer_pid,
+ &self->priv->thumbnailer_tmpfile,
&error))
{
- tloader->priv->thumbnailer_watch = g_child_watch_add (tloader->priv->thumbnailer_pid,
- watch_thumbnailer_cb,
- tloader);
- tloader->priv->thumbnailer_timeout = g_timeout_add (MAX_THUMBNAILER_LIFETIME,
- kill_thumbnailer_cb,
- tloader);
+ self->priv->thumbnailer_watch = g_child_watch_add (self->priv->thumbnailer_pid,
+ watch_thumbnailer_cb,
+ self);
+ self->priv->thumbnailer_timeout = g_timeout_add (MAX_THUMBNAILER_LIFETIME,
+ kill_thumbnailer_cb,
+ self);
}
else {
if (error == NULL)
@@ -487,201 +491,208 @@ thumb_loader (GthFileData *file,
GError **error,
gpointer data)
{
- GthThumbLoader *tloader = data;
- GdkPixbufAnimation *animation = NULL;
- GdkPixbuf *pixbuf = NULL;
+ GthThumbLoader *self = data;
+ GdkPixbufAnimation *animation;
+
+ animation = NULL;
+ if (! self->priv->loading_from_cache) {
+ PixbufLoader thumbnailer;
- if (tloader->priv->from_cache) {
- pixbuf = gth_pixbuf_new_from_file (file, error, -1, -1);
+ thumbnailer = gth_main_get_pixbuf_loader (gth_file_data_get_mime_type (file));
+ if (thumbnailer != NULL)
+ animation = thumbnailer (file, self->priv->cache_max_size, error);
}
else {
- /* try with a custom thumbnailer first */
-
- if (! tloader->priv->from_cache) {
- PixbufLoader thumbnailer;
+ GdkPixbuf *pixbuf;
- thumbnailer = gth_main_get_pixbuf_loader (gth_file_data_get_mime_type (file));
- if (thumbnailer != NULL)
- animation = thumbnailer (file, error, tloader->priv->cache_max_w, tloader->priv->cache_max_h);
-
- if (animation != NULL)
- return animation;
+ pixbuf = gth_pixbuf_new_from_file (file, -1, error);
+ if (pixbuf != NULL) {
+ g_clear_error (error);
+ animation = gdk_pixbuf_non_anim_new (pixbuf);
+ g_object_unref (pixbuf);
}
}
- if (pixbuf != NULL) {
- g_clear_error (error);
- animation = gdk_pixbuf_non_anim_new (pixbuf);
- g_object_unref (pixbuf);
- }
- else
- *error = g_error_new_literal (GTH_ERROR, 0, "cannot generate the thumbnail");
+ if (animation == NULL)
+ *error = g_error_new_literal (GTH_ERROR, 0, "Cannot generate the thumbnail");
return animation;
}
static void
-gth_thumb_loader_construct (GthThumbLoader *tloader,
- int width,
- int height)
+gth_thumb_loader_construct (GthThumbLoader *self,
+ int size)
{
- gth_thumb_loader_set_thumb_size (tloader, width, height);
+ gth_thumb_loader_set_requested_size (self, size);
- tloader->priv->iloader = gth_image_loader_new (FALSE);
- gth_image_loader_set_loader (tloader->priv->iloader, thumb_loader, tloader);
- g_signal_connect (G_OBJECT (tloader->priv->iloader),
+ self->priv->iloader = gth_image_loader_new (FALSE);
+ g_signal_connect (G_OBJECT (self->priv->iloader),
"ready",
G_CALLBACK (image_loader_ready_cb),
- tloader);
+ self);
+ gth_image_loader_set_loader (self->priv->iloader, thumb_loader, self);
}
GthThumbLoader *
-gth_thumb_loader_new (int width,
- int height)
+gth_thumb_loader_new (int size)
{
- GthThumbLoader *tloader;
+ GthThumbLoader *self;
+
+ self = g_object_new (GTH_TYPE_THUMB_LOADER, NULL);
+ gth_thumb_loader_construct (self, size);
+
+ return self;
+}
- tloader = g_object_new (GTH_TYPE_THUMB_LOADER, NULL);
- gth_thumb_loader_construct (tloader, width, height);
- return tloader;
+void
+gth_thumb_loader_set_loader (GthThumbLoader *self,
+ LoaderFunc loader)
+{
+ if (loader != NULL)
+ gth_image_loader_set_loader (self->priv->iloader, loader, self);
+ else
+ gth_image_loader_set_loader (self->priv->iloader, thumb_loader, self);
}
void
-gth_thumb_loader_set_thumb_size (GthThumbLoader *tloader,
- int width,
- int height)
+gth_thumb_loader_set_requested_size (GthThumbLoader *self,
+ int size)
{
- if (tloader->priv->thumb_factory != NULL) {
- g_object_unref (tloader->priv->thumb_factory);
- tloader->priv->thumb_factory = NULL;
+ if (self->priv->thumb_factory != NULL) {
+ g_object_unref (self->priv->thumb_factory);
+ self->priv->thumb_factory = NULL;
}
- if ((width <= THUMBNAIL_NORMAL_SIZE) && (height <= THUMBNAIL_NORMAL_SIZE)) {
- tloader->priv->cache_max_w = tloader->priv->cache_max_h = THUMBNAIL_NORMAL_SIZE;
- tloader->priv->thumb_size = GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL;
+ self->priv->requested_size = size;
+ if (self->priv->requested_size <= THUMBNAIL_NORMAL_SIZE) {
+ self->priv->cache_max_size = THUMBNAIL_NORMAL_SIZE;
+ self->priv->thumb_size = GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL;
}
else {
- tloader->priv->cache_max_w = tloader->priv->cache_max_h = THUMBNAIL_LARGE_SIZE;
- tloader->priv->thumb_size = GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE;
+ self->priv->cache_max_size = THUMBNAIL_LARGE_SIZE;
+ self->priv->thumb_size = GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE;
}
+ self->priv->thumb_factory = gnome_desktop_thumbnail_factory_new (self->priv->thumb_size);
+}
- tloader->priv->thumb_factory = gnome_desktop_thumbnail_factory_new (tloader->priv->thumb_size);
- tloader->priv->max_w = width;
- tloader->priv->max_h = height;
+int
+gth_thumb_loader_get_requested_size (GthThumbLoader *self)
+{
+ return self->priv->requested_size;
}
void
-gth_thumb_loader_use_cache (GthThumbLoader *tloader,
+gth_thumb_loader_use_cache (GthThumbLoader *self,
gboolean use)
{
- g_return_if_fail (tloader != NULL);
- tloader->priv->use_cache = use;
+ g_return_if_fail (self != NULL);
+ self->priv->use_cache = use;
}
void
-gth_thumb_loader_save_thumbnails (GthThumbLoader *tloader,
+gth_thumb_loader_save_thumbnails (GthThumbLoader *self,
gboolean save)
{
- g_return_if_fail (tloader != NULL);
- tloader->priv->save_thumbnails = save;
+ g_return_if_fail (self != NULL);
+ self->priv->save_thumbnails = save;
}
void
-gth_thumb_loader_set_max_file_size (GthThumbLoader *tloader,
+gth_thumb_loader_set_max_file_size (GthThumbLoader *self,
goffset size)
{
- g_return_if_fail (tloader != NULL);
- tloader->priv->max_file_size = size;
+ g_return_if_fail (self != NULL);
+ self->priv->max_file_size = size;
}
void
-gth_thumb_loader_set_file (GthThumbLoader *tloader,
- GthFileData *fd)
+gth_thumb_loader_set_file (GthThumbLoader *self,
+ GthFileData *file_data)
{
- g_return_if_fail (tloader != NULL);
+ g_return_if_fail (self != NULL);
- _g_object_unref (tloader->priv->file);
- tloader->priv->file = NULL;
+ _g_object_unref (self->priv->file_data);
+ self->priv->file_data = NULL;
- if (fd != NULL) {
+ if (file_data != NULL) {
GFile *real_file = NULL;
GError *error = NULL;
- tloader->priv->file = gth_file_data_dup (fd);
+ self->priv->file_data = gth_file_data_dup (file_data);
- real_file = _g_file_resolve_all_symlinks (tloader->priv->file->file, &error);
+ real_file = _g_file_resolve_all_symlinks (self->priv->file_data->file, &error);
if (real_file == NULL) {
g_warning ("%s", error->message);
g_clear_error (&error);
return;
}
- gth_file_data_set_file (tloader->priv->file, real_file);
+ gth_file_data_set_file (self->priv->file_data, real_file);
g_object_unref (real_file);
}
- gth_image_loader_set_file_data (tloader->priv->iloader, tloader->priv->file);
+ gth_image_loader_set_file_data (self->priv->iloader, self->priv->file_data);
}
void
-gth_thumb_loader_set_uri (GthThumbLoader *tloader,
+gth_thumb_loader_set_uri (GthThumbLoader *self,
const char *uri,
const char *mime_type)
{
GFile *file;
- GthFileData *fd;
+ GthFileData *file_data;
- g_return_if_fail (tloader != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (uri != NULL);
file = g_file_new_for_uri (uri);
- fd = gth_file_data_new (file, NULL);
- gth_file_data_update_info (fd, NULL);
- gth_file_data_set_mime_type (fd, mime_type);
+ file_data = gth_file_data_new (file, NULL);
+ gth_file_data_update_info (file_data, NULL);
+ gth_file_data_set_mime_type (file_data, mime_type);
- gth_thumb_loader_set_file (tloader, fd);
+ gth_thumb_loader_set_file (self, file_data);
g_object_unref (file);
}
GdkPixbuf *
-gth_thumb_loader_get_pixbuf (GthThumbLoader *tloader)
+gth_thumb_loader_get_pixbuf (GthThumbLoader *self)
{
- g_return_val_if_fail (tloader != NULL, NULL);
- return tloader->priv->pixbuf;
+ g_return_val_if_fail (self != NULL, NULL);
+ return self->priv->pixbuf;
}
static void
-gth_thumb_loader_load__step2 (GthThumbLoader *tloader)
+gth_thumb_loader_load__step2 (GthThumbLoader *self)
{
char *cache_path = NULL;
- g_return_if_fail (tloader != NULL);
+ g_return_if_fail (self != NULL);
- if (tloader->priv->use_cache) {
+ if (self->priv->use_cache) {
char *uri;
time_t mtime;
- uri = g_file_get_uri (tloader->priv->file->file);
- mtime = gth_file_data_get_mtime (tloader->priv->file);
- cache_path = gnome_desktop_thumbnail_factory_lookup (tloader->priv->thumb_factory, uri, mtime);
+ uri = g_file_get_uri (self->priv->file_data->file);
+ mtime = gth_file_data_get_mtime (self->priv->file_data);
+ cache_path = gnome_desktop_thumbnail_factory_lookup (self->priv->thumb_factory, uri, mtime);
if ((cache_path == NULL)
- && gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (tloader->priv->thumb_factory, uri, mtime))
+ && gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (self->priv->thumb_factory, uri, mtime))
{
- g_signal_emit (G_OBJECT (tloader),
+ g_signal_emit (G_OBJECT (self),
gth_thumb_loader_signals[READY],
0,
g_error_new_literal (GTH_ERROR, 0, "failed thumbnail"));
@@ -694,27 +705,24 @@ gth_thumb_loader_load__step2 (GthThumbLoader *tloader)
if (cache_path != NULL) {
GFile *file;
- tloader->priv->from_cache = TRUE;
+ self->priv->loading_from_cache = TRUE;
file = g_file_new_for_path (cache_path);
- gth_image_loader_set_file (tloader->priv->iloader, file, "image/png");
+ gth_image_loader_set_file (self->priv->iloader, file, "image/png");
g_object_unref (file);
g_free (cache_path);
}
else {
- tloader->priv->from_cache = FALSE;
- gth_image_loader_set_file_data (tloader->priv->iloader, tloader->priv->file);
+ self->priv->loading_from_cache = FALSE;
+ gth_image_loader_set_file_data (self->priv->iloader, self->priv->file_data);
/* Check file dimensions. */
- if ((tloader->priv->max_file_size > 0)
- && (g_file_info_get_size (tloader->priv->file->info) > tloader->priv->max_file_size))
+ if ((self->priv->max_file_size > 0)
+ && (g_file_info_get_size (self->priv->file_data->info) > self->priv->max_file_size))
{
- if (tloader->priv->pixbuf != NULL) {
- g_object_unref (tloader->priv->pixbuf);
- tloader->priv->pixbuf = NULL;
- }
- g_signal_emit (G_OBJECT (tloader),
+ _g_clear_object (&self->priv->pixbuf);
+ g_signal_emit (G_OBJECT (self),
gth_thumb_loader_signals[READY],
0,
NULL);
@@ -722,35 +730,35 @@ gth_thumb_loader_load__step2 (GthThumbLoader *tloader)
}
}
- gth_image_loader_load (tloader->priv->iloader);
+ gth_image_loader_load (self->priv->iloader);
}
void
-gth_thumb_loader_load (GthThumbLoader *tloader)
+gth_thumb_loader_load (GthThumbLoader *self)
{
- gth_thumb_loader_cancel (tloader, (DataFunc) gth_thumb_loader_load__step2, tloader);
+ gth_thumb_loader_cancel (self, (DataFunc) gth_thumb_loader_load__step2, self);
}
void
-gth_thumb_loader_cancel (GthThumbLoader *tloader,
+gth_thumb_loader_cancel (GthThumbLoader *self,
DataFunc done_func,
gpointer done_func_data)
{
- g_return_if_fail (tloader->priv->iloader != NULL);
+ g_return_if_fail (self->priv->iloader != NULL);
- if (tloader->priv->thumbnailer_timeout != 0) {
- g_source_remove (tloader->priv->thumbnailer_timeout);
- tloader->priv->thumbnailer_timeout = 0;
+ if (self->priv->thumbnailer_timeout != 0) {
+ g_source_remove (self->priv->thumbnailer_timeout);
+ self->priv->thumbnailer_timeout = 0;
}
- if (tloader->priv->thumbnailer_pid != 0) {
- g_source_remove (tloader->priv->thumbnailer_watch);
- tloader->priv->thumbnailer_watch = 0;
- kill (tloader->priv->thumbnailer_pid, SIGTERM);
- tloader->priv->thumbnailer_pid = 0;
+ if (self->priv->thumbnailer_pid != 0) {
+ g_source_remove (self->priv->thumbnailer_watch);
+ self->priv->thumbnailer_watch = 0;
+ kill (self->priv->thumbnailer_pid, SIGTERM);
+ self->priv->thumbnailer_pid = 0;
}
- gth_image_loader_cancel (tloader->priv->iloader, done_func, done_func_data);
+ gth_image_loader_cancel (self->priv->iloader, done_func, done_func_data);
}
diff --git a/gthumb/gth-thumb-loader.h b/gthumb/gth-thumb-loader.h
index cfc6206..bb02d83 100644
--- a/gthumb/gth-thumb-loader.h
+++ b/gthumb/gth-thumb-loader.h
@@ -52,32 +52,33 @@ struct _GthThumbLoaderClass
{
GObjectClass __parent_class;
- /* -- Signals -- */
+ /*< signals >*/
- void (* ready) (GthThumbLoader *il,
+ void (* ready) (GthThumbLoader *tl,
GError *error);
};
GType gth_thumb_loader_get_type (void);
-GthThumbLoader * gth_thumb_loader_new (int width,
- int height);
-void gth_thumb_loader_set_thumb_size (GthThumbLoader *tl,
- int width,
- int height);
-void gth_thumb_loader_use_cache (GthThumbLoader *tl,
+GthThumbLoader * gth_thumb_loader_new (int size);
+void gth_thumb_loader_set_loader (GthThumbLoader *self,
+ LoaderFunc loader);
+void gth_thumb_loader_set_requested_size (GthThumbLoader *self,
+ int size);
+int gth_thumb_loader_get_requested_size (GthThumbLoader *self);
+void gth_thumb_loader_use_cache (GthThumbLoader *self,
gboolean use);
-void gth_thumb_loader_save_thumbnails (GthThumbLoader *tl,
+void gth_thumb_loader_save_thumbnails (GthThumbLoader *self,
gboolean save);
-void gth_thumb_loader_set_max_file_size (GthThumbLoader *tl,
+void gth_thumb_loader_set_max_file_size (GthThumbLoader *self,
goffset size);
-void gth_thumb_loader_set_file (GthThumbLoader *tl,
- GthFileData *fd);
-void gth_thumb_loader_set_uri (GthThumbLoader *tl,
+void gth_thumb_loader_set_file (GthThumbLoader *self,
+ GthFileData *file_data);
+void gth_thumb_loader_set_uri (GthThumbLoader *self,
const char *uri,
const char *mime_type);
-GdkPixbuf * gth_thumb_loader_get_pixbuf (GthThumbLoader *tl);
-void gth_thumb_loader_load (GthThumbLoader *tl);
-void gth_thumb_loader_cancel (GthThumbLoader *tl,
+GdkPixbuf * gth_thumb_loader_get_pixbuf (GthThumbLoader *self);
+void gth_thumb_loader_load (GthThumbLoader *self);
+void gth_thumb_loader_cancel (GthThumbLoader *self,
DataFunc func,
gpointer data);
diff --git a/gthumb/pixbuf-io.c b/gthumb/pixbuf-io.c
index fd7a201..252283a 100644
--- a/gthumb/pixbuf-io.c
+++ b/gthumb/pixbuf-io.c
@@ -210,9 +210,8 @@ _gdk_pixbuf_save_async (GdkPixbuf *pixbuf,
GdkPixbuf*
gth_pixbuf_new_from_file (GthFileData *file_data,
- GError **error,
- int requested_width,
- int requested_height)
+ int requested_size,
+ GError **error)
{
GdkPixbuf *pixbuf = NULL;
char *path;
@@ -224,21 +223,21 @@ gth_pixbuf_new_from_file (GthFileData *file_data,
path = g_file_get_path (file_data->file);
scale_pixbuf = FALSE;
- if (requested_width > 0) {
+ if (requested_size > 0) {
int w, h;
if (gdk_pixbuf_get_file_info (path, &w, &h) == NULL) {
w = -1;
h = -1;
}
- if ((w > requested_width) || (h > requested_height))
+ if ((w > requested_size) || (h > requested_size))
scale_pixbuf = TRUE;
}
if (scale_pixbuf)
pixbuf = gdk_pixbuf_new_from_file_at_scale (path,
- requested_width,
- requested_height,
+ requested_size,
+ requested_size,
TRUE,
error);
else
@@ -262,9 +261,8 @@ gth_pixbuf_new_from_file (GthFileData *file_data,
GdkPixbufAnimation*
gth_pixbuf_animation_new_from_file (GthFileData *file_data,
- GError **error,
- int requested_width,
- int requested_height)
+ int requested_size,
+ GError **error)
{
GdkPixbufAnimation *animation = NULL;
const char *mime_type;
@@ -287,9 +285,8 @@ gth_pixbuf_animation_new_from_file (GthFileData *file_data,
GdkPixbuf *pixbuf;
pixbuf = gth_pixbuf_new_from_file (file_data,
- error,
- requested_width,
- requested_height);
+ requested_size,
+ error);
if (pixbuf != NULL) {
animation = gdk_pixbuf_non_anim_new (pixbuf);
diff --git a/gthumb/pixbuf-io.h b/gthumb/pixbuf-io.h
index 9f19945..dea8144 100644
--- a/gthumb/pixbuf-io.h
+++ b/gthumb/pixbuf-io.h
@@ -56,14 +56,12 @@ void _gdk_pixbuf_save_async (GdkPixbuf *pixbuf,
GthFileDataFunc ready_func,
gpointer data);
GdkPixbuf * gth_pixbuf_new_from_file (GthFileData *file,
- GError **error,
- int requested_width,
- int requested_height);
+ int requested_size,
+ GError **error);
GdkPixbufAnimation*
gth_pixbuf_animation_new_from_file (GthFileData *file_data,
- GError **error,
- int requested_width,
- int requested_height);
+ int requested_size,
+ GError **error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]