[gnome-photos/wip/rishi/dlna-renderer-fixes-00: 3/3] dlna-renderer: Make photos_dlna_renderer_unshare return a value
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/dlna-renderer-fixes-00: 3/3] dlna-renderer: Make photos_dlna_renderer_unshare return a value
- Date: Tue, 23 Mar 2021 22:47:16 +0000 (UTC)
commit 6afd1200267fc03dfc48337efadeab14a84c180f
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Mar 23 23:44:45 2021 +0100
dlna-renderer: Make photos_dlna_renderer_unshare return a value
The convention for GIO-style asynchronous APIs is to return a value
that indicates success or failure, and not just the GError.
src/photos-dlna-renderer.c | 9 ++++-----
src/photos-dlna-renderer.h | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-dlna-renderer.c b/src/photos-dlna-renderer.c
index 6842245e..2bec7e22 100644
--- a/src/photos-dlna-renderer.c
+++ b/src/photos-dlna-renderer.c
@@ -598,14 +598,14 @@ photos_dlna_renderer_unshare (PhotosDlnaRenderer *self,
}
-void
+gboolean
photos_dlna_renderer_unshare_finish (PhotosDlnaRenderer *self,
GAsyncResult *res,
GError **error)
{
- g_return_if_fail (g_task_is_valid (res, self));
+ g_return_val_if_fail (g_task_is_valid (res, self), FALSE);
- g_task_propagate_boolean (G_TASK (res), error);
+ return g_task_propagate_boolean (G_TASK (res), error);
}
@@ -625,8 +625,7 @@ photos_dlna_renderer_unshare_all_unshare_cb (GObject *source_object,
{
g_autoptr (GError) error = NULL;
- photos_dlna_renderer_unshare_finish (self, res, &error);
- if (error != NULL)
+ if (!photos_dlna_renderer_unshare_finish (self, res, &error))
g_warning ("Unable to unshare item: %s", error->message);
}
diff --git a/src/photos-dlna-renderer.h b/src/photos-dlna-renderer.h
index a0f079ba..535856c8 100644
--- a/src/photos-dlna-renderer.h
+++ b/src/photos-dlna-renderer.h
@@ -59,7 +59,7 @@ void photos_dlna_renderer_unshare (PhotosDlnaRendere
GAsyncReadyCallback callback,
gpointer user_data);
-void photos_dlna_renderer_unshare_finish (PhotosDlnaRenderer *self,
+gboolean photos_dlna_renderer_unshare_finish (PhotosDlnaRenderer *self,
GAsyncResult *res,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]