[vala/tintou/gdbus-properties: 228/228] Update expected C sources
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/tintou/gdbus-properties: 228/228] Update expected C sources
- Date: Sat, 7 Aug 2021 14:43:39 +0000 (UTC)
commit c26527ae0598770534311b2ac185958e1de52169
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Aug 7 16:43:00 2021 +0200
Update expected C sources
tests/dbus/arrays_client.c-expected | 131 +-
tests/dbus/arrays_server.c-expected | 26 +
tests/dbus/async-bus_client.c-expected | 85 +-
tests/dbus/async-connection_client.c-expected | 85 +-
tests/dbus/async-errors_client.c-expected | 85 +-
tests/dbus/async-no-reply_client.c-expected | 85 +-
tests/dbus/async_client.c-expected | 85 +-
tests/dbus/basic-types_client.c-expected | 162 ++-
tests/dbus/basic-types_server.c-expected | 52 +
tests/dbus/bug602003_client.c-expected | 85 +-
tests/dbus/bug735437_client.c-expected | 85 +-
tests/dbus/bug782719_client.c-expected | 85 +-
tests/dbus/bug783002_client.c-expected | 85 +-
tests/dbus/bug792277.c-expected | 85 +-
tests/dbus/connection_client.c-expected | 85 +-
tests/dbus/dicts_client.c-expected | 85 +-
tests/dbus/dicts_server.c-expected | 85 +-
tests/dbus/enum-string-marshalling.c-expected | 85 +-
tests/dbus/errors_client.c-expected | 85 +-
tests/dbus/filedescriptor-async_client.c-expected | 85 +-
tests/dbus/filedescriptor-errors_client.c-expected | 85 +-
tests/dbus/filedescriptor_client.c-expected | 85 +-
tests/dbus/generics_client.c-expected | 85 +-
tests/dbus/interface-info_client.c-expected | 85 +-
tests/dbus/no-reply_client.c-expected | 85 +-
tests/dbus/properties_client.c-expected | 1259 ++++++++++++++++++++
tests/dbus/properties_server.c-expected | 741 ++++++++++++
tests/dbus/rawvariants_client.c-expected | 248 +++-
tests/dbus/rawvariants_server.c-expected | 52 +
tests/dbus/signals_client.c-expected | 85 +-
tests/dbus/structs_client.c-expected | 129 +-
tests/dbus/structs_server.c-expected | 26 +
32 files changed, 4669 insertions(+), 27 deletions(-)
---
diff --git a/tests/dbus/arrays_client.c-expected b/tests/dbus/arrays_client.c-expected
index 8c17358f0..414fdcd58 100644
--- a/tests/dbus/arrays_client.c-expected
+++ b/tests/dbus/arrays_client.c-expected
@@ -28,6 +28,12 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_TEST_PROPERTY_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
@@ -68,10 +74,22 @@ VALA_EXTERN void test_set_test_property (Test* self,
gchar** value,
gint value_length1);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gint* test_proxy_test_int (Test* self,
gint* i,
gint i_length1,
@@ -124,6 +142,9 @@ static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
gpointer user_data);
static void _dbus_test_set_test_property (Test* self,
GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
static void _vala_main (void);
static void _vala_array_destroy (gpointer array,
@@ -218,6 +239,7 @@ static void
test_default_init (TestIface * iface,
gpointer iface_data)
{
+ g_object_interface_install_property (iface, g_param_spec_boxed ("test-property", "test-property",
"test-property", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}
static GType
@@ -250,7 +272,66 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_PROPERTY_PROPERTY, "test-property");
+ test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-property");
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ if (g_strcmp0 (dbus_property_name, "TestProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY];
+ }
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ {
+ int length;
+ g_value_take_boxed (value, test_dbus_proxy_get_test_property (self, &length));
+ }
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ {
+ gpointer boxed;
+ boxed = g_value_get_boxed (value);
+ test_dbus_proxy_set_test_property (self, boxed, (boxed == NULL) ? 0 : g_strv_length
(boxed));
+ }
+ break;
+ default:
+ return;
+ }
}
static void
@@ -261,6 +342,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
@@ -843,6 +949,27 @@ test_dbus_interface_set_property (GDBusConnection* connection,
return FALSE;
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -859,6 +986,7 @@ test_register_object (gpointer object,
if (!result) {
return 0;
}
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
return result;
}
@@ -867,6 +995,7 @@ _test_unregister_object (gpointer user_data)
{
gpointer* data;
data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/arrays_server.c-expected b/tests/dbus/arrays_server.c-expected
index 7cae17ed0..fff6cd234 100644
--- a/tests/dbus/arrays_server.c-expected
+++ b/tests/dbus/arrays_server.c-expected
@@ -132,6 +132,9 @@ static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
gpointer user_data);
static void _dbus_test_set_test_property (Test* self,
GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
VALA_EXTERN void client_exit (GPid pid,
gint status);
@@ -731,6 +734,27 @@ test_dbus_interface_set_property (GDBusConnection* connection,
return FALSE;
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -747,6 +771,7 @@ test_register_object (gpointer object,
if (!result) {
return 0;
}
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
return result;
}
@@ -755,6 +780,7 @@ _test_unregister_object (gpointer user_data)
{
gpointer* data;
data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/async-bus_client.c-expected b/tests/dbus/async-bus_client.c-expected
index 5bc147231..9dda0986c 100644
--- a/tests/dbus/async-bus_client.c-expected
+++ b/tests/dbus/async-bus_client.c-expected
@@ -27,6 +27,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
@@ -51,10 +56,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint test_get_test (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gint test_proxy_get_test (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -151,7 +168,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -162,6 +220,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/async-connection_client.c-expected b/tests/dbus/async-connection_client.c-expected
index 30ee60393..099661c4d 100644
--- a/tests/dbus/async-connection_client.c-expected
+++ b/tests/dbus/async-connection_client.c-expected
@@ -27,6 +27,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
@@ -51,10 +56,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint test_get_test (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gint test_proxy_get_test (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -151,7 +168,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -162,6 +220,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/async-errors_client.c-expected b/tests/dbus/async-errors_client.c-expected
index 4f9a12a28..991983b89 100644
--- a/tests/dbus/async-errors_client.c-expected
+++ b/tests/dbus/async-errors_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
typedef struct _TestTestVoidReadyData TestTestVoidReadyData;
typedef struct _TestTestIntReadyData TestTestIntReadyData;
typedef struct _TestTestStringReadyData TestTestStringReadyData;
@@ -132,10 +137,22 @@ VALA_EXTERN void test_test_cancellable_finish (Test* self,
GAsyncResult* _res_,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void _vala_g_async_ready_callback (GObject *source_object,
GAsyncResult *res,
void *user_data);
@@ -390,7 +407,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -401,6 +459,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/async-no-reply_client.c-expected b/tests/dbus/async-no-reply_client.c-expected
index abb397e7d..eebbc057d 100644
--- a/tests/dbus/async-no-reply_client.c-expected
+++ b/tests/dbus/async-no-reply_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
typedef struct _TestListMessagesReadyData TestListMessagesReadyData;
typedef struct _TestPostMessageReadyData TestPostMessageReadyData;
#define _g_free0(var) (var = (g_free (var), NULL))
@@ -144,10 +149,22 @@ VALA_EXTERN void test_post_message_finish (Test* self,
GAsyncResult* _res_,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void _vala_g_async_ready_callback (GObject *source_object,
GAsyncResult *res,
void *user_data);
@@ -330,7 +347,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -341,6 +399,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/async_client.c-expected b/tests/dbus/async_client.c-expected
index 659449fc2..b0fcce07e 100644
--- a/tests/dbus/async_client.c-expected
+++ b/tests/dbus/async_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
typedef struct _TestTestVoidReadyData TestTestVoidReadyData;
typedef struct _TestTestIntReadyData TestTestIntReadyData;
typedef struct _TestTestStringReadyData TestTestStringReadyData;
@@ -123,10 +128,22 @@ VALA_EXTERN gchar* test_test_string_finish (Test* self,
gchar* * t,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void _vala_g_async_ready_callback (GObject *source_object,
GAsyncResult *res,
void *user_data);
@@ -340,7 +357,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -351,6 +409,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/basic-types_client.c-expected b/tests/dbus/basic-types_client.c-expected
index 6d1d4b65c..3907d4ec2 100644
--- a/tests/dbus/basic-types_client.c-expected
+++ b/tests/dbus/basic-types_client.c-expected
@@ -28,6 +28,13 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_TEST_PROPERTY_PROPERTY,
+ TEST_PROXY_TEST_INT_PROPERTY_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
@@ -69,10 +76,22 @@ VALA_EXTERN gint test_get_test_int_property (Test* self);
VALA_EXTERN void test_set_test_int_property (Test* self,
gint value);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void test_proxy_test_void (Test* self,
GError** error);
static gint test_proxy_test_int (Test* self,
@@ -128,6 +147,12 @@ static void _dbus_test_set_test_property (Test* self,
GVariant* _value);
static void _dbus_test_set_test_int_property (Test* self,
GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
+static void _test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
static void _vala_main (void);
@@ -248,6 +273,8 @@ static void
test_default_init (TestIface * iface,
gpointer iface_data)
{
+ g_object_interface_install_property (iface, g_param_spec_string ("test-property", "test-property",
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_interface_install_property (iface, g_param_spec_int ("test-int-property",
"test-int-property", "test-int-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE |
G_PARAM_WRITABLE));
}
static GType
@@ -280,7 +307,69 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_PROPERTY_PROPERTY, "test-property");
+ test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-property");
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_INT_PROPERTY_PROPERTY,
"test-int-property");
+ test_proxy_properties[TEST_PROXY_TEST_INT_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-int-property");
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ if (g_strcmp0 (dbus_property_name, "TestProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY];
+ } else if (g_strcmp0 (dbus_property_name, "TestIntProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_INT_PROPERTY_PROPERTY];
+ }
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ g_value_take_string (value, test_dbus_proxy_get_test_property (self));
+ break;
+ case TEST_PROXY_TEST_INT_PROPERTY_PROPERTY:
+ g_value_set_int (value, test_dbus_proxy_get_test_int_property (self));
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ test_dbus_proxy_set_test_property (self, g_value_get_string (value));
+ break;
+ case TEST_PROXY_TEST_INT_PROPERTY_PROPERTY:
+ test_dbus_proxy_set_test_int_property (self, g_value_get_int (value));
+ break;
+ default:
+ return;
+ }
}
static void
@@ -291,6 +380,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
@@ -730,6 +844,48 @@ test_dbus_interface_set_property (GDBusConnection* connection,
return FALSE;
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
+static void
+_test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_int_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestIntProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -746,6 +902,8 @@ test_register_object (gpointer object,
if (!result) {
return 0;
}
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
+ g_signal_connect (object, "notify::test-int-property", (GCallback) _test_notify_test_int_property,
data);
return result;
}
@@ -754,6 +912,8 @@ _test_unregister_object (gpointer user_data)
{
gpointer* data;
data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_int_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/basic-types_server.c-expected b/tests/dbus/basic-types_server.c-expected
index f0731f71b..41b330f90 100644
--- a/tests/dbus/basic-types_server.c-expected
+++ b/tests/dbus/basic-types_server.c-expected
@@ -131,6 +131,12 @@ static void _dbus_test_set_test_property (Test* self,
GVariant* _value);
static void _dbus_test_set_test_int_property (Test* self,
GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
+static void _test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
VALA_EXTERN void client_exit (GPid pid,
gint status);
@@ -577,6 +583,48 @@ test_dbus_interface_set_property (GDBusConnection* connection,
return FALSE;
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
+static void
+_test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_int_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestIntProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -593,6 +641,8 @@ test_register_object (gpointer object,
if (!result) {
return 0;
}
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
+ g_signal_connect (object, "notify::test-int-property", (GCallback) _test_notify_test_int_property,
data);
return result;
}
@@ -601,6 +651,8 @@ _test_unregister_object (gpointer user_data)
{
gpointer* data;
data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_int_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/bug602003_client.c-expected b/tests/dbus/bug602003_client.c-expected
index 38836347a..abedfe8af 100644
--- a/tests/dbus/bug602003_client.c-expected
+++ b/tests/dbus/bug602003_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
@@ -49,10 +54,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GVariant* test_test_string (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static GVariant* test_proxy_test_string (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -152,7 +169,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -163,6 +221,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/bug735437_client.c-expected b/tests/dbus/bug735437_client.c-expected
index dae32bff8..ec3fe2f99 100644
--- a/tests/dbus/bug735437_client.c-expected
+++ b/tests/dbus/bug735437_client.c-expected
@@ -30,6 +30,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
@@ -62,10 +67,22 @@ VALA_EXTERN gchar** test_multi_array2 (Test* self,
gint* result_length3,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gdouble* test_proxy_array (Test* self,
gint* result_length1,
GError** error);
@@ -219,7 +236,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -230,6 +288,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/bug782719_client.c-expected b/tests/dbus/bug782719_client.c-expected
index a5883c89f..ceade57e2 100644
--- a/tests/dbus/bug782719_client.c-expected
+++ b/tests/dbus/bug782719_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
@@ -50,10 +55,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GHashTable* test_test_nested_dict (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static GHashTable* test_proxy_test_nested_dict (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -153,7 +170,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -164,6 +222,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/bug783002_client.c-expected b/tests/dbus/bug783002_client.c-expected
index f87ad4c6a..2d581b820 100644
--- a/tests/dbus/bug783002_client.c-expected
+++ b/tests/dbus/bug783002_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
typedef struct _TestTestArrayLifetimeReadyData TestTestArrayLifetimeReadyData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
@@ -90,10 +95,22 @@ VALA_EXTERN gchar* test_test_array_lifetime_finish (Test* self,
GAsyncResult* _res_,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void _vala_g_async_ready_callback (GObject *source_object,
GAsyncResult *res,
void *user_data);
@@ -226,7 +243,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -237,6 +295,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/bug792277.c-expected b/tests/dbus/bug792277.c-expected
index 63cea38d3..37733ac0d 100644
--- a/tests/dbus/bug792277.c-expected
+++ b/tests/dbus/bug792277.c-expected
@@ -27,6 +27,11 @@ typedef struct _IFooIface IFooIface;
#define TYPE_IFOO_PROXY (ifoo_proxy_get_type ())
typedef GDBusProxy IFooProxy;
typedef GDBusProxyClass IFooProxyClass;
+enum {
+ IFOO_PROXY_0_PROPERTY,
+ IFOO_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* ifoo_proxy_properties[IFOO_PROXY_NUM_PROPERTIES];
#define TYPE_FOO (foo_get_type ())
#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
@@ -74,10 +79,22 @@ VALA_EXTERN void ifoo_method1 (IFoo* self,
GError** error);
VALA_EXTERN void ifoo_method2 (IFoo* self);
static GType ifoo_get_type_once (void);
+static GParamSpec * _vala_ifoo_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void ifoo_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void ifoo_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void ifoo_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void ifoo_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void ifoo_proxy_method0 (IFoo* self,
GError** error);
static void ifoo_proxy_method1 (IFoo* self,
@@ -254,7 +271,48 @@ G_DEFINE_TYPE_EXTENDED (IFooProxy, ifoo_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
ifoo_proxy_class_init (IFooProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = ifoo_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = ifoo_proxy_g_signal;
+ proxy_class->g_properties_changed = ifoo_proxy_g_properties_changed;
+ object_class->get_property = ifoo_proxy_get_property;
+ object_class->set_property = ifoo_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_ifoo_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+ifoo_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ IFoo * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_IFOO, IFoo);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+ifoo_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ IFoo * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_IFOO, IFoo);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -265,6 +323,31 @@ ifoo_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+ifoo_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_ifoo_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_ifoo_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
ifoo_proxy_init (IFooProxy* self)
{
diff --git a/tests/dbus/connection_client.c-expected b/tests/dbus/connection_client.c-expected
index d25dbb971..6a8981ae6 100644
--- a/tests/dbus/connection_client.c-expected
+++ b/tests/dbus/connection_client.c-expected
@@ -27,6 +27,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
@@ -47,10 +52,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint test_get_test (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gint test_proxy_get_test (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -142,7 +159,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -153,6 +211,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/dicts_client.c-expected b/tests/dbus/dicts_client.c-expected
index d7de6e2fc..d532f957c 100644
--- a/tests/dbus/dicts_client.c-expected
+++ b/tests/dbus/dicts_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
@@ -50,10 +55,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GHashTable* test_test_dict (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static GHashTable* test_proxy_test_dict (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -153,7 +170,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -164,6 +222,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/dicts_server.c-expected b/tests/dbus/dicts_server.c-expected
index 90cafa765..f7aca16f6 100644
--- a/tests/dbus/dicts_server.c-expected
+++ b/tests/dbus/dicts_server.c-expected
@@ -45,6 +45,11 @@ typedef struct _TestInterfaceBarIface TestInterfaceBarIface;
#define TEST_INTERFACE_TYPE_BAR_PROXY (test_interface_bar_proxy_get_type ())
typedef GDBusProxy TestInterfaceBarProxy;
typedef GDBusProxyClass TestInterfaceBarProxyClass;
+enum {
+ TEST_INTERFACE_BAR_PROXY_0_PROPERTY,
+ TEST_INTERFACE_BAR_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_interface_bar_proxy_properties[TEST_INTERFACE_BAR_PROXY_NUM_PROPERTIES];
#define TEST_INTERFACE_TYPE_FOO (test_interface_foo_get_type ())
#define TEST_INTERFACE_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_INTERFACE_TYPE_FOO,
TestInterfaceFoo))
@@ -148,10 +153,22 @@ VALA_EXTERN GType test_interface_bar_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GHashTable* test_interface_bar_foo (TestInterfaceBar* self,
GError** error);
static GType test_interface_bar_get_type_once (void);
+static GParamSpec * _vala_test_interface_bar_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_interface_bar_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_interface_bar_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_interface_bar_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_interface_bar_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static GHashTable* test_interface_bar_proxy_foo (TestInterfaceBar* self,
GError** error);
static void test_interface_bar_proxy_test_interface_bar_interface_init (TestInterfaceBarIface* iface);
@@ -501,7 +518,48 @@ G_DEFINE_TYPE_EXTENDED (TestInterfaceBarProxy, test_interface_bar_proxy, G_TYPE_
static void
test_interface_bar_proxy_class_init (TestInterfaceBarProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_interface_bar_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_interface_bar_proxy_g_signal;
+ proxy_class->g_properties_changed = test_interface_bar_proxy_g_properties_changed;
+ object_class->get_property = test_interface_bar_proxy_get_property;
+ object_class->set_property = test_interface_bar_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_interface_bar_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_interface_bar_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ TestInterfaceBar * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TEST_INTERFACE_TYPE_BAR, TestInterfaceBar);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_interface_bar_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ TestInterfaceBar * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TEST_INTERFACE_TYPE_BAR, TestInterfaceBar);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -512,6 +570,31 @@ test_interface_bar_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_interface_bar_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_interface_bar_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_interface_bar_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_interface_bar_proxy_init (TestInterfaceBarProxy* self)
{
diff --git a/tests/dbus/enum-string-marshalling.c-expected b/tests/dbus/enum-string-marshalling.c-expected
index bf75b7b5a..f3971294f 100644
--- a/tests/dbus/enum-string-marshalling.c-expected
+++ b/tests/dbus/enum-string-marshalling.c-expected
@@ -33,6 +33,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
typedef struct _TestTest1ReadyData TestTest1ReadyData;
typedef struct _TestTest5ReadyData TestTest5ReadyData;
@@ -91,10 +96,22 @@ VALA_EXTERN void test_test5 (Test* self,
VALA_EXTERN void test_test5_finish (Test* self,
GAsyncResult* _res_);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void _vala_g_async_ready_callback (GObject *source_object,
GAsyncResult *res,
void *user_data);
@@ -368,7 +385,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -379,6 +437,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/errors_client.c-expected b/tests/dbus/errors_client.c-expected
index f8f2acc04..d53071494 100644
--- a/tests/dbus/errors_client.c-expected
+++ b/tests/dbus/errors_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
@@ -74,10 +79,22 @@ VALA_EXTERN void test_test_cancellable (Test* self,
VALA_EXTERN void test_test_custom_error (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void test_proxy_test_void (Test* self,
GError** error);
static gint test_proxy_test_int (Test* self,
@@ -274,7 +291,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -285,6 +343,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/filedescriptor-async_client.c-expected
b/tests/dbus/filedescriptor-async_client.c-expected
index 0c6bcb8d0..16aef75e4 100644
--- a/tests/dbus/filedescriptor-async_client.c-expected
+++ b/tests/dbus/filedescriptor-async_client.c-expected
@@ -30,6 +30,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
typedef struct _TestTestInReadyData TestTestInReadyData;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _RunData RunData;
@@ -126,10 +131,22 @@ VALA_EXTERN GUnixInputStream* test_test_in_finish (Test* self,
GUnixInputStream* * j,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void _vala_g_async_ready_callback (GObject *source_object,
GAsyncResult *res,
void *user_data);
@@ -257,7 +274,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -268,6 +326,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/filedescriptor-errors_client.c-expected
b/tests/dbus/filedescriptor-errors_client.c-expected
index dde04e5dd..0d3795d8b 100644
--- a/tests/dbus/filedescriptor-errors_client.c-expected
+++ b/tests/dbus/filedescriptor-errors_client.c-expected
@@ -32,6 +32,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
@@ -50,10 +55,22 @@ VALA_EXTERN gchar* test_test (Test* self,
GUnixOutputStream* output_stream,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gchar* test_proxy_test (Test* self,
GUnixOutputStream* output_stream,
GError** error);
@@ -151,7 +168,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -162,6 +220,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/filedescriptor_client.c-expected b/tests/dbus/filedescriptor_client.c-expected
index d22be7c38..e720e47f8 100644
--- a/tests/dbus/filedescriptor_client.c-expected
+++ b/tests/dbus/filedescriptor_client.c-expected
@@ -30,6 +30,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
@@ -52,10 +57,22 @@ VALA_EXTERN GUnixInputStream* test_test_in (Test* self,
GUnixInputStream* * j,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static GUnixInputStream* test_proxy_test_in (Test* self,
GUnixInputStream* i,
GUnixInputStream* * j,
@@ -153,7 +170,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -164,6 +222,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/generics_client.c-expected b/tests/dbus/generics_client.c-expected
index eaada2f07..f454de812 100644
--- a/tests/dbus/generics_client.c-expected
+++ b/tests/dbus/generics_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
@@ -48,10 +53,22 @@ VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint test_get_test (Test* self,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gint test_proxy_get_test (Test* self,
GError** error);
static void test_proxy_test_interface_init (TestIface* iface);
@@ -149,7 +166,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -160,6 +218,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/interface-info_client.c-expected b/tests/dbus/interface-info_client.c-expected
index 9ae2ff2b7..bae0ab727 100644
--- a/tests/dbus/interface-info_client.c-expected
+++ b/tests/dbus/interface-info_client.c-expected
@@ -33,6 +33,11 @@ enum {
static guint test_signals[TEST_NUM_SIGNALS] = {0};
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
@@ -54,12 +59,24 @@ VALA_EXTERN guint test_register_object (void* object,
const gchar* path,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
static void _dbus_handle_test_bar (Test* self,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void test_proxy_test_interface_init (TestIface* iface);
static void test_dbus_interface_method_call (GDBusConnection* connection,
const gchar* sender,
@@ -137,7 +154,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -166,6 +224,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
}
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/no-reply_client.c-expected b/tests/dbus/no-reply_client.c-expected
index 106c9a2b2..35b005172 100644
--- a/tests/dbus/no-reply_client.c-expected
+++ b/tests/dbus/no-reply_client.c-expected
@@ -28,6 +28,11 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block1Data Block1Data;
#define _g_async_queue_unref0(var) ((var == NULL) ? NULL : (var = (g_async_queue_unref (var), NULL)))
@@ -127,10 +132,22 @@ VALA_EXTERN void test_post_message_no_reply (Test* self,
const gchar* message,
GError** error);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gchar** test_proxy_list_messages (Test* self,
gint* result_length1,
GError** error);
@@ -295,7 +312,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -306,6 +364,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/properties_client.c-expected b/tests/dbus/properties_client.c-expected
new file mode 100644
index 000000000..b003aab9f
--- /dev/null
+++ b/tests/dbus/properties_client.c-expected
@@ -0,0 +1,1259 @@
+/* dbus_properties_client.c generated by valac, the Vala compiler
+ * generated from dbus_properties_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_TEST_PROPERTY_PROPERTY,
+ TEST_PROXY_TEST_INT_PROPERTY_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_TEST2 (test2_get_type ())
+#define TEST2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST2, Test2))
+#define TEST2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST2, Test2Class))
+#define IS_TEST2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST2))
+#define IS_TEST2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST2))
+#define TEST2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST2, Test2Class))
+
+typedef struct _Test2 Test2;
+typedef struct _Test2Class Test2Class;
+typedef struct _Test2Private Test2Private;
+enum {
+ TEST2_0_PROPERTY,
+ TEST2_TEST_PROPERTY_PROPERTY,
+ TEST2_TEST_INT_PROPERTY_PROPERTY,
+ TEST2_NUM_PROPERTIES
+};
+static GParamSpec* test2_properties[TEST2_NUM_PROPERTIES];
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _Block2Data Block2Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+ GTypeInterface parent_iface;
+ void (*change_everything) (Test* self, GError** error);
+ void (*check_everything) (Test* self, GError** error);
+ gchar* (*get_test_property) (Test* self);
+ void (*set_test_property) (Test* self, const gchar* value);
+ gint (*get_test_int_property) (Test* self);
+ void (*set_test_int_property) (Test* self, gint value);
+};
+
+struct _Test2 {
+ GObject parent_instance;
+ Test2Private * priv;
+};
+
+struct _Test2Class {
+ GObjectClass parent_class;
+};
+
+struct _Test2Private {
+ gchar* _test_property;
+ gint _test_int_property;
+};
+
+struct _Block1Data {
+ int _ref_count_;
+ GMainLoop* main_loop;
+};
+
+struct _Block2Data {
+ int _ref_count_;
+ GMainLoop* main_loop2;
+};
+
+static gint Test2_private_offset;
+static gpointer test2_parent_class = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+ GDBusConnection* connection,
+ const gchar* path,
+ GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_change_everything (Test* self,
+ GError** error);
+VALA_EXTERN void test_check_everything (Test* self,
+ GError** error);
+VALA_EXTERN gchar* test_get_test_property (Test* self);
+VALA_EXTERN void test_set_test_property (Test* self,
+ const gchar* value);
+VALA_EXTERN gint test_get_test_int_property (Test* self);
+VALA_EXTERN void test_set_test_int_property (Test* self,
+ gint value);
+static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+ const gchar* sender_name,
+ const gchar* signal_name,
+ GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
+static void test_proxy_change_everything (Test* self,
+ GError** error);
+static void test_proxy_check_everything (Test* self,
+ GError** error);
+static gchar* test_dbus_proxy_get_test_property (Test* self);
+static void test_dbus_proxy_set_test_property (Test* self,
+ const gchar* value);
+static gint test_dbus_proxy_get_test_int_property (Test* self);
+static void test_dbus_proxy_set_test_int_property (Test* self,
+ gint value);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_change_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation);
+static void _dbus_test_check_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* method_name,
+ GVariant* parameters,
+ GDBusMethodInvocation* invocation,
+ gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GError** error,
+ gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static GVariant* _dbus_test_get_test_int_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GVariant* value,
+ GError** error,
+ gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+ GVariant* _value);
+static void _dbus_test_set_test_int_property (Test* self,
+ GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
+static void _test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN GType test2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test2, g_object_unref)
+VALA_EXTERN Test2* test2_new (void);
+VALA_EXTERN Test2* test2_construct (GType object_type);
+VALA_EXTERN const gchar* test2_get_test_property (Test2* self);
+VALA_EXTERN void test2_set_test_property (Test2* self,
+ const gchar* value);
+VALA_EXTERN gint test2_get_test_int_property (Test2* self);
+VALA_EXTERN void test2_set_test_int_property (Test2* self,
+ gint value);
+static void test2_finalize (GObject * obj);
+static GType test2_get_type_once (void);
+static void _vala_test2_get_property (GObject * object,
+ guint property_id,
+ GValue * value,
+ GParamSpec * pspec);
+static void _vala_test2_set_property (GObject * object,
+ guint property_id,
+ const GValue * value,
+ GParamSpec * pspec);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void ___lambda4_ (Block1Data* _data1_,
+ GParamSpec* p);
+static void ____lambda4__g_object_notify (GObject* _sender,
+ GParamSpec* pspec,
+ gpointer self);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static void ___lambda5_ (Block2Data* _data2_,
+ GParamSpec* p);
+static void ____lambda5__g_object_notify (GObject* _sender,
+ GParamSpec* pspec,
+ gpointer self);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_change_everything_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_change_everything_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_change_everything = {-1, "ChangeEverything",
(GDBusArgInfo **) (&_test_dbus_arg_info_change_everything_in), (GDBusArgInfo **)
(&_test_dbus_arg_info_change_everything_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_check_everything_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_check_everything_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_check_everything = {-1, "CheckEverything", (GDBusArgInfo
**) (&_test_dbus_arg_info_check_everything_in), (GDBusArgInfo **)
(&_test_dbus_arg_info_check_everything_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_change_everything,
&_test_dbus_method_info_check_everything, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_int_property = {-1, "TestIntProperty", "i",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] =
{&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **)
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **)
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call,
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_change_everything (Test* self,
+ GError** error)
+{
+ TestIface* _iface_;
+ g_return_if_fail (IS_TEST (self));
+ _iface_ = TEST_GET_INTERFACE (self);
+ if (_iface_->change_everything) {
+ _iface_->change_everything (self, error);
+ }
+}
+
+void
+test_check_everything (Test* self,
+ GError** error)
+{
+ TestIface* _iface_;
+ g_return_if_fail (IS_TEST (self));
+ _iface_ = TEST_GET_INTERFACE (self);
+ if (_iface_->check_everything) {
+ _iface_->check_everything (self, error);
+ }
+}
+
+gchar*
+test_get_test_property (Test* self)
+{
+ TestIface* _iface_;
+ g_return_val_if_fail (IS_TEST (self), NULL);
+ _iface_ = TEST_GET_INTERFACE (self);
+ if (_iface_->get_test_property) {
+ return _iface_->get_test_property (self);
+ }
+ return NULL;
+}
+
+void
+test_set_test_property (Test* self,
+ const gchar* value)
+{
+ TestIface* _iface_;
+ g_return_if_fail (IS_TEST (self));
+ _iface_ = TEST_GET_INTERFACE (self);
+ if (_iface_->set_test_property) {
+ _iface_->set_test_property (self, value);
+ }
+}
+
+gint
+test_get_test_int_property (Test* self)
+{
+ TestIface* _iface_;
+ g_return_val_if_fail (IS_TEST (self), 0);
+ _iface_ = TEST_GET_INTERFACE (self);
+ if (_iface_->get_test_int_property) {
+ return _iface_->get_test_int_property (self);
+ }
+ return -1;
+}
+
+void
+test_set_test_int_property (Test* self,
+ gint value)
+{
+ TestIface* _iface_;
+ g_return_if_fail (IS_TEST (self));
+ _iface_ = TEST_GET_INTERFACE (self);
+ if (_iface_->set_test_int_property) {
+ _iface_->set_test_int_property (self, value);
+ }
+}
+
+static void
+test_default_init (TestIface * iface,
+ gpointer iface_data)
+{
+ g_object_interface_install_property (iface, g_param_spec_string ("test-property", "test-property",
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_interface_install_property (iface, g_param_spec_int ("test-int-property",
"test-int-property", "test-int-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE |
G_PARAM_WRITABLE));
+}
+
+static GType
+test_get_type_once (void)
+{
+ static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0,
(GInstanceInitFunc) NULL, NULL };
+ GType test_type_id;
+ test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+ g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*)
test_proxy_get_type);
+ g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"),
"org.example.Test");
+ g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*)
(&_test_dbus_interface_info));
+ g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*)
test_register_object);
+ return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+ static volatile gsize test_type_id__volatile = 0;
+ if (g_once_init_enter (&test_type_id__volatile)) {
+ GType test_type_id;
+ test_type_id = test_get_type_once ();
+ g_once_init_leave (&test_type_id__volatile, test_type_id);
+ }
+ return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST,
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_PROPERTY_PROPERTY, "test-property");
+ test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-property");
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_INT_PROPERTY_PROPERTY,
"test-int-property");
+ test_proxy_properties[TEST_PROXY_TEST_INT_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-int-property");
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ if (g_strcmp0 (dbus_property_name, "TestProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY];
+ } else if (g_strcmp0 (dbus_property_name, "TestIntProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_INT_PROPERTY_PROPERTY];
+ }
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ g_value_take_string (value, test_dbus_proxy_get_test_property (self));
+ break;
+ case TEST_PROXY_TEST_INT_PROPERTY_PROPERTY:
+ g_value_set_int (value, test_dbus_proxy_get_test_int_property (self));
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ test_dbus_proxy_set_test_property (self, g_value_get_string (value));
+ break;
+ case TEST_PROXY_TEST_INT_PROPERTY_PROPERTY:
+ test_dbus_proxy_set_test_int_property (self, g_value_get_int (value));
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+ const gchar* sender_name,
+ const gchar* signal_name,
+ GVariant* parameters)
+{
+}
+
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+ g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *)
(&_test_dbus_interface_info));
+}
+
+static void
+test_proxy_change_everything (Test* self,
+ GError** error)
+{
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ GDBusMessage *_reply_message;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self),
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "ChangeEverything");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout
((GDBusProxy *) self), NULL, NULL, error);
+ g_object_unref (_message);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_check_everything (Test* self,
+ GError** error)
+{
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ GDBusMessage *_reply_message;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self),
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "CheckEverything");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout
((GDBusProxy *) self), NULL, NULL, error);
+ g_object_unref (_message);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+static gchar*
+test_dbus_proxy_get_test_property (Test* self)
+{
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get",
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+static void
+test_dbus_proxy_set_test_property (Test* self,
+ const gchar* value)
+{
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set",
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+static gint
+test_dbus_proxy_get_test_int_property (Test* self)
+{
+ GVariant *_inner_reply;
+ gint _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestIntProperty");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestIntProperty"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get",
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ gint _tmp0_ = 0;
+ return _tmp0_;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_int32 (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+static void
+test_dbus_proxy_set_test_int_property (Test* self,
+ gint value)
+{
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestIntProperty"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set",
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+ iface->change_everything = test_proxy_change_everything;
+ iface->check_everything = test_proxy_check_everything;
+ iface->get_test_property = test_dbus_proxy_get_test_property;
+ iface->set_test_property = test_dbus_proxy_set_test_property;
+ iface->get_test_int_property = test_dbus_proxy_get_test_int_property;
+ iface->set_test_int_property = test_dbus_proxy_set_test_int_property;
+}
+
+static void
+_dbus_test_change_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation)
+{
+ GError* error = NULL;
+ GVariantIter _arguments_iter;
+ GDBusMessage* _reply_message = NULL;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ g_variant_iter_init (&_arguments_iter, _parameters_);
+ test_change_everything (self, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ g_error_free (error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_check_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation)
+{
+ GError* error = NULL;
+ GVariantIter _arguments_iter;
+ GDBusMessage* _reply_message = NULL;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ g_variant_iter_init (&_arguments_iter, _parameters_);
+ test_check_everything (self, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ g_error_free (error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* method_name,
+ GVariant* parameters,
+ GDBusMethodInvocation* invocation,
+ gpointer user_data)
+{
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "ChangeEverything") == 0) {
+ _dbus_test_change_everything (object, parameters, invocation);
+ } else if (strcmp (method_name, "CheckEverything") == 0) {
+ _dbus_test_check_everything (object, parameters, invocation);
+ } else {
+ g_object_unref (invocation);
+ }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+ gchar* result;
+ GVariant* _reply;
+ result = test_get_test_property (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+static GVariant*
+_dbus_test_get_test_int_property (Test* self)
+{
+ gint result;
+ GVariant* _reply;
+ result = test_get_test_int_property (self);
+ _reply = g_variant_new_int32 (result);
+ return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GError** error,
+ gpointer user_data)
+{
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "TestProperty") == 0) {
+ return _dbus_test_get_test_property (object);
+ } else if (strcmp (property_name, "TestIntProperty") == 0) {
+ return _dbus_test_get_test_int_property (object);
+ }
+ return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+ GVariant* _value)
+{
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ test_set_test_property (self, value);
+ _g_free0 (value);
+}
+
+static void
+_dbus_test_set_test_int_property (Test* self,
+ GVariant* _value)
+{
+ gint value = 0;
+ value = g_variant_get_int32 (_value);
+ test_set_test_int_property (self, value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GVariant* value,
+ GError** error,
+ gpointer user_data)
+{
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "TestProperty") == 0) {
+ _dbus_test_set_test_property (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "TestIntProperty") == 0) {
+ _dbus_test_set_test_int_property (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
+static void
+_test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_int_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestIntProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
+guint
+test_register_object (gpointer object,
+ GDBusConnection* connection,
+ const gchar* path,
+ GError** error)
+{
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *)
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
+ g_signal_connect (object, "notify::test-int-property", (GCallback) _test_notify_test_int_property,
data);
+ return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+ gpointer* data;
+ data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_int_property, data);
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+static inline gpointer
+test2_get_instance_private (Test2* self)
+{
+ return G_STRUCT_MEMBER_P (self, Test2_private_offset);
+}
+
+Test2*
+test2_construct (GType object_type)
+{
+ Test2 * self = NULL;
+ self = (Test2*) g_object_new (object_type, NULL);
+ return self;
+}
+
+Test2*
+test2_new (void)
+{
+ return test2_construct (TYPE_TEST2);
+}
+
+const gchar*
+test2_get_test_property (Test2* self)
+{
+ const gchar* result;
+ const gchar* _tmp0_;
+ g_return_val_if_fail (IS_TEST2 (self), NULL);
+ _tmp0_ = self->priv->_test_property;
+ result = _tmp0_;
+ return result;
+}
+
+void
+test2_set_test_property (Test2* self,
+ const gchar* value)
+{
+ gchar* old_value;
+ g_return_if_fail (IS_TEST2 (self));
+ old_value = test2_get_test_property (self);
+ if (g_strcmp0 (value, old_value) != 0) {
+ gchar* _tmp0_;
+ _tmp0_ = g_strdup (value);
+ _g_free0 (self->priv->_test_property);
+ self->priv->_test_property = _tmp0_;
+ g_object_notify_by_pspec ((GObject *) self, test2_properties[TEST2_TEST_PROPERTY_PROPERTY]);
+ }
+}
+
+gint
+test2_get_test_int_property (Test2* self)
+{
+ gint result;
+ g_return_val_if_fail (IS_TEST2 (self), 0);
+ result = self->priv->_test_int_property;
+ return result;
+}
+
+void
+test2_set_test_int_property (Test2* self,
+ gint value)
+{
+ gint old_value;
+ g_return_if_fail (IS_TEST2 (self));
+ old_value = test2_get_test_int_property (self);
+ if (old_value != value) {
+ self->priv->_test_int_property = value;
+ g_object_notify_by_pspec ((GObject *) self,
test2_properties[TEST2_TEST_INT_PROPERTY_PROPERTY]);
+ }
+}
+
+static void
+test2_class_init (Test2Class * klass,
+ gpointer klass_data)
+{
+ test2_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_adjust_private_offset (klass, &Test2_private_offset);
+ G_OBJECT_CLASS (klass)->get_property = _vala_test2_get_property;
+ G_OBJECT_CLASS (klass)->set_property = _vala_test2_set_property;
+ G_OBJECT_CLASS (klass)->finalize = test2_finalize;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), TEST2_TEST_PROPERTY_PROPERTY,
test2_properties[TEST2_TEST_PROPERTY_PROPERTY] = g_param_spec_string ("test-property", "test-property",
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), TEST2_TEST_INT_PROPERTY_PROPERTY,
test2_properties[TEST2_TEST_INT_PROPERTY_PROPERTY] = g_param_spec_int ("test-int-property",
"test-int-property", "test-int-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE |
G_PARAM_WRITABLE));
+}
+
+static void
+test2_instance_init (Test2 * self,
+ gpointer klass)
+{
+ self->priv = test2_get_instance_private (self);
+}
+
+static void
+test2_finalize (GObject * obj)
+{
+ Test2 * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST2, Test2);
+ _g_free0 (self->priv->_test_property);
+ G_OBJECT_CLASS (test2_parent_class)->finalize (obj);
+}
+
+static GType
+test2_get_type_once (void)
+{
+ static const GTypeInfo g_define_type_info = { sizeof (Test2Class), (GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test2),
0, (GInstanceInitFunc) test2_instance_init, NULL };
+ GType test2_type_id;
+ test2_type_id = g_type_register_static (G_TYPE_OBJECT, "Test2", &g_define_type_info, 0);
+ Test2_private_offset = g_type_add_instance_private (test2_type_id, sizeof (Test2Private));
+ return test2_type_id;
+}
+
+GType
+test2_get_type (void)
+{
+ static volatile gsize test2_type_id__volatile = 0;
+ if (g_once_init_enter (&test2_type_id__volatile)) {
+ GType test2_type_id;
+ test2_type_id = test2_get_type_once ();
+ g_once_init_leave (&test2_type_id__volatile, test2_type_id);
+ }
+ return test2_type_id__volatile;
+}
+
+static void
+_vala_test2_get_property (GObject * object,
+ guint property_id,
+ GValue * value,
+ GParamSpec * pspec)
+{
+ Test2 * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST2, Test2);
+ switch (property_id) {
+ case TEST2_TEST_PROPERTY_PROPERTY:
+ g_value_set_string (value, test2_get_test_property (self));
+ break;
+ case TEST2_TEST_INT_PROPERTY_PROPERTY:
+ g_value_set_int (value, test2_get_test_int_property (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+_vala_test2_set_property (GObject * object,
+ guint property_id,
+ const GValue * value,
+ GParamSpec * pspec)
+{
+ Test2 * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST2, Test2);
+ switch (property_id) {
+ case TEST2_TEST_PROPERTY_PROPERTY:
+ test2_set_test_property (self, g_value_get_string (value));
+ break;
+ case TEST2_TEST_INT_PROPERTY_PROPERTY:
+ test2_set_test_int_property (self, g_value_get_int (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+ g_atomic_int_inc (&_data1_->_ref_count_);
+ return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+ Block1Data* _data1_;
+ _data1_ = (Block1Data*) _userdata_;
+ if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+ _g_main_loop_unref0 (_data1_->main_loop);
+ g_slice_free (Block1Data, _data1_);
+ }
+}
+
+static void
+___lambda4_ (Block1Data* _data1_,
+ GParamSpec* p)
+{
+ const gchar* _tmp0_;
+ GMainLoop* _tmp1_;
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (p, G_TYPE_PARAM));
+ _tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (p, G_TYPE_PARAM_INT, GParamSpecInt),
G_TYPE_PARAM, GParamSpec)->name;
+ _vala_assert (g_strcmp0 (_tmp0_, "test-int-property") == 0, "((ParamSpecInt) p).name ==
\"test-int-property\"");
+ _tmp1_ = _data1_->main_loop;
+ g_main_loop_quit (_tmp1_);
+}
+
+static void
+____lambda4__g_object_notify (GObject* _sender,
+ GParamSpec* pspec,
+ gpointer self)
+{
+ ___lambda4_ (self, pspec);
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+ g_atomic_int_inc (&_data2_->_ref_count_);
+ return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+ Block2Data* _data2_;
+ _data2_ = (Block2Data*) _userdata_;
+ if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+ _g_main_loop_unref0 (_data2_->main_loop2);
+ g_slice_free (Block2Data, _data2_);
+ }
+}
+
+static void
+___lambda5_ (Block2Data* _data2_,
+ GParamSpec* p)
+{
+ const gchar* _tmp0_;
+ GMainLoop* _tmp1_;
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (p, G_TYPE_PARAM));
+ _tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (p, G_TYPE_PARAM_STRING,
GParamSpecString), G_TYPE_PARAM, GParamSpec)->name;
+ _vala_assert (g_strcmp0 (_tmp0_, "test-property") == 0, "((ParamSpecString) p).name ==
\"test-property\"");
+ _tmp1_ = _data2_->main_loop2;
+ g_main_loop_quit (_tmp1_);
+}
+
+static void
+____lambda5__g_object_notify (GObject* _sender,
+ GParamSpec* pspec,
+ gpointer self)
+{
+ ___lambda5_ (self, pspec);
+}
+
+static void
+_vala_main (void)
+{
+ Test* test = NULL;
+ Test* _tmp0_;
+ Test* _tmp1_;
+ gchar* _tmp2_;
+ gchar* _tmp3_;
+ gchar* _tmp4_;
+ Test* _tmp5_;
+ gint _tmp6_;
+ gint _tmp7_;
+ Test2* test2 = NULL;
+ Test2* _tmp8_;
+ Test* _tmp9_;
+ Test2* _tmp10_;
+ Test* _tmp11_;
+ Test2* _tmp12_;
+ GError* _inner_error0_ = NULL;
+ _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags",
G_DBUS_PROXY_FLAGS_NONE, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path",
"/org/example/test", "g-interface-name", "org.example.Test", NULL);
+ test = (Test*) _tmp0_;
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ _tmp1_ = test;
+ _tmp2_ = test_get_test_property (_tmp1_);
+ _tmp3_ = _tmp2_;
+ _tmp4_ = _tmp3_;
+ _vala_assert (g_strcmp0 (_tmp4_, "foo") == 0, "test.test_property == \"foo\"");
+ _g_free0 (_tmp4_);
+ _tmp5_ = test;
+ _tmp6_ = test_get_test_int_property (_tmp5_);
+ _tmp7_ = _tmp6_;
+ _vala_assert (_tmp7_ == 17, "test.test_int_property == 17");
+ _tmp8_ = test2_new ();
+ test2 = _tmp8_;
+ _tmp9_ = test;
+ _tmp10_ = test2;
+ g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, G_TYPE_OBJECT, GObject),
"test-property", G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, G_TYPE_OBJECT, GObject), "test-property",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new
((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new
((GCallback) NULL, NULL, (GClosureNotify) NULL)));
+ _tmp11_ = test;
+ _tmp12_ = test2;
+ g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, G_TYPE_OBJECT, GObject),
"test-int-property", G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, G_TYPE_OBJECT, GObject), "test-int-property",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new
((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new
((GCallback) NULL, NULL, (GClosureNotify) NULL)));
+ {
+ Block1Data* _data1_;
+ GMainLoop* _tmp13_;
+ Test2* _tmp14_;
+ const gchar* _tmp15_;
+ const gchar* _tmp16_;
+ Test2* _tmp17_;
+ gint _tmp18_;
+ gint _tmp19_;
+ Test2* _tmp20_;
+ Test* _tmp21_;
+ GMainLoop* _tmp22_;
+ Test* _tmp23_;
+ gchar* _tmp24_;
+ gchar* _tmp25_;
+ gchar* _tmp26_;
+ Test* _tmp27_;
+ gint _tmp28_;
+ gint _tmp29_;
+ _data1_ = g_slice_new0 (Block1Data);
+ _data1_->_ref_count_ = 1;
+ _tmp13_ = g_main_loop_new (NULL, FALSE);
+ _data1_->main_loop = _tmp13_;
+ _tmp14_ = test2;
+ _tmp15_ = test2_get_test_property (_tmp14_);
+ _tmp16_ = _tmp15_;
+ _vala_assert (g_strcmp0 (_tmp16_, "foo") == 0, "test2.test_property == \"foo\"");
+ _tmp17_ = test2;
+ _tmp18_ = test2_get_test_int_property (_tmp17_);
+ _tmp19_ = _tmp18_;
+ _vala_assert (_tmp19_ == 17, "test2.test_int_property == 17");
+ _tmp20_ = test2;
+ g_signal_connect_data (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, G_TYPE_OBJECT, GObject),
"notify::test-int-property", (GCallback) ____lambda4__g_object_notify, block1_data_ref (_data1_),
(GClosureNotify) block1_data_unref, 0);
+ _tmp21_ = test;
+ test_change_everything (_tmp21_, &_inner_error0_);
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ block1_data_unref (_data1_);
+ _data1_ = NULL;
+ _g_object_unref0 (test2);
+ _g_object_unref0 (test);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ _tmp22_ = _data1_->main_loop;
+ g_main_loop_run (_tmp22_);
+ _tmp23_ = test;
+ _tmp24_ = test_get_test_property (_tmp23_);
+ _tmp25_ = _tmp24_;
+ _tmp26_ = _tmp25_;
+ _vala_assert (g_strcmp0 (_tmp26_, "bar") == 0, "test.test_property == \"bar\"");
+ _g_free0 (_tmp26_);
+ _tmp27_ = test;
+ _tmp28_ = test_get_test_int_property (_tmp27_);
+ _tmp29_ = _tmp28_;
+ _vala_assert (_tmp29_ == 53, "test.test_int_property == 53");
+ block1_data_unref (_data1_);
+ _data1_ = NULL;
+ }
+ {
+ Block2Data* _data2_;
+ GMainLoop* _tmp30_;
+ Test2* _tmp31_;
+ const gchar* _tmp32_;
+ const gchar* _tmp33_;
+ Test2* _tmp34_;
+ gint _tmp35_;
+ gint _tmp36_;
+ Test* _tmp37_;
+ Test2* _tmp38_;
+ Test2* _tmp39_;
+ GMainLoop* _tmp40_;
+ Test2* _tmp41_;
+ const gchar* _tmp42_;
+ const gchar* _tmp43_;
+ Test2* _tmp44_;
+ gint _tmp45_;
+ gint _tmp46_;
+ Test* _tmp47_;
+ _data2_ = g_slice_new0 (Block2Data);
+ _data2_->_ref_count_ = 1;
+ _tmp30_ = g_main_loop_new (NULL, FALSE);
+ _data2_->main_loop2 = _tmp30_;
+ _tmp31_ = test2;
+ _tmp32_ = test2_get_test_property (_tmp31_);
+ _tmp33_ = _tmp32_;
+ _vala_assert (g_strcmp0 (_tmp33_, "bar") == 0, "test2.test_property == \"bar\"");
+ _tmp34_ = test2;
+ _tmp35_ = test2_get_test_int_property (_tmp34_);
+ _tmp36_ = _tmp35_;
+ _vala_assert (_tmp36_ == 53, "test2.test_int_property == 53");
+ _tmp37_ = test;
+ g_signal_connect_data (G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, G_TYPE_OBJECT, GObject),
"notify::test-property", (GCallback) ____lambda5__g_object_notify, block2_data_ref (_data2_),
(GClosureNotify) block2_data_unref, 0);
+ _tmp38_ = test2;
+ test2_set_test_property (_tmp38_, "baz");
+ _tmp39_ = test2;
+ test2_set_test_int_property (_tmp39_, 765);
+ _tmp40_ = _data2_->main_loop2;
+ g_main_loop_run (_tmp40_);
+ _tmp41_ = test2;
+ _tmp42_ = test2_get_test_property (_tmp41_);
+ _tmp43_ = _tmp42_;
+ _vala_assert (g_strcmp0 (_tmp43_, "baz") == 0, "test2.test_property == \"baz\"");
+ _tmp44_ = test2;
+ _tmp45_ = test2_get_test_int_property (_tmp44_);
+ _tmp46_ = _tmp45_;
+ _vala_assert (_tmp46_ == 765, "test2.test_int_property == 765");
+ _tmp47_ = test;
+ test_check_everything (_tmp47_, &_inner_error0_);
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ block2_data_unref (_data2_);
+ _data2_ = NULL;
+ _g_object_unref0 (test2);
+ _g_object_unref0 (test);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ block2_data_unref (_data2_);
+ _data2_ = NULL;
+ }
+ _g_object_unref0 (test2);
+ _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+ char ** argv)
+{
+ _vala_main ();
+ return 0;
+}
+
diff --git a/tests/dbus/properties_server.c-expected b/tests/dbus/properties_server.c-expected
new file mode 100644
index 000000000..34ce036d4
--- /dev/null
+++ b/tests/dbus/properties_server.c-expected
@@ -0,0 +1,741 @@
+/* dbus_properties_server.c generated by valac, the Vala compiler
+ * generated from dbus_properties_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum {
+ TEST_0_PROPERTY,
+ TEST_TEST_PROPERTY_PROPERTY,
+ TEST_TEST_INT_PROPERTY_PROPERTY,
+ TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+ GObject parent_instance;
+ TestPrivate * priv;
+};
+
+struct _TestClass {
+ GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+ gchar* _test_property;
+ gint _test_int_property;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+ GDBusConnection* connection,
+ const gchar* path,
+ GError** error);
+VALA_EXTERN void test_change_everything (Test* self,
+ GError** error);
+VALA_EXTERN void test_set_test_property (Test* self,
+ const gchar* value);
+VALA_EXTERN void test_set_test_int_property (Test* self,
+ gint value);
+VALA_EXTERN void test_check_everything (Test* self,
+ GError** error);
+VALA_EXTERN gchar* test_get_test_property (Test* self);
+VALA_EXTERN gint test_get_test_int_property (Test* self);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _vala_test_get_property (GObject * object,
+ guint property_id,
+ GValue * value,
+ GParamSpec * pspec);
+static void _vala_test_set_property (GObject * object,
+ guint property_id,
+ const GValue * value,
+ GParamSpec * pspec);
+static void _dbus_test_change_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation);
+static void _dbus_test_check_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* method_name,
+ GVariant* parameters,
+ GDBusMethodInvocation* invocation,
+ gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GError** error,
+ gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static GVariant* _dbus_test_get_test_int_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GVariant* value,
+ GError** error,
+ gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+ GVariant* _value);
+static void _dbus_test_set_test_int_property (Test* self,
+ GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
+static void _test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+ gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+ gint wait_status,
+ gpointer self);
+static void _vala_array_destroy (gpointer array,
+ gssize array_length,
+ GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+ gssize array_length,
+ GDestroyNotify destroy_func);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_change_everything_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_change_everything_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_change_everything = {-1, "ChangeEverything",
(GDBusArgInfo **) (&_test_dbus_arg_info_change_everything_in), (GDBusArgInfo **)
(&_test_dbus_arg_info_change_everything_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_check_everything_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_check_everything_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_check_everything = {-1, "CheckEverything", (GDBusArgInfo
**) (&_test_dbus_arg_info_check_everything_in), (GDBusArgInfo **)
(&_test_dbus_arg_info_check_everything_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_change_everything,
&_test_dbus_method_info_check_everything, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_int_property = {-1, "TestIntProperty", "i",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] =
{&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **)
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **)
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call,
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+ return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+void
+test_change_everything (Test* self,
+ GError** error)
+{
+ g_return_if_fail (IS_TEST (self));
+ test_set_test_property (self, "bar");
+ test_set_test_int_property (self, 53);
+}
+
+void
+test_check_everything (Test* self,
+ GError** error)
+{
+ gchar* _tmp0_;
+ gchar* _tmp1_;
+ gchar* _tmp2_;
+ gint _tmp3_;
+ g_return_if_fail (IS_TEST (self));
+ _tmp0_ = test_get_test_property (self);
+ _tmp1_ = _tmp0_;
+ _tmp2_ = _tmp1_;
+ _vala_assert (g_strcmp0 (_tmp2_, "baz") == 0, "test_property == \"baz\"");
+ _g_free0 (_tmp2_);
+ _tmp3_ = self->priv->_test_int_property;
+ _vala_assert (_tmp3_ == 765, "test_int_property == 765");
+}
+
+Test*
+test_construct (GType object_type)
+{
+ Test * self = NULL;
+ self = (Test*) g_object_new (object_type, NULL);
+ return self;
+}
+
+Test*
+test_new (void)
+{
+ return test_construct (TYPE_TEST);
+}
+
+gchar*
+test_get_test_property (Test* self)
+{
+ gchar* result;
+ const gchar* _tmp0_;
+ gchar* _tmp1_;
+ g_return_val_if_fail (IS_TEST (self), NULL);
+ _tmp0_ = self->priv->_test_property;
+ _tmp1_ = g_strdup (_tmp0_);
+ result = _tmp1_;
+ return result;
+}
+
+void
+test_set_test_property (Test* self,
+ const gchar* value)
+{
+ gchar* old_value;
+ g_return_if_fail (IS_TEST (self));
+ old_value = test_get_test_property (self);
+ if (g_strcmp0 (value, old_value) != 0) {
+ gchar* _tmp0_;
+ _tmp0_ = g_strdup (value);
+ _g_free0 (self->priv->_test_property);
+ self->priv->_test_property = _tmp0_;
+ g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_PROPERTY_PROPERTY]);
+ }
+ _g_free0 (old_value);
+}
+
+gint
+test_get_test_int_property (Test* self)
+{
+ gint result;
+ g_return_val_if_fail (IS_TEST (self), 0);
+ result = self->priv->_test_int_property;
+ return result;
+}
+
+void
+test_set_test_int_property (Test* self,
+ gint value)
+{
+ gint old_value;
+ g_return_if_fail (IS_TEST (self));
+ old_value = test_get_test_int_property (self);
+ if (old_value != value) {
+ self->priv->_test_int_property = value;
+ g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_INT_PROPERTY_PROPERTY]);
+ }
+}
+
+static void
+test_class_init (TestClass * klass,
+ gpointer klass_data)
+{
+ test_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_adjust_private_offset (klass, &Test_private_offset);
+ G_OBJECT_CLASS (klass)->get_property = _vala_test_get_property;
+ G_OBJECT_CLASS (klass)->set_property = _vala_test_set_property;
+ G_OBJECT_CLASS (klass)->finalize = test_finalize;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY,
test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_string ("test-property", "test-property",
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_INT_PROPERTY_PROPERTY,
test_properties[TEST_TEST_INT_PROPERTY_PROPERTY] = g_param_spec_int ("test-int-property",
"test-int-property", "test-int-property", G_MININT, G_MAXINT, 17, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE |
G_PARAM_WRITABLE));
+}
+
+static void
+test_instance_init (Test * self,
+ gpointer klass)
+{
+ gchar* _tmp0_;
+ self->priv = test_get_instance_private (self);
+ _tmp0_ = g_strdup ("foo");
+ self->priv->_test_property = _tmp0_;
+ self->priv->_test_int_property = 17;
+}
+
+static void
+test_finalize (GObject * obj)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+ _g_free0 (self->priv->_test_property);
+ G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+ static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test),
0, (GInstanceInitFunc) test_instance_init, NULL };
+ GType test_type_id;
+ test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+ g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*)
test_register_object);
+ Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+ return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+ static volatile gsize test_type_id__volatile = 0;
+ if (g_once_init_enter (&test_type_id__volatile)) {
+ GType test_type_id;
+ test_type_id = test_get_type_once ();
+ g_once_init_leave (&test_type_id__volatile, test_type_id);
+ }
+ return test_type_id__volatile;
+}
+
+static void
+_vala_test_get_property (GObject * object,
+ guint property_id,
+ GValue * value,
+ GParamSpec * pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_TEST_PROPERTY_PROPERTY:
+ g_value_take_string (value, test_get_test_property (self));
+ break;
+ case TEST_TEST_INT_PROPERTY_PROPERTY:
+ g_value_set_int (value, test_get_test_int_property (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+_vala_test_set_property (GObject * object,
+ guint property_id,
+ const GValue * value,
+ GParamSpec * pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_TEST_PROPERTY_PROPERTY:
+ test_set_test_property (self, g_value_get_string (value));
+ break;
+ case TEST_TEST_INT_PROPERTY_PROPERTY:
+ test_set_test_int_property (self, g_value_get_int (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+_dbus_test_change_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation)
+{
+ GError* error = NULL;
+ GVariantIter _arguments_iter;
+ GDBusMessage* _reply_message = NULL;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ g_variant_iter_init (&_arguments_iter, _parameters_);
+ test_change_everything (self, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ g_error_free (error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_check_everything (Test* self,
+ GVariant* _parameters_,
+ GDBusMethodInvocation* invocation)
+{
+ GError* error = NULL;
+ GVariantIter _arguments_iter;
+ GDBusMessage* _reply_message = NULL;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ g_variant_iter_init (&_arguments_iter, _parameters_);
+ test_check_everything (self, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ g_error_free (error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* method_name,
+ GVariant* parameters,
+ GDBusMethodInvocation* invocation,
+ gpointer user_data)
+{
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "ChangeEverything") == 0) {
+ _dbus_test_change_everything (object, parameters, invocation);
+ } else if (strcmp (method_name, "CheckEverything") == 0) {
+ _dbus_test_check_everything (object, parameters, invocation);
+ } else {
+ g_object_unref (invocation);
+ }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+ gchar* result;
+ GVariant* _reply;
+ result = test_get_test_property (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+static GVariant*
+_dbus_test_get_test_int_property (Test* self)
+{
+ gint result;
+ GVariant* _reply;
+ result = test_get_test_int_property (self);
+ _reply = g_variant_new_int32 (result);
+ return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GError** error,
+ gpointer user_data)
+{
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "TestProperty") == 0) {
+ return _dbus_test_get_test_property (object);
+ } else if (strcmp (property_name, "TestIntProperty") == 0) {
+ return _dbus_test_get_test_int_property (object);
+ }
+ return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+ GVariant* _value)
+{
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ test_set_test_property (self, value);
+ _g_free0 (value);
+}
+
+static void
+_dbus_test_set_test_int_property (Test* self,
+ GVariant* _value)
+{
+ gint value = 0;
+ value = g_variant_get_int32 (_value);
+ test_set_test_int_property (self, value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* property_name,
+ GVariant* value,
+ GError** error,
+ gpointer user_data)
+{
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "TestProperty") == 0) {
+ _dbus_test_set_test_property (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "TestIntProperty") == 0) {
+ _dbus_test_set_test_int_property (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
+static void
+_test_notify_test_int_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_int_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestIntProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
+guint
+test_register_object (gpointer object,
+ GDBusConnection* connection,
+ const gchar* path,
+ GError** error)
+{
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *)
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
+ g_signal_connect (object, "notify::test-int-property", (GCallback) _test_notify_test_int_property,
data);
+ return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+ gpointer* data;
+ data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_int_property, data);
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+void
+client_exit (GPid pid,
+ gint status)
+{
+ GMainLoop* _tmp0_;
+ _vala_assert (status == 0, "status == 0");
+ _tmp0_ = main_loop;
+ g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+ return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+ gint wait_status,
+ gpointer self)
+{
+ client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+ GDBusConnection* conn = NULL;
+ GDBusConnection* _tmp0_;
+ GDBusConnection* _tmp1_;
+ Test* _tmp2_;
+ Test* _tmp3_;
+ GVariant* request_result = NULL;
+ GDBusConnection* _tmp4_;
+ GVariant* _tmp5_;
+ GVariant* _tmp6_;
+ GVariant* _tmp7_;
+ GVariant* _tmp8_;
+ GVariant* _tmp9_;
+ GVariant* _tmp10_;
+ GVariant* _tmp11_;
+ guint _tmp12_;
+ GPid client_pid = 0;
+ gchar* _tmp13_;
+ gchar** _tmp14_;
+ gchar** _tmp15_;
+ gint _tmp15__length1;
+ GPid _tmp16_ = 0;
+ GMainLoop* _tmp17_;
+ GMainLoop* _tmp18_;
+ GError* _inner_error0_ = NULL;
+ _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+ conn = _tmp0_;
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ _tmp1_ = conn;
+ _tmp2_ = test_new ();
+ _tmp3_ = _tmp2_;
+ test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+ _g_object_unref0 (_tmp3_);
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ _g_object_unref0 (conn);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ _tmp4_ = conn;
+ _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+ g_variant_ref_sink (_tmp5_);
+ _tmp6_ = _tmp5_;
+ _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus",
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+ _tmp8_ = _tmp7_;
+ _g_variant_unref0 (_tmp6_);
+ request_result = _tmp8_;
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ _g_object_unref0 (conn);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ _tmp9_ = request_result;
+ _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+ _tmp11_ = _tmp10_;
+ _tmp12_ = _variant_get1 (_tmp11_);
+ _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+ _g_variant_unref0 (_tmp11_);
+ _tmp13_ = g_strdup ("dbus_properties_client");
+ _tmp14_ = g_new0 (gchar*, 1 + 1);
+ _tmp14_[0] = _tmp13_;
+ _tmp15_ = _tmp14_;
+ _tmp15__length1 = 1;
+ g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+ client_pid = _tmp16_;
+ _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+ if (G_UNLIKELY (_inner_error0_ != NULL)) {
+ _g_variant_unref0 (request_result);
+ _g_object_unref0 (conn);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__,
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+ g_clear_error (&_inner_error0_);
+ return;
+ }
+ g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL,
NULL);
+ _tmp17_ = g_main_loop_new (NULL, FALSE);
+ _g_main_loop_unref0 (main_loop);
+ main_loop = _tmp17_;
+ _tmp18_ = main_loop;
+ g_main_loop_run (_tmp18_);
+ _g_variant_unref0 (request_result);
+ _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+ char ** argv)
+{
+ _vala_main ();
+ return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+ gssize array_length,
+ GDestroyNotify destroy_func)
+{
+ if ((array != NULL) && (destroy_func != NULL)) {
+ gssize i;
+ for (i = 0; i < array_length; i = i + 1) {
+ if (((gpointer*) array)[i] != NULL) {
+ destroy_func (((gpointer*) array)[i]);
+ }
+ }
+ }
+}
+
+static void
+_vala_array_free (gpointer array,
+ gssize array_length,
+ GDestroyNotify destroy_func)
+{
+ _vala_array_destroy (array, array_length, destroy_func);
+ g_free (array);
+}
+
diff --git a/tests/dbus/rawvariants_client.c-expected b/tests/dbus/rawvariants_client.c-expected
index 287614547..da12bd5d1 100644
--- a/tests/dbus/rawvariants_client.c-expected
+++ b/tests/dbus/rawvariants_client.c-expected
@@ -33,6 +33,12 @@ enum {
static guint test_signals[TEST_NUM_SIGNALS] = {0};
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_TEST_PROPERTY_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define TYPE_TEST_RAW (test_raw_get_type ())
@@ -51,6 +57,12 @@ enum {
static guint test_raw_signals[TEST_RAW_NUM_SIGNALS] = {0};
typedef GDBusProxy TestRawProxy;
typedef GDBusProxyClass TestRawProxyClass;
+enum {
+ TEST_RAW_PROXY_0_PROPERTY,
+ TEST_RAW_PROXY_TEST_PROPERTY_PROPERTY,
+ TEST_RAW_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_raw_proxy_properties[TEST_RAW_PROXY_NUM_PROPERTIES];
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
@@ -99,12 +111,24 @@ VALA_EXTERN gchar* test_get_test_property (Test* self);
VALA_EXTERN void test_set_test_property (Test* self,
const gchar* value);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
static void _dbus_handle_test_test_signal (Test* self,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static gint test_proxy_test_method (Test* self,
gint j,
gint k,
@@ -145,6 +169,9 @@ static void _dbus_test_set_test_property (Test* self,
static void _dbus_test_test_signal (GObject* _sender,
gint i,
gpointer* _data);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
VALA_EXTERN GType test_raw_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint test_raw_register_object (void* object,
@@ -160,12 +187,24 @@ VALA_EXTERN GVariant* test_raw_get_test_property (TestRaw* self);
VALA_EXTERN void test_raw_set_test_property (TestRaw* self,
GVariant* value);
static GType test_raw_get_type_once (void);
+static GParamSpec * _vala_test_raw_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_raw_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_raw_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_raw_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
static void _dbus_handle_test_raw_test_signal (TestRaw* self,
GVariant* parameters);
+static void test_raw_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static GVariant* test_raw_proxy_test_method (TestRaw* self,
GVariant* j,
GVariant* k,
@@ -206,6 +245,9 @@ static void _dbus_test_raw_set_test_property (TestRaw* self,
static void _dbus_test_raw_test_signal (GObject* _sender,
GVariant* i,
gpointer* _data);
+static void _test_raw_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_raw_unregister_object (gpointer user_data);
VALA_EXTERN void test_raw (TestRaw* test);
static Block1Data* block1_data_ref (Block1Data* _data1_);
@@ -305,6 +347,7 @@ static void
test_default_init (TestIface * iface,
gpointer iface_data)
{
+ g_object_interface_install_property (iface, g_param_spec_string ("test-property", "test-property",
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
test_signals[TEST_TEST_SIGNAL_SIGNAL] = g_signal_new ("test-signal", TYPE_TEST, G_SIGNAL_RUN_LAST, 0,
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}
@@ -338,7 +381,59 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_PROPERTY_PROPERTY, "test-property");
+ test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-property");
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ if (g_strcmp0 (dbus_property_name, "TestProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY];
+ }
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ g_value_take_string (value, test_dbus_proxy_get_test_property (self));
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ test_dbus_proxy_set_test_property (self, g_value_get_string (value));
+ break;
+ default:
+ return;
+ }
}
static void
@@ -366,6 +461,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
}
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
@@ -605,6 +725,27 @@ _dbus_test_test_signal (GObject* _sender,
g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal",
_arguments, NULL);
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -622,6 +763,7 @@ test_register_object (gpointer object,
return 0;
}
g_signal_connect (object, "test-signal", (GCallback) _dbus_test_test_signal, data);
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
return result;
}
@@ -631,6 +773,7 @@ _test_unregister_object (gpointer user_data)
gpointer* data;
data = user_data;
g_signal_handlers_disconnect_by_func (data[0], _dbus_test_test_signal, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
@@ -680,6 +823,7 @@ static void
test_raw_default_init (TestRawIface * iface,
gpointer iface_data)
{
+ g_object_interface_install_property (iface, g_param_spec_variant ("test-property", "test-property",
"test-property", G_VARIANT_TYPE_ANY, NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
test_raw_signals[TEST_RAW_TEST_SIGNAL_SIGNAL] = g_signal_new ("test-signal", TYPE_TEST_RAW,
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VARIANT, G_TYPE_NONE, 1, G_TYPE_VARIANT);
}
@@ -713,7 +857,59 @@ G_DEFINE_TYPE_EXTENDED (TestRawProxy, test_raw_proxy, G_TYPE_DBUS_PROXY, 0, G_IM
static void
test_raw_proxy_class_init (TestRawProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_raw_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_raw_proxy_g_signal;
+ proxy_class->g_properties_changed = test_raw_proxy_g_properties_changed;
+ object_class->get_property = test_raw_proxy_get_property;
+ object_class->set_property = test_raw_proxy_set_property;
+ g_object_class_override_property (object_class, TEST_RAW_PROXY_TEST_PROPERTY_PROPERTY,
"test-property");
+ test_raw_proxy_properties[TEST_RAW_PROXY_TEST_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-property");
+}
+
+static GParamSpec *
+_vala_test_raw_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ if (g_strcmp0 (dbus_property_name, "TestProperty") == 0) {
+ return test_raw_proxy_properties[TEST_RAW_PROXY_TEST_PROPERTY_PROPERTY];
+ }
+ return NULL;
+}
+
+static void
+test_raw_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ TestRaw * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST_RAW, TestRaw);
+ switch (property_id) {
+ case TEST_RAW_PROXY_TEST_PROPERTY_PROPERTY:
+ g_value_take_variant (value, test_raw_dbus_proxy_get_test_property (self));
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_raw_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ TestRaw * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST_RAW, TestRaw);
+ switch (property_id) {
+ case TEST_RAW_PROXY_TEST_PROPERTY_PROPERTY:
+ test_raw_dbus_proxy_set_test_property (self, g_value_get_variant (value));
+ break;
+ default:
+ return;
+ }
}
static void
@@ -739,6 +935,31 @@ test_raw_proxy_g_signal (GDBusProxy* proxy,
}
}
+static void
+test_raw_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_raw_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_raw_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_raw_proxy_init (TestRawProxy* self)
{
@@ -969,6 +1190,27 @@ _dbus_test_raw_test_signal (GObject* _sender,
g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal",
_arguments, NULL);
}
+static void
+_test_raw_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ TestRaw * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST_RAW, TestRaw);
+ variant = _dbus_test_raw_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_raw_register_object (gpointer object,
GDBusConnection* connection,
@@ -986,6 +1228,7 @@ test_raw_register_object (gpointer object,
return 0;
}
g_signal_connect (object, "test-signal", (GCallback) _dbus_test_raw_test_signal, data);
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_raw_notify_test_property, data);
return result;
}
@@ -995,6 +1238,7 @@ _test_raw_unregister_object (gpointer user_data)
gpointer* data;
data = user_data;
g_signal_handlers_disconnect_by_func (data[0], _dbus_test_raw_test_signal, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_raw_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/rawvariants_server.c-expected b/tests/dbus/rawvariants_server.c-expected
index f1e88b5cf..2d94de9d0 100644
--- a/tests/dbus/rawvariants_server.c-expected
+++ b/tests/dbus/rawvariants_server.c-expected
@@ -158,6 +158,9 @@ static void _dbus_test_set_test_property (Test* self,
static void _dbus_test_test_signal (GObject* _sender,
gint i,
gpointer* _data);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
VALA_EXTERN GType test_raw_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestRaw, g_object_unref)
@@ -219,6 +222,9 @@ static void _dbus_test_raw_set_test_property (TestRaw* self,
static void _dbus_test_raw_test_signal (GObject* _sender,
GVariant* i,
gpointer* _data);
+static void _test_raw_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_raw_unregister_object (gpointer user_data);
VALA_EXTERN void client_exit (GPid pid,
gint status);
@@ -549,6 +555,27 @@ _dbus_test_test_signal (GObject* _sender,
g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal",
_arguments, NULL);
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -566,6 +593,7 @@ test_register_object (gpointer object,
return 0;
}
g_signal_connect (object, "test-signal", (GCallback) _dbus_test_test_signal, data);
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
return result;
}
@@ -575,6 +603,7 @@ _test_unregister_object (gpointer user_data)
gpointer* data;
data = user_data;
g_signal_handlers_disconnect_by_func (data[0], _dbus_test_test_signal, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
@@ -901,6 +930,27 @@ _dbus_test_raw_test_signal (GObject* _sender,
g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal",
_arguments, NULL);
}
+static void
+_test_raw_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ TestRaw * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST_RAW, TestRaw);
+ variant = _dbus_test_raw_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_raw_register_object (gpointer object,
GDBusConnection* connection,
@@ -918,6 +968,7 @@ test_raw_register_object (gpointer object,
return 0;
}
g_signal_connect (object, "test-signal", (GCallback) _dbus_test_raw_test_signal, data);
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_raw_notify_test_property, data);
return result;
}
@@ -927,6 +978,7 @@ _test_raw_unregister_object (gpointer user_data)
gpointer* data;
data = user_data;
g_signal_handlers_disconnect_by_func (data[0], _dbus_test_raw_test_signal, data);
+ g_signal_handlers_disconnect_by_func (data[0], _test_raw_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/signals_client.c-expected b/tests/dbus/signals_client.c-expected
index b172477d0..a84956a14 100644
--- a/tests/dbus/signals_client.c-expected
+++ b/tests/dbus/signals_client.c-expected
@@ -35,6 +35,11 @@ enum {
static guint test_signals[TEST_NUM_SIGNALS] = {0};
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
@@ -71,6 +76,15 @@ static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
gpointer invocation_hint,
gpointer marshal_data);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
@@ -79,6 +93,9 @@ static void _dbus_handle_test_foo (Test* self,
GVariant* parameters);
static void _dbus_handle_test_bar (Test* self,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void test_proxy_do_foo (Test* self,
gint i,
GError** error);
@@ -257,7 +274,48 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ default:
+ return;
+ }
}
static void
@@ -325,6 +383,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
}
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected
index 91c61053a..b3e54704e 100644
--- a/tests/dbus/structs_client.c-expected
+++ b/tests/dbus/structs_client.c-expected
@@ -32,6 +32,12 @@ typedef struct _TestIface TestIface;
#define TYPE_TEST_PROXY (test_proxy_get_type ())
typedef GDBusProxy TestProxy;
typedef GDBusProxyClass TestProxyClass;
+enum {
+ TEST_PROXY_0_PROPERTY,
+ TEST_PROXY_TEST_PROPERTY_PROPERTY,
+ TEST_PROXY_NUM_PROPERTIES
+};
+static GParamSpec* test_proxy_properties[TEST_PROXY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__,
__LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN,
G_STRFUNC, msg); return; }
@@ -75,10 +81,22 @@ VALA_EXTERN void test_get_test_property (Test* self,
VALA_EXTERN void test_set_test_property (Test* self,
FooStruct * value);
static GType test_get_type_once (void);
+static GParamSpec * _vala_test_find_property_from_dbus_name (const gchar * dbus_property_name);
+static void test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec);
+static void test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec);
static void test_proxy_g_signal (GDBusProxy* proxy,
const gchar* sender_name,
const gchar* signal_name,
GVariant* parameters);
+static void test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties);
static void test_proxy_test_struct (Test* self,
FooStruct* f,
FooStruct* g,
@@ -118,6 +136,9 @@ static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
gpointer user_data);
static void _dbus_test_set_test_property (Test* self,
GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
static void _vala_main (void);
@@ -247,6 +268,7 @@ static void
test_default_init (TestIface * iface,
gpointer iface_data)
{
+ g_object_interface_install_property (iface, g_param_spec_boxed ("test-property", "test-property",
"test-property", TYPE_FOO_STRUCT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}
static GType
@@ -279,7 +301,64 @@ G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT
static void
test_proxy_class_init (TestProxyClass* klass)
{
- G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+ GDBusProxyClass * proxy_class = G_DBUS_PROXY_CLASS (klass);
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ proxy_class->g_signal = test_proxy_g_signal;
+ proxy_class->g_properties_changed = test_proxy_g_properties_changed;
+ object_class->get_property = test_proxy_get_property;
+ object_class->set_property = test_proxy_set_property;
+ g_object_class_override_property (object_class, TEST_PROXY_TEST_PROPERTY_PROPERTY, "test-property");
+ test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY] = g_object_class_find_property
(object_class, "test-property");
+}
+
+static GParamSpec *
+_vala_test_find_property_from_dbus_name (const gchar * dbus_property_name)
+{
+ if (g_strcmp0 (dbus_property_name, "TestProperty") == 0) {
+ return test_proxy_properties[TEST_PROXY_TEST_PROPERTY_PROPERTY];
+ }
+ return NULL;
+}
+
+static void
+test_proxy_get_property (GObject* object,
+ guint property_id,
+ GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ GVariant * variant;
+ const gchar * dbus_property_name = NULL;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ {
+ FooStruct boxed;
+ test_dbus_proxy_get_test_property (self, &boxed);
+ g_value_set_boxed (value, &boxed);
+ foo_struct_destroy (&boxed);
+ }
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+test_proxy_set_property (GObject* object,
+ guint property_id,
+ const GValue* value,
+ GParamSpec* pspec)
+{
+ Test * self;
+ self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+ switch (property_id) {
+ case TEST_PROXY_TEST_PROPERTY_PROPERTY:
+ test_dbus_proxy_set_test_property (self, g_value_get_boxed (value));
+ break;
+ default:
+ return;
+ }
}
static void
@@ -290,6 +369,31 @@ test_proxy_g_signal (GDBusProxy* proxy,
{
}
+static void
+test_proxy_g_properties_changed (GDBusProxy* proxy,
+ GVariant* changed_properties,
+ const gchar* const* invalidated_properties)
+{
+ GVariantIter * iter;
+ const gchar * key;
+ GParamSpec * pspec;
+ guint n;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) {
+ pspec = _vala_test_find_property_from_dbus_name (key);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++) {
+ pspec = _vala_test_find_property_from_dbus_name (invalidated_properties[n]);
+ if (pspec != NULL) {
+ g_object_notify_by_pspec ((GObject *) proxy, pspec);
+ }
+ }
+}
+
static void
test_proxy_init (TestProxy* self)
{
@@ -591,6 +695,27 @@ test_dbus_interface_set_property (GDBusConnection* connection,
return FALSE;
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -607,6 +732,7 @@ test_register_object (gpointer object,
if (!result) {
return 0;
}
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
return result;
}
@@ -615,6 +741,7 @@ _test_unregister_object (gpointer user_data)
{
gpointer* data;
data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
diff --git a/tests/dbus/structs_server.c-expected b/tests/dbus/structs_server.c-expected
index 0840275f1..ceaa1ac7b 100644
--- a/tests/dbus/structs_server.c-expected
+++ b/tests/dbus/structs_server.c-expected
@@ -134,6 +134,9 @@ static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
gpointer user_data);
static void _dbus_test_set_test_property (Test* self,
GVariant* _value);
+static void _test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data);
static void _test_unregister_object (gpointer user_data);
VALA_EXTERN void client_exit (GPid pid,
gint status);
@@ -580,6 +583,27 @@ test_dbus_interface_set_property (GDBusConnection* connection,
return FALSE;
}
+static void
+_test_notify_test_property (GObject * gobject,
+ GParamSpec * pspec,
+ gpointer user_data)
+{
+ gpointer* data = user_data;
+ GError* error = NULL;
+ GVariant* parameters = NULL;
+ GVariant* variant = NULL;
+ GVariantBuilder changed_builder;
+ GVariantBuilder invalidated_builder;
+ Test * self;
+ g_variant_builder_init (&changed_builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE_STRING_ARRAY);
+ self = G_TYPE_CHECK_INSTANCE_CAST (gobject, TYPE_TEST, Test);
+ variant = _dbus_test_get_test_property (self);
+ g_variant_builder_add (&changed_builder, "{sv}", "TestProperty", variant);
+ parameters = g_variant_new ("(sa{sv}as)", "org.example.Test", &changed_builder, &invalidated_builder);
+ g_dbus_connection_emit_signal ((GDBusConnection *) data[1], NULL, (const gchar *) data[2],
"org.freedesktop.DBus.Properties", "PropertiesChanged", parameters, &error);
+}
+
guint
test_register_object (gpointer object,
GDBusConnection* connection,
@@ -596,6 +620,7 @@ test_register_object (gpointer object,
if (!result) {
return 0;
}
+ g_signal_connect (object, "notify::test-property", (GCallback) _test_notify_test_property, data);
return result;
}
@@ -604,6 +629,7 @@ _test_unregister_object (gpointer user_data)
{
gpointer* data;
data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _test_notify_test_property, data);
g_object_unref (data[0]);
g_object_unref (data[1]);
g_free (data[2]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]