[gnome-software/1587-updates-glitchy-empty-list: 15/21] gs-app-row: Unmapped row does not hide




commit a699b8a8cd9b6cbfb73595390899fe8225f4f7fe
Author: Milan Crha <mcrha redhat com>
Date:   Wed Aug 24 05:56:19 2022 +0200

    gs-app-row: Unmapped row does not hide
    
    The GtkRevealer does not animate when the widget is not mapped, thus
    just emit the "unrevealed" signal on an idle callback in such case.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1587

 src/gs-app-row.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 952dadbef..85ef4b4ad 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -553,6 +553,20 @@ child_unrevealed (GObject *revealer, GParamSpec *pspec, gpointer user_data)
        g_signal_emit (app_row, signals[SIGNAL_UNREVEALED], 0);
 }
 
+static gboolean
+child_unrevealed_unmapped_cb (gpointer user_data)
+{
+       g_autofree GWeakRef *weak_ref = user_data;
+       g_autoptr(GsAppRow) app_row = g_weak_ref_get (weak_ref);
+
+       if (app_row != NULL)
+               g_signal_emit (app_row, signals[SIGNAL_UNREVEALED], 0);
+
+       g_weak_ref_clear (weak_ref);
+
+       return G_SOURCE_REMOVE;
+}
+
 void
 gs_app_row_unreveal (GsAppRow *app_row)
 {
@@ -564,6 +578,14 @@ gs_app_row_unreveal (GsAppRow *app_row)
        child = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (app_row));
        gtk_widget_set_sensitive (child, FALSE);
 
+       /* Revealer does not animate when the widget is not mapped */
+       if (!gtk_widget_get_mapped (GTK_WIDGET (app_row))) {
+               GWeakRef *weak_ref = g_new0 (GWeakRef, 1);
+               g_weak_ref_init (weak_ref, app_row);
+               g_idle_add_full (G_PRIORITY_HIGH, child_unrevealed_unmapped_cb, weak_ref, NULL);
+               return;
+       }
+
        revealer = gtk_revealer_new ();
        gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE);
        gtk_widget_show (revealer);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]