[Pkg-telepathy-commits] [telepathy-glib-1] 183/212: TpDBusPropertiesMixin: don't use TP_ERROR

Simon McVittie smcv at debian.org
Wed May 14 12:09:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-glib-1.

commit 5af6b0f66e3921a1b6941161370e665c79945fab
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Apr 16 15:07:38 2014 +0100

    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.
    
    Reviewed-by: Xavier Claessens <xavier.claessens at collabora.com>
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77189
---
 telepathy-glib/dbus-properties-mixin.c | 18 +++++++++---------
 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 6909424..3723b47 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, &copy))
         {
-          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 fc1b4da..036d485 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);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib-1.git



More information about the Pkg-telepathy-commits mailing list