[gnome-software/wip/rancell/paid] Add a dummy purchasable app
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/paid] Add a dummy purchasable app
- Date: Fri, 6 May 2016 04:09:03 +0000 (UTC)
commit c3d424c1638ff6e270292d1816b0a385a2141cd1
Author: Robert Ancell <robert ancell canonical com>
Date: Fri May 6 16:08:40 2016 +1200
Add a dummy purchasable app
src/plugins/gs-plugin-dummy.c | 39 ++++++++++++++++++++++++++++++++++++---
1 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index c8be780..c313d66 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -152,13 +152,31 @@ gs_plugin_add_search (GsPlugin *plugin,
GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
- g_autoptr(GsApp) app = NULL;
+ g_autoptr(GsApp) app = NULL, app2 = NULL;
g_autoptr(AsIcon) ic = NULL;
/* we're very specific */
if (g_strcmp0 (values[0], "chiron") != 0)
return TRUE;
+ /* use a generic stock icon */
+ ic = as_icon_new ();
+ as_icon_set_kind (ic, AS_ICON_KIND_STOCK);
+ as_icon_set_name (ic, "drive-harddisk");
+
+ /* add a live updatable normal application */
+ app2 = gs_app_new ("chiron-paid.desktop");
+ gs_app_set_name (app2, GS_APP_QUALITY_NORMAL, "Chiron (paid)");
+ gs_app_set_summary (app2, GS_APP_QUALITY_NORMAL, "A teaching application");
+ gs_app_add_price (app2, 100, "USD");
+ gs_app_set_icon (app2, ic);
+ gs_app_set_size_installed (app2, 42 * 1024 * 1024);
+ gs_app_set_size_download (app2, 50 * 1024 * 1024);
+ gs_app_set_kind (app2, AS_APP_KIND_DESKTOP);
+ gs_app_set_state (app2, AS_APP_STATE_PURCHASABLE);
+ gs_app_set_management_plugin (app2, gs_plugin_get_name (plugin));
+ gs_app_list_add (list, app2);
+
/* does the app already exist? */
app = gs_plugin_cache_lookup (plugin, "example:chiron");
if (app != NULL) {
@@ -476,7 +494,9 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
- g_autoptr(GsApp) app = gs_app_new ("chiron.desktop");
+ g_autoptr(GsApp) app = NULL, app2 = NULL;
+
+ app = gs_app_new ("chiron.desktop");
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Chiron");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "View and use virtual machines");
gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, "http://www.box.org");
@@ -486,6 +506,19 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
gs_app_list_add (list, app);
+
+ app2 = gs_app_new ("chiron-paid.desktop");
+ gs_app_set_name (app2, GS_APP_QUALITY_NORMAL, "Expensive App");
+ gs_app_set_summary (app2, GS_APP_QUALITY_NORMAL, "An app that costs you money");
+ gs_app_add_price (app2, 100, "USD");
+ gs_app_set_url (app2, AS_URL_KIND_HOMEPAGE, "http://www.example.com");
+ gs_app_set_kind (app2, AS_APP_KIND_DESKTOP);
+ gs_app_set_state (app2, AS_APP_STATE_PURCHASABLE);
+ gs_app_set_pixbuf (app2, gdk_pixbuf_new_from_file
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL));
+ gs_app_set_kind (app2, AS_APP_KIND_DESKTOP);
+ gs_app_set_management_plugin (app2, gs_plugin_get_name (plugin));
+ gs_app_list_add (list, app2);
+
return TRUE;
}
@@ -618,7 +651,7 @@ gs_plugin_app_purchase (GsPlugin *plugin,
GError **error)
{
g_debug ("Purchasing app");
- gs_app_set_owned (app, TRUE);
+ gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]