From a3fd03f852a27ac45fbaf740a965ce45af5f5390 Mon Sep 17 00:00:00 2001 From: Matthias Clasen <mclasen@redhat.com> Date: Tue, 17 Sep 2019 23:06:13 -0400 Subject: [PATCH] background: Don't spam the logs Only warn once if we don't find the shell api. Closes: https://github.com/flatpak/xdg-desktop-portal-gtk/issues/215 --- src/background.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/background.c b/src/background.c index a10edeb..6cbe704 100644 --- a/src/background.c +++ b/src/background.c @@ -462,7 +462,14 @@ get_app_states (void) if (!xdp_impl_background_call_get_app_state_sync (background_impl, &apps, NULL, &error)) { - g_warning ("Failed to get application states: %s", error->message); + static int warned = 0; + + if (!warned) + { + g_warning ("Failed to get application states: %s", error->message); + warned = 1; + } + return NULL; }