Update to 42.2; Add patch to correct order of the setup of the GsShell

This commit is contained in:
Milan Crha 2022-05-30 17:51:05 +02:00
parent 82d21baa53
commit b0b459586b
3 changed files with 141 additions and 2 deletions

View File

@ -0,0 +1,134 @@
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 38cc31bb5..c73adce6d 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -1626,12 +1626,12 @@ gs_appstream_add_categories (XbSilo *silo,
for (guint k = 0; k < groups->len; k++) {
const gchar *group = g_ptr_array_index (groups, k);
guint cnt = gs_appstream_count_component_for_groups (silo, group);
- for (guint l = 0; l < cnt; l++) {
- gs_category_increment_size (parent);
+ if (cnt > 0) {
+ gs_category_increment_size (parent, cnt);
if (children->len > 1) {
/* Parent category has multiple groups, so increment
* each group's size too */
- gs_category_increment_size (cat);
+ gs_category_increment_size (cat, cnt);
}
}
}
diff --git a/lib/gs-category.c b/lib/gs-category.c
index b311c4941..4baede3bc 100644
--- a/lib/gs-category.c
+++ b/lib/gs-category.c
@@ -147,17 +147,19 @@ gs_category_set_size (GsCategory *category, guint size)
/**
* gs_category_increment_size:
* @category: a #GsCategory
+ * @value: how many to add
*
- * Adds one to the size count if an application is available
+ * Adds @value to the size count.
*
* Since: 3.22
**/
void
-gs_category_increment_size (GsCategory *category)
+gs_category_increment_size (GsCategory *category,
+ guint value)
{
g_return_if_fail (GS_IS_CATEGORY (category));
- category->size++;
+ category->size += value;
g_object_notify_by_pspec (G_OBJECT (category), obj_props[PROP_SIZE]);
}
diff --git a/lib/gs-category.h b/lib/gs-category.h
index ecd2e1e23..1e82591aa 100644
--- a/lib/gs-category.h
+++ b/lib/gs-category.h
@@ -39,6 +39,7 @@ GsCategory *gs_category_find_child (GsCategory *category,
GPtrArray *gs_category_get_children (GsCategory *category);
guint gs_category_get_size (GsCategory *category);
-void gs_category_increment_size (GsCategory *category);
+void gs_category_increment_size (GsCategory *category,
+ guint value);
G_END_DECLS
diff --git a/src/gs-shell.c b/src/gs-shell.c
index db449a9b0..796d7b05a 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -107,6 +107,7 @@ struct _GsShell
GtkWidget *primary_menu;
GtkWidget *sub_page_header_title;
+ gboolean active_after_setup;
gboolean is_narrow;
guint allocation_changed_cb_id;
@@ -165,6 +166,12 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkWindow *window)
void
gs_shell_activate (GsShell *shell)
{
+ /* Waiting for plugin loader to setup first */
+ if (shell->plugin_loader == NULL) {
+ shell->active_after_setup = TRUE;
+ return;
+ }
+
gtk_widget_show (GTK_WIDGET (shell));
gtk_window_present (GTK_WINDOW (shell));
}
@@ -2237,6 +2244,11 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
if (g_settings_get_boolean (shell->settings, "first-run"))
g_settings_set_boolean (shell->settings, "first-run", FALSE);
}
+
+ if (shell->active_after_setup) {
+ shell->active_after_setup = FALSE;
+ gs_shell_activate (shell);
+ }
}
void
diff --git a/src/gs-application.c b/src/gs-application.c
index e3f5f55c7..bdadd5c34 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -968,12 +968,9 @@ gs_application_startup (GApplication *application)
G_CALLBACK (gs_application_shell_loaded_cb),
app);
- gs_shell_setup (app->shell, app->plugin_loader, app->cancellable);
app->main_window = GTK_WINDOW (app->shell);
gtk_application_add_window (GTK_APPLICATION (app), app->main_window);
- app->update_monitor = gs_update_monitor_new (app, app->plugin_loader);
-
gs_application_update_software_sources_presence (application);
/* Set up the plugins. */
@@ -990,6 +987,7 @@ startup_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
+ GsApplication *app = GS_APPLICATION (user_data);
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
g_autoptr(GError) local_error = NULL;
@@ -1002,6 +1000,11 @@ startup_cb (GObject *source_object,
/* show the priority of each plugin */
gs_plugin_loader_dump_state (plugin_loader);
+
+ /* Setup the shell only after the plugin loader finished its setup,
+ thus all plugins are loaded and ready for the jobs. */
+ gs_shell_setup (app->shell, app->plugin_loader, app->cancellable);
+ app->update_monitor = gs_update_monitor_new (app, app->plugin_loader);
}
static void

View File

@ -15,7 +15,7 @@
%global tarball_version %%(echo %{version} | tr '~' '.')
Name: gnome-software
Version: 42.1
Version: 42.2
Release: 1%{?dist}
Summary: A software center for GNOME
@ -24,6 +24,7 @@ URL: https://wiki.gnome.org/Apps/Software
Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz
Patch01: 0001-crash-with-broken-theme.patch
Patch02: 0002-shell-setup-order.patch
BuildRequires: appstream-devel >= %{appstream_version}
BuildRequires: gcc
@ -198,6 +199,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_datadir}/gtk-doc/html/gnome-software
%changelog
* Mon May 30 2022 Milan Crha <mcrha@redhat.com> - 42.2-1
- Update to 42.2
- Add patch to correct order of the setup of the GsShell
* Wed Apr 27 2022 Milan Crha <mcrha@redhat.com> - 42.1-1
- Update to 42.1

View File

@ -1 +1 @@
SHA512 (gnome-software-42.1.tar.xz) = 292a17e94c7409198fdff4250a88cb240a126c3d77a9cfee1ea8608fdc482d75af6f8fc91c5c6c068b474edea6dcb197f88ec09081a8b270d5f3eda67db755ad
SHA512 (gnome-software-42.2.tar.xz) = 2b231afbedb241b8957fa902c37cd85734cdb8b2071cd32ac75ae2e9e064483fe1e9e8d49f2e6df478fdd01e9c6225a85887ba2af1792a9150b89cea75ef8bb4