[gnome-photos/wip/rishi/dlna-renderer-fixes-01: 2/3] Make photos_dlna_renderer_unshare_all return a value




commit 20544ec035a24f69bd37b0a40680683777080909
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 24 00:01:20 2021 +0100

    Make photos_dlna_renderer_unshare_all 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          | 4 ++--
 src/photos-dlna-renderer.h          | 2 +-
 src/photos-remote-display-manager.c | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-dlna-renderer.c b/src/photos-dlna-renderer.c
index 0d301ada..4b6aff28 100644
--- a/src/photos-dlna-renderer.c
+++ b/src/photos-dlna-renderer.c
@@ -660,14 +660,14 @@ photos_dlna_renderer_unshare_all (PhotosDlnaRenderer  *self,
 }
 
 
-void
+gboolean
 photos_dlna_renderer_unshare_all_finish (PhotosDlnaRenderer *self,
                                          GAsyncResult *res,
                                          GError **error)
 {
   g_return_if_fail (g_task_is_valid (res, self));
 
-  g_task_propagate_boolean (G_TASK (res), error);
+  return g_task_propagate_boolean (G_TASK (res), error);
 }
 
 
diff --git a/src/photos-dlna-renderer.h b/src/photos-dlna-renderer.h
index 535856c8..ae12b88d 100644
--- a/src/photos-dlna-renderer.h
+++ b/src/photos-dlna-renderer.h
@@ -68,7 +68,7 @@ void                  photos_dlna_renderer_unshare_all        (PhotosDlnaRendere
                                                                GAsyncReadyCallback  callback,
                                                                gpointer             user_data);
 
-void                  photos_dlna_renderer_unshare_all_finish (PhotosDlnaRenderer  *self,
+gboolean              photos_dlna_renderer_unshare_all_finish (PhotosDlnaRenderer  *self,
                                                                GAsyncResult        *res,
                                                                GError             **error);
 
diff --git a/src/photos-remote-display-manager.c b/src/photos-remote-display-manager.c
index d080f8f7..d57ddff1 100644
--- a/src/photos-remote-display-manager.c
+++ b/src/photos-remote-display-manager.c
@@ -203,8 +203,7 @@ photos_remote_display_manager_unshare_all_cb (GObject *source_object, GAsyncResu
   {
     g_autoptr (GError) error = NULL;
 
-    photos_dlna_renderer_unshare_all_finish (renderer, res, &error);
-    if (error != NULL)
+    if (!photos_dlna_renderer_unshare_all_finish (renderer, res, &error))
       g_warning ("Error while unsharing: %s", error->message);
   }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]