[gnome-software/wip/kalev/gnome-3-22: 2/96] Sync whitespace changes from master



commit e769f209527d1edb87445fdb28b836cd8c1606c1
Author: Kalev Lember <klember redhat com>
Date:   Tue Mar 7 13:09:01 2017 +0100

    Sync whitespace changes from master
    
    This syncs various whitespace / formatting changes from commits 5da646c9
    and d7e7a148 in order to make it easier to backport fixes in the future.

 src/gs-plugin-loader.c                         |   16 +++--
 src/plugins/gs-appstream.c                     |    9 ++-
 src/plugins/gs-flatpak.c                       |   82 ++++++++++++++++--------
 src/plugins/gs-plugin-appstream.c              |    3 +-
 src/plugins/gs-plugin-dpkg.c                   |    3 +-
 src/plugins/gs-plugin-epiphany.c               |    6 +-
 src/plugins/gs-plugin-fedora-distro-upgrades.c |    3 +-
 src/plugins/gs-plugin-fwupd.c                  |   35 +++++++---
 src/plugins/gs-plugin-icons.c                  |   37 ++++++++---
 src/plugins/gs-plugin-odrs.c                   |    9 ++-
 src/plugins/gs-plugin-ostree.c                 |    6 +-
 src/plugins/gs-plugin-repos.c                  |    9 ++-
 src/plugins/gs-plugin-shell-extensions.c       |   18 ++++--
 src/plugins/gs-plugin-steam.c                  |   45 +++++++++----
 src/plugins/gs-plugin-systemd-updates.c        |   10 ++-
 src/plugins/gs-plugin-ubuntuone.c              |    3 +-
 16 files changed, 200 insertions(+), 94 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 1f88681..1f1d03a 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -702,9 +702,9 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               ret = g_cancellable_set_error_if_cancelled (cancellable, error);
-               if (ret)
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
                        return NULL;
+               }
 
                /* get symbol */
                exists = g_module_symbol (gs_plugin_get_module (plugin),
@@ -1033,8 +1033,9 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
                        return FALSE;
+               }
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          function_name,
                                          (gpointer *) &plugin_func);
