[gnome-software/wip/ubuntu-3-20: 54/57] Don't generate popular apps from Ubuntu reviews



commit 64af660e808edf46c651adb0aae3b3742a2538ef
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon Jul 24 16:41:12 2017 +1200

    Don't generate popular apps from Ubuntu reviews

 src/plugins/gs-plugin-ubuntu-reviews.c |   87 --------------------------------
 1 files changed, 0 insertions(+), 87 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index a2ddcfb..c3aee59 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -1049,90 +1049,3 @@ gs_plugin_review_remove (GsPlugin *plugin,
 
        return remove_review (plugin, review_id, error);
 }
-
-typedef struct {
-       gchar           *package_name;
-       gint             rating;
-} PopularEntry;
-
-static gint
-popular_sqlite_cb (void *data,
-                  gint argc,
-                  gchar **argv,
-                  gchar **col_name)
-{
-       GList **list = data;
-       PopularEntry *entry;
-
-       entry = g_slice_new (PopularEntry);
-       entry->package_name = g_strdup (argv[0]);
-       entry->rating = get_rating (g_ascii_strtoll (argv[1], NULL, 10), g_ascii_strtoll (argv[2], NULL, 10), 
g_ascii_strtoll (argv[3], NULL, 10), g_ascii_strtoll (argv[4], NULL, 10), g_ascii_strtoll (argv[5], NULL, 
10));
-       *list = g_list_prepend (*list, entry);
-
-       return 0;
-}
-
-static gint
-compare_popular_entry (gconstpointer a, gconstpointer b)
-{
-       PopularEntry *ea = a, *eb = b;
-       return eb->rating - ea->rating;
-}
-
-static void
-free_popular_entry (gpointer data)
-{
-       PopularEntry *entry = data;
-       g_free (entry->package_name);
-       g_slice_free (PopularEntry, entry);
-}
-
-gboolean
-gs_plugin_add_popular (GsPlugin *plugin,
-                      GList **list,
-                      GCancellable *cancellable,
-                      GError **error)
-{
-       gint result;
-       GList *entries = NULL, *link;
-       char *error_msg = NULL;
-
-       /* Load database once */
-       if (g_once_init_enter (&plugin->priv->db_loaded)) {
-               gboolean ret = load_database (plugin, error);
-               g_once_init_leave (&plugin->priv->db_loaded, TRUE);
-               if (!ret)
-                       return FALSE;
-       }
-
-       result = sqlite3_exec (plugin->priv->db,
-                              "SELECT package_name, one_star_count, two_star_count, three_star_count, 
four_star_count, five_star_count FROM review_stats",
-                              popular_sqlite_cb,
-                              &entries,
-                              &error_msg);
-       if (result != SQLITE_OK) {
-               g_set_error (error,
-                            GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_FAILED,
-                            "SQL error: %s", error_msg);
-               sqlite3_free (error_msg);
-               return FALSE;
-       }
-
-       entries = g_list_sort (entries, compare_popular_entry);
-       for (link = entries; link; link = link->next) {
-               PopularEntry *entry = link->data;
-               g_autoptr(GsApp) app = NULL;
-
-               /* Need four stars to show */
-               if (entry->rating < 80)
-                       break;
-
-               app = gs_app_new (NULL);
-               gs_app_add_source (app, entry->package_name);
-               gs_plugin_add_app (list, app);
-       }
-       g_list_free_full (entries, free_popular_entry);
-
-       return TRUE;
-}


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