[at-spi2-atk] Use new dbus errors if they are available



commit ccc0eca4840cfeba27754b0cd2b576d9698068a4
Author: Mike Gorse <mgorse novell com>
Date:   Mon Mar 21 12:14:32 2011 -0700

    Use new dbus errors if they are available
    
    If a new version of libdbus is available, use DBUS_ERROR_UNKNOWN_OBJECT,
    DBUS_ERROR_UNKNOWN_PROPERTY, and DBUS_ERROR_PROPERTY_READ_ONLY when
    appropriate.

 droute/droute.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/droute/droute.c b/droute/droute.c
index b58402c..20c262f 100644
--- a/droute/droute.c
+++ b/droute/droute.c
@@ -326,7 +326,11 @@ impl_prop_GetSet (DBusMessage *message,
 
     prop_funcs = (PropertyPair *) g_hash_table_lookup (path->properties, &pair);
     if (!prop_funcs)
+#ifdef DBUS_ERROR_UNKNOWN_PROPERTY
+        return dbus_message_new_error (message, DBUS_ERROR_UNKNOWN_PROPERTY, "Property unavailable");
+#else
         return dbus_message_new_error (message, DBUS_ERROR_FAILED, "Property unavailable");
+#endif
 
     datum = path_get_datum (path, pathstr);
     if (!datum)
@@ -361,6 +365,12 @@ impl_prop_GetSet (DBusMessage *message,
 
         reply = dbus_message_new_method_return (message);
       }
+#ifdef DBUS_ERROR_PROPERTY_READ_ONLY
+    else if (!get)
+      {
+        reply = dbus_message_new_error (message, DBUS_ERROR_PROPERTY_READ_ONLY, "Property is read-only");
+      }
+#endif
     else
       {
         reply = dbus_message_new_error (message, DBUS_ERROR_FAILED, "Getter or setter unavailable");
@@ -596,9 +606,15 @@ droute_object_does_not_exist_error (DBusMessage *message)
             dbus_message_get_signature (message),
             dbus_message_get_interface (message),
             dbus_message_get_path (message));
+#ifdef DBUS_ERROR_UNKNOWN_OBJECT
+    reply = dbus_message_new_error (message,
+                                    DBUS_ERROR_UNKNOWN_OBJECT,
+                                    errmsg);
+#else
     reply = dbus_message_new_error (message,
                                     DBUS_ERROR_FAILED,
                                     errmsg);
+#endif
     g_free (errmsg);
     return reply;
 }



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