[gnome-software] Drop purchasing support



commit e69a00806ea6ad681290c90a5292af852632d0f7
Author: Kalev Lember <klember redhat com>
Date:   Thu Jul 11 13:21:16 2019 +0100

    Drop purchasing support
    
    This is now unused.
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 lib/gs-app-list.c                           |   3 +-
 lib/gs-app.c                                |  65 +--------
 lib/gs-app.h                                |   6 -
 lib/gs-plugin-job-private.h                 |   1 -
 lib/gs-plugin-job.c                         |  32 -----
 lib/gs-plugin-job.h                         |   3 -
 lib/gs-plugin-loader.c                      |  18 ---
 lib/gs-plugin-types.h                       |   6 -
 lib/gs-plugin-vfuncs.h                      |  22 ----
 lib/gs-plugin.c                             |  10 --
 lib/gs-price.c                              | 160 -----------------------
 lib/gs-price.h                              |  31 -----
 lib/meson.build                             |   2 -
 plugins/dummy/gs-plugin-dummy.c             |  22 ----
 plugins/dummy/gs-self-test.c                |  27 ----
 plugins/eos-updater/gs-plugin-eos-updater.c |   2 -
 plugins/flatpak/gs-flatpak.c                |   1 -
 po/POTFILES.in                              |   1 -
 src/gs-details-page.c                       |  12 --
 src/gs-page.c                               | 196 ++--------------------------
 src/gs-search-page.c                        |   2 +-
 src/gs-shell.c                              |  55 --------
 src/gs-updates-page.c                       |   1 -
 23 files changed, 13 insertions(+), 665 deletions(-)
---
diff --git a/lib/gs-app-list.c b/lib/gs-app-list.c
index 00574e75..0acf7fe5 100644
--- a/lib/gs-app-list.c
+++ b/lib/gs-app-list.c
@@ -157,8 +157,7 @@ gs_app_list_invalidate_state (GsAppList *self)
                GsApp *app_tmp = g_ptr_array_index (apps, i);
                AsAppState state_tmp = gs_app_get_state (app_tmp);
                if (state_tmp == AS_APP_STATE_INSTALLING ||
-                   state_tmp == AS_APP_STATE_REMOVING ||
-                   state_tmp == AS_APP_STATE_PURCHASING) {
+                   state_tmp == AS_APP_STATE_REMOVING) {
                        state = state_tmp;
                        break;
                }
diff --git a/lib/gs-app.c b/lib/gs-app.c
index 2bc32011..476ec62e 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -112,7 +112,6 @@ typedef struct
        GFile                   *local_file;
        AsContentRating         *content_rating;
        GdkPixbuf               *pixbuf;
-       GsPrice                 *price;
        GCancellable            *cancellable;
        GsPluginAction           pending_action;
        GsAppPermissions         permissions;
@@ -587,10 +586,6 @@ gs_app_to_string_append (GsApp *app, GString *str)
                gs_app_kv_size (str, "size-installed", priv->size_installed);
        if (priv->size_download != 0)
                gs_app_kv_size (str, "size-download", gs_app_get_size_download (app));
-       if (priv->price != NULL)
-               gs_app_kv_printf (str, "price", "%s %.2f",
-                                 gs_price_get_currency (priv->price),
-                                 gs_price_get_amount (priv->price));
        for (i = 0; i < gs_app_list_length (priv->related); i++) {
                GsApp *app_tmp = gs_app_list_index (priv->related, i);
                const gchar *id = gs_app_get_unique_id (app_tmp);
@@ -914,8 +909,7 @@ gs_app_set_state_internal (GsApp *app, AsAppState state)
                    state == AS_APP_STATE_AVAILABLE_LOCAL ||
                    state == AS_APP_STATE_UPDATABLE ||
                    state == AS_APP_STATE_UPDATABLE_LIVE ||
-                   state == AS_APP_STATE_UNAVAILABLE ||
-                   state == AS_APP_STATE_PURCHASABLE)
+                   state == AS_APP_STATE_UNAVAILABLE)
                        state_change_ok = TRUE;
                break;
        case AS_APP_STATE_INSTALLED:
@@ -953,7 +947,6 @@ gs_app_set_state_internal (GsApp *app, AsAppState state)
                /* removing has to go into an stable state */
                if (state == AS_APP_STATE_UNKNOWN ||
                    state == AS_APP_STATE_AVAILABLE ||
-                   state == AS_APP_STATE_PURCHASABLE ||
                    state == AS_APP_STATE_INSTALLED)
                        state_change_ok = TRUE;
                break;
@@ -983,19 +976,6 @@ gs_app_set_state_internal (GsApp *app, AsAppState state)
                    state == AS_APP_STATE_INSTALLING)
                        state_change_ok = TRUE;
                break;
-       case AS_APP_STATE_PURCHASABLE:
-               /* local has to go into an action state */
-               if (state == AS_APP_STATE_UNKNOWN ||
-                   state == AS_APP_STATE_PURCHASING)
-                       state_change_ok = TRUE;
-               break;
-       case AS_APP_STATE_PURCHASING:
-               /* purchasing has to go into an stable state */
-               if (state == AS_APP_STATE_UNKNOWN ||
-                   state == AS_APP_STATE_AVAILABLE ||
-                   state == AS_APP_STATE_PURCHASABLE)
-                       state_change_ok = TRUE;
-               break;
        default:
                g_warning ("state %s unhandled",
                           as_app_state_to_string (priv->state));
