[gnome-software/wip/rancell/paid: 3/3] Mark owned apps
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/paid: 3/3] Mark owned apps
- Date: Tue, 23 Feb 2016 02:17:56 +0000 (UTC)
commit 455462ae64e017117dda4586487b5ec02cc9c449
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Feb 23 15:14:36 2016 +1300
Mark owned apps
src/gs-app.c | 23 +++++++++++++++++++++++
src/gs-app.h | 3 +++
src/gs-plugin.h | 4 ++++
src/plugins/gs-plugin-dummy.c | 14 ++++++++++++++
4 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 888a7d6..1fd06a1 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -84,6 +84,7 @@ struct _GsApp
gchar *management_plugin;
guint price;
gchar *currency;
+ gboolean owned;
gint rating;
GArray *review_ratings;
GPtrArray *reviews; /* of GsReview */
@@ -298,6 +299,8 @@ gs_app_to_string (GsApp *app)
g_string_append_printf (str, "\tprice:\t%u\n", app->price);
if (app->currency != NULL)
g_string_append_printf (str, "\tcurrency:\t%s\n", app->currency);
+ if (app->owned)
+ g_string_append_printf (str, "\towned:\tTRUE\n");
}
if (app->rating != -1)
g_string_append_printf (str, "\trating:\t%i\n", app->rating);
@@ -1720,6 +1723,26 @@ gs_app_set_currency (GsApp *app, const gchar *currency)
}
/**
+ * gs_app_get_owned:
+ */
+gboolean
+gs_app_get_owned (GsApp *app)
+{
+ g_return_val_if_fail (GS_IS_APP (app), FALSE);
+ return app->owned;
+}
+
+/**
+ * gs_app_set_owned:
+ */
+void
+gs_app_set_owned (GsApp *app, gboolean owned)
+{
+ g_return_if_fail (GS_IS_APP (app));
+ app->owned = owned;
+}
+
+/**
* gs_app_get_rating:
*/
gint
diff --git a/src/gs-app.h b/src/gs-app.h
index a0bf5a6..55052da 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -205,6 +205,9 @@ void gs_app_set_price (GsApp *app,
const gchar *gs_app_get_currency (GsApp *app);
void gs_app_set_currency (GsApp *app,
const gchar *currency);
+gboolean gs_app_get_owned (GsApp *app);
+void gs_app_set_owned (GsApp *app,
+ gboolean owned);
gint gs_app_get_rating (GsApp *app);
void gs_app_set_rating (GsApp *app,
gint rating);
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 3ed167d..ef2c3fc 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -268,6 +268,10 @@ gboolean gs_plugin_offline_update_cancel (GsPlugin *plugin,
GsApp *app,
GCancellable *cancellable,
GError **error);
+gboolean gs_plugin_app_buy (GsPlugin *plugin,
+ GsApp *app,
+ GCancellable *cancellable,
+ GError **error);
gboolean gs_plugin_app_install (GsPlugin *plugin,
GsApp *app,
GCancellable *cancellable,
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 02a84df..41ceaa3 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -259,6 +259,20 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
}
/**
+ * gs_plugin_app_buy:
+ */
+gboolean
+gs_plugin_app_buy (GsPlugin *plugin,
+ GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_debug ("Buying app");
+ gs_app_set_owned (app, TRUE);
+ return TRUE;
+}
+
+/**
* gs_plugin_review_submit:
*/
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]