gnome-software/0002-shell-setup-order.patch

130 lines
4.8 KiB
Diff

diff -up gnome-software-43.alpha/lib/gs-appstream.c.2 gnome-software-43.alpha/lib/gs-appstream.c
--- gnome-software-43.alpha/lib/gs-appstream.c.2 2022-06-30 20:03:37.000000000 +0200
+++ gnome-software-43.alpha/lib/gs-appstream.c 2022-07-01 12:01:07.781026426 +0200
@@ -1648,12 +1648,12 @@ gs_appstream_add_categories (XbSilo *sil
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 -up gnome-software-43.alpha/lib/gs-category.c.2 gnome-software-43.alpha/lib/gs-category.c
--- gnome-software-43.alpha/lib/gs-category.c.2 2022-06-30 20:03:37.000000000 +0200
+++ gnome-software-43.alpha/lib/gs-category.c 2022-07-01 12:01:07.781026426 +0200
@@ -147,17 +147,19 @@ gs_category_set_size (GsCategory *catego
/**
* 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 -up gnome-software-43.alpha/lib/gs-category.h.2 gnome-software-43.alpha/lib/gs-category.h
--- gnome-software-43.alpha/lib/gs-category.h.2 2022-06-30 20:03:37.000000000 +0200
+++ gnome-software-43.alpha/lib/gs-category.h 2022-07-01 12:01:07.781026426 +0200
@@ -39,6 +39,7 @@ GsCategory *gs_category_find_child (GsC
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 -up gnome-software-43.alpha/src/gs-application.c.2 gnome-software-43.alpha/src/gs-application.c
--- gnome-software-43.alpha/src/gs-application.c.2 2022-06-30 20:03:37.000000000 +0200
+++ gnome-software-43.alpha/src/gs-application.c 2022-07-01 12:02:05.799267693 +0200
@@ -1036,12 +1036,9 @@ gs_application_startup (GApplication *ap
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);
/* Remove possibly obsolete notifications */
@@ -1067,6 +1064,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;
@@ -1079,6 +1077,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
diff -up gnome-software-43.alpha/src/gs-shell.c.2 gnome-software-43.alpha/src/gs-shell.c
--- gnome-software-43.alpha/src/gs-shell.c.2 2022-06-30 20:03:37.000000000 +0200
+++ gnome-software-43.alpha/src/gs-shell.c 2022-07-01 12:01:07.782026430 +0200
@@ -109,6 +109,7 @@ struct _GsShell
GtkWidget *primary_menu;
GtkWidget *sub_page_header_title;
+ gboolean active_after_setup;
gboolean is_narrow;
guint allocation_changed_cb_id;
@@ -167,6 +168,12 @@ gs_shell_modal_dialog_present (GsShell *
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));
}
@@ -2265,6 +2272,11 @@ gs_shell_setup (GsShell *shell, GsPlugin
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