[gnome-software: 1/2] flatpak: Set no-interaction correctly when refreshing




commit 7fa77dc48d2d8cc78acde71fc41210b521384bca
Author: Jonathan Kang <jonathankang gnome org>
Date:   Wed Dec 15 14:59:11 2021 +0800

    flatpak: Set no-interaction correctly when refreshing
    
    A GS_PLUGIN_FLAGS_INTERACTIVE flags will be set based on whether the
    plugin action should be interactive or not. Set no-interaction value
    of FlatpakInstallation according to that flag.
    
    This fixes the issue where an polkit authentication dialog pops up
    when GNOME Software is running in the background and trying to check
    updates, if the polkit rules for
    org.freedesktop.Flatpak.appstream-update requires authorisation.
    
    https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1561

 plugins/flatpak/gs-plugin-flatpak.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index f2f4945da..097644310 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -393,7 +393,17 @@ gs_plugin_refresh (GsPlugin *plugin,
        GsPluginFlatpak *self = GS_PLUGIN_FLATPAK (plugin);
 
        for (guint i = 0; i < self->installations->len; i++) {
+               FlatpakInstallation *installation;
                GsFlatpak *flatpak = g_ptr_array_index (self->installations, i);
+               g_autoptr(FlatpakInstallation) installation_clone = NULL;
+
+               installation = gs_flatpak_get_installation (flatpak);
+               installation_clone = g_object_ref (installation);
+
+               /* Let flatpak know if it is a background operation */
+               flatpak_installation_set_no_interaction (installation_clone,
+                                                        !gs_plugin_has_flags (plugin, 
GS_PLUGIN_FLAGS_INTERACTIVE));
+
                if (!gs_flatpak_refresh (flatpak, cache_age, cancellable, error))
                        return FALSE;
        }


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