diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-16 15:07:38 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-17 14:22:30 +0100 |
commit | c4bf0e46bdd37336f3a60886a3c76b25b8e91872 (patch) | |
tree | fa50bffdcfc41bd894310fca7d3fe857cf3a5b59 | |
parent | db40ad4e75885e5663a0c77a1595a52a8f7a2917 (diff) |
TpDBusPropertiesMixin: don't use TP_ERROR
We can't do that if we want to put it in the -dbus library. Using
InvalidArgs is consistent with GDBus.
-rw-r--r-- | telepathy-glib/dbus-properties-mixin.c | 18 | ||||
-rw-r--r-- | tests/dbus/account.c | 3 |
2 files changed, 11 insertions, 10 deletions
diff --git a/telepathy-glib/dbus-properties-mixin.c b/telepathy-glib/dbus-properties-mixin.c index 690942458..3723b47b6 100644 --- a/telepathy-glib/dbus-properties-mixin.c +++ b/telepathy-glib/dbus-properties-mixin.c @@ -672,7 +672,7 @@ _iface_impl_get_property_impl ( if (prop_impl == NULL) { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Unknown property %s on %s", property_name, interface_name); return FALSE; } @@ -681,14 +681,14 @@ _iface_impl_get_property_impl ( if ((prop_info->flags & TP_DBUS_PROPERTIES_MIXIN_FLAG_READ) == 0) { - g_set_error (error, TP_ERROR, TP_ERROR_PERMISSION_DENIED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Property %s on %s is write-only", property_name, interface_name); return FALSE; } if (iface_impl->getter == NULL) { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Getting properties on %s is unimplemented", interface_name); return FALSE; } @@ -735,7 +735,7 @@ tp_dbus_properties_mixin_get (GObject *self, if (iface_impl == NULL) { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No properties known for interface %s", interface_name); return FALSE; } @@ -1149,7 +1149,7 @@ tp_dbus_properties_mixin_set ( if (iface_impl == NULL) { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No properties known for interface '%s'", interface_name); return FALSE; } @@ -1161,7 +1161,7 @@ tp_dbus_properties_mixin_set ( if (prop_impl == NULL) { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Unknown property '%s' on interface '%s'", property_name, interface_name); return FALSE; @@ -1171,14 +1171,14 @@ tp_dbus_properties_mixin_set ( if ((prop_info->flags & TP_DBUS_PROPERTIES_MIXIN_FLAG_WRITE) == 0) { - g_set_error (error, TP_ERROR, TP_ERROR_PERMISSION_DENIED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "'%s.%s' is read-only", interface_name, property_name); return FALSE; } if (iface_impl->setter == NULL) { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Setting properties on '%s' is unimplemented", interface_name); return FALSE; } @@ -1189,7 +1189,7 @@ tp_dbus_properties_mixin_set ( if (!g_value_transform (value, ©)) { - g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Cannot convert %s to %s for property %s", g_type_name (G_VALUE_TYPE (value)), g_type_name (prop_info->type), diff --git a/tests/dbus/account.c b/tests/dbus/account.c index fc1b4da0c..036d485d2 100644 --- a/tests/dbus/account.c +++ b/tests/dbus/account.c @@ -263,7 +263,8 @@ test_setters (Test *test, &test->result); tp_tests_run_until_result (&test->result); tp_account_set_enabled_finish (test->account, test->result, &test->error); - g_assert_error (test->error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED); + /* this is what TpDBusPropertiesMixin raises for an unimplemented property */ + g_assert_error (test->error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); g_clear_error (&test->error); tp_clear_object (&test->result); } |