[gnome-software/wip/rancell/ubuntu-3-20-4: 15/28] De-dup based on source
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/ubuntu-3-20-4: 15/28] De-dup based on source
- Date: Fri, 23 Jun 2017 00:56:51 +0000 (UTC)
commit 677c1ce643de227f2e63cc3f11892ad33bfa6b8b
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Feb 17 11:31:07 2016 -0800
De-dup based on source
src/gs-plugin.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 92e82b6..a4ef3da 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -206,26 +206,33 @@ gs_plugin_list_filter_duplicates (GList **list)
GList *l;
GList *new = NULL;
GsApp *app;
- GsApp *found;
- const gchar *id;
+ GsApp *found, *found_source;
+ const gchar *id, *source;
g_autoptr(GHashTable) hash = NULL;
+ g_autoptr(GHashTable) source_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);
+ source_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);
+ source = gs_app_get_source_default (app);
if (id == NULL) {
gs_plugin_add_app (&new, app);
continue;
}
found = g_hash_table_lookup (hash, id);
- if (found == NULL) {
+ found_source = source != NULL ? g_hash_table_lookup (source_hash, source) : NULL;
+ if (found == NULL && found_source == NULL) {
gs_plugin_add_app (&new, app);
g_hash_table_insert (hash, (gpointer) id,
GUINT_TO_POINTER (1));
+ if (source != NULL)
+ g_hash_table_insert (source_hash, (gpointer) source,
+ GUINT_TO_POINTER (1));
continue;
}
g_debug ("ignoring duplicate %s", id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]