From 81e61d3c41a4ce08cb533acd327b3eaad1dff532 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 19 Aug 2022 18:16:53 -0300 Subject: [PATCH 01/20] overview-page: Remove unused variable Trivial cleanup. --- src/gs-overview-page.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c index b9fd8c338..7a3d76606 100644 --- a/src/gs-overview-page.c +++ b/src/gs-overview-page.c @@ -549,7 +549,6 @@ fedora_third_party_disable (GsOverviewPage *self) static gchar * gs_overview_page_dup_deployment_featured_filename (void) { - g_autoptr(GPtrArray) dirs = NULL; g_autofree gchar *filename = NULL; const gchar * const *sys_dirs; -- GitLab From 93f116f8f225a1d318e23c6f59f87c6e91a6c60a Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 18 Aug 2022 18:20:41 -0300 Subject: [PATCH 02/20] plugin-loader: Cleanup unused variables Trivial cleanup. --- lib/gs-plugin-loader.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c index e3f48666a..a8810312f 100644 --- a/lib/gs-plugin-loader.c +++ b/lib/gs-plugin-loader.c @@ -454,7 +454,6 @@ gs_plugin_error_handle_failure (GsPluginLoaderHelper *helper, g_autoptr(GError) error_local_copy = NULL; g_autofree gchar *app_id = NULL; g_autofree gchar *origin_id = NULL; - g_autoptr(GsPluginEvent) event = NULL; /* badly behaved plugin */ if (error_local == NULL) { @@ -1945,7 +1944,6 @@ gs_plugin_loader_setup_async (GsPluginLoader *plugin_loader, SetupData *setup_data; g_autoptr(SetupData) setup_data_owned = NULL; g_autoptr(GTask) task = NULL; - g_autoptr(GError) local_error = NULL; #ifdef HAVE_SYSPROF gint64 begin_time_nsec G_GNUC_UNUSED = SYSPROF_CAPTURE_CURRENT_TIME; #endif @@ -2037,8 +2035,6 @@ finish_setup_get_bus (GTask *task) guint dep_loop_check = 0; guint i; guint j; - g_autoptr(GsPluginLoaderHelper) helper = NULL; - g_autoptr(GsPluginJob) plugin_job = NULL; g_autoptr(GPtrArray) locations = NULL; g_autoptr(GError) local_error = NULL; -- GitLab From 9cff5923beb94f2571937e66150be9e57d73c9fa Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 18 Aug 2022 15:32:30 -0300 Subject: [PATCH 03/20] debug: Print milliseconds with 3 digits It only goes up to 999! --- lib/gs-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gs-debug.c b/lib/gs-debug.c index 1b2da0c2b..f76788af4 100644 --- a/lib/gs-debug.c +++ b/lib/gs-debug.c @@ -82,7 +82,7 @@ gs_log_writer_console (GLogLevelFlags log_level, /* time header */ if (debug->use_time) { g_autoptr(GDateTime) dt = g_date_time_new_now_utc (); - tmp = g_strdup_printf ("%02i:%02i:%02i:%04i", + tmp = g_strdup_printf ("%02i:%02i:%02i:%03i", g_date_time_get_hour (dt), g_date_time_get_minute (dt), g_date_time_get_second (dt), -- GitLab From a55edf0b54487bd7dcd213d05c2cc726109b4fe6 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 18 Aug 2022 15:11:14 -0300 Subject: [PATCH 04/20] updates-section: Don't ref to parent page This creates a circular reference on the parent page, and prevents it from being disposed. Don't own the ref, since GsUpdatesSection lifetime is inherently managed by GsUpdatesPage. --- src/gs-updates-section.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c index 02aae8e80..5dd50d6b4 100644 --- a/src/gs-updates-section.c +++ b/src/gs-updates-section.c @@ -38,7 +38,7 @@ struct _GsUpdatesSection GsAppList *list; GsUpdatesSectionKind kind; GCancellable *cancellable; - GsPage *page; + GsPage *page; /* (transfer none) */ GsPluginLoader *plugin_loader; GtkSizeGroup *sizegroup_name; GtkSizeGroup *sizegroup_button_label; @@ -542,7 +542,6 @@ gs_updates_section_dispose (GObject *object) g_clear_object (&self->cancellable); g_clear_object (&self->list); g_clear_object (&self->plugin_loader); - g_clear_object (&self->page); g_clear_object (&self->sizegroup_name); g_clear_object (&self->sizegroup_button_label); g_clear_object (&self->sizegroup_button_image); @@ -551,6 +550,7 @@ gs_updates_section_dispose (GObject *object) self->button_update = NULL; self->button_cancel = NULL; self->button_stack = NULL; + self->page = NULL; G_OBJECT_CLASS (gs_updates_section_parent_class)->dispose (object); } @@ -726,7 +726,7 @@ gs_updates_section_new (GsUpdatesSectionKind kind, self = g_object_new (GS_TYPE_UPDATES_SECTION, NULL); self->kind = kind; self->plugin_loader = g_object_ref (plugin_loader); - self->page = g_object_ref (page); + self->page = page; _setup_section_header (self); if (self->kind == GS_UPDATES_SECTION_KIND_ONLINE) { -- GitLab From f90c4549c4655eac621f5f35a287895047293a0d Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 18 Aug 2022 15:14:39 -0300 Subject: [PATCH 05/20] upgrade-banner: Subclass AdwBin Now that GsUpdatesPage is properly disposed, it revealed that GsUpgradeBanner was not unparenting its only child, a GtkBox. This triggers a GTK warning. This could have been worked around by unparenting this single box, but libadwaita provides a widget tailored for single child widgets: AdwBin. It also takes care of disposing for us, and is generally a better option here. Make GsUpgradeBanner subclass AdwBin. --- src/gs-upgrade-banner.c | 3 +-- src/gs-upgrade-banner.h | 6 +++--- src/gs-upgrade-banner.ui | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gs-upgrade-banner.c b/src/gs-upgrade-banner.c index f0b340726..8a5e6a29e 100644 --- a/src/gs-upgrade-banner.c +++ b/src/gs-upgrade-banner.c @@ -35,7 +35,7 @@ typedef struct GtkCssProvider *banner_provider; /* (owned) (nullable) */ } GsUpgradeBannerPrivate; -G_DEFINE_TYPE_WITH_PRIVATE (GsUpgradeBanner, gs_upgrade_banner, GTK_TYPE_WIDGET) +G_DEFINE_TYPE_WITH_PRIVATE (GsUpgradeBanner, gs_upgrade_banner, ADW_TYPE_BIN) enum { SIGNAL_DOWNLOAD_CLICKED, @@ -348,7 +348,6 @@ gs_upgrade_banner_class_init (GsUpgradeBannerClass *klass) G_TYPE_NONE, 0); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-upgrade-banner.ui"); - gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_bind_template_child_private (widget_class, GsUpgradeBanner, box_upgrades_info); gtk_widget_class_bind_template_child_private (widget_class, GsUpgradeBanner, box_upgrades_download); diff --git a/src/gs-upgrade-banner.h b/src/gs-upgrade-banner.h index 2ddf6021e..7aff12ba0 100644 --- a/src/gs-upgrade-banner.h +++ b/src/gs-upgrade-banner.h @@ -8,7 +8,7 @@ #pragma once -#include +#include #include "gnome-software-private.h" @@ -16,11 +16,11 @@ G_BEGIN_DECLS #define GS_TYPE_UPGRADE_BANNER (gs_upgrade_banner_get_type ()) -G_DECLARE_DERIVABLE_TYPE (GsUpgradeBanner, gs_upgrade_banner, GS, UPGRADE_BANNER, GtkWidget) +G_DECLARE_DERIVABLE_TYPE (GsUpgradeBanner, gs_upgrade_banner, GS, UPGRADE_BANNER, AdwBin) struct _GsUpgradeBannerClass { - GtkWidgetClass parent_class; + AdwBinClass parent_class; void (*download_clicked) (GsUpgradeBanner *self); void (*install_clicked) (GsUpgradeBanner *self); diff --git a/src/gs-upgrade-banner.ui b/src/gs-upgrade-banner.ui index 1f0f6abef..3ea236bd3 100644 --- a/src/gs-upgrade-banner.ui +++ b/src/gs-upgrade-banner.ui @@ -1,7 +1,7 @@ -