[gnome-software/1479-repositories-settings-optional-repos-can-t-be-disabled: 118/121] gs-repo-row: Use GS_APP_QUIRK_COMPULSORY to recognize required repositories




commit dca731ff0daf904911dd6815fb9a1b181329c887
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 5 11:00:20 2021 +0200

    gs-repo-row: Use GS_APP_QUIRK_COMPULSORY to recognize required repositories
    
    The GS_APP_QUIRK_PROVENANCE quirk does not mean it's also required repository,
    thus use the GS_APP_QUIRK_COMPULSORY for repos, which cannot be disabled.
    The GS_APP_QUIRK_PROVENANCE is used only for repositories, which cannot be removed.

 src/gs-repo-row.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c
index 87926092f..bbf67c194 100644
--- a/src/gs-repo-row.c
+++ b/src/gs-repo-row.c
@@ -48,7 +48,8 @@ refresh_ui (GsRepoRow *row)
        gboolean active = FALSE;
        gboolean state_sensitive = FALSE;
        gboolean busy = priv->busy_counter> 0;
-       gboolean is_system_repo;
+       gboolean is_provenance;
+       gboolean is_compulsory;
 
        if (priv->repo == NULL) {
                gtk_widget_set_sensitive (priv->disable_switch, FALSE);
@@ -87,11 +88,12 @@ refresh_ui (GsRepoRow *row)
                break;
        }
 
-       is_system_repo = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_PROVENANCE);
+       is_provenance = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_PROVENANCE);
+       is_compulsory = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_COMPULSORY);
 
        /* Disable for the system repos, if installed */
-       gtk_widget_set_sensitive (priv->disable_switch, priv->supports_enable_disable && (state_sensitive || 
!is_system_repo || priv->always_allow_enable_disable));
-       gtk_widget_set_visible (priv->remove_button, priv->supports_remove && !is_system_repo);
+       gtk_widget_set_sensitive (priv->disable_switch, priv->supports_enable_disable && (state_sensitive || 
!is_compulsory || priv->always_allow_enable_disable));
+       gtk_widget_set_visible (priv->remove_button, priv->supports_remove && !is_provenance && 
!is_compulsory);
 
        /* Set only the 'state' to visually indicate the state is not saved yet */
        if (busy)


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