[gnome-software/wip/rancell/reviews-3-18] Don't need plugins to report review auth - the plugin does this directly



commit 3fb0c684497579f85dfe3c19a2c131230bfa4beb
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Jan 22 15:43:17 2016 +1300

    Don't need plugins to report review auth - the plugin does this directly

 src/gs-plugin-loader.c                 |   32 ++------------------------------
 src/gs-plugin-loader.h                 |    1 -
 src/gs-plugin.h                        |    2 --
 src/gs-shell-details.c                 |    4 ----
 src/plugins/gs-plugin-ubuntu-reviews.c |    6 ------
 5 files changed, 2 insertions(+), 43 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 66c1303..6902a69 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -51,7 +51,6 @@ typedef struct
        gboolean                 online; 
 
        gboolean                 supports_reviews;
-       gchar                   **review_auths;
 } GsPluginLoaderPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (GsPluginLoader, gs_plugin_loader, G_TYPE_OBJECT)
@@ -2806,8 +2805,7 @@ gs_plugin_loader_updates_changed_cb (GsPlugin *plugin, gpointer user_data)
  */
 static GsPlugin *
 gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
-                             const gchar *filename,
-                             GPtrArray *review_auths)
+                             const gchar *filename)
 {
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
        gboolean ret;
@@ -2815,8 +2813,6 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
        GsPluginGetNameFunc plugin_name = NULL;
        GsPluginGetDepsFunc plugin_deps = NULL;
        GsPluginGetSupportsReviewsFunc plugin_supports_reviews = NULL;
-       GsPluginGetReviewAuthFunc plugin_review_auth = NULL;
-       const gchar *review_auth;
        GsPlugin *plugin = NULL;
 
        module = g_module_open (filename, 0);
@@ -2848,14 +2844,6 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
        if (plugin_supports_reviews && plugin_supports_reviews (plugin))
                priv->supports_reviews = TRUE;
 
-       /* Check if this plugin requires any authorization for reviews */
-       (void) g_module_symbol (module,
-                               "gs_plugin_get_review_auth",
-                               (gpointer *) &plugin_review_auth);
-       review_auth = plugin_review_auth != NULL ? plugin_review_auth (plugin) : NULL;
-       if (review_auth)
-               g_ptr_array_add (review_auths, g_strdup (review_auth));
-
        /* print what we know */
        plugin = g_slice_new0 (GsPlugin);
        plugin->enabled = TRUE;
@@ -2978,7 +2966,6 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
        guint i;
        guint j;
        g_autoptr(GDir) dir = NULL;
-       GPtrArray *review_auths;
 
        g_return_val_if_fail (priv->location != NULL, FALSE);
 
@@ -2992,7 +2979,6 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
 
        /* try to open each plugin */
        g_debug ("searching for plugins in %s", priv->location);
-       review_auths = g_ptr_array_new ();
        do {
                g_autofree gchar *filename_plugin = NULL;
                filename_tmp = g_dir_read_name (dir);
@@ -3003,12 +2989,9 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
                filename_plugin = g_build_filename (priv->location,
                                                    filename_tmp,
                                                    NULL);
-               gs_plugin_loader_open_plugin (plugin_loader, filename_plugin, review_auths);
+               gs_plugin_loader_open_plugin (plugin_loader, filename_plugin);
        } while (TRUE);
 
-       g_ptr_array_add (review_auths, NULL);
-       priv->review_auths = (char **) g_ptr_array_free (review_auths, FALSE);
-
        /* order by deps */
        do {
                changes = FALSE;
@@ -3140,7 +3123,6 @@ gs_plugin_loader_finalize (GObject *object)
 
        g_strfreev (priv->compatible_projects);
        g_free (priv->location);
-       g_strfreev (priv->review_auths);
 
        g_mutex_clear (&priv->pending_apps_mutex);
        g_mutex_clear (&priv->app_cache_mutex);
@@ -3727,16 +3709,6 @@ gs_plugin_loader_get_supports_reviews (GsPluginLoader *plugin_loader)
        return priv->supports_reviews;
 }
 
-/**
- * gs_plugin_loader_get_review_auths:
- */
-gchar **
-gs_plugin_loader_get_review_auths (GsPluginLoader *plugin_loader)
-{
-       GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
-       return priv->review_auths;
-}
-
 /******************************************************************************/
 
 /* vim: set noexpandtab: */
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 6edc759..807ffcb 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -214,7 +214,6 @@ GsApp               *gs_plugin_loader_dedupe                (GsPluginLoader 
*plugin_loader,
 void            gs_plugin_loader_set_network_status    (GsPluginLoader *plugin_loader,
                                                         gboolean        online);
 gboolean        gs_plugin_loader_get_supports_reviews  (GsPluginLoader *plugin_loader);
-gchar          **gs_plugin_loader_get_review_auths     (GsPluginLoader *plugin_loader);
 
 G_END_DECLS
 
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index e5341e9..e120b25 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -118,7 +118,6 @@ typedef enum {
 typedef const gchar    *(*GsPluginGetNameFunc)         (void);
 typedef const gchar    **(*GsPluginGetDepsFunc)        (GsPlugin       *plugin);
 typedef gboolean       *(*GsPluginGetSupportsReviewsFunc)      (GsPlugin       *plugin);
-typedef const gchar    *(*GsPluginGetReviewAuthFunc)   (GsPlugin       *plugin);
 typedef void            (*GsPluginFunc)                (GsPlugin       *plugin);
 typedef gboolean        (*GsPluginSearchFunc)          (GsPlugin       *plugin,
                                                         gchar          **value,
@@ -250,7 +249,6 @@ gboolean     gs_plugin_app_set_rating               (GsPlugin       *plugin,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_get_supports_review          (GsPlugin       *plugin);
-const gchar    *gs_plugin_get_review_auth              (GsPlugin       *plugin);
 gboolean        gs_plugin_app_set_review               (GsPlugin       *plugin,
                                                         GsApp          *app,
                                                         GCancellable   *cancellable,
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 0fd0877..8808c58 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1247,14 +1247,10 @@ gs_shell_details_rating_changed_cb (GsStarWidget *star,
 {
        GtkWidget *dialog;
        GtkResponseType response;
-       gchar **review_auths;
 
        dialog = gs_app_review_dialog_new ();
        gs_app_review_dialog_set_rating (GS_APP_REVIEW_DIALOG (dialog), rating);
 
-       review_auths = gs_plugin_loader_get_review_auths (self->plugin_loader);
-       // FIXME: Use these
-
        gtk_window_set_transient_for (GTK_WINDOW (dialog), gs_shell_get_window (self->shell));
        response = gtk_dialog_run (GTK_DIALOG (dialog));
        if (response == GTK_RESPONSE_OK) {
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index 9c58e18..fe033ee 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -730,12 +730,6 @@ gs_plugin_get_supports_reviews (GsPlugin *plugin)
        return TRUE;
 }
 
-const gchar *
-gs_plugin_get_review_auth (GsPlugin *plugin)
-{
-       return "ubuntuone";
-}
-
 static gboolean
 send_review (GsPlugin    *plugin,
              GsAppReview *review,


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