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



commit 945f8b39637fd3ce523c256fee3a6bc0e4901f1f
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 195a64b..43a8727 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -52,7 +52,6 @@ typedef struct
        gboolean                 online; 
 
        gboolean                 supports_reviews;
-       gchar                   **review_auths;
 } GsPluginLoaderPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (GsPluginLoader, gs_plugin_loader, G_TYPE_OBJECT)
@@ -2831,8 +2830,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;
@@ -2840,8 +2838,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);
@@ -2873,14 +2869,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;
@@ -3004,7 +2992,6 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
        guint j;
        g_autoptr(GDir) dir = NULL;
        g_autoptr(AsProfileTask) ptask = NULL;
-       GPtrArray *review_auths;
 
        g_return_val_if_fail (priv->location != NULL, FALSE);
 
@@ -3016,7 +3003,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);
@@ -3027,12 +3013,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;
@@ -3157,7 +3140,6 @@ gs_plugin_loader_finalize (GObject *object)
        g_strfreev (priv->compatible_projects);
        g_free (priv->location);
        g_free (priv->locale);
-       g_strfreev (priv->review_auths);
 
        g_mutex_clear (&priv->pending_apps_mutex);
        g_mutex_clear (&priv->app_cache_mutex);
@@ -3738,16 +3720,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 56458ab..3bef20f 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -225,7 +225,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 ea3584f..1ec4d6a 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -124,7 +124,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,
@@ -279,7 +278,6 @@ gboolean     gs_plugin_app_upgrade_download         (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 5ecc0ad..fa1ba29 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1345,14 +1345,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 dc90ad4..7de4731 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -728,12 +728,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]