[gtk+] Only warn once if inhibit-related dbus calls fail



commit 4aa0d168652a629c3596015b6a9faaeb589ba4d1
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 3 00:48:42 2014 -0500

    Only warn once if inhibit-related dbus calls fail
    
    No need to spam about it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734140

 gtk/gtkapplication-dbus.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c
index 45136b0..0c45447 100644
--- a/gtk/gtkapplication-dbus.c
+++ b/gtk/gtkapplication-dbus.c
@@ -334,6 +334,7 @@ gtk_application_impl_dbus_inhibit (GtkApplicationImpl         *impl,
   GVariant *res;
   GError *error = NULL;
   guint cookie;
+  static gboolean warned = FALSE;
 
   if (dbus->sm_proxy == NULL)
     return 0;
@@ -352,7 +353,11 @@ gtk_application_impl_dbus_inhibit (GtkApplicationImpl         *impl,
 
  if (error)
     {
-      g_warning ("Calling Inhibit failed: %s", error->message);
+      if (!warned)
+        {
+          g_warning ("Calling Inhibit failed: %s", error->message);
+          warned = TRUE;
+        }
       g_error_free (error);
       return 0;
     }
@@ -390,6 +395,7 @@ gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl         *impl,
   GVariant *res;
   GError *error = NULL;
   gboolean inhibited;
+  static gboolean warned = FALSE;
 
   if (dbus->sm_proxy == NULL)
     return FALSE;
@@ -403,7 +409,11 @@ gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl         *impl,
                                 &error);
   if (error)
     {
-      g_warning ("Calling IsInhibited failed: %s", error->message);
+      if (!warned)
+        {
+          g_warning ("Calling IsInhibited failed: %s", error->message);
+          warned = TRUE;
+        }
       g_error_free (error);
       return FALSE;
     }


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