[gnome-software] Use packagekit-glib2 with g_autoptr as well



commit 4d2f59de691db95ac79c1215c65414dd3346d00e
Author: Kalev Lember <klember redhat com>
Date:   Tue Sep 8 18:14:28 2015 +0200

    Use packagekit-glib2 with g_autoptr as well
    
    ... and bump PackageKit dep to 1.0.9 for the cleanup macro support.

 configure.ac                               |    2 +-
 src/gs-dbus-helper.c                       |    9 ++++-----
 src/gs-offline-updates.c                   |    4 ++--
 src/gs-update-monitor.c                    |   15 +++++++--------
 src/plugins/gs-plugin-packagekit-refine.c  |   15 +++++++--------
 src/plugins/gs-plugin-packagekit-refresh.c |    7 +++----
 src/plugins/gs-plugin-packagekit.c         |   25 ++++++++++++-------------
 src/plugins/packagekit-common.c            |    3 +--
 8 files changed, 37 insertions(+), 43 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3545871..131124e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ dnl ---------------------------------------------------------------------------
 dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.17.7 gio-unix-2.0)
-PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.0)
+PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.9)
 PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.1)
 PKG_CHECK_MODULES(SQLITE, sqlite3)
 PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42)
diff --git a/src/gs-dbus-helper.c b/src/gs-dbus-helper.c
index df60eba..e657f2a 100644
--- a/src/gs-dbus-helper.c
+++ b/src/gs-dbus-helper.c
@@ -27,7 +27,6 @@
 #include <gtk/gtk.h>
 #include <packagekit-glib2/packagekit.h>
 
-#include "gs-cleanup.h"
 #include "gs-dbus-helper.h"
 #include "gs-packagekit-generated.h"
 #include "gs-packagekit-modify2-generated.h"
@@ -124,8 +123,8 @@ gs_dbus_helper_query_is_installed_cb (GObject *source, GAsyncResult *res, gpoint
        GsDbusHelperTask *dtask = (GsDbusHelperTask *) data;
        PkClient *client = PK_CLIENT (source);
        g_autoptr(GError) error = NULL;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) array = NULL;
 
        /* get the results */
@@ -171,8 +170,8 @@ gs_dbus_helper_query_search_file_cb (GObject *source, GAsyncResult *res, gpointe
        PkInfoEnum info;
        PkPackage *item;
        g_autoptr(GPtrArray) array = NULL;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        /* get the results */
        results = pk_client_generic_finish (client, res, &error);
diff --git a/src/gs-offline-updates.c b/src/gs-offline-updates.c
index 4e018b7..92b0302 100644
--- a/src/gs-offline-updates.c
+++ b/src/gs-offline-updates.c
@@ -265,8 +265,8 @@ gs_offline_updates_show_error (GsShell *shell)
        const gchar *secondary;
        const gchar *geeky;
        GtkWidget *dialog;
-       _cleanup_object_unref_ PkError *pk_error = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) pk_error = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        results = pk_offline_get_results (NULL);
        if (results == NULL)
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index a082510..78a51fb 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -27,7 +27,6 @@
 #include <packagekit-glib2/packagekit.h>
 #include <gsettings-desktop-schemas/gdesktop-enums.h>
 
-#include "gs-cleanup.h"
 #include "gs-update-monitor.h"
 #include "gs-utils.h"
 #include "gs-offline-updates.h"
@@ -157,7 +156,7 @@ show_installed_updates_notification (GsUpdateMonitor *monitor)
        const gchar *message;
        const gchar *title;
        g_autoptr(GNotification) notification = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        results = pk_offline_get_results (NULL);
        if (results == NULL)
