234 lines
6.8 KiB
Diff
234 lines
6.8 KiB
Diff
From 5c203ae1b07e2c31ca39c3d6a793534d45c49125 Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Tue, 5 Oct 2021 19:42:37 +0200
|
|
Subject: [PATCH 1/5] gs-shell: Remove left-over function prototype declaration
|
|
|
|
The function body does not exist.
|
|
---
|
|
src/gs-shell.h | 2 --
|
|
1 file changed, 2 deletions(-)
|
|
|
|
diff --git a/src/gs-shell.h b/src/gs-shell.h
|
|
index bb39fc928..46661db16 100644
|
|
--- a/src/gs-shell.h
|
|
+++ b/src/gs-shell.h
|
|
@@ -43,8 +43,6 @@ typedef enum {
|
|
|
|
GsShell *gs_shell_new (void);
|
|
void gs_shell_activate (GsShell *shell);
|
|
-void gs_shell_refresh (GsShell *shell,
|
|
- GCancellable *cancellable);
|
|
void gs_shell_change_mode (GsShell *shell,
|
|
GsShellMode mode,
|
|
gpointer data,
|
|
--
|
|
GitLab
|
|
|
|
|
|
From ca49eb3974e220ff17262c6189e3cdf0a92746fe Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Tue, 5 Oct 2021 19:45:10 +0200
|
|
Subject: [PATCH 2/5] gs-application: Introduce gs_application_refresh()
|
|
|
|
It can be used to call a non-interactive refresh call for the plugins.
|
|
---
|
|
src/gs-application.c | 28 ++++++++++++++++++++++++++++
|
|
src/gs-application.h | 3 ++-
|
|
2 files changed, 30 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/gs-application.c b/src/gs-application.c
|
|
index 90487df62..df982df19 100644
|
|
--- a/src/gs-application.c
|
|
+++ b/src/gs-application.c
|
|
@@ -1371,3 +1371,31 @@ gs_application_emit_install_resources_done (GsApplication *application,
|
|
{
|
|
g_signal_emit (application, signals[INSTALL_RESOURCES_DONE], 0, ident, op_error, NULL);
|
|
}
|
|
+
|
|
+static void
|
|
+gs_application_refresh_cb (GsPluginLoader *plugin_loader,
|
|
+ GAsyncResult *result,
|
|
+ GsApplication *self)
|
|
+{
|
|
+ gboolean success;
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ success = gs_plugin_loader_job_action_finish (plugin_loader, result, &error);
|
|
+ if (!success &&
|
|
+ !g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
|
|
+ g_warning ("failed to refresh: %s", error->message);
|
|
+}
|
|
+
|
|
+void
|
|
+gs_application_refresh (GsApplication *self)
|
|
+{
|
|
+ g_autoptr(GsPluginJob) plugin_job = NULL;
|
|
+ plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH,
|
|
+ "interactive", FALSE,
|
|
+ "age", (guint64) 1,
|
|
+ NULL);
|
|
+ gs_plugin_loader_job_process_async (self->plugin_loader, plugin_job,
|
|
+ self->cancellable,
|
|
+ (GAsyncReadyCallback) gs_application_refresh_cb,
|
|
+ self);
|
|
+}
|
|
diff --git a/src/gs-application.h b/src/gs-application.h
|
|
index 40bad4d4c..92978e1f5 100644
|
|
--- a/src/gs-application.h
|
|
+++ b/src/gs-application.h
|
|
@@ -23,4 +23,5 @@ gboolean gs_application_has_active_window (GsApplication *application);
|
|
void gs_application_emit_install_resources_done
|
|
(GsApplication *application,
|
|
const gchar *ident,
|
|
- const GError *op_error);
|
|
\ No newline at end of file
|
|
+ const GError *op_error);
|
|
+void gs_application_refresh (GsApplication *self);
|
|
--
|
|
GitLab
|
|
|
|
|
|
From 2781d350a9a9ee1fd2078928f4e0933a34e05b9f Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Tue, 5 Oct 2021 19:46:17 +0200
|
|
Subject: [PATCH 3/5] 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);
|
|
}
|
|
|
|
--
|
|
GitLab
|
|
|
|
|
|
From 4c6f4f20c904600a3c5d8ea446ed3c3b0ef0808d Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Wed, 6 Oct 2021 14:41:55 +0200
|
|
Subject: [PATCH 4/5] gs-application: Invoke page reload after the refresh is
|
|
finished
|
|
|
|
The refresh can cause new applications or alternative sources being
|
|
found in the newly enabled repositories, thus reload the pages, to
|
|
reflect the current state.
|
|
---
|
|
src/gs-application.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/src/gs-application.c b/src/gs-application.c
|
|
index df982df19..6ecc093f1 100644
|
|
--- a/src/gs-application.c
|
|
+++ b/src/gs-application.c
|
|
@@ -1384,6 +1384,9 @@ gs_application_refresh_cb (GsPluginLoader *plugin_loader,
|
|
if (!success &&
|
|
!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
|
|
g_warning ("failed to refresh: %s", error->message);
|
|
+
|
|
+ if (success)
|
|
+ g_signal_emit_by_name (self->plugin_loader, "reload", 0, NULL);
|
|
}
|
|
|
|
void
|
|
--
|
|
GitLab
|
|
|
|
|
|
From b1277d97ba4495de434eb3be4ea1f17b80ac1ef8 Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Wed, 6 Oct 2021 14:44:09 +0200
|
|
Subject: [PATCH 5/5] gs-overview-page: Refresh the application after
|
|
third-party repositories enable/disable
|
|
|
|
The enable/disable can cause other applications being found, thus call
|
|
the refresh, to update the repositories information.
|
|
---
|
|
src/gs-overview-page.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
|
|
index 9ba33fb2b..bcf02243d 100644
|
|
--- a/src/gs-overview-page.c
|
|
+++ b/src/gs-overview-page.c
|
|
@@ -13,6 +13,7 @@
|
|
#include <handy.h>
|
|
#include <math.h>
|
|
|
|
+#include "gs-application.h"
|
|
#include "gs-shell.h"
|
|
#include "gs-overview-page.h"
|
|
#include "gs-app-list-private.h"
|
|
@@ -568,6 +569,8 @@ third_party_response_cb (GtkInfoBar *info_bar,
|
|
gint response_id,
|
|
GsOverviewPage *self)
|
|
{
|
|
+ GApplication *application;
|
|
+
|
|
if (response_id == GTK_RESPONSE_YES)
|
|
fedora_third_party_enable (self);
|
|
else
|
|
@@ -575,6 +578,10 @@ third_party_response_cb (GtkInfoBar *info_bar,
|
|
|
|
self->third_party_needs_question = FALSE;
|
|
refresh_third_party_repo (self);
|
|
+
|
|
+ application = g_application_get_default ();
|
|
+ if (application)
|
|
+ gs_application_refresh (GS_APPLICATION (application));
|
|
}
|
|
|
|
static gboolean
|
|
--
|
|
GitLab
|
|
|