@@ -2904,8 +2905,9 @@ gs_plugin_loader_review_action_thread_cb (GTask *task,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, &error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
                        g_task_return_error (task, error);
+               }
 
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          state->function_name,
@@ -3302,8 +3304,9 @@ gs_plugin_loader_auth_action_thread_cb (GTask *task,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, &error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
                        g_task_return_error (task, error);
+               }
 
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          state->function_name,
@@ -4180,8 +4183,9 @@ gs_plugin_loader_run_refresh (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (priv->plugins, i);
                if (!gs_plugin_get_enabled (plugin))
                        continue;
-               if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
                        return FALSE;
+               }
 
                exists = g_module_symbol (gs_plugin_get_module (plugin),
                                          function_name,
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 7743fc5..5377f3b 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -426,8 +426,9 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
                desc = as_markup_convert (as_release_get_description (rel, NULL),
                                          AS_MARKUP_CONVERT_FORMAT_SIMPLE,
                                          error);
-               if (desc == NULL)
+               if (desc == NULL) {
                        return FALSE;
+               }
                gs_app_set_update_details (app, desc);
 
        /* get the descriptions with a version prefix */
@@ -439,8 +440,9 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
                        desc = as_markup_convert (as_release_get_description (rel, NULL),
                                                  AS_MARKUP_CONVERT_FORMAT_SIMPLE,
                                                  error);
-                       if (desc == NULL)
+                       if (desc == NULL) {
                                return FALSE;
+                       }
                        g_string_append_printf (update_desc,
                                                "Version %s:\n%s\n\n",
                                                as_release_get_version (rel),
@@ -808,8 +810,9 @@ gs_appstream_store_search (GsPlugin *plugin,
        g_assert (ptask != NULL);
        array = as_store_get_apps (store);
        for (i = 0; i < array->len; i++) {
-               if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
                        return FALSE;
+               }
 
                item = g_ptr_array_index (array, i);
                ret = gs_appstream_store_search_item (plugin, item,
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index fcd5885..01d97d2 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -378,16 +378,17 @@ gs_flatpak_setup (GsFlatpak *self, GCancellable *cancellable, GError **error)
                self->installation = flatpak_installation_new_user (cancellable,
                                                                    error);
        }
-
-       if (self->installation == NULL)
+       if (self->installation == NULL) {
                return FALSE;
+       }
 
        /* watch for changes */
        self->monitor = flatpak_installation_create_monitor (self->installation,
                                                             cancellable,
                                                             error);
-       if (self->monitor == NULL)
+       if (self->monitor == NULL) {
                return FALSE;
+       }
        g_signal_connect (self->monitor, "changed",
                          G_CALLBACK (gs_plugin_flatpak_changed_cb), self);
 
@@ -430,8 +431,9 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
        xremotes = flatpak_installation_list_remotes (self->installation,
                                                      cancellable,
                                                      error);
-       if (xremotes == NULL)
+       if (xremotes == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xremotes->len; i++) {
                const gchar *remote_name;
                guint tmp;
@@ -671,8 +673,9 @@ gs_flatpak_add_installed (GsFlatpak *self, GsAppList *list,
        /* get apps and runtimes */
        xrefs = flatpak_installation_list_installed_refs (self->installation,
                                                          cancellable, error);
-       if (xrefs == NULL)
+       if (xrefs == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xrefs->len; i++) {
                FlatpakInstalledRef *xref = g_ptr_array_index (xrefs, i);
                g_autoptr(GError) error_local = NULL;
@@ -709,15 +712,17 @@ gs_flatpak_add_sources (GsFlatpak *self, GsAppList *list,
        xrefs = flatpak_installation_list_installed_refs (self->installation,
                                                          cancellable,
                                                          error);
-       if (xrefs == NULL)
+       if (xrefs == NULL) {
                return FALSE;
+       }
 
        /* get available remotes */
        xremotes = flatpak_installation_list_remotes (self->installation,
                                                      cancellable,
                                                      error);
-       if (xremotes == NULL)
+       if (xremotes == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xremotes->len; i++) {
                FlatpakRemote *xremote = g_ptr_array_index (xremotes, i);
                g_autoptr(GsApp) app = NULL;
@@ -862,8 +867,9 @@ gs_flatpak_add_updates (GsFlatpak *self, GsAppList *list,
        xrefs = flatpak_installation_list_installed_refs (self->installation,
                                                          cancellable,
                                                          error);
-       if (xrefs == NULL)
+       if (xrefs == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xrefs->len; i++) {
                FlatpakInstalledRef *xref = g_ptr_array_index (xrefs, i);
                const gchar *commit;
@@ -947,8 +953,9 @@ gs_flatpak_refresh (GsFlatpak *self,
        xrefs = flatpak_installation_list_installed_refs_for_update (self->installation,
                                                                     cancellable,
                                                                     error);
-       if (xrefs == NULL)
+       if (xrefs == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xrefs->len; i++) {
                FlatpakInstalledRef *xref = g_ptr_array_index (xrefs, i);
                g_autoptr(GsApp) app = NULL;
@@ -969,8 +976,9 @@ gs_flatpak_refresh (GsFlatpak *self,
                                                     flatpak_ref_get_branch (FLATPAK_REF (xref)),
                                                     gs_flatpak_progress_cb, app,
                                                     cancellable, error);
-               if (xref2 == NULL)
+               if (xref2 == NULL) {
                        return FALSE;
+               }
        }
 
        return TRUE;
@@ -998,8 +1006,9 @@ gs_plugin_refine_item_origin_ui (GsFlatpak *self, GsApp *app,
        xremotes = flatpak_installation_list_remotes (self->installation,
                                                      cancellable,
                                                      error);
-       if (xremotes == NULL)
+       if (xremotes == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xremotes->len; i++) {
                FlatpakRemote *xremote = g_ptr_array_index (xremotes, i);
                if (flatpak_remote_get_disabled (xremote))
@@ -1037,8 +1046,9 @@ gs_plugin_refine_item_origin_hostname (GsFlatpak *self, GsApp *app,
                                                           gs_app_get_origin (app),
                                                           cancellable,
                                                           error);
-       if (xremote == NULL)
+       if (xremote == NULL) {
                return FALSE;
+       }
        url = flatpak_remote_get_url (xremote);
        if (url == NULL) {
                g_set_error (error,
@@ -1114,8 +1124,9 @@ refine_origin_from_installation (GsFlatpak *self,
        xremotes = flatpak_installation_list_remotes (installation,
                                                      cancellable,
                                                      error);
-       if (xremotes == NULL)
+       if (xremotes == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xremotes->len; i++) {
                const gchar *remote_name;
                FlatpakRemote *xremote = g_ptr_array_index (xremotes, i);
@@ -1158,10 +1169,15 @@ gs_flatpak_get_installation_counterpart (GsFlatpak *self,
                                         GCancellable *cancellable,
                                         GError **error)
 {
+       FlatpakInstallation *installation;
        if (flatpak_installation_get_is_user (self->installation))
-               return flatpak_installation_new_system (cancellable, error);
-
-       return flatpak_installation_new_user (cancellable, error);
+               installation = flatpak_installation_new_system (cancellable, error);
+       else
+               installation = flatpak_installation_new_user (cancellable, error);
+       if (installation == NULL) {
+               return NULL;
+       }
+       return installation;
 }
 
 static gboolean
@@ -1254,13 +1270,18 @@ gs_flatpak_app_matches_xref (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
 static FlatpakRef *
 gs_flatpak_create_fake_ref (GsApp *app, GError **error)
 {
+       FlatpakRef *xref;
        g_autofree gchar *id = NULL;
        id = g_strdup_printf ("%s/%s/%s/%s",
                              gs_app_get_flatpak_kind_as_str (app),
                              gs_app_get_flatpak_name (app),
                              gs_app_get_flatpak_arch (app),
                              gs_app_get_flatpak_branch (app));
-       return flatpak_ref_parse (id, error);
+       xref = flatpak_ref_parse (id, error);
+       if (xref == NULL) {
+               return NULL;
+       }
+       return xref;
 }
 
 static gboolean
@@ -1287,8 +1308,9 @@ gs_plugin_refine_item_state (GsFlatpak *self,
        g_assert (ptask != NULL);
        xrefs = flatpak_installation_list_installed_refs (self->installation,
                                                          cancellable, error);
-       if (xrefs == NULL)
+       if (xrefs == NULL) {
                return FALSE;
+       }
        for (i = 0; i < xrefs->len; i++) {
                FlatpakInstalledRef *xref = g_ptr_array_index (xrefs, i);
 
@@ -1320,8 +1342,9 @@ gs_plugin_refine_item_state (GsFlatpak *self,
                        return FALSE;
                xrefs = flatpak_installation_list_installed_refs (installation,
                                                                  cancellable, error);
-               if (xrefs == NULL)
+               if (xrefs == NULL) {
                        return FALSE;
+               }
                for (i = 0; i < xrefs->len; i++) {
                        FlatpakInstalledRef *xref = g_ptr_array_index (xrefs, i);
                        if (!gs_flatpak_app_matches_xref (self, app, FLATPAK_REF(xref)))
@@ -1380,15 +1403,18 @@ gs_flatpak_set_app_metadata (GsFlatpak *self,
        g_auto(GStrv) filesystems = NULL;
 
        kf = g_key_file_new ();
-       if (!g_key_file_load_from_data (kf, data, length, G_KEY_FILE_NONE, error))
+       if (!g_key_file_load_from_data (kf, data, length, G_KEY_FILE_NONE, error)) {
                return FALSE;
+       }
        name = g_key_file_get_string (kf, "Application", "name", error);
-       if (name == NULL)
+       if (name == NULL) {
                return FALSE;
+       }
        gs_app_set_flatpak_name (app, name);
        runtime = g_key_file_get_string (kf, "Application", "runtime", error);
-       if (runtime == NULL)
+       if (runtime == NULL) {
                return FALSE;
+       }
        g_debug ("runtime for %s is %s", name, runtime);
 
        /* we always get this, but it's a low bar... */
@@ -1496,8 +1522,9 @@ gs_plugin_refine_item_metadata (GsFlatpak *self,
                                                                        xref,
                                                                        cancellable,
                                                                        error);
-               if (data == NULL)
+               if (data == NULL) {
                        return FALSE;
+               }
                str = g_bytes_get_data (data, &len);
        }
 
@@ -2132,11 +2159,13 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
                                                       0x100000, /* 1Mb */
                                                       cancellable,
                                                       error);
-               if (appstream == NULL)
+               if (appstream == NULL) {
                        return FALSE;
+               }
                store = as_store_new ();
-               if (!as_store_from_bytes (store, appstream, cancellable, error))
+               if (!as_store_from_bytes (store, appstream, cancellable, error)) {
                        return FALSE;
+               }
 
                /* allow peeking into this for debugging */
                if (g_getenv ("GS_FLATPAK_DEBUG_APPSTREAM") != NULL) {
@@ -2191,8 +2220,9 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
                g_autoptr(GdkPixbuf) pixbuf = NULL;
                stream_icon = g_memory_input_stream_new_from_bytes (icon_data);
                pixbuf = gdk_pixbuf_new_from_stream (stream_icon, cancellable, error);
-               if (pixbuf == NULL)
+               if (pixbuf == NULL) {
                        return FALSE;
+               }
                gs_app_set_pixbuf (app, pixbuf);
        } else {
                g_autoptr(AsIcon) icon = NULL;
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 8ec448b..87d0321 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -261,8 +261,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                                     AS_STORE_LOAD_FLAG_APP_INSTALL,
                                     cancellable,
                                     error);
-               if (!ret)
+               if (!ret) {
                        return FALSE;
+               }
        }
        items = as_store_get_apps (priv->store);
        if (items->len == 0) {
diff --git a/src/plugins/gs-plugin-dpkg.c b/src/plugins/gs-plugin-dpkg.c
index bb82fcc..becebed 100644
--- a/src/plugins/gs-plugin-dpkg.c
+++ b/src/plugins/gs-plugin-dpkg.c
@@ -73,8 +73,9 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        argv[3] = g_file_get_path (file);
        if (!g_spawn_sync (NULL, argv, NULL,
                           G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
-                          NULL, NULL, &output, NULL, NULL, error))
+                          NULL, NULL, &output, NULL, NULL, error)) {
                return FALSE;
+       }
 
        /* parse output */
        tokens = g_strsplit (output, "\n", 0);
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index ccd3502..8371cdb 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -198,8 +198,9 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
                                         epi_desktop,
                                         NULL,
                                         error);
-       if (!ret)
+       if (!ret) {
                return FALSE;
+       }
 
        /* update state */
        gs_app_set_state (app, AS_APP_STATE_INSTALLING);
@@ -234,8 +235,9 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
                                        gs_app_get_id (app),
                                        NULL);
        file_app = g_file_new_for_path (app_desktop);
-       if (!g_file_delete (file_app, NULL, error))
+       if (!g_file_delete (file_app, NULL, error)) {
                return FALSE;
+       }
        gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
        return TRUE;
 }
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 40b7dcf..e4faf42 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -334,8 +334,9 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
                return FALSE;
 
        /* get cached file */
-       if (!g_file_get_contents (priv->cachefn, &data, &len, error))
+       if (!g_file_get_contents (priv->cachefn, &data, &len, error)) {
                return FALSE;
+       }
 
        /* parse data */
        settings = g_settings_new ("org.gnome.software");
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index efd800e..4000af7 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -183,8 +183,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        /* read config file */
        config = g_key_file_new ();
        if (!g_key_file_load_from_file (config, priv->config_fn,
-                                       G_KEY_FILE_NONE, error))
+                                       G_KEY_FILE_NONE, error)) {
                return FALSE;
+       }
 
        /* get the download URI */
        priv->download_uri = g_key_file_get_string (config, "fwupd",
@@ -216,12 +217,14 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                                                         "firmware.xml.gz.asc",
                                                         GS_UTILS_CACHE_FLAG_WRITEABLE,
                                                         error);
-       if (priv->lvfs_sig_fn == NULL)
+       if (priv->lvfs_sig_fn == NULL) {
                return FALSE;
+       }
        if (g_file_test (priv->lvfs_sig_fn, G_FILE_TEST_EXISTS)) {
                if (!g_file_get_contents (priv->lvfs_sig_fn,
-                                         &data, &len, error))
+                                         &data, &len, error)) {
                        return FALSE;
+               }
                priv->lvfs_sig_hash =
                        g_compute_checksum_for_data (G_CHECKSUM_SHA1, (guchar *) data, len);
        }
@@ -256,8 +259,9 @@ gs_plugin_fwupd_get_file_checksum (const gchar *filename,
        gsize len;
        g_autofree gchar *data = NULL;
 
-       if (!g_file_get_contents (filename, &data, &len, error))
+       if (!g_file_get_contents (filename, &data, &len, error)) {
                return NULL;
+       }
        return g_compute_checksum_for_data (checksum_type, (const guchar *)data, len);
 }
 
@@ -679,9 +683,9 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
                                           cache_fn_data,
                                           priv->lvfs_sig_fn,
                                           cancellable,
-                                          error))
+                                          error)) {
                return FALSE;
-
+       }
        return TRUE;
 }
 
@@ -834,11 +838,18 @@ gs_plugin_update_app (GsPlugin *plugin,
                                             "not enough data for fwupd unlock");
                        return FALSE;
                }
-               return fwupd_client_unlock (priv->client, device_id,
-                                           cancellable, error);
+               if (!fwupd_client_unlock (priv->client, device_id,
+                                         cancellable, error)) {
+                       return FALSE;
+               }
+               return TRUE;
        }
 
-       return gs_plugin_fwupd_install (plugin, app, cancellable, error);
+       /* update means install */
+       if (!gs_plugin_fwupd_install (plugin, app, cancellable, error)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 gboolean
@@ -876,8 +887,9 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                                                  filename,
                                                  cancellable,
                                                  error);
-       if (results == NULL)
+       if (results == NULL) {
                return FALSE;
+       }
        for (i = 0; i < results->len; i++) {
                FwupdResult *res = g_ptr_array_index (results, i);
                g_autoptr(GsApp) app = NULL;
@@ -896,8 +908,9 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                                        filename,
                                        cancellable,
                                        error);
-       if (res == NULL)
+       if (res == NULL) {
                return FALSE;
+       }
        app = gs_plugin_fwupd_new_app_from_results (plugin, res);
 
        /* we have no update view for local files */
diff --git a/src/plugins/gs-plugin-icons.c b/src/plugins/gs-plugin-icons.c
index 92225cb..c08051b 100644
--- a/src/plugins/gs-plugin-icons.c
+++ b/src/plugins/gs-plugin-icons.c
@@ -100,8 +100,9 @@ gs_plugin_icons_download (GsPlugin *plugin,
                                                      msg->response_body->length,
                                                      NULL);
        pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error);
-       if (pixbuf == NULL)
+       if (pixbuf == NULL) {
                return FALSE;
+       }
        if (gdk_pixbuf_get_height (pixbuf) == 64 &&
            gdk_pixbuf_get_width (pixbuf) == 64) {
                pixbuf_new = g_object_ref (pixbuf);
@@ -111,12 +112,16 @@ gs_plugin_icons_download (GsPlugin *plugin,
        }
 
        /* write file */
-       return gdk_pixbuf_save (pixbuf_new, filename, "png", error, NULL);
+       if (!gdk_pixbuf_save (pixbuf_new, filename, "png", error, NULL)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 static GdkPixbuf *
 gs_plugin_icons_load_local (GsPlugin *plugin, AsIcon *icon, GError **error)
 {
+       GdkPixbuf *pixbuf;
        gint size;
        if (as_icon_get_filename (icon) == NULL) {
                g_set_error_literal (error,
@@ -126,8 +131,12 @@ gs_plugin_icons_load_local (GsPlugin *plugin, AsIcon *icon, GError **error)
                return NULL;
        }
        size = (gint) (64 * gs_plugin_get_scale (plugin));
-       return gdk_pixbuf_new_from_file_at_size (as_icon_get_filename (icon),
-                                                size, size, error);
+       pixbuf = gdk_pixbuf_new_from_file_at_size (as_icon_get_filename (icon),
+                                                  size, size, error);
+       if (pixbuf == NULL) {
+               return NULL;
+       }
+       return pixbuf;
 }
 
 static gchar *
@@ -215,6 +224,7 @@ static GdkPixbuf *
 gs_plugin_icons_load_stock (GsPlugin *plugin, AsIcon *icon, GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
+       GdkPixbuf *pixbuf;
        gint size;
        g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->icon_theme_lock);
 
@@ -228,19 +238,24 @@ gs_plugin_icons_load_stock (GsPlugin *plugin, AsIcon *icon, GError **error)
        }
        gs_plugin_icons_add_theme_path (plugin, as_icon_get_prefix (icon));
        size = (gint) (64 * gs_plugin_get_scale (plugin));
-       return gtk_icon_theme_load_icon (priv->icon_theme,
-                                        as_icon_get_name (icon),
-                                        size,
-                                        GTK_ICON_LOOKUP_USE_BUILTIN |
-                                        GTK_ICON_LOOKUP_FORCE_SIZE,
-                                        error);
+       pixbuf = gtk_icon_theme_load_icon (priv->icon_theme,
+                                          as_icon_get_name (icon),
+                                          size,
+                                          GTK_ICON_LOOKUP_USE_BUILTIN |
+                                          GTK_ICON_LOOKUP_FORCE_SIZE,
+                                          error);
+       if (pixbuf == NULL) {
+               return NULL;
+       }
+       return pixbuf;
 }
 
 static GdkPixbuf *
 gs_plugin_icons_load_cached (GsPlugin *plugin, AsIcon *icon, GError **error)
 {
-       if (!as_icon_load (icon, AS_ICON_LOAD_FLAG_SEARCH_SIZE, error))
+       if (!as_icon_load (icon, AS_ICON_LOAD_FLAG_SEARCH_SIZE, error)) {
                return NULL;
+       }
        return g_object_ref (as_icon_get_pixbuf (icon));
 }
 
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index 5507655..bffed51 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -116,8 +116,9 @@ gs_plugin_odrs_load_ratings (GsPlugin *plugin, const gchar *fn, GError **error)
 
        /* parse the data and find the success */
        json_parser = json_parser_new ();
-       if (!json_parser_load_from_file (json_parser, fn, error))
+       if (!json_parser_load_from_file (json_parser, fn, error)) {
                return FALSE;
+       }
        json_root = json_parser_get_root (json_parser);
        if (json_root == NULL) {
                g_set_error_literal (error,
@@ -316,8 +317,9 @@ gs_plugin_odrs_parse_reviews (GsPlugin *plugin,
 
        /* parse the data and find the array or ratings */
        json_parser = json_parser_new ();
-       if (!json_parser_load_from_data (json_parser, data, data_len, error))
+       if (!json_parser_load_from_data (json_parser, data, data_len, error)) {
                return NULL;
+       }
        json_root = json_parser_get_root (json_parser);
        if (json_root == NULL) {
                g_set_error_literal (error,
@@ -387,8 +389,9 @@ gs_plugin_odrs_parse_success (const gchar *data, gssize data_len, GError **error
 
        /* parse the data and find the success */
        json_parser = json_parser_new ();
-       if (!json_parser_load_from_data (json_parser, data, data_len, error))
+       if (!json_parser_load_from_data (json_parser, data, data_len, error)) {
                return FALSE;
+       }
        json_root = json_parser_get_root (json_parser);
        if (json_root == NULL) {
                g_set_error_literal (error,
diff --git a/src/plugins/gs-plugin-ostree.c b/src/plugins/gs-plugin-ostree.c
index adf3d7f..ea07cdc 100644
--- a/src/plugins/gs-plugin-ostree.c
+++ b/src/plugins/gs-plugin-ostree.c
@@ -72,8 +72,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
 
        /* open */
        priv->ostree_repo = ostree_repo_new_default ();
-       if (!ostree_repo_open (priv->ostree_repo, cancellable, error))
+       if (!ostree_repo_open (priv->ostree_repo, cancellable, error)) {
                return FALSE;
+       }
        return TRUE;
 }
 
@@ -97,8 +98,9 @@ gs_plugin_add_sources (GsPlugin *plugin,
 
                /* get info */
                if (!ostree_repo_remote_get_url (priv->ostree_repo,
-                                                names[i], &url, error))
+                                                names[i], &url, error)) {
                        return FALSE;
+               }
 
                /* create app */
                app = gs_app_new (names[i]);
diff --git a/src/plugins/gs-plugin-repos.c b/src/plugins/gs-plugin-repos.c
index d96f315..e530207 100644
--- a/src/plugins/gs-plugin-repos.c
+++ b/src/plugins/gs-plugin-repos.c
@@ -80,8 +80,9 @@ gs_plugin_repos_setup (GsPlugin *plugin, GCancellable *cancellable, GError **err
 
        /* search all files */
        dir = g_dir_open (priv->reposdir, 0, error);
-       if (dir == NULL)
+       if (dir == NULL) {
                return FALSE;
+       }
        while ((fn = g_dir_read_name (dir)) != NULL) {
                g_autofree gchar *filename = NULL;
                g_auto(GStrv) groups = NULL;
@@ -96,8 +97,9 @@ gs_plugin_repos_setup (GsPlugin *plugin, GCancellable *cancellable, GError **err
                filename = g_build_filename (priv->reposdir, fn, NULL);
                if (!g_key_file_load_from_file (kf, filename,
                                                G_KEY_FILE_NONE,
-                                               error))
+                                               error)) {
                        return FALSE;
+               }
 
                /* we can have multiple repos in one file */
                groups = g_key_file_get_groups (kf, NULL);
@@ -144,8 +146,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
 
        /* watch for changes */
        priv->monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, cancellable, error);
-       if (priv->monitor == NULL)
+       if (priv->monitor == NULL) {
                return FALSE;
+       }
        g_signal_connect (priv->monitor, "changed",
                          G_CALLBACK (gs_plugin_repos_changed_cb), plugin);
 
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index abe155b..03b6c34 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -133,8 +133,9 @@ gs_plugin_shell_extensions_add_app (GsPlugin *plugin,
                                                 AS_MARKUP_CONVERT_FORMAT_SIMPLE,
                                                 NULL);
                        tmp2 = as_markup_convert_simple (tmp1, error);
-                       if (tmp2 == NULL)
+                       if (tmp2 == NULL) {
                                return FALSE;
+                       }
                        gs_app_set_description (app, GS_APP_QUALITY_NORMAL, tmp2);
                        continue;
                }
@@ -259,8 +260,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                                                     "org.gnome.Shell.Extensions",
                                                     cancellable,
                                                     error);
-       if (priv->proxy == NULL)
+       if (priv->proxy == NULL) {
                return FALSE;
+       }
        g_signal_connect (priv->proxy, "g-signal",
                          G_CALLBACK (gs_plugin_shell_extensions_changed_cb), plugin);
 
@@ -293,8 +295,9 @@ gs_plugin_add_installed (GsPlugin *plugin,
                                         -1,
                                         cancellable,
                                         error);
-       if (retval == NULL)
+       if (retval == NULL) {
                return FALSE;
+       }
 
        /* parse each installed extension */
        g_variant_get (retval, "(a{sa{sv}})", &iter);
@@ -440,8 +443,9 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
        if (tmp != NULL) {
                g_autofree gchar *desc = NULL;
                desc = as_markup_import (tmp, AS_MARKUP_CONVERT_FORMAT_SIMPLE, error);
-               if (desc == NULL)
+               if (desc == NULL) {
                        return NULL;
+               }
                as_app_set_description (app, NULL, desc);
        }
        tmp = json_object_get_string_member (json_app, "screenshot");
@@ -534,8 +538,9 @@ gs_plugin_shell_extensions_parse_apps (GsPlugin *plugin,
 
        /* parse the data and find the success */
        json_parser = json_parser_new ();
-       if (!json_parser_load_from_data (json_parser, data, data_len, error))
+       if (!json_parser_load_from_data (json_parser, data, data_len, error)) {
                return NULL;
+       }
        json_root = json_parser_get_root (json_parser);
        if (json_root == NULL) {
                g_set_error_literal (error,
@@ -869,8 +874,9 @@ gs_plugin_launch (GsPlugin *plugin,
                                         -1,
                                         cancellable,
                                         error);
-       if (retval == NULL)
+       if (retval == NULL) {
                return FALSE;
+       }
        return TRUE;
 }
 
diff --git a/src/plugins/gs-plugin-steam.c b/src/plugins/gs-plugin-steam.c
index 06c08f6..c41c32e 100644
--- a/src/plugins/gs-plugin-steam.c
+++ b/src/plugins/gs-plugin-steam.c
@@ -136,8 +136,9 @@ gs_plugin_steam_parse_appinfo_file (const gchar *filename, GError **error)
        gboolean debug =  g_getenv ("GS_PLUGIN_STEAM_DEBUG") != NULL;
 
        /* load file */
-       if (!g_file_get_contents (filename, (gchar **) &data, &data_len, error))
+       if (!g_file_get_contents (filename, (gchar **) &data, &data_len, error)) {
                return NULL;
+       }
 
        /* a GPtrArray of GHashTable */
        apps = g_ptr_array_new_with_free_func ((GDestroyNotify) g_hash_table_unref);
@@ -378,8 +379,9 @@ gs_plugin_steam_download_icon (GsPlugin *plugin,
        if (cache_fn == NULL)
                return FALSE;
        if (g_file_test (cache_fn, G_FILE_TEST_EXISTS)) {
-               if (!g_file_get_contents (cache_fn, &data, &data_len, error))
+               if (!g_file_get_contents (cache_fn, &data, &data_len, error)) {
                        return FALSE;
+               }
        } else {
                if (!gs_mkdir_parent (cache_fn, error))
                        return FALSE;
@@ -394,8 +396,9 @@ gs_plugin_steam_download_icon (GsPlugin *plugin,
 
        /* load the icon as large as possible */
        pb = gdk_pixbuf_new_from_file (cache_fn, error);
-       if (pb == NULL)
+       if (pb == NULL) {
                return FALSE;
+       }
 
        /* too small? */
        if (gdk_pixbuf_get_width (pb) < 48 ||
@@ -417,8 +420,9 @@ gs_plugin_steam_download_icon (GsPlugin *plugin,
                                                 error);
        if (cache_png == NULL)
                return FALSE;
-       if (!gdk_pixbuf_save (pb, cache_png, "png", error, NULL))
+       if (!gdk_pixbuf_save (pb, cache_png, "png", error, NULL)) {
                return FALSE;
+       }
 
        /* add an icon */
        icon = as_icon_new ();
@@ -595,8 +599,9 @@ gs_plugin_steam_update_store_app (GsPlugin *plugin,
        }
 
        /* get screenshots and descriptions */
-       if (!g_file_get_contents (cache_fn, &html, NULL, error))
+       if (!g_file_get_contents (cache_fn, &html, NULL, error)) {
                return FALSE;
+       }
        if (!gs_plugin_steam_update_screenshots (item, html, error))
                return FALSE;
        if (!gs_plugin_steam_update_description (item, html, error))
@@ -684,11 +689,13 @@ gs_plugin_steam_refresh (GsPlugin *plugin,
                return FALSE;
 
        /* save new file */
-       return as_store_to_file (store, file,
-                                AS_NODE_TO_XML_FLAG_FORMAT_INDENT |
-                                AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE,
-                                NULL,
-                                error);
+       if (!as_store_to_file (store, file,
+                              AS_NODE_TO_XML_FLAG_FORMAT_INDENT |
+                              AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE,
+                              NULL, error)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 gboolean
@@ -711,8 +718,9 @@ gs_plugin_steam_load_app_manifest (const gchar *fn, GError **error)
        g_auto(GStrv) lines = NULL;
 
        /* get file */
-       if (!g_file_get_contents (fn, &data, NULL, error))
+       if (!g_file_get_contents (fn, &data, NULL, error)) {
                return NULL;
+       }
 
        /* parse each line */
        manifest = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -884,7 +892,10 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
        gs_app_set_state (app, AS_APP_STATE_INSTALLING);
        gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
        cmdline = g_strdup_printf ("steam steam://install/%s", gameid);
-       return g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error);
+       if (!g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 gboolean
@@ -903,7 +914,10 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
        gs_app_set_state (app, AS_APP_STATE_REMOVING);
        gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
        cmdline = g_strdup_printf ("steam steam://uninstall/%s", gameid);
-       return g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error);
+       if (!g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 gboolean
@@ -921,7 +935,10 @@ gs_plugin_launch (GsPlugin *plugin, GsApp *app,
        /* this is async as steam is a different process: FIXME: use D-Bus */
        gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
        cmdline = g_strdup_printf ("steam steam://run/%s", gameid);
-       return g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error);
+       if (!g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 gboolean
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index dce5efd..13de531 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -67,8 +67,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
        priv->monitor = pk_offline_get_prepared_monitor (cancellable, error);
-       if (priv->monitor == NULL)
+       if (priv->monitor == NULL) {
                return FALSE;
+       }
        g_signal_connect (priv->monitor, "changed",
                          G_CALLBACK (gs_plugin_systemd_updates_changed_cb),
                          plugin);
@@ -170,8 +171,11 @@ gs_plugin_update (GsPlugin *plugin,
        for (i = 0; i < gs_app_list_length (apps); i++) {
                GsApp *app = gs_app_list_index (apps, i);
                if (gs_plugin_systemd_updates_requires_trigger (app)) {
-                       return pk_offline_trigger (PK_OFFLINE_ACTION_REBOOT,
-                                                  cancellable, error);
+                       if (!pk_offline_trigger (PK_OFFLINE_ACTION_REBOOT,
+                                                cancellable, error)) {
+                               return FALSE;
+                       }
+                       return TRUE;
                }
        }
        return TRUE;
diff --git a/src/plugins/gs-plugin-ubuntuone.c b/src/plugins/gs-plugin-ubuntuone.c
index c141947..74bc668 100644
--- a/src/plugins/gs-plugin-ubuntuone.c
+++ b/src/plugins/gs-plugin-ubuntuone.c
@@ -130,8 +130,9 @@ gs_plugin_auth_login (GsPlugin *plugin, GsAuth *auth,
        status_code = soup_session_send_message (gs_plugin_get_soup_session (plugin), msg);
 
        parser = json_parser_new ();
-       if (!json_parser_load_from_data (parser, msg->response_body->data, -1, error))
+       if (!json_parser_load_from_data (parser, msg->response_body->data, -1, error)) {
                return FALSE;
+       }
        response_root = json_parser_get_root (parser);
 
        if (status_code != SOUP_STATUS_OK) {


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