[gnome-software] trivial: Split out the GsAppList as a new source file
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Split out the GsAppList as a new source file
- Date: Wed, 20 Apr 2016 13:02:49 +0000 (UTC)
commit e82b52346cfdd42f72781b0df1ee57c2662639a8
Author: Richard Hughes <richard hughsie com>
Date: Wed Apr 20 12:18:02 2016 +0100
trivial: Split out the GsAppList as a new source file
src/Makefile.am | 4 +
src/gs-app-list.c | 193 ++++++++++++++++++++++++
src/gs-app-list.h | 50 ++++++
src/gs-cmd.c | 26 ++--
src/gs-plugin-loader.c | 118 +++++++-------
src/gs-plugin.c | 147 ------------------
src/gs-plugin.h | 17 +--
src/gs-self-test.c | 26 ++--
src/gs-shell-overview.c | 10 +-
src/plugins/gs-plugin-appstream.c | 12 +-
src/plugins/gs-plugin-dpkg.c | 2 +-
src/plugins/gs-plugin-dummy.c | 18 +-
src/plugins/gs-plugin-fedora-distro-upgrades.c | 2 +-
src/plugins/gs-plugin-fwupd.c | 6 +-
src/plugins/gs-plugin-limba.c | 4 +-
src/plugins/gs-plugin-odrs.c | 2 +-
src/plugins/gs-plugin-packagekit-offline.c | 2 +-
src/plugins/gs-plugin-packagekit-refresh.c | 2 +-
src/plugins/gs-plugin-packagekit.c | 2 +-
src/plugins/gs-plugin-shell-extensions.c | 2 +-
src/plugins/gs-plugin-systemd-updates.c | 2 +-
src/plugins/gs-plugin-xdg-app.c | 10 +-
src/plugins/packagekit-common.c | 2 +-
23 files changed, 372 insertions(+), 287 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index f1e45be..c2deba3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,6 +87,7 @@ noinst_PROGRAMS = \
gnome_software_cmd_SOURCES = \
gs-app.c \
+ gs-app-list.c \
gs-review.c \
gs-cmd.c \
gs-debug.c \
@@ -115,6 +116,8 @@ gnome_software_SOURCES = \
gs-utils.h \
gs-app.c \
gs-app.h \
+ gs-app-list.c \
+ gs-app-list.h \
gs-category.c \
gs-category.h \
gs-debug.c \
@@ -292,6 +295,7 @@ check_PROGRAMS = \
gs_self_test_SOURCES = \
gs-app.c \
+ gs-app-list.c \
gs-category.c \
gs-os-release.c \
gs-plugin-loader-sync.c \
diff --git a/src/gs-app-list.c b/src/gs-app-list.c
new file mode 100644
index 0000000..5003bf5
--- /dev/null
+++ b/src/gs-app-list.c
@@ -0,0 +1,193 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* Introduction:
+ *
+ * Plugins are modules that are loaded at runtime to provide information
+ * about requests and to service user actions like installing, removing
+ * and updating.
+ * This allows different distributions to pick and choose how the
+ * application installer gathers data.
+ *
+ * Plugins also have a priority system where the largest number gets
+ * run first. That means if one plugin requires some property or
+ * metadata set by another plugin then it **must** depend on the other
+ * plugin to be run in the correct order.
+ *
+ * As a general rule, try to make plugins as small and self-contained
+ * as possible and remember to cache as much data as possible for speed.
+ * Memory is cheap, time less so.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "gs-app-list.h"
+
+/**
+ * gs_app_list_add:
+ **/
+void
+gs_app_list_add (GsAppList **list, GsApp *app)
+{
+ g_return_if_fail (list != NULL);
+ g_return_if_fail (GS_IS_APP (app));
+ *list = g_list_prepend (*list, g_object_ref (app));
+}
+
+/**
+ * gs_app_list_free:
+ **/
+void
+gs_app_list_free (GsAppList *list)
+{
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
+}
+
+/**
+ * gs_app_list_filter:
+ *
+ * If func() returns TRUE for the GsApp, then the app is kept.
+ **/
+void
+gs_app_list_filter (GsAppList **list, GsAppListFilterFunc func, gpointer user_data)
+{
+ GsAppList *l;
+ GsAppList *new = NULL;
+ GsApp *app;
+
+ g_return_if_fail (list != NULL);
+ g_return_if_fail (func != NULL);
+
+ /* see if any of the apps need filtering */
+ for (l = *list; l != NULL; l = l->next) {
+ app = GS_APP (l->data);
+ if (func (app, user_data))
+ gs_app_list_add (&new, app);
+ }
+
+ /* replace the list */
+ gs_app_list_free (*list);
+ *list = new;
+}
+
+/**
+ * gs_app_list_randomize_cb:
+ */
+static gint
+gs_app_list_randomize_cb (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ const gchar *k1;
+ const gchar *k2;
+ g_autofree gchar *key = NULL;
+
+ key = g_strdup_printf ("Plugin::sort-key[%p]", user_data);
+ k1 = gs_app_get_metadata_item (GS_APP (a), key);
+ k2 = gs_app_get_metadata_item (GS_APP (b), key);
+ return g_strcmp0 (k1, k2);
+}
+
+/**
+ * gs_app_list_randomize:
+ *
+ * Randomize the order of the list, but don't change the order until the next day
+ **/
+void
+gs_app_list_randomize (GsAppList **list)
+{
+ GsAppList *l;
+ GRand *rand;
+ GsApp *app;
+ gchar sort_key[] = { '\0', '\0', '\0', '\0' };
+ g_autoptr(GDateTime) date = NULL;
+ g_autofree gchar *key = NULL;
+
+ g_return_if_fail (list != NULL);
+
+ key = g_strdup_printf ("Plugin::sort-key[%p]", list);
+ rand = g_rand_new ();
+ date = g_date_time_new_now_utc ();
+ g_rand_set_seed (rand, g_date_time_get_day_of_year (date));
+ for (l = *list; l != NULL; l = l->next) {
+ app = GS_APP (l->data);
+ sort_key[0] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
+ sort_key[1] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
+ sort_key[2] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
+ gs_app_set_metadata (app, key, sort_key);
+ }
+ *list = g_list_sort_with_data (*list, gs_app_list_randomize_cb, list);
+ for (l = *list; l != NULL; l = l->next) {
+ app = GS_APP (l->data);
+ gs_app_set_metadata (app, key, NULL);
+ }
+ g_rand_free (rand);
+}
+
+/**
+ * gs_app_list_filter_duplicates:
+ **/
+void
+gs_app_list_filter_duplicates (GsAppList **list)
+{
+ GsAppList *l;
+ GsAppList *new = NULL;
+ GsApp *app;
+ GsApp *found;
+ const gchar *id;
+ g_autoptr(GHashTable) hash = NULL;
+
+ g_return_if_fail (list != NULL);
+
+ /* create a new list with just the unique items */
+ hash = g_hash_table_new (g_str_hash, g_str_equal);
+ for (l = *list; l != NULL; l = l->next) {
+ app = GS_APP (l->data);
+ id = gs_app_get_id (app);
+ if (id == NULL) {
+ gs_app_list_add (&new, app);
+ continue;
+ }
+ found = g_hash_table_lookup (hash, id);
+ if (found == NULL) {
+ gs_app_list_add (&new, app);
+ g_hash_table_insert (hash, (gpointer) id,
+ GUINT_TO_POINTER (1));
+ continue;
+ }
+ g_debug ("ignoring duplicate %s", id);
+ }
+
+ /* replace the list */
+ gs_app_list_free (*list);
+ *list = new;
+}
+
+/**
+ * gs_app_list_copy:
+ **/
+GsAppList *
+gs_app_list_copy (GsAppList *list)
+{
+ return g_list_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
+}
+
+/* vim: set noexpandtab: */
diff --git a/src/gs-app-list.h b/src/gs-app-list.h
new file mode 100644
index 0000000..ae4afca
--- /dev/null
+++ b/src/gs-app-list.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2012-2016 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __GS_APP_LIST_H
+#define __GS_APP_LIST_H
+
+#include "gs-app.h"
+
+G_BEGIN_DECLS
+
+typedef GList GsAppList;
+
+typedef gboolean (*GsAppListFilterFunc) (GsApp *app,
+ gpointer user_data);
+
+void gs_app_list_add (GsAppList **list,
+ GsApp *app);
+void gs_app_list_free (GsAppList *list);
+GList *gs_app_list_copy (GsAppList *list);
+void gs_app_list_filter (GsAppList **list,
+ GsAppListFilterFunc func,
+ gpointer user_data);
+void gs_app_list_filter_duplicates (GsAppList **list);
+void gs_app_list_randomize (GsAppList **list);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GsAppList, gs_app_list_free)
+
+G_END_DECLS
+
+#endif /* __GS_APP_LIST_H */
+
+/* vim: set noexpandtab: */
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index cb60dcb..c52f428 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -284,7 +284,7 @@ main (int argc, char **argv)
if (argc == 2 && g_strcmp0 (argv[1], "installed") == 0) {
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_get_installed (plugin_loader,
refine_flags,
NULL,
@@ -297,7 +297,7 @@ main (int argc, char **argv)
} else if (argc == 3 && g_strcmp0 (argv[1], "search") == 0) {
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_search (plugin_loader,
argv[2],
refine_flags,
@@ -317,7 +317,7 @@ main (int argc, char **argv)
NULL,
&error);
if (ret)
- gs_plugin_add_app (&list, app);
+ gs_app_list_add (&list, app);
} else if (argc == 3 && g_strcmp0 (argv[1], "refine") == 0) {
app = gs_app_new (argv[2]);
for (i = 0; i < repeat; i++) {
@@ -329,7 +329,7 @@ main (int argc, char **argv)
if (!ret)
break;
}
- gs_plugin_add_app (&list, app);
+ gs_app_list_add (&list, app);
} else if (argc == 3 && g_strcmp0 (argv[1], "launch") == 0) {
app = gs_app_new (argv[2]);
for (i = 0; i < repeat; i++) {
@@ -350,12 +350,12 @@ main (int argc, char **argv)
if (app == NULL) {
ret = FALSE;
} else {
- gs_plugin_add_app (&list, app);
+ gs_app_list_add (&list, app);
}
} else if (argc == 2 && g_strcmp0 (argv[1], "updates") == 0) {
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_get_updates (plugin_loader,
refine_flags,
NULL,
@@ -368,7 +368,7 @@ main (int argc, char **argv)
} else if (argc == 2 && g_strcmp0 (argv[1], "upgrades") == 0) {
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_get_distro_upgrades (plugin_loader,
refine_flags,
NULL,
@@ -388,7 +388,7 @@ main (int argc, char **argv)
} else if (argc == 2 && g_strcmp0 (argv[1], "popular") == 0) {
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_get_popular (plugin_loader,
refine_flags,
NULL,
@@ -401,7 +401,7 @@ main (int argc, char **argv)
} else if (argc == 2 && g_strcmp0 (argv[1], "featured") == 0) {
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_get_featured (plugin_loader,
refine_flags,
NULL,
@@ -414,7 +414,7 @@ main (int argc, char **argv)
} else if (argc == 2 && g_strcmp0 (argv[1], "get-categories") == 0) {
for (i = 0; i < repeat; i++) {
if (categories != NULL)
- gs_plugin_list_free (categories);
+ gs_app_list_free (categories);
categories = gs_plugin_loader_get_categories (plugin_loader,
refine_flags,
NULL,
@@ -437,7 +437,7 @@ main (int argc, char **argv)
}
for (i = 0; i < repeat; i++) {
if (list != NULL)
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = gs_plugin_loader_get_category_apps (plugin_loader,
category,
refine_flags,
@@ -476,8 +476,8 @@ out:
if (profile != NULL)
as_profile_dump (profile);
g_option_context_free (context);
- gs_plugin_list_free (list);
- gs_plugin_list_free (categories);
+ gs_app_list_free (list);
+ gs_app_list_free (categories);
return status;
}
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 2bdb782..fe9fc70 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -88,7 +88,7 @@ gs_plugin_loader_free_async_state (GsPluginLoaderAsyncState *state)
g_free (state->filename);
g_free (state->value);
- gs_plugin_list_free (state->list);
+ gs_app_list_free (state->list);
g_slice_free (GsPluginLoaderAsyncState, state);
}
@@ -248,7 +248,7 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
g_autoptr(GsAppList) related_list = NULL;
/* freeze all apps */
- freeze_list = gs_plugin_list_copy (*list);
+ freeze_list = gs_app_list_copy (*list);
for (l = freeze_list; l != NULL; l = l->next)
g_object_freeze_notify (G_OBJECT (l->data));
@@ -333,7 +333,7 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
g_debug ("refining app %s addon %s",
gs_app_get_id (app),
gs_app_get_id (addon));
- gs_plugin_add_app (&addons_list, addon);
+ gs_app_list_add (&addons_list, addon);
}
}
if (addons_list != NULL) {
@@ -359,7 +359,7 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
g_debug ("refining related: %s[%s]",
gs_app_get_id (app),
gs_app_get_source_default (app));
- gs_plugin_add_app (&related_list, app);
+ gs_app_list_add (&related_list, app);
}
}
if (related_list != NULL) {
@@ -465,7 +465,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
goto out;
/* filter package list */
- gs_plugin_list_filter_duplicates (&list);
+ gs_app_list_filter_duplicates (&list);
/* no results */
if (list == NULL) {
@@ -477,7 +477,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
}
out:
if (!ret) {
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
list = NULL;
}
return list;
@@ -874,14 +874,14 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
+ gs_app_list_filter_duplicates (&state->list);
/* coalesce all packages down into one os-update */
state->list = gs_plugin_loader_add_os_update_item (state->list);
/* remove any packages that are not proper applications or
* OS updates */
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -891,7 +891,7 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -984,10 +984,10 @@ gs_plugin_loader_get_distro_upgrades_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
+ gs_app_list_filter_duplicates (&state->list);
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1064,10 +1064,10 @@ gs_plugin_loader_get_unvoted_reviews_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
+ gs_app_list_filter_duplicates (&state->list);
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1144,7 +1144,7 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
+ gs_app_list_filter_duplicates (&state->list);
/* none left? */
if (state->list == NULL) {
@@ -1156,7 +1156,7 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1237,8 +1237,8 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid_installed, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid_installed, state);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -1248,7 +1248,7 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1342,7 +1342,7 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
for (i = 0; apps[i] != NULL; i++) {
g_autoptr(GsApp) app = gs_app_new (apps[i]);
gs_app_add_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX);
- gs_plugin_add_app (&state->list, app);
+ gs_app_list_add (&state->list, app);
}
} else {
/* do things that would block */
@@ -1358,9 +1358,9 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -1370,7 +1370,7 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1458,10 +1458,10 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
/* filter package list */
if (g_getenv ("GNOME_SOFTWARE_FEATURED") != NULL) {
- gs_plugin_list_filter (&state->list, gs_plugin_loader_featured_debug, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_featured_debug, NULL);
} else {
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
}
if (state->list == NULL) {
g_task_return_new_error (task,
@@ -1472,7 +1472,7 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1679,10 +1679,10 @@ gs_plugin_loader_search_thread_cb (GTask *task,
gs_plugin_loader_convert_unavailable (state->list, state->value);
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
+ gs_app_list_filter_duplicates (&state->list);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -1699,7 +1699,7 @@ gs_plugin_loader_search_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -1840,11 +1840,11 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
gs_plugin_loader_convert_unavailable (state->list, state->value);
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
+ gs_app_list_filter_duplicates (&state->list);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -1861,7 +1861,7 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -2002,11 +2002,11 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
gs_plugin_loader_convert_unavailable (state->list, state->value);
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
+ gs_app_list_filter_duplicates (&state->list);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -2023,7 +2023,7 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -2190,7 +2190,7 @@ gs_plugin_loader_get_categories_thread_cb (GTask *task,
}
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -2307,11 +2307,11 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_compulsory, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
+ gs_app_list_filter_duplicates (&state->list);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_non_compulsory, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
+ gs_app_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
+ gs_app_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
@@ -2324,7 +2324,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
state->list = g_list_sort (state->list, gs_plugin_loader_app_sort_cb);
/* success */
- g_task_return_pointer (task, gs_plugin_list_copy (state->list), (GDestroyNotify) gs_plugin_list_free);
+ g_task_return_pointer (task, gs_app_list_copy (state->list), (GDestroyNotify) gs_app_list_free);
}
/**
@@ -2409,7 +2409,7 @@ gs_plugin_loader_app_refine_thread_cb (GTask *task,
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
gboolean ret;
- gs_plugin_add_app (&list, state->app);
+ gs_app_list_add (&list, state->app);
ret = gs_plugin_loader_run_refine (plugin_loader,
NULL,
&list,
@@ -2424,7 +2424,7 @@ gs_plugin_loader_app_refine_thread_cb (GTask *task,
/* success */
g_task_return_boolean (task, TRUE);
out:
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
}
/**
@@ -2529,7 +2529,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
}
/* refine again to make sure we pick up new source id */
- gs_plugin_add_app (&list, state->app);
+ gs_app_list_add (&list, state->app);
ret = gs_plugin_loader_run_refine (plugin_loader,
state->function_name,
&list,
@@ -2678,7 +2678,7 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
g_mutex_unlock (&priv->pending_apps_mutex);
g_debug ("adding pending app %s", gs_app_get_id (app));
- gs_plugin_add_app (&list, app);
+ gs_app_list_add (&list, app);
}
/* refine */
@@ -2693,7 +2693,7 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
goto out;
}
out:
- gs_plugin_list_free (list);
+ gs_app_list_free (list);
return ret;
}
@@ -2814,7 +2814,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
/* handle with a fake list */
if (action == GS_PLUGIN_LOADER_ACTION_UPDATE) {
g_autoptr(GsAppList) list = NULL;
- gs_plugin_add_app (&list, app);
+ gs_app_list_add (&list, app);
gs_plugin_loader_update_async (plugin_loader, list,
cancellable, callback,
user_data);
@@ -3650,7 +3650,7 @@ gs_plugin_loader_set_network_status (GsPluginLoader *plugin_loader,
for (i = 0; i < priv->pending_apps->len; i++) {
app = g_ptr_array_index (priv->pending_apps, i);
if (gs_app_get_state (app) == AS_APP_STATE_QUEUED_FOR_INSTALL)
- gs_plugin_add_app (&queue, app);
+ gs_app_list_add (&queue, app);
}
g_mutex_unlock (&priv->pending_apps_mutex);
for (l = queue; l; l = l->next) {
@@ -3873,7 +3873,7 @@ gs_plugin_loader_filename_to_app_thread_cb (GTask *task,
}
/* filter package list */
- gs_plugin_list_filter_duplicates (&state->list);
+ gs_app_list_filter_duplicates (&state->list);
if (state->list == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index a3c8765..208f7a3 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -97,153 +97,6 @@ gs_plugin_check_distro_id (GsPlugin *plugin, const gchar *distro_id)
return TRUE;
}
-/**
- * gs_plugin_add_app:
- **/
-void
-gs_plugin_add_app (GList **list, GsApp *app)
-{
- g_return_if_fail (list != NULL);
- g_return_if_fail (GS_IS_APP (app));
- *list = g_list_prepend (*list, g_object_ref (app));
-}
-
-/**
- * gs_plugin_list_free:
- **/
-void
-gs_plugin_list_free (GList *list)
-{
- g_list_free_full (list, (GDestroyNotify) g_object_unref);
-}
-
-/**
- * gs_plugin_list_filter:
- *
- * If func() returns TRUE for the GsApp, then the app is kept.
- **/
-void
-gs_plugin_list_filter (GList **list, GsPluginListFilter func, gpointer user_data)
-{
- GList *l;
- GList *new = NULL;
- GsApp *app;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (func != NULL);
-
- /* see if any of the apps need filtering */
- for (l = *list; l != NULL; l = l->next) {
- app = GS_APP (l->data);
- if (func (app, user_data))
- gs_plugin_add_app (&new, app);
- }
-
- /* replace the list */
- gs_plugin_list_free (*list);
- *list = new;
-}
-
-/**
- * gs_plugin_list_randomize_cb:
- */
-static gint
-gs_plugin_list_randomize_cb (gconstpointer a, gconstpointer b, gpointer user_data)
-{
- const gchar *k1;
- const gchar *k2;
- g_autofree gchar *key = NULL;
-
- key = g_strdup_printf ("Plugin::sort-key[%p]", user_data);
- k1 = gs_app_get_metadata_item (GS_APP (a), key);
- k2 = gs_app_get_metadata_item (GS_APP (b), key);
- return g_strcmp0 (k1, k2);
-}
-
-/**
- * gs_plugin_list_randomize:
- *
- * Randomize the order of the list, but don't change the order until the next day
- **/
-void
-gs_plugin_list_randomize (GList **list)
-{
- GList *l;
- GRand *rand;
- GsApp *app;
- gchar sort_key[] = { '\0', '\0', '\0', '\0' };
- g_autoptr(GDateTime) date = NULL;
- g_autofree gchar *key = NULL;
-
- g_return_if_fail (list != NULL);
-
- key = g_strdup_printf ("Plugin::sort-key[%p]", list);
- rand = g_rand_new ();
- date = g_date_time_new_now_utc ();
- g_rand_set_seed (rand, g_date_time_get_day_of_year (date));
- for (l = *list; l != NULL; l = l->next) {
- app = GS_APP (l->data);
- sort_key[0] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
- sort_key[1] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
- sort_key[2] = g_rand_int_range (rand, (gint32) 'A', (gint32) 'Z');
- gs_app_set_metadata (app, key, sort_key);
- }
- *list = g_list_sort_with_data (*list, gs_plugin_list_randomize_cb, list);
- for (l = *list; l != NULL; l = l->next) {
- app = GS_APP (l->data);
- gs_app_set_metadata (app, key, NULL);
- }
- g_rand_free (rand);
-}
-
-/**
- * gs_plugin_list_filter_duplicates:
- **/
-void
-gs_plugin_list_filter_duplicates (GList **list)
-{
- GList *l;
- GList *new = NULL;
- GsApp *app;
- GsApp *found;
- const gchar *id;
- g_autoptr(GHashTable) hash = NULL;
-
- g_return_if_fail (list != NULL);
-
- /* create a new list with just the unique items */
- hash = g_hash_table_new (g_str_hash, g_str_equal);
- for (l = *list; l != NULL; l = l->next) {
- app = GS_APP (l->data);
- id = gs_app_get_id (app);
- if (id == NULL) {
- gs_plugin_add_app (&new, app);
- continue;
- }
- found = g_hash_table_lookup (hash, id);
- if (found == NULL) {
- gs_plugin_add_app (&new, app);
- g_hash_table_insert (hash, (gpointer) id,
- GUINT_TO_POINTER (1));
- continue;
- }
- g_debug ("ignoring duplicate %s", id);
- }
-
- /* replace the list */
- gs_plugin_list_free (*list);
- *list = new;
-}
-
-/**
- * gs_plugin_list_copy:
- **/
-GList *
-gs_plugin_list_copy (GList *list)
-{
- return g_list_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
-}
-
typedef struct {
GsPlugin *plugin;
GsApp *app;
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 7304439..0dc9b42 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -30,6 +30,7 @@
#include <libsoup/soup.h>
#include "gs-app.h"
+#include "gs-app-list.h"
#include "gs-category.h"
G_BEGIN_DECLS
@@ -49,8 +50,6 @@ typedef enum {
GS_PLUGIN_STATUS_LAST
} GsPluginStatus;
-typedef GList GsAppList;
-
typedef void (*GsPluginStatusUpdate) (GsPlugin *plugin,
GsApp *app,
GsPluginStatus status,
@@ -58,9 +57,6 @@ typedef void (*GsPluginStatusUpdate) (GsPlugin *plugin,
typedef void (*GsPluginUpdatesChanged) (GsPlugin *plugin,
gpointer user_data);
-typedef gboolean (*GsPluginListFilter) (GsApp *app,
- gpointer user_data);
-
typedef enum {
GS_PLUGIN_FLAGS_NONE = 0,
GS_PLUGIN_FLAGS_RUNNING_SELF = 1 << 0,
@@ -234,15 +230,6 @@ gboolean gs_plugin_download_file (GsPlugin *plugin,
GError **error);
gboolean gs_plugin_check_distro_id (GsPlugin *plugin,
const gchar *distro_id);
-void gs_plugin_add_app (GList **list,
- GsApp *app);
-void gs_plugin_list_free (GList *list);
-GList *gs_plugin_list_copy (GList *list);
-void gs_plugin_list_filter (GList **list,
- GsPluginListFilter func,
- gpointer user_data);
-void gs_plugin_list_filter_duplicates (GList **list);
-void gs_plugin_list_randomize (GList **list);
GsApp *gs_plugin_cache_lookup (GsPlugin *plugin,
const gchar *key);
@@ -410,8 +397,6 @@ gboolean gs_plugin_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-self-test.c b/src/gs-self-test.c
index d69ec49..988b111 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -47,7 +47,7 @@ gs_test_get_filename (const gchar *filename)
}
static gboolean
-gs_plugin_list_filter_cb (GsApp *app, gpointer user_data)
+gs_app_list_filter_cb (GsApp *app, gpointer user_data)
{
if (g_strcmp0 (gs_app_get_id (app), "a") == 0)
return FALSE;
@@ -66,43 +66,43 @@ gs_plugin_func (void)
/* add a couple of duplicate IDs */
app = gs_app_new ("a");
- gs_plugin_add_app (&list, app);
+ gs_app_list_add (&list, app);
g_object_unref (app);
/* test refcounting */
g_assert_cmpstr (gs_app_get_id (GS_APP (list->data)), ==, "a");
- list_dup = gs_plugin_list_copy (list);
- gs_plugin_list_free (list);
+ list_dup = gs_app_list_copy (list);
+ gs_app_list_free (list);
g_assert_cmpint (g_list_length (list_dup), ==, 1);
g_assert_cmpstr (gs_app_get_id (GS_APP (list_dup->data)), ==, "a");
- gs_plugin_list_free (list_dup);
+ gs_app_list_free (list_dup);
/* test removing obects */
app = gs_app_new ("a");
- gs_plugin_add_app (&list_remove, app);
+ gs_app_list_add (&list_remove, app);
g_object_unref (app);
app = gs_app_new ("b");
- gs_plugin_add_app (&list_remove, app);
+ gs_app_list_add (&list_remove, app);
g_object_unref (app);
app = gs_app_new ("c");
- gs_plugin_add_app (&list_remove, app);
+ gs_app_list_add (&list_remove, app);
g_object_unref (app);
g_assert_cmpint (g_list_length (list_remove), ==, 3);
- gs_plugin_list_filter (&list_remove, gs_plugin_list_filter_cb, NULL);
+ gs_app_list_filter (&list_remove, gs_app_list_filter_cb, NULL);
g_assert_cmpint (g_list_length (list_remove), ==, 1);
g_assert_cmpstr (gs_app_get_id (GS_APP (list_remove->data)), ==, "b");
/* test removing duplicates */
app = gs_app_new ("b");
- gs_plugin_add_app (&list_remove, app);
+ gs_app_list_add (&list_remove, app);
g_object_unref (app);
app = gs_app_new ("b");
- gs_plugin_add_app (&list_remove, app);
+ gs_app_list_add (&list_remove, app);
g_object_unref (app);
- gs_plugin_list_filter_duplicates (&list_remove);
+ gs_app_list_filter_duplicates (&list_remove);
g_assert_cmpint (g_list_length (list_remove), ==, 1);
g_assert_cmpstr (gs_app_get_id (GS_APP (list_remove->data)), ==, "b");
- gs_plugin_list_free (list_remove);
+ gs_app_list_free (list_remove);
}
static void
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index ec35c82..bd35014 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -144,8 +144,8 @@ gs_shell_overview_get_popular_cb (GObject *source_object,
goto out;
}
/* Don't show apps from the category that's currently featured as the category of the day */
- gs_plugin_list_filter (&list, filter_category, priv->category_of_day);
- gs_plugin_list_randomize (&list);
+ gs_app_list_filter (&list, filter_category, priv->category_of_day);
+ gs_app_list_randomize (&list);
gs_container_remove_all (GTK_CONTAINER (priv->box_popular));
@@ -198,7 +198,7 @@ gs_shell_overview_get_popular_rotating_cb (GObject *source_object,
gtk_widget_hide (priv->box_popular_rotating);
goto out;
}
- gs_plugin_list_randomize (&list);
+ gs_app_list_randomize (&list);
gtk_widget_show (priv->popular_rotating_heading);
gtk_widget_show (priv->box_popular_rotating);
@@ -255,8 +255,8 @@ gs_shell_overview_get_featured_cb (GObject *source_object,
if (g_getenv ("GNOME_SOFTWARE_FEATURED") == NULL) {
/* Don't show apps from the category that's currently featured as the category of the day */
- gs_plugin_list_filter (&list, filter_category, priv->category_of_day);
- gs_plugin_list_randomize (&list);
+ gs_app_list_filter (&list, filter_category, priv->category_of_day);
+ gs_app_list_randomize (&list);
}
gs_container_remove_all (GTK_CONTAINER (priv->bin_featured));
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 5bd2ec5..7939fe7 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -338,7 +338,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
if (!gs_appstream_refine_app (plugin, app, item, error))
return FALSE;
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
@@ -415,7 +415,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
app = gs_app_new (as_app_get_id (item));
if (!gs_appstream_refine_app (plugin, app, item, error))
return FALSE;
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
@@ -454,7 +454,7 @@ gs_plugin_add_search_item (GsPlugin *plugin,
if (!gs_appstream_refine_app (plugin, app, item, error))
return FALSE;
gs_app_set_match_value (app, match_value);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
@@ -513,7 +513,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
app = gs_app_new (as_app_get_id (item));
if (!gs_appstream_refine_app (plugin, app, item, error))
return FALSE;
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
}
return TRUE;
@@ -619,7 +619,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
continue;
app = gs_app_new (as_app_get_id_no_prefix (item));
gs_app_add_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
@@ -650,7 +650,7 @@ gs_plugin_add_featured (GsPlugin *plugin,
continue;
app = gs_app_new (as_app_get_id_no_prefix (item));
gs_app_add_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
diff --git a/src/plugins/gs-plugin-dpkg.c b/src/plugins/gs-plugin-dpkg.c
index 1b558fb..1708de9 100644
--- a/src/plugins/gs-plugin-dpkg.c
+++ b/src/plugins/gs-plugin-dpkg.c
@@ -118,6 +118,6 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
gs_app_set_description (app, GS_APP_QUALITY_LOWEST, description + 1);
/* success */
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 2672b4b..3353532 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -208,7 +208,7 @@ gs_plugin_add_search (GsPlugin *plugin,
app = gs_plugin_cache_lookup (plugin, "example:chiron");
if (app != NULL) {
g_debug ("using %s fom the cache", gs_app_get_id (app));
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
@@ -230,7 +230,7 @@ gs_plugin_add_search (GsPlugin *plugin,
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
/* add to cache so it can be found by the flashing callback */
gs_plugin_cache_add (plugin, "example:chiron", app);
@@ -272,7 +272,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
g_object_unref (app);
/* add a offline OS update */
@@ -286,7 +286,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
gs_app_add_source (app, "libvirt-glib-devel");
gs_app_add_source_id (app, "libvirt-glib-devel;0.0.1;noarch;fedora");
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
g_object_unref (app);
/* add a live OS update */
@@ -300,7 +300,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
gs_app_add_source (app, "chiron-libs");
gs_app_add_source_id (app, "chiron-libs;0.0.1;i386;updates-testing");
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
g_object_unref (app);
return TRUE;
@@ -327,7 +327,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_app_set_origin (app, "london-west");
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
/* add all app-ids */
@@ -336,7 +336,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
@@ -520,7 +520,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
gs_app_set_pixbuf (app, gdk_pixbuf_new_from_file
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL));
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_management_plugin (app, plugin->name);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
@@ -547,7 +547,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
gs_app_set_metadata (app, "GnomeSoftware::UpgradeBanner-css",
"background: url('" DATADIR "/gnome-software/upgrade-bg.png');"
"background-size: 100% 100%;");
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 15517fd..09ed353 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -357,7 +357,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
distro_info->version);
gs_app_set_metadata (app, "GnomeSoftware::UpgradeBanner-css", css);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index e326903..a4f97bf 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -372,7 +372,7 @@ gs_plugin_add_update_app (GsPlugin *plugin,
/* actually add the application */
gs_app_add_source_id (app, filename_cache);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
@@ -413,7 +413,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
/* parse */
app = gs_plugin_fwupd_new_app_from_results (res);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
@@ -757,6 +757,6 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
gs_app_set_version (app, gs_app_get_update_version (app));
gs_app_set_description (app, GS_APP_QUALITY_NORMAL,
gs_app_get_update_details (app));
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-limba.c b/src/plugins/gs-plugin-limba.c
index 2492127..f8d4f3d 100644
--- a/src/plugins/gs-plugin-limba.c
+++ b/src/plugins/gs-plugin-limba.c
@@ -386,7 +386,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
LiPkgInfo *pki = LI_PKG_INFO (g_ptr_array_index (swlist, i));
app = gs_plugin_app_from_pki (pki);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
@@ -427,7 +427,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
app = gs_plugin_app_from_pki (old_pki);
gs_app_set_update_version (app,
li_pkg_info_get_version (new_pki));
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index 28f3d22..058218f 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -997,7 +997,7 @@ gs_plugin_add_unvoted_reviews (GsPlugin *plugin,
app = g_hash_table_lookup (hash, app_id);
if (app == NULL) {
app = gs_plugin_create_app_dummy (app_id);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
g_hash_table_insert (hash, g_strdup (app_id), app);
}
gs_app_add_review (app, review);
diff --git a/src/plugins/gs-plugin-packagekit-offline.c b/src/plugins/gs-plugin-packagekit-offline.c
index dc46087..554920f 100644
--- a/src/plugins/gs-plugin-packagekit-offline.c
+++ b/src/plugins/gs-plugin-packagekit-offline.c
@@ -198,7 +198,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_app_set_install_date (app, mtime);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 083e2d1..e623a63 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -385,6 +385,6 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
error))
return FALSE;
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 89d4705..b1a7ad7 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -269,7 +269,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
gs_app_set_summary (app,
GS_APP_QUALITY_LOWEST,
pk_repo_detail_get_description (rd));
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
g_hash_table_insert (hash,
g_strdup (id),
(gpointer) app);
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index 8124d15..b849280 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -297,7 +297,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
return FALSE;
/* add to results */
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index b203ff5..566b079 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -135,7 +135,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
gs_app_set_update_version (app, split[PK_PACKAGE_ID_VERSION]);
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
diff --git a/src/plugins/gs-plugin-xdg-app.c b/src/plugins/gs-plugin-xdg-app.c
index bb9da8b..8dc0e59 100644
--- a/src/plugins/gs-plugin-xdg-app.c
+++ b/src/plugins/gs-plugin-xdg-app.c
@@ -171,7 +171,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
for (i = 0; apps[i] != NULL; i++) {
g_autoptr(GsApp) app = NULL;
app = gs_app_new (apps[i]);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
@@ -497,7 +497,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
continue;
}
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
@@ -542,7 +542,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
gs_app_set_url (app,
AS_URL_KIND_HOMEPAGE,
xdg_app_remote_get_url (xremote));
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
@@ -593,7 +593,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED)
gs_app_set_state (app, AS_APP_STATE_UNKNOWN);
gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
@@ -1506,6 +1506,6 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
gs_app_add_quirk (app, AS_APP_QUIRK_HAS_SOURCE);
g_debug ("created local app: %s", gs_app_to_string (app));
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
return TRUE;
}
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index f60b7db..c3bd09a 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -272,7 +272,7 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
pk_info_enum_to_string (pk_package_get_info (package)));
}
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
- gs_plugin_add_app (list, app);
+ gs_app_list_add (list, app);
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]