[gnome-software/wip/rancell/ubuntu-3-20-2: 18/59] Use AS_APP_QUIRK_NOT_LAUNCHABLE to control the Launch button visibility
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/ubuntu-3-20-2: 18/59] Use AS_APP_QUIRK_NOT_LAUNCHABLE to control the Launch button visibility
- Date: Sat, 17 Jun 2017 11:52:38 +0000 (UTC)
commit 57d034addf3650689456357014bee953cb7c42f1
Author: Richard Hughes <richard hughsie com>
Date: Tue Apr 26 20:09:31 2016 +0100
Use AS_APP_QUIRK_NOT_LAUNCHABLE to control the Launch button visibility
src/gs-app.h | 5 +++++
src/gs-shell-details.c | 3 +--
src/plugins/gs-appstream.c | 19 +++++++++++++++++++
src/plugins/gs-plugin-fwupd.c | 2 ++
4 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app.h b/src/gs-app.h
index b8f9c35..5e3d03f 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -82,6 +82,11 @@ typedef enum {
#define AS_APP_QUIRK_NOT_REVIEWABLE (1 << 5)
#endif
+#if !AS_CHECK_VERSION(0,5,15)
+#define AS_APP_QUIRK_HAS_SHORTCUT (1 << 6)
+#define AS_APP_QUIRK_NOT_LAUNCHABLE (1 << 7)
+#endif
+
GQuark gs_app_error_quark (void);
GsApp *gs_app_new (const gchar *id);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 7e1982f..5223f91 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -256,8 +256,7 @@ gs_shell_details_switch_to (GsPage *page, gboolean scroll_up)
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
- if (gs_app_get_kind (self->app) == AS_APP_KIND_DESKTOP ||
- gs_app_get_kind (self->app) == AS_APP_KIND_WEB_APP) {
+ if (!gs_app_has_quirk (self->app, AS_APP_QUIRK_NOT_LAUNCHABLE)) {
gtk_widget_set_visible (self->button_details_launch, TRUE);
} else {
gtk_widget_set_visible (self->button_details_launch, FALSE);
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 5c04ae2..479ee5b 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -486,6 +486,25 @@ gs_appstream_refine_app (GsPlugin *plugin,
}
}
+ /* types we can never launch */
+ switch (gs_app_get_kind (app)) {
+ case AS_APP_KIND_ADDON:
+ case AS_APP_KIND_CODEC:
+ case AS_APP_KIND_FIRMWARE:
+ case AS_APP_KIND_FONT:
+ case AS_APP_KIND_GENERIC:
+ case AS_APP_KIND_INPUT_METHOD:
+ case AS_APP_KIND_LOCALIZATION:
+ case AS_APP_KIND_OS_UPDATE:
+ case AS_APP_KIND_OS_UPGRADE:
+ case AS_APP_KIND_RUNTIME:
+ case AS_APP_KIND_SOURCE:
+ gs_app_add_quirk (app, AS_APP_QUIRK_NOT_LAUNCHABLE);
+ break;
+ default:
+ break;
+ }
+
/* set management plugin automatically */
gs_refine_item_management_plugin (app, item);
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index abf1f16..4e1b65a 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -207,6 +207,8 @@ gs_plugin_fwupd_set_app_from_kv (GsApp *app, const gchar *key, GVariant *val)
{
g_debug ("key %s", key);
+ gs_app_add_quirk (app, AS_APP_QUIRK_NOT_LAUNCHABLE);
+
if (g_strcmp0 (key, "AppstreamId") == 0) {
gs_app_set_id (app, g_variant_get_string (val, NULL));
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]