[gnome-software/mwleeds/hardcoded-pwa-list: 36/39] Allow web apps to be in UNAVAILABLE state
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/mwleeds/hardcoded-pwa-list: 36/39] Allow web apps to be in UNAVAILABLE state
- Date: Mon, 16 May 2022 19:13:22 +0000 (UTC)
commit 15f27a37528507bb9eb8e8dff2a260944712bae5
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Thu Mar 24 13:50:20 2022 -0700
Allow web apps to be in UNAVAILABLE state
After a web app is uninstalled in Software, it is only re-installable if
it is present in the AppStream data. Otherwise the app must have been
installed via Epiphany, and the information needed to re-install it
(e.g. the icon) is not available. If we leave the state as
GS_APP_STATE_UNKNOWN after the removal, the user is greeted by an ugly
message "Unable to find org.gnome.Epiphany.WebApp_...." in place of the
details page. So set the state to GS_APP_STATE_UNAVAILABLE instead, and
update other parts of Software to allow that state to mean "Don't show
any Install/Remove/Open button" when it is set on a web app.
plugins/epiphany/gs-plugin-epiphany.c | 2 ++
src/gs-app-row.c | 7 +++++--
src/gs-details-page.c | 4 +++-
3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 5b13f05af..0358188d8 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -367,6 +367,8 @@ gs_epiphany_refine_app_state (GsPlugin *plugin,
gs_app_set_state (app, gs_app_get_state (cached_app));
else if (appstream_source)
gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
+ else
+ gs_app_set_state (app, GS_APP_STATE_UNAVAILABLE);
}
}
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index e9ec818af..2d110b441 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -140,13 +140,16 @@ gs_app_row_refresh_button (GsAppRow *app_row, gboolean missing_search_result)
/* label */
switch (gs_app_get_state (priv->app)) {
case GS_APP_STATE_UNAVAILABLE:
- gtk_widget_set_visible (priv->button, TRUE);
- if (missing_search_result) {
+ if (gs_app_get_kind (priv->app) == AS_COMPONENT_KIND_WEB_APP) {
+ gtk_widget_set_visible (priv->button, FALSE);
+ } else if (missing_search_result) {
+ gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily installed */
gs_progress_button_set_label (GS_PROGRESS_BUTTON (priv->button), _("Visit Website"));
gs_progress_button_set_icon_name (GS_PROGRESS_BUTTON (priv->button), NULL);
} else {
+ gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily installed.
* The ellipsis indicates that further steps are required */
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 4a9b4361a..8cce632cb 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -848,7 +848,9 @@ gs_details_page_refresh_buttons (GsDetailsPage *self)
}
break;
case GS_APP_STATE_UNAVAILABLE:
- if (gs_app_get_url_missing (self->app) != NULL) {
+ if (gs_app_get_kind (self->app) == AS_COMPONENT_KIND_WEB_APP) {
+ gtk_widget_set_visible (self->button_install, FALSE);
+ } else if (gs_app_get_url_missing (self->app) != NULL) {
gtk_widget_set_visible (self->button_install, FALSE);
} else {
gtk_widget_set_visible (self->button_install, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]