[gnome-software: 9/15] gs-app-tile: Don’t unnecessary destroy and recreate idle handler




commit fa0f7771168cf9d3c61aa63e9ac99cb5168c6359
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Apr 20 15:22:22 2021 +0100

    gs-app-tile: Don’t unnecessary destroy and recreate idle handler
    
    If a notify callback is already pending, it will get the latest data
    from the `GsApp` anyway, so there’s no need to destroy and recreate the
    idle handler.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-app-tile.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-app-tile.c b/src/gs-app-tile.c
index bb3fb7b72..bad5d4ecb 100644
--- a/src/gs-app-tile.c
+++ b/src/gs-app-tile.c
@@ -100,7 +100,10 @@ gs_app_tile_app_notify_cb (GsApp *app, GParamSpec *pspec, GsAppTile *self)
 {
        GsAppTilePrivate *priv = gs_app_tile_get_instance_private (self);
 
-       g_clear_handle_id (&priv->app_notify_idle_id, g_source_remove);
+       /* Already pending */
+       if (priv->app_notify_idle_id != 0)
+               return;
+
        priv->app_notify_idle_id = g_idle_add (gs_app_tile_app_notify_idle_cb, self);
 }
 


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