[gnome-software/1486-gs-repos-dialog-call-refresh-on-repository-setup-change] gs-repos-dialog: Call refresh on repository setup change



commit 2781d350a9a9ee1fd2078928f4e0933a34e05b9f
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 5 19:46:17 2021 +0200

    gs-repos-dialog: Call refresh on repository setup change
    
    When a repository is enabled/disabled/removed, call also the refresh
    on the plugins, thus the data from those repos are available for the user.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1486

 src/gs-repos-dialog.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 1d6a82f48..c986ad724 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -13,6 +13,7 @@
 #include "gs-repos-dialog.h"
 
 #include "gnome-software-private.h"
+#include "gs-application.h"
 #include "gs-common.h"
 #include "gs-os-release.h"
 #include "gs-repo-row.h"
@@ -35,6 +36,8 @@ struct _GsReposDialog
        GtkWidget       *content_page;
        GtkWidget       *spinner;
        GtkWidget       *stack;
+
+       gboolean         changed;
 };
 
 G_DEFINE_TYPE (GsReposDialog, gs_repos_dialog, HDY_TYPE_WINDOW)
@@ -115,6 +118,8 @@ repo_enabled_cb (GObject *source,
        }
 
        g_debug ("finished %s repo %s", action_str, gs_app_get_id (install_remove_data->repo));
+
+       install_remove_data->dialog->changed = TRUE;
 }
 
 static void
@@ -710,6 +715,17 @@ gs_repos_dialog_dispose (GObject *object)
        g_clear_object (&dialog->cancellable);
        g_clear_object (&dialog->settings);
 
+       if (dialog->changed) {
+               GApplication *app;
+
+               dialog->changed = FALSE;
+               g_debug ("Repository setup changed, calling refresh...");
+
+               app = g_application_get_default ();
+               if (app)
+                       gs_application_refresh (GS_APPLICATION (app));
+       }
+
        G_OBJECT_CLASS (gs_repos_dialog_parent_class)->dispose (object);
 }
 


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