[gnome-software] Typedef GsAppList and define a cleanup function for it



commit 80611f4911fb37332e27334b25fb4f95d8ac6b86
Author: Kalev Lember <klember redhat com>
Date:   Thu Sep 10 22:56:40 2015 +0200

    Typedef GsAppList and define a cleanup function for it
    
    This lets us port '_cleanup_plugin_list_free_ GList *' to
    g_autoptr(GsAppList). As it was the last user of the old cleanup macros,
    this commit also drops gs-cleanup.h.

 src/Makefile.am        |    2 --
 src/gs-cleanup.h       |   42 ------------------------------------------
 src/gs-plugin.h        |    4 ++++
 src/gs-shell-extras.c  |    5 ++---
 src/gs-update-dialog.c |    3 +--
 5 files changed, 7 insertions(+), 49 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 98bdb3d..903caf7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,7 +75,6 @@ noinst_PROGRAMS =                                     \
        gnome-software-cmd
 
 gnome_software_cmd_SOURCES =                           \
-       gs-cleanup.h                                    \
        gs-app.c                                        \
        gs-cmd.c                                        \
        gs-utils.c                                      \
@@ -99,7 +98,6 @@ bin_PROGRAMS =                                                \
 gnome_software_SOURCES =                               \
        $(packagekit_built_sources)                     \
        $(packagekit_modify2_built_sources)             \
-       gs-cleanup.h                                    \
        gs-resources.c                                  \
        gs-resources.h                                  \
        gs-dbus-helper.c                                \
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 857c637..78971b4 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -48,6 +48,8 @@ typedef enum {
        GS_PLUGIN_STATUS_LAST
 } GsPluginStatus;
 
+typedef GList GsAppList;
+
 typedef void (*GsPluginStatusUpdate)   (GsPlugin       *plugin,
                                         GsApp          *app,
                                         GsPluginStatus  status,
@@ -259,6 +261,8 @@ gboolean     gs_plugin_offline_update               (GsPlugin       *plugin,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GsAppList, gs_plugin_list_free)
+
 G_END_DECLS
 
 #endif /* __GS_PLUGIN_H */
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index 29dc71c..70dc6fd 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -25,7 +25,6 @@
 
 #include "gs-app.h"
 #include "gs-app-row.h"
-#include "gs-cleanup.h"
 #include "gs-language.h"
 #include "gs-markdown.h"
 #include "gs-shell.h"
@@ -519,7 +518,7 @@ search_files_cb (GObject *source_object,
 {
        SearchData *search_data = (SearchData *) user_data;
        GsShellExtras *self = search_data->self;
-       _cleanup_plugin_list_free_ GList *list = NULL;
+       g_autoptr(GsAppList) list = NULL;
        GList *l;
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
        g_autoptr(GError) error = NULL;
@@ -617,7 +616,7 @@ get_search_what_provides_cb (GObject *source_object,
 {
        SearchData *search_data = (SearchData *) user_data;
        GsShellExtras *self = search_data->self;
-       _cleanup_plugin_list_free_ GList *list = NULL;
+       g_autoptr(GsAppList) list = NULL;
        GList *l;
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
        g_autoptr(GError) error = NULL;
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 9230f82..4b04643 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -25,7 +25,6 @@
 #include <gtk/gtk.h>
 #include <packagekit-glib2/packagekit.h>
 
-#include "gs-cleanup.h"
 #include "gs-update-dialog.h"
 #include "gs-app-row.h"
 #include "gs-markdown.h"
@@ -178,7 +177,7 @@ get_installed_updates_cb (GsPluginLoader *plugin_loader,
                           GsUpdateDialog *dialog)
 {
        GList *l;
-       _cleanup_plugin_list_free_ GList *list = NULL;
+       g_autoptr(GsAppList) list = NULL;
        g_autoptr(GError) error = NULL;
 
        gs_stop_spinner (GTK_SPINNER (dialog->spinner));


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