@@ -1022,7 +1002,6 @@ gs_app_set_state_internal (GsApp *app, AsAppState state)
        case AS_APP_STATE_INSTALLING:
        case AS_APP_STATE_REMOVING:
        case AS_APP_STATE_QUEUED_FOR_INSTALL:
-       case AS_APP_STATE_PURCHASING:
                /* transient, so ignore */
                break;
        default:
@@ -1871,46 +1850,6 @@ gs_app_set_pixbuf (GsApp *app, GdkPixbuf *pixbuf)
        g_set_object (&priv->pixbuf, pixbuf);
 }
 
-/**
- * gs_app_get_price:
- * @app: a #GsApp
- *
- * Gets the price required to purchase the application.
- *
- * Returns: (transfer none): a #GsPrice, or %NULL
- *
- * Since: 3.26
- **/
-GsPrice *
-gs_app_get_price (GsApp *app)
-{
-       GsAppPrivate *priv = gs_app_get_instance_private (app);
-       g_return_val_if_fail (GS_IS_APP (app), NULL);
-       return priv->price;
-}
-
-/**
- * gs_app_set_price:
- * @app: a #GsApp
- * @amount: the amount of this price, e.g. 0.99
- * @currency: an ISO 4217 currency code, e.g. "USD"
- *
- * Sets a price required to purchase the application.
- *
- * Since: 3.26
- **/
-void
-gs_app_set_price (GsApp *app, gdouble amount, const gchar *currency)
-{
-       GsAppPrivate *priv = gs_app_get_instance_private (app);
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_return_if_fail (GS_IS_APP (app));
-       locker = g_mutex_locker_new (&priv->mutex);
-       if (priv->price != NULL)
-               g_object_unref (priv->price);
-       priv->price = gs_price_new (amount, currency);
-}
-
 typedef enum {
        GS_APP_VERSION_FIXUP_RELEASE            = 1,
        GS_APP_VERSION_FIXUP_DISTRO_SUFFIX      = 2,
@@ -4204,8 +4143,6 @@ gs_app_finalize (GObject *object)
                g_object_unref (priv->content_rating);
        if (priv->pixbuf != NULL)
                g_object_unref (priv->pixbuf);
-       if (priv->price != NULL)
-               g_object_unref (priv->price);
 
        G_OBJECT_CLASS (gs_app_parent_class)->finalize (object);
 }
diff --git a/lib/gs-app.h b/lib/gs-app.h
index cd185154..cc3aa9cc 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -13,8 +13,6 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <appstream-glib.h>
 
-#include "gs-price.h"
-
 G_BEGIN_DECLS
 
 #define GS_TYPE_APP (gs_app_get_type ())
@@ -281,10 +279,6 @@ void                gs_app_set_management_plugin   (GsApp          *app,
 GdkPixbuf      *gs_app_get_pixbuf              (GsApp          *app);
 void            gs_app_set_pixbuf              (GsApp          *app,
                                                 GdkPixbuf      *pixbuf);
-GsPrice                *gs_app_get_price               (GsApp          *app);
-void            gs_app_set_price               (GsApp          *app,
-                                                gdouble         amount,
-                                                const gchar    *currency);
 GPtrArray      *gs_app_get_icons               (GsApp          *app);
 void            gs_app_add_icon                (GsApp          *app,
                                                 AsIcon         *icon);
diff --git a/lib/gs-plugin-job-private.h b/lib/gs-plugin-job-private.h
index 64ee39b7..487e603b 100644
--- a/lib/gs-plugin-job-private.h
+++ b/lib/gs-plugin-job-private.h
@@ -37,7 +37,6 @@ GFile                 *gs_plugin_job_get_file                 (GsPluginJob    *self);
 GsPlugin               *gs_plugin_job_get_plugin               (GsPluginJob    *self);
 GsCategory             *gs_plugin_job_get_category             (GsPluginJob    *self);
 AsReview               *gs_plugin_job_get_review               (GsPluginJob    *self);
-GsPrice                        *gs_plugin_job_get_price                (GsPluginJob    *self);
 gchar                  *gs_plugin_job_to_string                (GsPluginJob    *self);
 void                    gs_plugin_job_set_action               (GsPluginJob    *self,
                                                                 GsPluginAction  action);
diff --git a/lib/gs-plugin-job.c b/lib/gs-plugin-job.c
index bc001011..54de3c55 100644
--- a/lib/gs-plugin-job.c
+++ b/lib/gs-plugin-job.c
@@ -34,7 +34,6 @@ struct _GsPluginJob
        GFile                   *file;
        GsCategory              *category;
        AsReview                *review;
-       GsPrice                 *price;
        gint64                   time_created;
 };
 
@@ -54,7 +53,6 @@ enum {
        PROP_CATEGORY,
        PROP_REVIEW,
        PROP_MAX_RESULTS,
-       PROP_PRICE,
        PROP_TIMEOUT,
        PROP_LAST
 };
@@ -111,10 +109,6 @@ gs_plugin_job_to_string (GsPluginJob *self)
                g_string_append_printf (str, " with review=%s",
                                        as_review_get_id (self->review));
        }
