Commit edd8deaa authored by Debarshi Ray's avatar Debarshi Ray

share-point-google: Use g_auto*

Bump minimum libgdata version to 0.17.13.

#77
parent 8ef758bd
Pipeline #211834 passed with stages
in 12 minutes and 7 seconds
...@@ -168,7 +168,7 @@ gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas') ...@@ -168,7 +168,7 @@ gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.16') gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.16')
gtk_unix_print_dep = dependency('gtk+-unix-print-3.0') gtk_unix_print_dep = dependency('gtk+-unix-print-3.0')
libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.26.0') libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.26.0')
libgdata_dep = dependency('libgdata', version: '>= 0.17.10') libgdata_dep = dependency('libgdata', version: '>= 0.17.13')
libgfgraph_dep = dependency('libgfbgraph-0.2', version: '>= 0.2.1') libgfgraph_dep = dependency('libgfbgraph-0.2', version: '>= 0.2.1')
libjpeg_dep = dependency('libjpeg') libjpeg_dep = dependency('libjpeg')
libpng_dep = dependency('libpng16') libpng_dep = dependency('libpng16')
......
/* /*
* Photos - access, organize and share your photos on GNOME * Photos - access, organize and share your photos on GNOME
* Copyright © 2016 – 2019 Red Hat, Inc. * Copyright © 2016 – 2020 Red Hat, Inc.
* Copyright © 2016 Umang Jain * Copyright © 2016 Umang Jain
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
...@@ -112,7 +112,7 @@ static void ...@@ -112,7 +112,7 @@ static void
photos_share_point_google_share_insert_shared_content (GObject *source_object, GAsyncResult *res, gpointer user_data) photos_share_point_google_share_insert_shared_content (GObject *source_object, GAsyncResult *res, gpointer user_data)
{ {
GError *error; GError *error;
GTask *task = G_TASK (user_data); g_autoptr (GTask) task = G_TASK (user_data);
GomMiner *miner = GOM_MINER (source_object); GomMiner *miner = GOM_MINER (source_object);
error = NULL; error = NULL;
...@@ -125,7 +125,7 @@ photos_share_point_google_share_insert_shared_content (GObject *source_object, G ...@@ -125,7 +125,7 @@ photos_share_point_google_share_insert_shared_content (GObject *source_object, G
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);
out: out:
g_object_unref (task); return;
} }
...@@ -178,36 +178,33 @@ static void ...@@ -178,36 +178,33 @@ static void
photos_share_point_google_share_metadata_add_shared (GObject *source_object, GAsyncResult *res, gpointer user_data) photos_share_point_google_share_metadata_add_shared (GObject *source_object, GAsyncResult *res, gpointer user_data)
{ {
PhotosSharePointGoogle *self; PhotosSharePointGoogle *self;
GError *error; g_autoptr (GTask) task = G_TASK (user_data);
GTask *task = G_TASK (user_data);
PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object); PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object);
PhotosSharePointGoogleShareData *data; PhotosSharePointGoogleShareData *data;
self = PHOTOS_SHARE_POINT_GOOGLE (g_task_get_source_object (task)); self = PHOTOS_SHARE_POINT_GOOGLE (g_task_get_source_object (task));
data = (PhotosSharePointGoogleShareData *) g_task_get_task_data (task); data = (PhotosSharePointGoogleShareData *) g_task_get_task_data (task);
error = NULL; {
if (!photos_base_item_metadata_add_shared_finish (item, res, &error)) g_autoptr (GError) error = NULL;
{
if (g_task_get_completed (task)) if (!photos_base_item_metadata_add_shared_finish (item, res, &error))
{ {
if (g_task_get_completed (task))
g_warning ("Unable to add shared metadata: %s", error->message); g_warning ("Unable to add shared metadata: %s", error->message);
g_error_free (error); else
} g_task_return_error (task, g_steal_pointer (&error));
else
{
g_task_return_error (task, error);
}
goto out; goto out;
} }
}
data->pending_async_calls--; data->pending_async_calls--;
if (data->pending_async_calls == 0) if (data->pending_async_calls == 0)
photos_share_point_google_share_metadata_add_shared_second (self, g_object_ref (task)); photos_share_point_google_share_metadata_add_shared_second (self, g_object_ref (task));
out: out:
g_object_unref (task); return;
} }
...@@ -215,43 +212,38 @@ static void ...@@ -215,43 +212,38 @@ static void
photos_share_point_google_share_wait_for_changes (GObject *source_object, GAsyncResult *res, gpointer user_data) photos_share_point_google_share_wait_for_changes (GObject *source_object, GAsyncResult *res, gpointer user_data)
{ {
PhotosSharePointGoogle *self; PhotosSharePointGoogle *self;
GError *error; g_autoptr (GTask) task = G_TASK (user_data);
GTask *task = G_TASK (user_data);
PhotosItemManager *item_mngr = PHOTOS_ITEM_MANAGER (source_object); PhotosItemManager *item_mngr = PHOTOS_ITEM_MANAGER (source_object);
PhotosSharePointGoogleShareData *data; PhotosSharePointGoogleShareData *data;
gchar *item_id_after_changes = NULL; g_autofree gchar *item_id_after_changes = NULL;
self = PHOTOS_SHARE_POINT_GOOGLE (g_task_get_source_object (task)); self = PHOTOS_SHARE_POINT_GOOGLE (g_task_get_source_object (task));
data = (PhotosSharePointGoogleShareData *) g_task_get_task_data (task); data = (PhotosSharePointGoogleShareData *) g_task_get_task_data (task);
error = NULL; {
item_id_after_changes = photos_item_manager_wait_for_changes_finish (item_mngr, res, &error); g_autoptr (GError) error = NULL;
if (error != NULL)
{ item_id_after_changes = photos_item_manager_wait_for_changes_finish (item_mngr, res, &error);
if (g_task_get_completed (task)) if (error != NULL)
{ {
if (g_task_get_completed (task))
g_warning ("Unable to detect changes: %s", error->message); g_warning ("Unable to detect changes: %s", error->message);
g_error_free (error); else
} g_task_return_error (task, g_steal_pointer (&error));
else
{
g_task_return_error (task, error);
}
goto out; goto out;
} }
}
g_assert_null (data->item_id_after_changes); g_assert_null (data->item_id_after_changes);
data->item_id_after_changes = item_id_after_changes; data->item_id_after_changes = g_steal_pointer (&item_id_after_changes);
item_id_after_changes = NULL;
data->pending_async_calls--; data->pending_async_calls--;
if (data->pending_async_calls == 0) if (data->pending_async_calls == 0)
photos_share_point_google_share_metadata_add_shared_second (self, g_object_ref (task)); photos_share_point_google_share_metadata_add_shared_second (self, g_object_ref (task));
out: out:
g_free (item_id_after_changes); return;
g_object_unref (task);
} }
...@@ -261,8 +253,8 @@ photos_share_point_google_share_save_to_stream (GObject *source_object, GAsyncRe ...@@ -261,8 +253,8 @@ photos_share_point_google_share_save_to_stream (GObject *source_object, GAsyncRe
PhotosSharePointGoogle *self; PhotosSharePointGoogle *self;
GCancellable *cancellable; GCancellable *cancellable;
GError *error; GError *error;
GTask *task = G_TASK (user_data); g_autoptr (GTask) task = G_TASK (user_data);
GDataPicasaWebFile *file_entry = NULL; g_autoptr (GDataPicasaWebFile) file_entry = NULL;
GoaAccount *account; GoaAccount *account;
GoaObject *object; GoaObject *object;
PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object); PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object);
...@@ -271,7 +263,7 @@ photos_share_point_google_share_save_to_stream (GObject *source_object, GAsyncRe ...@@ -271,7 +263,7 @@ photos_share_point_google_share_save_to_stream (GObject *source_object, GAsyncRe
const gchar *account_identity; const gchar *account_identity;
const gchar *file_entry_id; const gchar *file_entry_id;
const gchar *provider_type; const gchar *provider_type;
gchar *shared_identifier = NULL; g_autofree gchar *shared_identifier = NULL;
self = PHOTOS_SHARE_POINT_GOOGLE (g_task_get_source_object (task)); self = PHOTOS_SHARE_POINT_GOOGLE (g_task_get_source_object (task));
cancellable = g_task_get_cancellable (task); cancellable = g_task_get_cancellable (task);
...@@ -333,9 +325,7 @@ photos_share_point_google_share_save_to_stream (GObject *source_object, GAsyncRe ...@@ -333,9 +325,7 @@ photos_share_point_google_share_save_to_stream (GObject *source_object, GAsyncRe
data->pending_async_calls++; data->pending_async_calls++;
out: out:
g_clear_object (&file_entry); return;
g_object_unref (task);
g_free (shared_identifier);
} }
...@@ -347,10 +337,10 @@ photos_share_point_google_share_refresh_authorization (GObject *source_object, ...@@ -347,10 +337,10 @@ photos_share_point_google_share_refresh_authorization (GObject *source_object,
PhotosSharePointGoogle *self; PhotosSharePointGoogle *self;
GCancellable *cancellable; GCancellable *cancellable;
GError *error; GError *error;
GTask *task = G_TASK (user_data); g_autoptr (GTask) task = G_TASK (user_data);
GDataAuthorizer *authorizer = GDATA_AUTHORIZER (source_object); GDataAuthorizer *authorizer = GDATA_AUTHORIZER (source_object);
GDataPicasaWebFile *file_entry = NULL; g_autoptr (GDataPicasaWebFile) file_entry = NULL;
GDataUploadStream *stream = NULL; g_autoptr (GDataUploadStream) stream = NULL;
PhotosSharePointGoogleShareData *data; PhotosSharePointGoogleShareData *data;
const gchar *filename; const gchar *filename;
const gchar *mime_type; const gchar *mime_type;
...@@ -399,9 +389,7 @@ photos_share_point_google_share_refresh_authorization (GObject *source_object, ...@@ -399,9 +389,7 @@ photos_share_point_google_share_refresh_authorization (GObject *source_object,
g_object_ref (task)); g_object_ref (task));
out: out:
g_clear_object (&file_entry); return;
g_clear_object (&stream);
g_object_unref (task);
} }
...@@ -413,7 +401,7 @@ photos_share_point_google_share_async (PhotosSharePoint *share_point, ...@@ -413,7 +401,7 @@ photos_share_point_google_share_async (PhotosSharePoint *share_point,
gpointer user_data) gpointer user_data)
{ {
PhotosSharePointGoogle *self = PHOTOS_SHARE_POINT_GOOGLE (share_point); PhotosSharePointGoogle *self = PHOTOS_SHARE_POINT_GOOGLE (share_point);
GTask *task; g_autoptr (GTask) task = NULL;
PhotosSharePointGoogleShareData *data; PhotosSharePointGoogleShareData *data;
data = photos_share_point_google_share_data_new (item); data = photos_share_point_google_share_data_new (item);
...@@ -426,8 +414,6 @@ photos_share_point_google_share_async (PhotosSharePoint *share_point, ...@@ -426,8 +414,6 @@ photos_share_point_google_share_async (PhotosSharePoint *share_point,
cancellable, cancellable,
photos_share_point_google_share_refresh_authorization, photos_share_point_google_share_refresh_authorization,
g_object_ref (task)); g_object_ref (task));
g_object_unref (task);
} }
......
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