[gthumb: 61/129] added a cancellable to the g_load_file_in_buffer function
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 61/129] added a cancellable to the g_load_file_in_buffer function
- Date: Wed, 27 Apr 2011 20:55:30 +0000 (UTC)
commit b7bed79269ad968237d10ae6d14a3fa5f6e4601c
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Apr 23 16:26:09 2011 +0200
added a cancellable to the g_load_file_in_buffer function
extensions/catalogs/gth-catalog.c | 2 +-
extensions/comments/gth-comment.c | 2 +-
extensions/contact_sheet/dlg-contact-sheet.c | 1 +
.../exiv2_tools/gth-metadata-provider-exiv2.c | 2 +-
extensions/flicker/dlg-import-from-flickr.c | 2 +-
extensions/picasaweb/dlg-import-from-picasaweb.c | 2 +-
gthumb/gio-utils.c | 17 +++++++++++------
gthumb/gio-utils.h | 1 +
gthumb/main-migrate-catalogs.c | 1 +
9 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/extensions/catalogs/gth-catalog.c b/extensions/catalogs/gth-catalog.c
index 5a60a3e..3eb1efd 100644
--- a/extensions/catalogs/gth-catalog.c
+++ b/extensions/catalogs/gth-catalog.c
@@ -1160,7 +1160,7 @@ gth_catalog_load_from_file (GFile *file)
gsize buffer_size;
gio_file = gth_catalog_file_to_gio_file (file);
- if (! g_load_file_in_buffer (gio_file, &buffer, &buffer_size, NULL))
+ if (! g_load_file_in_buffer (gio_file, &buffer, &buffer_size, NULL, NULL))
return NULL;
catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", buffer);
diff --git a/extensions/comments/gth-comment.c b/extensions/comments/gth-comment.c
index 90fa68e..b3a2afc 100644
--- a/extensions/comments/gth-comment.c
+++ b/extensions/comments/gth-comment.c
@@ -317,7 +317,7 @@ gth_comment_new_for_file (GFile *file,
if (comment_file == NULL)
return NULL;
- if (! g_load_file_in_buffer (comment_file, &zipped_buffer, &zipped_size, error)) {
+ if (! g_load_file_in_buffer (comment_file, &zipped_buffer, &zipped_size, NULL, error)) {
g_object_unref (comment_file);
return NULL;
}
diff --git a/extensions/contact_sheet/dlg-contact-sheet.c b/extensions/contact_sheet/dlg-contact-sheet.c
index c661cf1..dc261e5 100644
--- a/extensions/contact_sheet/dlg-contact-sheet.c
+++ b/extensions/contact_sheet/dlg-contact-sheet.c
@@ -323,6 +323,7 @@ add_themes_from_dir (DialogData *data,
if (! g_load_file_in_buffer (file,
(void **) &buffer,
&size,
+ NULL,
NULL))
{
g_object_unref (file);
diff --git a/extensions/exiv2_tools/gth-metadata-provider-exiv2.c b/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
index 68623e1..2f39544 100644
--- a/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
+++ b/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
@@ -129,7 +129,7 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
if (! exiv2_supports_writes (gth_file_data_get_mime_type (file_data)))
return;
- if (! g_load_file_in_buffer (file_data->file, &buffer, &size, &error))
+ if (! g_load_file_in_buffer (file_data->file, &buffer, &size, NULL, &error))
return;
metadata = g_file_info_get_attribute_object (file_data->info, "general::description");
diff --git a/extensions/flicker/dlg-import-from-flickr.c b/extensions/flicker/dlg-import-from-flickr.c
index 8b33146..c0f0915 100644
--- a/extensions/flicker/dlg-import-from-flickr.c
+++ b/extensions/flicker/dlg-import-from-flickr.c
@@ -459,7 +459,7 @@ flickr_thumbnail_loader (GthFileData *file_data,
gsize size;
file = g_file_new_for_uri (uri);
- if (g_load_file_in_buffer (file, &buffer, &size, error)) {
+ if (g_load_file_in_buffer (file, &buffer, &size, cancellable, error)) {
GInputStream *stream;
GdkPixbuf *pixbuf;
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index 8a47af1..d9f94f8 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -897,7 +897,7 @@ picasa_web_thumbnail_loader (GthFileData *file_data,
gsize size;
file = g_file_new_for_uri (uri);
- if (g_load_file_in_buffer (file, &buffer, &size, error)) {
+ if (g_load_file_in_buffer (file, &buffer, &size, cancellable, error)) {
GInputStream *stream;
GdkPixbuf *pixbuf;
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index 1db84d7..972da94 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -1920,10 +1920,11 @@ _g_delete_files_async (GList *file_list,
gboolean
-g_load_file_in_buffer (GFile *file,
- void **buffer,
- gsize *size,
- GError **error)
+g_load_file_in_buffer (GFile *file,
+ void **buffer,
+ gsize *size,
+ GCancellable *cancellable,
+ GError **error)
{
GFileInputStream *istream;
gboolean retval;
@@ -1932,7 +1933,7 @@ g_load_file_in_buffer (GFile *file,
gssize n;
char tmp_buffer[BUFFER_SIZE];
- istream = g_file_read (file, NULL, error);
+ istream = g_file_read (file, cancellable, error);
if (istream == NULL)
return FALSE;
@@ -1940,7 +1941,11 @@ g_load_file_in_buffer (GFile *file,
local_buffer = NULL;
count = 0;
for (;;) {
- n = g_input_stream_read (G_INPUT_STREAM (istream), tmp_buffer, BUFFER_SIZE, NULL, error);
+ n = g_input_stream_read (G_INPUT_STREAM (istream),
+ tmp_buffer,
+ BUFFER_SIZE,
+ cancellable,
+ error);
if (n < 0) {
g_free (local_buffer);
retval = FALSE;
diff --git a/gthumb/gio-utils.h b/gthumb/gio-utils.h
index 7ada506..306dddf 100644
--- a/gthumb/gio-utils.h
+++ b/gthumb/gio-utils.h
@@ -151,6 +151,7 @@ void _g_delete_files_async (GList *file_list,
gboolean g_load_file_in_buffer (GFile *file,
void **buffer,
gsize *size,
+ GCancellable *cancellable,
GError **error);
void g_load_file_async (GFile *file,
int io_priority,
diff --git a/gthumb/main-migrate-catalogs.c b/gthumb/main-migrate-catalogs.c
index ae7e454..1f3d89d 100644
--- a/gthumb/main-migrate-catalogs.c
+++ b/gthumb/main-migrate-catalogs.c
@@ -83,6 +83,7 @@ migration_for_each_file (GFile *file,
if (! g_load_file_in_buffer (file,
(void **) &buffer,
&buffer_size,
+ NULL,
&error))
{
g_warning ("%s", error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]