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

« back to all changes in this revision

Viewing changes to src/plugins/packagekit-common.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:
23
23
 
24
24
#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
25
25
#include <packagekit-glib2/packagekit.h>
 
26
 
 
27
#include "gs-cleanup.h"
26
28
#include <gs-plugin.h>
27
29
 
28
30
#include "packagekit-common.h"
92
94
                                  GError **error)
93
95
{
94
96
        const gchar *package_id;
95
 
        gboolean ret = TRUE;
96
 
        GHashTable *installed = NULL;
97
 
        GPtrArray *array = NULL;
98
 
        GPtrArray *array_filtered = NULL;
99
 
        GsApp *app;
100
97
        guint i;
101
 
        PkError *error_code = NULL;
102
98
        PkPackage *package;
 
99
        _cleanup_hashtable_unref_ GHashTable *installed = NULL;
 
100
        _cleanup_object_unref_ PkError *error_code = NULL;
 
101
        _cleanup_ptrarray_unref_ GPtrArray *array_filtered = NULL;
 
102
        _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
103
103
 
104
104
        /* check error code */
105
105
        error_code = pk_results_get_error_code (results);
106
106
        if (error_code != NULL) {
107
 
                ret = FALSE;
108
107
                g_set_error (error,
109
108
                             GS_PLUGIN_ERROR,
110
109
                             GS_PLUGIN_ERROR_FAILED,
111
110
                             "failed to get-packages: %s, %s",
112
111
                             pk_error_enum_to_string (pk_error_get_code (error_code)),
113
112
                             pk_error_get_details (error_code));
114
 
                goto out;
 
113
                return FALSE;
115
114
        }
116
115
 
117
116
        /* add all installed packages to a hash */
142
141
 
143
142
        /* process packages */
144
143
        for (i = 0; i < array_filtered->len; i++) {
 
144
                _cleanup_object_unref_ GsApp *app = NULL;
145
145
                package = g_ptr_array_index (array_filtered, i);
146
146
 
147
147
                app = gs_app_new (NULL);
169
169
                }
170
170
                gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
171
171
                gs_plugin_add_app (list, app);
172
 
                g_object_unref (app);
173
172
        }
174
 
out:
175
 
        if (installed != NULL)
176
 
                g_hash_table_unref (installed);
177
 
        if (error_code != NULL)
178
 
                g_object_unref (error_code);
179
 
        if (array != NULL)
180
 
                g_ptr_array_unref (array);
181
 
        if (array_filtered != NULL)
182
 
                g_ptr_array_unref (array_filtered);
183
 
        return ret;
 
173
        return TRUE;
184
174
}