Don't display warnings when connecting to an app that no longer exists
authorMike Gorse <mgorse@suse.com>
Mon, 29 Feb 2016 17:51:45 +0000 (11:51 -0600)
committerMike Gorse <mgorse@suse.com>
Mon, 29 Feb 2016 17:51:45 +0000 (11:51 -0600)
If an application starts and subsequently exits before we've had time to
connect to it, then this at the very least should not trigger a warning.

atspi/atspi-misc.c

index 3a1d174..83d3f96 100644 (file)
@@ -201,7 +201,8 @@ handle_get_bus_address (DBusPendingCall *pending, void *user_data)
       }
       else
       {
-        g_warning ("Unable to open bus connection: %s", error.message);
+        if (!strcmp (error.name, DBUS_ERROR_FILE_NOT_FOUND))
+          g_warning ("Unable to open bus connection: %s", error.message);
         dbus_error_free (&error);
       }
     }
@@ -529,9 +530,16 @@ handle_get_items (DBusPendingCall *pending, void *user_data)
   {
     const char *sender = dbus_message_get_sender (reply);
     const char *error = NULL;
-    dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &error,
-                           DBUS_TYPE_INVALID);
-    g_warning ("AT-SPI: Error in GetItems, sender=%s, error=%s", sender, error);
+    if (!strcmp (dbus_message_get_error_name (reply),
+                 DBUS_ERROR_SERVICE_UNKNOWN))
+    {
+    }
+    else
+    {
+      dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &error,
+                             DBUS_TYPE_INVALID);
+      g_warning ("AT-SPI: Error in GetItems, sender=%s, error=%s", sender, error);
+    }
     dbus_message_unref (reply);
     dbus_pending_call_unref (pending);
     return;