-       if (self->price != NULL) {
-               g_autofree gchar *price_string = gs_price_to_string (self->price);
-               g_string_append_printf (str, " with price=%s", price_string);
-       }
        if (self->auth != NULL) {
                g_string_append_printf (str, " with auth=%s",
                                        gs_auth_get_auth_id (self->auth));
@@ -425,20 +419,6 @@ gs_plugin_job_get_review (GsPluginJob *self)
        return self->review;
 }
 
-void
-gs_plugin_job_set_price (GsPluginJob *self, GsPrice *price)
-{
-       g_return_if_fail (GS_IS_PLUGIN_JOB (self));
-       g_set_object (&self->price, price);
-}
-
-GsPrice *
-gs_plugin_job_get_price (GsPluginJob *self)
-{
-       g_return_val_if_fail (GS_IS_PLUGIN_JOB (self), NULL);
-       return self->price;
-}
-
 static void
 gs_plugin_job_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec)
 {
@@ -484,9 +464,6 @@ gs_plugin_job_get_property (GObject *obj, guint prop_id, GValue *value, GParamSp
        case PROP_REVIEW:
                g_value_set_object (value, self->review);
                break;
-       case PROP_PRICE:
-               g_value_set_object (value, self->price);
-               break;
        case PROP_MAX_RESULTS:
                g_value_set_uint (value, self->max_results);
                break;
@@ -550,9 +527,6 @@ gs_plugin_job_set_property (GObject *obj, guint prop_id, const GValue *value, GP
        case PROP_TIMEOUT:
                gs_plugin_job_set_timeout (self, g_value_get_uint (value));
                break;
-       case PROP_PRICE:
-               gs_plugin_job_set_price (self, g_value_get_object (value));
-               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
                break;
@@ -571,7 +545,6 @@ gs_plugin_job_finalize (GObject *obj)
        g_clear_object (&self->plugin);
        g_clear_object (&self->category);
        g_clear_object (&self->review);
-       g_clear_object (&self->price);
        G_OBJECT_CLASS (gs_plugin_job_parent_class)->finalize (obj);
 }
 
@@ -661,11 +634,6 @@ gs_plugin_job_class_init (GsPluginJobClass *klass)
                                   0, G_MAXUINT, 60,
                                   G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
        g_object_class_install_property (object_class, PROP_TIMEOUT, pspec);
-
-       pspec = g_param_spec_object ("price", NULL, NULL,
-                                    GS_TYPE_PRICE,
-                                    G_PARAM_READWRITE);
-       g_object_class_install_property (object_class, PROP_PRICE, pspec);
 }
 
 static void
diff --git a/lib/gs-plugin-job.h b/lib/gs-plugin-job.h
index a9863343..20a1b04f 100644
--- a/lib/gs-plugin-job.h
+++ b/lib/gs-plugin-job.h
@@ -13,7 +13,6 @@
 #include "gs-auth.h"
 #include "gs-category.h"
 #include "gs-plugin-types.h"
-#include "gs-price.h"
 
 G_BEGIN_DECLS
 
@@ -55,8 +54,6 @@ void           gs_plugin_job_set_category             (GsPluginJob    *self,
                                                         GsCategory     *category);
 void            gs_plugin_job_set_review               (GsPluginJob    *self,
                                                         AsReview       *review);
-void            gs_plugin_job_set_price                (GsPluginJob    *self,
-                                                        GsPrice        *price);
 
 #define                 gs_plugin_job_newv(a,...)              
GS_PLUGIN_JOB(g_object_new(GS_TYPE_PLUGIN_JOB, "action", a, __VA_ARGS__))
 
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 17b010e9..4bfb7a01 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -122,11 +122,6 @@ typedef gboolean    (*GsPluginActionFunc)          (GsPlugin       *plugin,
                                                         GsApp          *app,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
-typedef gboolean        (*GsPluginPurchaseFunc)        (GsPlugin       *plugin,
-                                                        GsApp          *app,
-                                                        GsPrice        *price,
-                                                        GCancellable   *cancellable,
-                                                        GError         **error);
 typedef gboolean        (*GsPluginReviewFunc)          (GsPlugin       *plugin,
                                                         GsApp          *app,
                                                         AsReview       *review,
@@ -373,10 +368,6 @@ gs_plugin_loader_is_error_fatal (const GError *err)
                return TRUE;
        if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID))
                return TRUE;
-       if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_PURCHASE_NOT_SETUP))
-               return TRUE;
-       if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_PURCHASE_DECLINED))
-               return TRUE;
        return FALSE;
 }
 
@@ -603,14 +594,6 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
                        ret = plugin_func (plugin, app, cancellable, &error_local);
                }
                break;
-       case GS_PLUGIN_ACTION_PURCHASE:
-               {
-                       GsPluginPurchaseFunc plugin_func = func;
-                       ret = plugin_func (plugin, app,
-                                          gs_plugin_job_get_price (helper->plugin_job),
-                                          cancellable, &error_local);
-               }
-               break;
        case GS_PLUGIN_ACTION_REVIEW_SUBMIT:
        case GS_PLUGIN_ACTION_REVIEW_UPVOTE:
        case GS_PLUGIN_ACTION_REVIEW_DOWNVOTE:
