Commit 2833417f authored by Paolo Bacchilega's avatar Paolo Bacchilega

gio utils: use the _g_file prefix fir functions that take a GFile object

parent 86aaa579
......@@ -171,11 +171,11 @@ _cairo_image_surface_create_from_jpeg (GthFileData *file_data,
image = gth_image_new ();
if (! g_load_file_in_buffer (file_data->file,
&in_buffer,
&in_buffer_size,
cancellable,
error))
if (! _g_file_load_in_buffer (file_data->file,
&in_buffer,
&in_buffer_size,
cancellable,
error))
{
return image;
}
......
......@@ -804,13 +804,13 @@ process_rename_data_list (gpointer user_data)
gio_file = gth_catalog_file_to_gio_file (rename_data->location);
catalog_data = gth_catalog_to_data (catalog, &catalog_data_size);
if (! g_write_file (gio_file,
FALSE,
G_FILE_CREATE_NONE,
catalog_data,
catalog_data_size,
NULL,
&error))
if (! _g_file_write (gio_file,
FALSE,
G_FILE_CREATE_NONE,
catalog_data,
catalog_data_size,
NULL,
&error))
{
g_warning ("%s", error->message);
g_clear_error (&error);
......
......@@ -144,14 +144,14 @@ catalog_ready_cb (GObject *catalog,
buffer = gth_catalog_to_data (add_data->catalog, &length);
gio_file = gth_catalog_file_to_gio_file (add_data->catalog_file);
g_write_file_async (gio_file,
buffer,
length,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
catalog_save_done_cb,
add_data);
_g_file_write_async (gio_file,
buffer,
length,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
catalog_save_done_cb,
add_data);
g_object_unref (gio_file);
}
......
......@@ -127,14 +127,14 @@ save_button_clicked_cb (GtkButton *button,
gio_file = gth_catalog_file_to_gio_file (data->file_data->file);
buffer = gth_catalog_to_data (data->catalog, &size);
g_write_file_async (gio_file,
buffer,
size,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
catalog_saved_cb,
data);
_g_file_write_async (gio_file,
buffer,
size,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
catalog_saved_cb,
data);
g_object_unref (gio_file);
}
......
......@@ -582,11 +582,11 @@ gth_catalog_list_async (GthCatalog *catalog,
list_data->list_ready_func = ready_func;
list_data->user_data = user_data;
g_load_file_async (catalog->priv->file,
G_PRIORITY_DEFAULT,
catalog->priv->cancellable,
list__catalog_buffer_ready_cb,
list_data);
_g_file_load_async (catalog->priv->file,
G_PRIORITY_DEFAULT,
catalog->priv->cancellable,
list__catalog_buffer_ready_cb,
list_data);
}
......@@ -1072,11 +1072,11 @@ gth_catalog_load_from_file_async (GFile *file,
load_data->user_data = user_data;
gio_file = gth_catalog_file_to_gio_file (file);
g_load_file_async (gio_file,
G_PRIORITY_DEFAULT,
cancellable,
load__catalog_buffer_ready_cb,
load_data);
_g_file_load_async (gio_file,
G_PRIORITY_DEFAULT,
cancellable,
load__catalog_buffer_ready_cb,
load_data);
g_object_unref (gio_file);
}
......@@ -1129,7 +1129,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, NULL))
if (! _g_file_load_in_buffer (gio_file, &buffer, &buffer_size, NULL, NULL))
return NULL;
catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", buffer);
......@@ -1160,13 +1160,13 @@ gth_catalog_save (GthCatalog *catalog)
if (gio_parent != NULL)
g_file_make_directory_with_parents (gio_parent, NULL, NULL);
data = gth_catalog_to_data (catalog, &size);
if (! g_write_file (gio_file,
FALSE,
G_FILE_CREATE_NONE,
data,
size,
NULL,
&error))
if (! _g_file_write (gio_file,
FALSE,
G_FILE_CREATE_NONE,
data,
size,
NULL,
&error))
{
g_warning ("%s", error->message);
g_clear_error (&error);
......
......@@ -253,14 +253,14 @@ write_metadata_load_buffer_ready_cb (void **buffer,
catalog_buffer = gth_catalog_to_data (metadata_op->catalog, &catalog_size);
gio_file = gth_catalog_file_to_gio_file (metadata_op->file_data->file);
g_write_file_async (gio_file,
catalog_buffer,
catalog_size,
TRUE,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (GTH_FILE_SOURCE (metadata_op->catalogs)),
write_metadata_write_buffer_ready_cb,
metadata_op);
_g_file_write_async (gio_file,
catalog_buffer,
catalog_size,
TRUE,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (GTH_FILE_SOURCE (metadata_op->catalogs)),
write_metadata_write_buffer_ready_cb,
metadata_op);
g_object_unref (gio_file);
}
......@@ -301,11 +301,11 @@ gth_file_source_catalogs_write_metadata (GthFileSource *file_source,
metadata_op->catalog = gth_catalog_new ();
gio_file = gth_file_source_to_gio_file (file_source, file_data->file);
gth_catalog_set_file (metadata_op->catalog, gio_file);
g_load_file_async (gio_file,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (file_source),
write_metadata_load_buffer_ready_cb,
metadata_op);
_g_file_load_async (gio_file,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (file_source),
write_metadata_load_buffer_ready_cb,
metadata_op);
g_object_unref (gio_file);
g_free (uri);
......@@ -837,14 +837,14 @@ catalog_ready_cb (GObject *catalog,
buffer = gth_catalog_to_data (cod->catalog, &size);
gio_file = gth_catalog_file_to_gio_file (cod->destination->file);
g_write_file_async (gio_file,
buffer,
size,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
copy__catalog_save_done_cb,
cod);
_g_file_write_async (gio_file,
buffer,
size,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
copy__catalog_save_done_cb,
cod);
g_object_unref (gio_file);
}
......@@ -1255,14 +1255,14 @@ reorder_catalog_ready_cb (GObject *object,
buffer = gth_catalog_to_data (catalog, &size);
gio_file = gth_file_source_to_gio_file (reorder_data->file_source, reorder_data->destination->file);
g_write_file_async (gio_file,
buffer,
size,
TRUE,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (reorder_data->file_source),
reorder_buffer_ready_cb,
reorder_data);
_g_file_write_async (gio_file,
buffer,
size,
TRUE,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (reorder_data->file_source),
reorder_buffer_ready_cb,
reorder_data);
g_object_unref (gio_file);
}
......@@ -1399,14 +1399,14 @@ catalog_buffer_ready_cb (void **buffer,
return;
}
g_write_file_async (data->gio_file,
catalog_buffer,
catalog_size,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
remove_files__catalog_save_done_cb,
data);
_g_file_write_async (data->gio_file,
catalog_buffer,
catalog_size,
TRUE,
G_PRIORITY_DEFAULT,
NULL,
remove_files__catalog_save_done_cb,
data);
}
......@@ -1422,11 +1422,11 @@ gth_catalog_manager_remove_files (GtkWindow *parent,
data->file_data_list = gth_file_data_list_dup (file_list);
data->gio_file = gth_main_get_gio_file (location->file);
g_load_file_async (data->gio_file,
G_PRIORITY_DEFAULT,
NULL,
catalog_buffer_ready_cb,
data);
_g_file_load_async (data->gio_file,
G_PRIORITY_DEFAULT,
NULL,
catalog_buffer_ready_cb,
data);
}
......
......@@ -289,7 +289,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, cancellable, error)) {
if (! _g_file_load_in_buffer (comment_file, &zipped_buffer, &zipped_size, cancellable, error)) {
g_object_unref (comment_file);
return NULL;
}
......@@ -704,13 +704,13 @@ gth_comment_synchronize_metadata (GList *file_list)
g_file_make_directory (comment_directory, NULL, NULL);
buffer = gth_comment_to_data (comment, &size);
g_write_file (comment_file,
FALSE,
G_FILE_CREATE_NONE,
buffer,
size,
NULL,
NULL);
_g_file_write (comment_file,
FALSE,
G_FILE_CREATE_NONE,
buffer,
size,
NULL,
NULL);
{
GFile *parent;
......
......@@ -117,14 +117,14 @@ load_file_ready_cb (void **buffer,
gth_hook_invoke ("delete-metadata", file, &tmp_buffer, &count);
g_write_file_async (file,
tmp_buffer,
count,
TRUE,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
write_file_ready_cb,
self);
_g_file_write_async (file,
tmp_buffer,
count,
TRUE,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
write_file_ready_cb,
self);
}
......@@ -139,11 +139,11 @@ import_current_file (GthImportMetadataTask *self)
}
file = self->priv->current->data;
g_load_file_async (file,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
load_file_ready_cb,
self);
_g_file_load_async (file,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
load_file_ready_cb,
self);
}
......
......@@ -209,7 +209,7 @@ gth_metadata_provider_comment_write (GthMetadataProvider *self,
comment_folder = g_file_get_parent (comment_file);
g_file_make_directory (comment_folder, NULL, NULL);
g_write_file (comment_file, FALSE, 0, data, length, cancellable, NULL);
_g_file_write (comment_file, FALSE, 0, data, length, cancellable, NULL);
g_object_unref (comment_folder);
g_object_unref (comment_file);
......
......@@ -323,11 +323,11 @@ add_themes_from_dir (DialogData *data,
}
file = g_file_get_child (dir, g_file_info_get_name (file_info));
if (! g_load_file_in_buffer (file,
(void **) &buffer,
&size,
NULL,
NULL))
if (! _g_file_load_in_buffer (file,
(void **) &buffer,
&size,
NULL,
NULL))
{
g_object_unref (file);
g_object_unref (file_info);
......@@ -495,13 +495,13 @@ theme_dialog_response_cb (GtkDialog *dialog,
return;
}
if (! g_write_file (theme->file,
FALSE,
G_FILE_CREATE_NONE,
buffer,
buffer_size,
NULL,
&error))
if (! _g_file_write (theme->file,
FALSE,
G_FILE_CREATE_NONE,
buffer,
buffer_size,
NULL,
&error))
{
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), error);
g_clear_error (&error);
......
......@@ -365,13 +365,13 @@ end_page (GthContactSheetCreator *self,
return FALSE;
}
if (! g_write_file (self->priv->destination_file,
FALSE,
G_FILE_CREATE_REPLACE_DESTINATION,
buffer,
size,
gth_task_get_cancellable (GTH_TASK (self)),
error))
if (! _g_file_write (self->priv->destination_file,
FALSE,
G_FILE_CREATE_REPLACE_DESTINATION,
buffer,
size,
gth_task_get_cancellable (GTH_TASK (self)),
error))
{
g_object_unref (pixbuf);
return FALSE;
......
......@@ -115,14 +115,14 @@ load_file_ready_cb (void **buffer,
gth_hook_invoke ("delete-metadata", file, &tmp_buffer, &count);
g_write_file_async (file,
tmp_buffer,
count,
TRUE,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
write_file_ready_cb,
self);
_g_file_write_async (file,
tmp_buffer,
count,
TRUE,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
write_file_ready_cb,
self);
}
......@@ -137,11 +137,11 @@ transform_current_file (GthDeleteMetadataTask *self)
}
file = self->priv->current->data;
g_load_file_async (file,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
load_file_ready_cb,
self);
_g_file_load_async (file,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
load_file_ready_cb,
self);
}
......
......@@ -148,7 +148,7 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *base,
if (! exiv2_supports_writes (gth_file_data_get_mime_type (file_data)))
return;
if (! g_load_file_in_buffer (file_data->file, &buffer, &size, cancellable, &error))
if (! _g_file_load_in_buffer (file_data->file, &buffer, &size, cancellable, &error))
return;
metadata = g_file_info_get_attribute_object (file_data->info, "general::description");
......@@ -284,13 +284,13 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *base,
{
GFileInfo *tmp_info;
g_write_file (file_data->file,
FALSE,
G_FILE_CREATE_NONE,
buffer,
size,
cancellable,
&error);
_g_file_write (file_data->file,
FALSE,
G_FILE_CREATE_NONE,
buffer,
size,
cancellable,
&error);
tmp_info = g_file_info_new ();
g_file_info_set_attribute_uint64 (tmp_info,
......
......@@ -840,11 +840,11 @@ facebook_service_upload_current_file (FacebookService *self)
}
file_data = self->priv->post_photos->current->data;
g_load_file_async (file_data->file,
G_PRIORITY_DEFAULT,
self->priv->post_photos->cancellable,
upload_photo_file_buffer_ready_cb,
self);
_g_file_load_async (file_data->file,
G_PRIORITY_DEFAULT,
self->priv->post_photos->cancellable,
upload_photo_file_buffer_ready_cb,
self);
}
......@@ -1059,7 +1059,7 @@ facebook_accounts_load_from_file (void)
DomDocument *doc;
file = gth_user_dir_get_file_for_read (GTH_DIR_CONFIG, GTHUMB_DIR, "accounts", "facebook.xml", NULL);
if (! g_load_file_in_buffer (file, (void **) &buffer, &len, NULL, NULL)) {
if (! _g_file_load_in_buffer (file, (void **) &buffer, &len, NULL, NULL)) {
g_object_unref (file);
return NULL;
}
......@@ -1142,7 +1142,7 @@ facebook_accounts_save_to_file (GList *accounts,
file = gth_user_dir_get_file_for_write (GTH_DIR_CONFIG, GTHUMB_DIR, "accounts", "facebook.xml", NULL);
buffer = dom_document_dump (doc, &len);
g_write_file (file, FALSE, G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, buffer, len, NULL, NULL);
_g_file_write (file, FALSE, G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, buffer, len, NULL, NULL);
g_free (buffer);
g_object_unref (file);
......
......@@ -450,7 +450,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, cancellable, error)) {
if (_g_file_load_in_buffer (file, &buffer, &size, cancellable, error)) {
GInputStream *stream;
GdkPixbuf *pixbuf;
......
......@@ -867,11 +867,11 @@ flickr_service_post_current_file (FlickrService *self)
}
file_data = self->priv->post_photos->current->data;
g_load_file_async (file_data->file,
G_PRIORITY_DEFAULT,
self->priv->post_photos->cancellable,
post_photo_file_buffer_ready_cb,
self);
_g_file_load_async (file_data->file,
G_PRIORITY_DEFAULT,
self->priv->post_photos->cancellable,
post_photo_file_buffer_ready_cb,
self);
}
......@@ -1177,7 +1177,7 @@ flickr_accounts_load_from_file (const char *server_name)
file = gth_user_dir_get_file_for_read (GTH_DIR_CONFIG, GTHUMB_DIR, "accounts", accounts_filename, NULL);
g_free (accounts_filename);
if (! g_load_file_in_buffer (file, (void **) &buffer, &len, NULL, NULL)) {
if (! _g_file_load_in_buffer (file, (void **) &buffer, &len, NULL, NULL)) {
g_object_unref (file);
return NULL;
}
......@@ -1263,7 +1263,7 @@ flickr_accounts_save_to_file (const char *server_name,
accounts_filename = get_server_accounts_filename (server_name);
file = gth_user_dir_get_file_for_write (GTH_DIR_CONFIG, GTHUMB_DIR, "accounts", accounts_filename, NULL);
buffer = dom_document_dump (doc, &len);
g_write_file (file, FALSE, G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, buffer, len, NULL, NULL);
_g_file_write (file, FALSE, G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, buffer, len, NULL, NULL);
g_free (buffer);
g_object_unref (file);
......
......@@ -298,14 +298,14 @@ file_buffer_ready_cb (void **buffer,
return;
}
g_write_file_async (tdata->file_data->file,
out_buffer,
out_buffer_size,
TRUE,
G_PRIORITY_DEFAULT,
tdata->cancellable,
write_file_ready_cb,
tdata);
_g_file_write_async (tdata->file_data->file,
out_buffer,
out_buffer_size,
TRUE,
G_PRIORITY_DEFAULT,
tdata->cancellable,
write_file_ready_cb,
tdata);
}
else
#endif /* HAVE_LIBJPEG */
......@@ -360,9 +360,9 @@ apply_transformation_async (GthFileData *file_data,
tdata->ready_func = ready_func;
tdata->user_data = user_data;
g_load_file_async (tdata->file_data->file,
G_PRIORITY_DEFAULT,
tdata->cancellable,
file_buffer_ready_cb,
tdata);
_g_file_load_async (tdata->file_data->file,
G_PRIORITY_DEFAULT