[gnome-software/1935-firmware-updates-are-hidden-if-they-require-the-laptop-lid-to-be-open] gs-app-row: Show update problems and disallow update when available



commit cfc3247a6f47b0165ba6f614c560f715260a6e39
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 12 12:30:20 2022 +0200

    gs-app-row: Show update problems and disallow update when available
    
    Show update problem to the user, as it's meant to be something the user
    can do about it, like correct it by charging a battery, open a lid and
    similar.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1935

 src/gs-app-row.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 0cc9895b7..759f76f2d 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -143,6 +143,8 @@ gs_app_row_refresh_button (GsAppRow *app_row, gboolean missing_search_result)
                return;
        }
 
+       gtk_widget_set_sensitive (priv->button, TRUE);
+
        /* label */
        switch (gs_app_get_state (priv->app)) {
        case GS_APP_STATE_UNAVAILABLE:
@@ -182,6 +184,7 @@ gs_app_row_refresh_button (GsAppRow *app_row, gboolean missing_search_result)
                         * that allows the app to be easily updated live */
                        gs_progress_button_set_label (GS_PROGRESS_BUTTON (priv->button), _("Update"));
                        gs_progress_button_set_icon_name (GS_PROGRESS_BUTTON (priv->button), 
"software-update-available-symbolic");
+                       gtk_widget_set_sensitive (priv->button, !gs_app_has_quirk (priv->app, 
GS_APP_QUIRK_NEEDS_USER_ACTION));
                } else {
                        /* TRANSLATORS: this is a button next to the search results that
                         * allows the application to be easily removed */
@@ -486,6 +489,10 @@ gs_app_row_actually_refresh (GsAppRow *app_row)
        /* hide buttons in the update list, unless the app is live updatable */
        switch (gs_app_get_state (priv->app)) {
        case GS_APP_STATE_UPDATABLE_LIVE:
+               gtk_widget_set_visible (priv->button_box,
+                                       !priv->show_update ||
+                                       !gs_app_has_quirk (priv->app, GS_APP_QUIRK_NEEDS_USER_ACTION));
+               break;
        case GS_APP_STATE_INSTALLING:
                gtk_widget_set_visible (priv->button_box, TRUE);
                break;
@@ -523,6 +530,16 @@ gs_app_row_actually_refresh (GsAppRow *app_row)
                        g_string_append_printf (warning, _("Renamed from %s"), renamed_from);
                }
 
+               if (gs_app_has_quirk (priv->app, GS_APP_QUIRK_NEEDS_USER_ACTION)) {
+                       const gchar *problems;
+                       problems = gs_app_get_metadata_item (priv->app, "GnomeSoftware::problems");
+                       if (problems != NULL && *problems != '\0') {
+                               if (warning->len > 0)
+                                       g_string_append_c (warning, '\n');
+                               g_string_append (warning, problems);
+                       }
+               }
+
                if (warning->len > 0) {
                        gtk_label_set_text (GTK_LABEL (priv->label_warning), warning->str);
                        gtk_widget_show (priv->label_warning);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]