[gnome-photos/wip/rishi/collection: 9/51] source-manager: Style fix
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 9/51] source-manager: Style fix
- Date: Wed, 7 Feb 2018 23:59:24 +0000 (UTC)
commit 4816b62aa92a5859e788e9bdeb21c2194de94de3
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Feb 2 03:23:47 2018 +0100
source-manager: Style fix
Not only does this match the pattern used elsewhere in the codebase,
it will also be useful when tracking GMounts because a failure to
create a GoaClient doesn't mean that that the GMounts can't be read.
https://gitlab.gnome.org/GNOME/gnome-photos/issues/29
src/photos-source-manager.c | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index 8596f76b..a90c168d 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -208,7 +208,7 @@ static void
photos_source_manager_goa_client (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
PhotosSourceManager *self;
- GoaClient *client;
+ g_autoptr (GoaClient) client = NULL;
{
g_autoptr (GError) error = NULL;
@@ -216,30 +216,36 @@ photos_source_manager_goa_client (GObject *source_object, GAsyncResult *res, gpo
client = goa_client_new_finish (res, &error);
if (error != NULL)
{
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("Unable to create GoaClient: %s", error->message);
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ goto out;
- return;
+ g_warning ("Unable to create GoaClient: %s", error->message);
}
}
self = PHOTOS_SOURCE_MANAGER (user_data);
- self->client = client;
- g_signal_connect_swapped (self->client,
- "account-added",
- G_CALLBACK (photos_source_manager_refresh_accounts),
- self);
- g_signal_connect_swapped (self->client,
- "account-changed",
- G_CALLBACK (photos_source_manager_refresh_accounts),
- self);
- g_signal_connect_swapped (self->client,
- "account-removed",
- G_CALLBACK (photos_source_manager_refresh_accounts),
- self);
+ if (client != NULL)
+ {
+ self->client = g_object_ref (client);
+ g_signal_connect_swapped (self->client,
+ "account-added",
+ G_CALLBACK (photos_source_manager_refresh_accounts),
+ self);
+ g_signal_connect_swapped (self->client,
+ "account-changed",
+ G_CALLBACK (photos_source_manager_refresh_accounts),
+ self);
+ g_signal_connect_swapped (self->client,
+ "account-removed",
+ G_CALLBACK (photos_source_manager_refresh_accounts),
+ self);
+ }
photos_source_manager_refresh_accounts (self);
+
+ out:
+ return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]