~ubuntu-branches/ubuntu/wily/gnome-software/wily-proposed

« back to all changes in this revision

Viewing changes to src/plugins/gs-plugin-systemd-updates.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2015-07-22 00:03:04 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20150722000304-ctnkwytku720qft7
Tags: 3.16.4-1
* New upstream release.
* Update Build-Depends as per configure.ac:
  - Add appstream-util.
  - Add libpolkit-gobject-1-dev.
  - Bump libappstream-glib-dev to (>= 0.3.4).
  - Bump libgtk-3-dev to (>= 3.16).
* Drop hard-coded dependency on libappstream-glib7 now that the library
  provides a symbols file.
* Use dh_install's exclude (-X) functionality to not install the .a and .la
  files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
26
26
#include <packagekit-glib2/packagekit.h>
27
27
 
 
28
#include "gs-cleanup.h"
28
29
#include <gs-plugin.h>
29
30
 
30
31
struct GsPluginPrivate {
97
98
                       GCancellable *cancellable,
98
99
                       GError **error)
99
100
{
100
 
        GError *error_local = NULL;
101
 
        GsApp *app;
102
 
        gboolean ret = TRUE;
103
 
        gchar **package_ids = NULL;
104
 
        gchar **split;
 
101
        gboolean ret;
105
102
        guint i;
 
103
        _cleanup_error_free_ GError *error_local = NULL;
 
104
        _cleanup_strv_free_ gchar **package_ids = NULL;
106
105
 
107
106
        /* watch the file in case it comes or goes */
108
107
        if (g_once_init_enter (&plugin->priv->done_init)) {
109
108
                ret = gs_plugin_startup (plugin, cancellable, error);
110
109
                g_once_init_leave (&plugin->priv->done_init, TRUE);
111
110
                if (!ret)
112
 
                        goto out;
 
111
                        return FALSE;
113
112
        }
114
113
 
115
114
        /* get the id's if the file exists */
118
117
                if (g_error_matches (error_local,
119
118
                                     PK_OFFLINE_ERROR,
120
119
                                     PK_OFFLINE_ERROR_NO_DATA)) {
121
 
                        g_error_free (error_local);
122
 
                        ret = TRUE;
123
 
                } else {
124
 
                        g_propagate_error (error, error_local);
125
 
                        ret = FALSE;
 
120
                        return TRUE;
126
121
                }
127
 
                goto out;
 
122
                g_set_error (error,
 
123
                             GS_PLUGIN_ERROR,
 
124
                             GS_PLUGIN_ERROR_FAILED,
 
125
                             "Failed to get prepared IDs: %s",
 
126
                             error_local->message);
 
127
                return FALSE;
128
128
        }
129
129
 
130
130
        /* add them to the new array */
131
131
        for (i = 0; package_ids[i] != NULL; i++) {
 
132
                _cleanup_object_unref_ GsApp *app = NULL;
 
133
                _cleanup_strv_free_ gchar **split = NULL;
132
134
                app = gs_app_new (NULL);
133
135
                gs_app_set_management_plugin (app, "PackageKit");
134
136
                gs_app_add_source_id (app, package_ids[i]);
138
140
                gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
139
141
                gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
140
142
                gs_plugin_add_app (list, app);
141
 
                g_object_unref (app);
142
 
                g_strfreev (split);
143
143
        }
144
 
out:
145
 
        g_strfreev (package_ids);
146
 
        return ret;
 
144
        return TRUE;
147
145
}