@@ -1147,7 +1130,6 @@ gs_plugin_loader_app_is_valid_installed (GsApp *app, gpointer user_data)
        switch (gs_app_get_state (app)) {
        case AS_APP_STATE_INSTALLING:
        case AS_APP_STATE_REMOVING:
-       case AS_APP_STATE_PURCHASING:
                return TRUE;
                break;
        default:
diff --git a/lib/gs-plugin-types.h b/lib/gs-plugin-types.h
index a455abff..adee4b6e 100644
--- a/lib/gs-plugin-types.h
+++ b/lib/gs-plugin-types.h
@@ -66,8 +66,6 @@ typedef guint64 GsPluginFlags;
  * @GS_PLUGIN_ERROR_RESTART_REQUIRED:          A restart is required
  * @GS_PLUGIN_ERROR_AC_POWER_REQUIRED:         AC power is required
  * @GS_PLUGIN_ERROR_TIMED_OUT:                 The job timed out
- * @GS_PLUGIN_ERROR_PURCHASE_NOT_SETUP:                Purchase support not setup
- * @GS_PLUGIN_ERROR_PURCHASE_DECLINED:         Purchase was declined
  *
  * The failure error types.
  **/
@@ -88,8 +86,6 @@ typedef enum {
        GS_PLUGIN_ERROR_RESTART_REQUIRED,
        GS_PLUGIN_ERROR_AC_POWER_REQUIRED,
        GS_PLUGIN_ERROR_TIMED_OUT,
-       GS_PLUGIN_ERROR_PURCHASE_NOT_SETUP,
-       GS_PLUGIN_ERROR_PURCHASE_DECLINED,
        /*< private >*/
        GS_PLUGIN_ERROR_LAST
 } GsPluginError;
@@ -226,7 +222,6 @@ typedef enum {
  * @GS_PLUGIN_ACTION_GET_UPDATES_HISTORICAL:    Get the list of historical updates
  * @GS_PLUGIN_ACTION_INITIALIZE:               Initialize the plugin
  * @GS_PLUGIN_ACTION_DESTROY:                  Destroy the plugin
- * @GS_PLUGIN_ACTION_PURCHASE:                 Purchase an app
  * @GS_PLUGIN_ACTION_DOWNLOAD:                 Download an application
  * @GS_PLUGIN_ACTION_GET_ALTERNATES:           Get the alternates for a specific application
  *
@@ -271,7 +266,6 @@ typedef enum {
        GS_PLUGIN_ACTION_GET_UPDATES_HISTORICAL,
        GS_PLUGIN_ACTION_INITIALIZE,
        GS_PLUGIN_ACTION_DESTROY,
-       GS_PLUGIN_ACTION_PURCHASE,
        GS_PLUGIN_ACTION_DOWNLOAD,
        GS_PLUGIN_ACTION_GET_ALTERNATES,
        /*< private >*/
diff --git a/lib/gs-plugin-vfuncs.h b/lib/gs-plugin-vfuncs.h
index d9527bfa..94f63bdb 100644
--- a/lib/gs-plugin-vfuncs.h
+++ b/lib/gs-plugin-vfuncs.h
@@ -24,7 +24,6 @@
 #include "gs-app.h"
 #include "gs-app-list.h"
 #include "gs-category.h"
-#include "gs-price.h"
 
 G_BEGIN_DECLS
 
@@ -546,27 +545,6 @@ gboolean    gs_plugin_update_cancel                (GsPlugin       *plugin,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
-/**
- * gs_plugin_app_purchase:
- * @plugin: a #GsPlugin
- * @app: a #GsApp
- * @price: a #GsPrice
- * @cancellable: a #GCancellable, or %NULL
- * @error: a #GError, or %NULL
- *
- * Purchase the application.
- *
- * NOTE: Once the action is complete, the plugin must set the new state of @app
- * to %AS_APP_STATE_AVAILABLE.
- *
- * Returns: %TRUE for success or if not relevant
- **/
-gboolean        gs_plugin_app_purchase                 (GsPlugin       *plugin,
-                                                        GsApp          *app,
-                                                        GsPrice        *price,
-                                                        GCancellable   *cancellable,
-                                                        GError         **error);
-
 /**
  * gs_plugin_app_install:
  * @plugin: a #GsPlugin
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index eab2287a..26d4185c 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1550,10 +1550,6 @@ gs_plugin_error_to_string (GsPluginError error)
                return "ac-power-required";
        if (error == GS_PLUGIN_ERROR_TIMED_OUT)
                return "timed-out";
-       if (error == GS_PLUGIN_ERROR_PURCHASE_NOT_SETUP)
-               return "purchase-not-setup";
-       if (error == GS_PLUGIN_ERROR_PURCHASE_DECLINED)
-               return "purchase-declined";
        return NULL;
 }
 
@@ -1644,8 +1640,6 @@ gs_plugin_action_to_function_name (GsPluginAction action)
                return "gs_plugin_initialize";
        if (action == GS_PLUGIN_ACTION_DESTROY)
                return "gs_plugin_destroy";
-       if (action == GS_PLUGIN_ACTION_PURCHASE)
-               return "gs_plugin_app_purchase";
        if (action == GS_PLUGIN_ACTION_GET_ALTERNATES)
                return "gs_plugin_add_alternates";
        return NULL;
@@ -1740,8 +1734,6 @@ gs_plugin_action_to_string (GsPluginAction action)
                return "initialize";
        if (action == GS_PLUGIN_ACTION_DESTROY)
                return "destroy";
-       if (action == GS_PLUGIN_ACTION_PURCHASE)
-               return "purchase";
        if (action == GS_PLUGIN_ACTION_GET_ALTERNATES)
                return "get-alternates";
        return NULL;
@@ -1836,8 +1828,6 @@ gs_plugin_action_from_string (const gchar *action)
                return GS_PLUGIN_ACTION_INITIALIZE;
        if (g_strcmp0 (action, "destroy") == 0)
                return GS_PLUGIN_ACTION_DESTROY;
-       if (g_strcmp0 (action, "purchase") == 0)
-               return GS_PLUGIN_ACTION_PURCHASE;
        if (g_strcmp0 (action, "get-alternates") == 0)
                return GS_PLUGIN_ACTION_GET_ALTERNATES;
        return GS_PLUGIN_ACTION_UNKNOWN;
diff --git a/lib/meson.build b/lib/meson.build
index b74248a5..2126ce1a 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -46,7 +46,6 @@ install_headers([
     'gs-plugin-event.h',
     'gs-plugin-types.h',
     'gs-plugin-vfuncs.h',
-    'gs-price.h',
     'gs-utils.h'
   ],
   subdir : 'gnome-software'
@@ -84,7 +83,6 @@ libgnomesoftware = static_library(
     'gs-plugin-job.c',
     'gs-plugin-loader.c',
     'gs-plugin-loader-sync.c',
-    'gs-price.c',
     'gs-test.c',
     'gs-utils.c',
   ],
diff --git a/plugins/dummy/gs-plugin-dummy.c b/plugins/dummy/gs-plugin-dummy.c
index bb3b1b12..ee041500 100644
--- a/plugins/dummy/gs-plugin-dummy.c
+++ b/plugins/dummy/gs-plugin-dummy.c
@@ -871,28 +871,6 @@ gs_plugin_update_cancel (GsPlugin *plugin, GsApp *app,
        return TRUE;
 }
 
-gboolean
-gs_plugin_app_purchase (GsPlugin *plugin,
-                       GsApp *app,
-                       GsPrice *price,
-                       GCancellable *cancellable,
-                       GError **error)
-{
-       g_debug ("Purchasing app");
-
-       /* purchase app */
-       if (g_strcmp0 (gs_app_get_id (app), "chiron-paid.desktop") == 0) {
-               gs_app_set_state (app, AS_APP_STATE_PURCHASING);
-               if (!gs_plugin_dummy_delay (plugin, app, 500, cancellable, error)) {
-                       gs_app_set_state_recover (app);
-                       return FALSE;
-               }
-               gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
-       }
-
-       return TRUE;
-}
-
 gboolean
 gs_plugin_review_submit (GsPlugin *plugin,
                         GsApp *app,
diff --git a/plugins/dummy/gs-self-test.c b/plugins/dummy/gs-self-test.c
index 3f6b9c8e..8ca5f8ca 100644
--- a/plugins/dummy/gs-self-test.c
+++ b/plugins/dummy/gs-self-test.c
@@ -591,30 +591,6 @@ gs_plugins_dummy_wildcard_func (GsPluginLoader *plugin_loader)
        }
 }
 
-static void
-gs_plugins_dummy_purchase_func (GsPluginLoader *plugin_loader)
-{
-       gboolean ret;
-       g_autoptr(GsApp) app = NULL;
-       g_autoptr(GError) error = NULL;
-       g_autoptr(GsPluginJob) plugin_job = NULL;
-
-       /* get the updates list */
-       app = gs_app_new ("chiron-paid.desktop");
-       gs_app_set_management_plugin (app, "dummy");
-       gs_app_set_state (app, AS_APP_STATE_PURCHASABLE);
-       gs_app_set_price (app, 100, "USD");
-       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_PURCHASE,
-                                        "app", app,
-                                        "price", gs_app_get_price (app),
-                                        NULL);
-       ret = gs_plugin_loader_job_action (plugin_loader, plugin_job, NULL, &error);
-       gs_test_flush_main_context ();
-       g_assert_no_error (error);
-       g_assert (ret);
-       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
-}
-
 static void
 plugin_job_action_cb (GObject *source,
                      GAsyncResult *res,
@@ -880,9 +856,6 @@ main (int argc, char **argv)
        g_test_add_data_func ("/gnome-software/plugins/dummy/distro-upgrades",
                              plugin_loader,
                              (GTestDataFunc) gs_plugins_dummy_distro_upgrades_func);
-       g_test_add_data_func ("/gnome-software/plugins/dummy/purchase",
-                             plugin_loader,
-                             (GTestDataFunc) gs_plugins_dummy_purchase_func);
        g_test_add_data_func ("/gnome-software/plugins/dummy/metadata-quirks",
                              plugin_loader,
                              (GTestDataFunc) gs_plugins_dummy_metadata_quirks);
diff --git a/plugins/eos-updater/gs-plugin-eos-updater.c b/plugins/eos-updater/gs-plugin-eos-updater.c
index 55e5d2b6..f38eee50 100644
--- a/plugins/eos-updater/gs-plugin-eos-updater.c
+++ b/plugins/eos-updater/gs-plugin-eos-updater.c
@@ -229,8 +229,6 @@ should_add_os_upgrade (AsAppState state)
        case AS_APP_STATE_QUEUED_FOR_INSTALL:
        case AS_APP_STATE_INSTALLING:
        case AS_APP_STATE_UPDATABLE_LIVE:
-       case AS_APP_STATE_PURCHASABLE:
-       case AS_APP_STATE_PURCHASING:
                return TRUE;
        case AS_APP_STATE_UNKNOWN:
        case AS_APP_STATE_INSTALLED:
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index e9c95dea..a62355ed 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -796,7 +796,6 @@ gs_flatpak_progress_cb (const gchar *status,
 
                switch (gs_app_get_state (phelper->app)) {
                case AS_APP_STATE_INSTALLING:
-               case AS_APP_STATE_PURCHASING:
                        plugin_status = GS_PLUGIN_STATUS_INSTALLING;
                        break;
                case AS_APP_STATE_REMOVING:
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cf7dafed..5c5a4256 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -47,7 +47,6 @@ lib/gs-plugin-loader.c
 src/gs-popular-tile.c
 src/gs-popular-tile.ui
 src/gs-prefs-dialog.ui
-lib/gs-price.c
 src/gs-removal-dialog.c
 src/gs-removal-dialog.ui
 src/gs-repos-dialog.c
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 87f00f12..5f11b728 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -797,7 +797,6 @@ static void
 gs_details_page_refresh_buttons (GsDetailsPage *self)
 {
        AsAppState state;
-       GsPrice *price;
        g_autofree gchar *text = NULL;
 
        state = gs_app_get_state (self->app);
@@ -814,15 +813,6 @@ gs_details_page_refresh_buttons (GsDetailsPage *self)
        case AS_APP_STATE_INSTALLING:
                gtk_widget_set_visible (self->button_install, FALSE);
                break;
-       case AS_APP_STATE_PURCHASABLE:
-               gtk_widget_set_visible (self->button_install, TRUE);
-               price = gs_app_get_price (self->app);
-               text = gs_price_to_string (price);
-               gtk_button_set_label (GTK_BUTTON (self->button_install), text);
-               break;
-       case AS_APP_STATE_PURCHASING:
-               gtk_widget_set_visible (self->button_install, FALSE);
-               break;
        case AS_APP_STATE_UNKNOWN:
        case AS_APP_STATE_INSTALLED:
        case AS_APP_STATE_REMOVING:
@@ -931,8 +921,6 @@ gs_details_page_refresh_buttons (GsDetailsPage *self)
                case AS_APP_STATE_REMOVING:
                case AS_APP_STATE_UNAVAILABLE:
                case AS_APP_STATE_UNKNOWN:
-               case AS_APP_STATE_PURCHASABLE:
-               case AS_APP_STATE_PURCHASING:
                case AS_APP_STATE_QUEUED_FOR_INSTALL:
                        gtk_widget_set_visible (self->button_remove, FALSE);
                        break;
diff --git a/src/gs-page.c b/src/gs-page.c
index 4b8ae790..b2bef0ee 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -305,147 +305,6 @@ gs_page_set_header_end_widget (GsPage *page, GtkWidget *widget)
        g_set_object (&priv->header_end_widget, widget);
 }
 
-static void
-gs_page_app_purchased_cb (GObject *source,
-                          GAsyncResult *res,
-                          gpointer user_data);
-
-static void
-gs_page_purchase_authenticate_cb (GsPage *page,
-                                 gboolean authenticated,
-                                 gpointer user_data)
-{
-       g_autoptr(GsPageHelper) helper = (GsPageHelper *) user_data;
-       GsPagePrivate *priv = gs_page_get_instance_private (page);
-       g_autoptr(GsPluginJob) plugin_job = NULL;
-
-       if (!authenticated)
-               return;
-
-       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_PURCHASE,
-                                        "interactive", TRUE,
-                                        "app", helper->app,
-                                        "price", gs_app_get_price (helper->app),
-                                        NULL);
-       gs_plugin_loader_job_process_async (priv->plugin_loader, plugin_job,
-                                           helper->cancellable,
-                                           gs_page_app_purchased_cb,
-                                           helper);
-       g_steal_pointer (&helper);
-}
-
-static void
-gs_page_app_purchased_cb (GObject *source,
-                          GAsyncResult *res,
-                          gpointer user_data)
-{
-       g_autoptr(GsPageHelper) helper = (GsPageHelper *) user_data;
-       GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
-       GsPage *page = helper->page;
-       GsPagePrivate *priv = gs_page_get_instance_private (page);
-       gboolean ret;
-       g_autoptr(GsPluginJob) plugin_job = NULL;
-       g_autoptr(GError) error = NULL;
-
-       ret = gs_plugin_loader_job_action_finish (plugin_loader,
-                                                 res,
-                                                 &error);
-       if (g_error_matches (error,
-                            GS_PLUGIN_ERROR,
-                            GS_PLUGIN_ERROR_CANCELLED)) {
-               g_debug ("%s", error->message);
-               return;
-       }
-       if (!ret) {
-               /* try to authenticate then retry */
-               if (g_error_matches (error,
-                                    GS_PLUGIN_ERROR,
-                                    GS_PLUGIN_ERROR_AUTH_REQUIRED)) {
-                       gs_page_authenticate (page,
-                                             helper->app,
-                                             gs_utils_get_error_value (error),
-                                             helper->cancellable,
-                                             gs_page_purchase_authenticate_cb,
-                                             helper);
-                       g_steal_pointer (&helper);
-                       return;
-               } else if (g_error_matches (error,
-                                           GS_PLUGIN_ERROR,
-                                           GS_PLUGIN_ERROR_PURCHASE_NOT_SETUP)) {
-                       const gchar *url;
-
-                       /* have we been given a link */
-                       url = gs_utils_get_error_value (error);
-                       if (url != NULL) {
-                               g_autoptr(GError) error_local = NULL;
-                               g_debug ("showing link in: %s", error->message);
-                               if (!gtk_show_uri_on_window (GTK_WINDOW (gs_shell_get_window (priv->shell)),
-                                                            url,
-                                                            GDK_CURRENT_TIME,
-                                                            &error_local)) {
-                                       g_warning ("failed to show URI %s: %s",
-                                                  url, error_local->message);
-                               }
-                               return;
-                       }
-               }
-
-               g_warning ("failed to purchase %s: %s",
-                          gs_app_get_id (helper->app),
-                          error->message);
-               return;
-       }
-
-       if (gs_app_get_state (helper->app) != AS_APP_STATE_AVAILABLE) {
-               g_warning ("no plugin purchased %s",
-                          gs_app_get_id (helper->app));
-               return;
-       }
-
-       /* now install */
-       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_INSTALL,
-                                        "interactive", TRUE,
-                                        "app", helper->app,
-                                        NULL);
-       gs_plugin_loader_job_process_async (priv->plugin_loader,
-                                           plugin_job,
-                                           helper->cancellable,
-                                           gs_page_app_installed_cb,
-                                           helper);
-       g_steal_pointer (&helper);
-}
-
-static void
-gs_page_install_purchase_response_cb (GtkDialog *dialog,
-                                     gint response,
-                                     gpointer user_data)
-{
-       g_autoptr(GsPageHelper) helper = (GsPageHelper *) user_data;
-       GsPagePrivate *priv = gs_page_get_instance_private (helper->page);
-       g_autoptr(GsPluginJob) plugin_job = NULL;
-
-       /* unmap the dialog */
-       gtk_widget_destroy (GTK_WIDGET (dialog));
-
-       /* not agreed */
-       if (response != GTK_RESPONSE_OK)
-               return;
-
-       g_debug ("purchase %s", gs_app_get_id (helper->app));
-
-       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_PURCHASE,
-                                        "interactive", TRUE,
-                                        "app", helper->app,
-                                        "price", gs_app_get_price (helper->app),
-                                        NULL);
-       gs_plugin_loader_job_process_async (priv->plugin_loader,
-                                           plugin_job,
-                                           helper->cancellable,
-                                           gs_page_app_purchased_cb,
-                                           helper);
-       g_steal_pointer (&helper);
-}
-
 void
 gs_page_install_app (GsPage *page,
                     GsApp *app,
@@ -454,6 +313,7 @@ gs_page_install_app (GsPage *page,
 {
        GsPagePrivate *priv = gs_page_get_instance_private (page);
        GsPageHelper *helper;
+       g_autoptr(GsPluginJob) plugin_job = NULL;
 
        /* probably non-free */
        if (gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE) {
@@ -471,51 +331,15 @@ gs_page_install_app (GsPage *page,
        helper->cancellable = g_object_ref (cancellable);
        helper->interaction = interaction;
 
-       /* need to purchase first */
-       if (gs_app_get_state (app) == AS_APP_STATE_PURCHASABLE) {
-               GtkWidget *dialog;
-               g_autofree gchar *title = NULL;
-               g_autofree gchar *message = NULL;
-               g_autofree gchar *price_text = NULL;
-
-               /* TRANSLATORS: this is a prompt message, and '%s' is an
-                * application summary, e.g. 'GNOME Clocks' */
-               title = g_strdup_printf (_("Are you sure you want to purchase %s?"),
-                                        gs_app_get_name (app));
-               price_text = gs_price_to_string (gs_app_get_price (app));
-               /* TRANSLATORS: longer dialog text */
-               message = g_strdup_printf (_("%s will be installed, and you will "
-                                            "be charged %s."),
-                                          gs_app_get_name (app), price_text);
-
-               dialog = gtk_message_dialog_new (gs_shell_get_window (priv->shell),
-                                                GTK_DIALOG_MODAL,
-                                                GTK_MESSAGE_QUESTION,
-                                                GTK_BUTTONS_CANCEL,
-                                                "%s", title);
-               gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                         "%s", message);
-
-               /* TRANSLATORS: this is button text to purchase the application */
-               gtk_dialog_add_button (GTK_DIALOG (dialog), _("Purchase"), GTK_RESPONSE_OK);
-
-               /* handle this async */
-               g_signal_connect (dialog, "response",
-                                 G_CALLBACK (gs_page_install_purchase_response_cb), helper);
-               gs_shell_modal_dialog_present (priv->shell, GTK_DIALOG (dialog));
-       } else {
-               g_autoptr(GsPluginJob) plugin_job = NULL;
-
-               plugin_job = gs_plugin_job_newv (helper->action,
-                                                "interactive", TRUE,
-                                                "app", helper->app,
-                                                NULL);
-               gs_plugin_loader_job_process_async (priv->plugin_loader,
-                                                   plugin_job,
-                                                   helper->cancellable,
-                                                   gs_page_app_installed_cb,
-                                                   helper);
-       }
+       plugin_job = gs_plugin_job_newv (helper->action,
+                                        "interactive", TRUE,
+                                        "app", helper->app,
+                                        NULL);
+       gs_plugin_loader_job_process_async (priv->plugin_loader,
+                                           plugin_job,
+                                           helper->cancellable,
+                                           gs_page_app_installed_cb,
+                                           helper);
 }
 
 static void
diff --git a/src/gs-search-page.c b/src/gs-search-page.c
index 189bd43c..1eb04021 100644
--- a/src/gs-search-page.c
+++ b/src/gs-search-page.c
@@ -50,7 +50,7 @@ gs_search_page_app_row_clicked_cb (GsAppRow *app_row,
 {
        GsApp *app;
        app = gs_app_row_get_app (app_row);
-       if (gs_app_get_state (app) == AS_APP_STATE_AVAILABLE || gs_app_get_state (app) == 
AS_APP_STATE_PURCHASABLE)
+       if (gs_app_get_state (app) == AS_APP_STATE_AVAILABLE)
                gs_page_install_app (GS_PAGE (self), app, GS_SHELL_INTERACTION_FULL,
                                     self->cancellable);
        else if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED)
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 029aa49c..f1c5bd13 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1083,59 +1083,6 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
        return TRUE;
 }
 
-static gboolean
-gs_shell_show_event_purchase (GsShell *shell, GsPluginEvent *event)
-{
-       GsApp *app = gs_plugin_event_get_app (event);
-       const GError *error = gs_plugin_event_get_error (event);
-       g_autofree gchar *str_app = NULL;
-       g_autoptr(GString) str = g_string_new (NULL);
-
-       str_app = gs_shell_get_title_from_app (app);
-       switch (error->code) {
-       case GS_PLUGIN_ERROR_AUTH_REQUIRED:
-               /* TRANSLATORS: failure text for the in-app notification,
-                * where the %s is the application name (e.g. "GIMP") */
-               g_string_append_printf (str, _("Unable to purchase %s: "
-                                              "authentication was required"),
-                                       str_app);
-               break;
-       case GS_PLUGIN_ERROR_AUTH_INVALID:
-               /* TRANSLATORS: failure text for the in-app notification,
-                * where the %s is the application name (e.g. "GIMP") */
-               g_string_append_printf (str, _("Unable to purchase %s: "
-                                              "authentication was invalid"),
-                                       str_app);
-               break;
-       case GS_PLUGIN_ERROR_PURCHASE_NOT_SETUP:
-               /* TRANSLATORS: failure text for the in-app notification,
-                * where the %s is the application name (e.g. "GIMP") */
-               g_string_append_printf (str, _("Unable to purchase %s: "
-                                              "no payment method setup"),
-                                       str_app);
-               break;
-       case GS_PLUGIN_ERROR_PURCHASE_DECLINED:
-               /* TRANSLATORS: failure text for the in-app notification,
-                * where the %s is the application name (e.g. "GIMP") */
-               g_string_append_printf (str, _("Unable to purchase %s: "
-                                              "payment was declined"),
-                                       str_app);
-               break;
-       default:
-               /* TRANSLATORS: failure text for the in-app notification,
-                * where the %s is the application name (e.g. "GIMP") */
-               g_string_append_printf (str, _("Unable to purchase %s"), str_app);
-               gs_shell_append_detailed_error (shell, str, error);
-               break;
-       }
-       if (str->len == 0)
-               return FALSE;
-
-       /* show in-app notification */
-       gs_shell_show_event_app_notify (shell, str->str, GS_SHELL_EVENT_BUTTON_NONE);
-       return TRUE;
-}
-
 static gboolean
 gs_shell_show_event_install (GsShell *shell, GsPluginEvent *event)
 {
@@ -1836,8 +1783,6 @@ gs_shell_show_event (GsShell *shell, GsPluginEvent *event)
        case GS_PLUGIN_ACTION_REFRESH:
        case GS_PLUGIN_ACTION_DOWNLOAD:
                return gs_shell_show_event_refresh (shell, event);
-       case GS_PLUGIN_ACTION_PURCHASE:
-               return gs_shell_show_event_purchase (shell, event);
        case GS_PLUGIN_ACTION_INSTALL:
                return gs_shell_show_event_install (shell, event);
        case GS_PLUGIN_ACTION_UPDATE:
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index 429bf27b..117e7bcd 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -1200,7 +1200,6 @@ gs_shell_update_are_updates_in_progress (GsUpdatesPage *self)
                switch (gs_app_get_state (app)) {
                case AS_APP_STATE_INSTALLING:
                case AS_APP_STATE_REMOVING:
-               case AS_APP_STATE_PURCHASING:
                        return TRUE;
                        break;
                default:


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