[gnome-software/wip/rancell/ubuntu-3-20-rebase: 13/28] 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-rebase: 13/28] Use AS_APP_QUIRK_NOT_LAUNCHABLE to control the Launch button visibility
- Date: Sat, 17 Jun 2017 04:54:56 +0000 (UTC)
commit a179d0ae326afe41ab7a5d63b52746aa9c3e913c
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 5ce46e9..7c35521 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -78,6 +78,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 5217082..10bf26c 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 1cc68f2..f4cf73d 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -396,6 +396,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 8352547..d8c721f 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]