@@ -269,8 +268,8 @@ package_download_finished_cb (GObject *object,
 {
        GsUpdateMonitor *monitor = data;
        g_autoptr(GError) error = NULL;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        results = pk_client_generic_finish (PK_CLIENT (object), res, &error);
        if (results == NULL) {
@@ -321,8 +320,8 @@ get_updates_finished_cb (GObject *object,
        guint i;
        PkPackage *pkg;
        g_autoptr(GError) error = NULL;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) packages = NULL;
 
        results = pk_client_generic_finish (PK_CLIENT (object), res, &error);
@@ -401,8 +400,8 @@ refresh_cache_finished_cb (GObject *object,
 {
        GsUpdateMonitor *monitor = data;
        g_autoptr(GError) error = NULL;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        results = pk_client_generic_finish (PK_CLIENT (object), res, &error);
        if (results == NULL) {
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 10c5e70..861af53 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -24,7 +24,6 @@
 #define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
 #include <packagekit-glib2/packagekit.h>
 
-#include "gs-cleanup.h"
 #include <gs-plugin.h>
 #include <gs-utils.h>
 #include <glib/gi18n.h>
@@ -253,8 +252,8 @@ gs_plugin_packagekit_resolve_packages (GsPlugin *plugin,
        GsApp *app;
        const gchar *pkgname;
        guint i;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) package_ids = NULL;
        g_autoptr(GPtrArray) packages = NULL;
 
@@ -308,8 +307,8 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin,
                                          GError **error)
 {
        const gchar *to_array[] = { NULL, NULL };
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) packages = NULL;
 
        to_array[0] = filename;
@@ -365,7 +364,7 @@ gs_plugin_packagekit_refine_updatedetails (GsPlugin *plugin,
        guint size;
        PkUpdateDetail *update_detail;
        g_autofree const gchar **package_ids = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) array = NULL;
 
        size = g_list_length (list);
@@ -504,7 +503,7 @@ gs_plugin_packagekit_refine_details (GsPlugin *plugin,
        guint i;
        g_autoptr(GPtrArray) array = NULL;
        g_autoptr(GPtrArray) package_ids = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        package_ids = g_ptr_array_new_with_free_func (g_free);
        for (l = list; l != NULL; l = l->next) {
@@ -600,7 +599,7 @@ gs_plugin_packagekit_get_source_list (GsPlugin *plugin,
 {
        PkRepoDetail *rd;
        guint i;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) array = NULL;
 
        /* ask PK for the repo details */
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 0839028..cd558b7 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -25,7 +25,6 @@
 #include <packagekit-glib2/packagekit.h>
 #include <glib/gi18n.h>
 
-#include "gs-cleanup.h"
 #include <gs-plugin.h>
 
 #include "packagekit-common.h"
@@ -110,9 +109,9 @@ gs_plugin_refresh (GsPlugin *plugin,
        PkBitfield filter;
        PkBitfield transaction_flags;
        g_auto(GStrv) package_ids = NULL;
-       _cleanup_object_unref_ PkPackageSack *sack = NULL;
-       _cleanup_object_unref_ PkResults *results2 = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkPackageSack) sack = NULL;
+       g_autoptr(PkResults) results2 = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        /* not us */
        if ((flags & GS_PLUGIN_REFRESH_FLAGS_UPDATES) == 0)
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index b0539fb..337e78d 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -25,7 +25,6 @@
 #include <packagekit-glib2/packagekit.h>
 #include <glib/gi18n.h>
 
-#include "gs-cleanup.h"
 #include <gs-plugin.h>
 
 #include "packagekit-common.h"
@@ -123,7 +122,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
 {
        PkBitfield filter;
        ProgressData data;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
@@ -167,7 +166,7 @@ gs_plugin_add_sources_related (GsPlugin *plugin,
        ProgressData data;
        const gchar *id;
        gboolean ret = TRUE;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
@@ -228,7 +227,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
        const gchar *id;
        guint i;
        g_autoptr(GHashTable) hash = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) array = NULL;
 
        data.app = NULL;
@@ -283,7 +282,7 @@ gs_plugin_app_source_enable (GsPlugin *plugin,
                             GError **error)
 {
        ProgressData data;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
@@ -313,8 +312,8 @@ gs_plugin_app_install (GsPlugin *plugin,
        ProgressData data;
        const gchar *package_id;
        guint i, j;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) array_package_ids = NULL;
        g_auto(GStrv) package_ids = NULL;
 
@@ -475,7 +474,7 @@ gs_plugin_app_source_disable (GsPlugin *plugin,
                              GError **error)
 {
        ProgressData data;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
@@ -502,7 +501,7 @@ gs_plugin_app_source_remove (GsPlugin *plugin,
 {
        ProgressData data;
        g_autoptr(GError) error_local = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
@@ -540,8 +539,8 @@ gs_plugin_app_remove (GsPlugin *plugin,
        ProgressData data;
        guint i;
        guint cnt = 0;
-       _cleanup_object_unref_ PkError *error_code = NULL;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkError) error_code = NULL;
+       g_autoptr(PkResults) results = NULL;
        g_auto(GStrv) package_ids = NULL;
 
        data.app = NULL;
@@ -621,7 +620,7 @@ gs_plugin_add_search_files (GsPlugin *plugin,
 {
        PkBitfield filter;
        ProgressData data;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
@@ -656,7 +655,7 @@ gs_plugin_add_search_what_provides (GsPlugin *plugin,
 {
        PkBitfield filter;
        ProgressData data;
-       _cleanup_object_unref_ PkResults *results = NULL;
+       g_autoptr(PkResults) results = NULL;
 
        data.app = NULL;
        data.plugin = plugin;
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index 6f0b6a0..8d497fd 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -24,7 +24,6 @@
 #define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
 #include <packagekit-glib2/packagekit.h>
 
-#include "gs-cleanup.h"
 #include <gs-plugin.h>
 
 #include "packagekit-common.h"
@@ -97,7 +96,7 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
        guint i;
        PkPackage *package;
        g_autoptr(GHashTable) installed = NULL;
-       _cleanup_object_unref_ PkError *error_code = NULL;
+       g_autoptr(PkError) error_code = NULL;
        g_autoptr(GPtrArray) array_filtered = NULL;
        g_autoptr(GPtrArray) array = NULL;
 


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