From 76d6fd01dec6fd3ae4cb21f4bdf1ad7ee521a2c2 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 9 Apr 2014 16:14:11 +0200 Subject: [PATCH] gio: Add newer dbus UnknownXxxx and PropertyReadOnly errors Add G_DBUS_ERROR codes for: * org.freedesktop.DBus.Error.UnknownObject * org.freedesktop.DBus.Error.UnknownInterface * org.freedesktop.DBus.Error.UnknownProperty * org.freedesktop.DBus.Error.PropertyReadOnly These were discussed on the dbus mailing list and introduced in the following libdbus commit: 2c34514620c4b79ea4ec71d1db583379138d01ac https://bugzilla.gnome.org/show_bug.cgi?id=727900 --- gio/gdbuserror.c | 6 +++++- gio/gioenums.h | 14 +++++++++++++- gio/tests/gdbus-error.c | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gio/gdbuserror.c b/gio/gdbuserror.c index 6308e1772..8dd4b7181 100644 --- a/gio/gdbuserror.c +++ b/gio/gdbuserror.c @@ -150,12 +150,16 @@ static const GDBusErrorEntry g_dbus_error_entries[] = {G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown"}, {G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN, "org.freedesktop.DBus.Error.AdtAuditDataUnknown"}, {G_DBUS_ERROR_OBJECT_PATH_IN_USE, "org.freedesktop.DBus.Error.ObjectPathInUse"}, + {G_DBUS_ERROR_UNKNOWN_OBJECT, "org.freedesktop.DBus.Error.UnknownObject"}, + {G_DBUS_ERROR_UNKNOWN_INTERFACE, "org.freedesktop.DBus.Error.UnknownInterface"}, + {G_DBUS_ERROR_UNKNOWN_PROPERTY, "org.freedesktop.DBus.Error.UnknownProperty"}, + {G_DBUS_ERROR_PROPERTY_READ_ONLY, "org.freedesktop.DBus.Error.PropertyReadOnly"}, }; GQuark g_dbus_error_quark (void) { - G_STATIC_ASSERT (G_N_ELEMENTS (g_dbus_error_entries) - 1 == G_DBUS_ERROR_OBJECT_PATH_IN_USE); + G_STATIC_ASSERT (G_N_ELEMENTS (g_dbus_error_entries) - 1 == G_DBUS_ERROR_PROPERTY_READ_ONLY); static volatile gsize quark_volatile = 0; g_dbus_error_register_error_domain ("g-dbus-error-quark", &quark_volatile, diff --git a/gio/gioenums.h b/gio/gioenums.h index 9eaef3185..9a7631f91 100644 --- a/gio/gioenums.h +++ b/gio/gioenums.h @@ -1030,6 +1030,14 @@ typedef enum * Existing file and the operation you're using does not silently overwrite. * @G_DBUS_ERROR_UNKNOWN_METHOD: * Method name you invoked isn't known by the object you invoked it on. + * @G_DBUS_ERROR_UNKNOWN_OBJECT: + * Object you invoked a method on isn't known. Since 2.42 + * @G_DBUS_ERROR_UNKNOWN_INTERFACE: + * Interface you invoked a method on isn't known by the object. Since 2.42 + * @G_DBUS_ERROR_UNKNOWN_PROPERTY: + * Property you tried to access isn't known by the object. Since 2.42 + * @G_DBUS_ERROR_PROPERTY_READ_ONLY: + * Property you tried to set is read-only. Since 2.42 * @G_DBUS_ERROR_TIMED_OUT: * Certain timeout errors, e.g. while starting a service. Warning: this is * confusingly-named given that %G_DBUS_ERROR_TIMEOUT also exists. We @@ -1122,7 +1130,11 @@ typedef enum G_DBUS_ERROR_INVALID_FILE_CONTENT, /* org.freedesktop.DBus.Error.InvalidFileContent */ G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN, /* org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown */ G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN, /* org.freedesktop.DBus.Error.AdtAuditDataUnknown */ - G_DBUS_ERROR_OBJECT_PATH_IN_USE /* org.freedesktop.DBus.Error.ObjectPathInUse */ + G_DBUS_ERROR_OBJECT_PATH_IN_USE, /* org.freedesktop.DBus.Error.ObjectPathInUse */ + G_DBUS_ERROR_UNKNOWN_OBJECT, /* org.freedesktop.DBus.Error.UnknownObject */ + G_DBUS_ERROR_UNKNOWN_INTERFACE, /* org.freedesktop.DBus.Error.UnknownInterface */ + G_DBUS_ERROR_UNKNOWN_PROPERTY, /* org.freedesktop.DBus.Error.UnknownProperty */ + G_DBUS_ERROR_PROPERTY_READ_ONLY, /* org.freedesktop.DBus.Error.PropertyReadOnly */ } GDBusError; /* Remember to update g_dbus_error_quark() in gdbuserror.c if you extend this enumeration */ diff --git a/gio/tests/gdbus-error.c b/gio/tests/gdbus-error.c index ccdac9701..960eb8911 100644 --- a/gio/tests/gdbus-error.c +++ b/gio/tests/gdbus-error.c @@ -73,6 +73,9 @@ test_registered_errors (void) check_registered_error ("org.freedesktop.DBus.Error.UnknownMethod", G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); + check_registered_error ("org.freedesktop.DBus.Error.UnknownObject", + G_DBUS_ERROR, + G_DBUS_ERROR_UNKNOWN_OBJECT); } /* ---------------------------------------------------------------------------------------------------- */