summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2011-03-28 10:03:54 -0400
committerDavid Zeuthen <davidz@redhat.com>2011-03-28 10:03:54 -0400
commit208ca3685a16c7f682e858f4a57944866ff8a715 (patch)
tree85bcbee157596ef748d0df7f2b07797ecd32b940
parentd374c17bb083d8aea376185db7a2a3e849ab0c8f (diff)
Print a warning if Property.Set() fails
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r--src/codegen.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/codegen.py b/src/codegen.py
index dc7f793..471edf1 100644
--- a/src/codegen.py
+++ b/src/codegen.py
@@ -1084,13 +1084,31 @@ class CodeGenerator:
%(len(i.properties), i.name_lower))
self.c.write('}\n'
'\n')
+ if len(i.properties) > 0:
+ self.c.write('static void\n'
+ '%s_proxy_set_property_cb (GDBusProxy *proxy,\n'
+ ' GAsyncResult *res,\n'
+ ' gpointer user_data)\n'
+ '{\n'%(i.name_lower))
+ self.c.write(' const _ExtendedGDBusPropertyInfo *info = user_data;\n'
+ ' GError *error;\n'
+ ' error = NULL;\n'
+ ' if (!g_dbus_proxy_call_finish (proxy, res, &error))\n'
+ ' {\n'
+ ' g_warning ("Error setting property `%%s\' on interface %s: %%s (%%s, %%d)",\n'
+ ' info->parent_struct.name, \n'
+ ' error->message, g_quark_to_string (error->domain), error->code);\n'
+ ' g_error_free (error);\n'
+ ' }\n'
+ %(i.name))
+ self.c.write('}\n'
+ '\n')
self.c.write('static void\n'
'%s_proxy_set_property (GObject *object,\n'
' guint prop_id,\n'
' const GValue *value,\n'
' GParamSpec *pspec)\n'
'{\n'%(i.name_lower))
- # TODO: callback with g_warning() error reporting
if len(i.properties) > 0:
self.c.write(' const _ExtendedGDBusPropertyInfo *info;\n'
' GVariant *variant;\n'
@@ -1102,9 +1120,9 @@ class CodeGenerator:
' g_variant_new ("(ssv)", "%s", info->parent_struct.name, variant),\n'
' G_DBUS_CALL_FLAGS_NONE,\n'
' -1,\n'
- ' NULL, NULL, NULL);\n'
+ ' NULL, (GAsyncReadyCallback) %s_proxy_set_property_cb, (gpointer) info);\n'
' g_variant_unref (variant);\n'
- %(len(i.properties), i.name_lower, i.name))
+ %(len(i.properties), i.name_lower, i.name, i.name_lower))
self.c.write('}\n'
'\n')