[gnome-software/wip/mcrha/gs-updates-section-row-unreveal] gs-updates-section: Fails to find the GsUpdatesSection on row unrevealed
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/mcrha/gs-updates-section-row-unreveal] gs-updates-section: Fails to find the GsUpdatesSection on row unrevealed
- Date: Tue, 14 Sep 2021 13:05:52 +0000 (UTC)
commit a1a293f395c04de95a2ee94e54ad464ab4fdcd99
Author: Milan Crha <mcrha redhat com>
Date: Tue Sep 14 15:03:51 2021 +0200
gs-updates-section: Fails to find the GsUpdatesSection on row unrevealed
After the widget structure changed the row unrevealed signal handler fails
to find the GsUpdatesSection instance, because it's not the direct parent
of the row anymore.
src/gs-updates-section.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index fa050513d..8a30dcf9b 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -89,21 +89,29 @@ _app_row_button_clicked_cb (GsAppRow *app_row, GsUpdatesSection *self)
static void
_row_unrevealed_cb (GObject *row, GParamSpec *pspec, gpointer data)
{
- GtkWidget *list;
+ GtkWidget *widget;
GsUpdatesSection *self;
- list = gtk_widget_get_parent (GTK_WIDGET (row));
- if (list == NULL)
+ widget = gtk_widget_get_parent (GTK_WIDGET (row));
+ if (widget == NULL)
return;
- self = GS_UPDATES_SECTION (list);
+ /* Traverse the widget structure up to the GsUpdatesSection */
+ while (widget != NULL) {
+ if (GS_IS_UPDATES_SECTION (widget))
+ break;
+ widget = gtk_widget_get_parent (widget);
+ }
+
+ g_return_if_fail (GS_IS_UPDATES_SECTION (widget));
+ self = GS_UPDATES_SECTION (widget);
gs_app_list_remove (self->list, gs_app_row_get_app (GS_APP_ROW (row)));
gtk_widget_destroy (GTK_WIDGET (row));
if (!gs_app_list_length (self->list))
- gtk_widget_hide (list);
+ gtk_widget_hide (widget);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]