[vala] D-Bus: Fix proxy creation in separate source file
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] D-Bus: Fix proxy creation in separate source file
- Date: Sat, 23 Aug 2014 18:58:23 +0000 (UTC)
commit 166a5960daf834e6df042579c3c65b087554f491
Author: Jürg Billeter <j bitron ch>
Date: Sat Aug 23 20:55:49 2014 +0200
D-Bus: Fix proxy creation in separate source file
codegen/valagdbusclientmodule.vala | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index cbf7223..59aa20e 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -259,7 +259,7 @@ public class Vala.GDBusClientModule : GDBusModule {
CCodeExpression proxy_type;
CCodeExpression dbus_iface_name;
- CCodeExpression dbus_iface_info = null;
+ CCodeExpression dbus_iface_info;
var object_type = type_arg as ObjectType;
if (object_type != null) {
@@ -272,7 +272,6 @@ public class Vala.GDBusClientModule : GDBusModule {
proxy_type = new CCodeIdentifier ("%s_PROXY".printf (get_ccode_type_id (iface)));
dbus_iface_name = new CCodeConstant ("\"%s\"".printf (get_dbus_name (iface)));
- dbus_iface_info = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF,
get_interface_info (iface));
} else {
// use runtime type information for generic methods
@@ -295,6 +294,15 @@ public class Vala.GDBusClientModule : GDBusModule {
dbus_iface_name = get_qdata;
}
+ var quark = new CCodeFunctionCall (new CCodeIdentifier ("g_quark_from_static_string"));
+ quark.add_argument (new CCodeConstant ("\"vala-dbus-interface-info\""));
+
+ var get_qdata = new CCodeFunctionCall (new CCodeIdentifier ("g_type_get_qdata"));
+ get_qdata.add_argument (get_type_id_expression (type_arg));
+ get_qdata.add_argument (quark);
+
+ dbus_iface_info = get_qdata;
+
if (bus_get_proxy_async || conn_get_proxy_async) {
if (ma.member_name == "end" && ma.inner.symbol_reference == ma.symbol_reference) {
// method can fail
@@ -1166,5 +1174,15 @@ public class Vala.GDBusClientModule : GDBusModule {
set_qdata.add_argument (new CCodeConstant ("\"%s\"".printf (dbus_iface_name)));
block.add_statement (new CCodeExpressionStatement (set_qdata));
+
+ quark = new CCodeFunctionCall (new CCodeIdentifier ("g_quark_from_static_string"));
+ quark.add_argument (new CCodeConstant ("\"vala-dbus-interface-info\""));
+
+ set_qdata = new CCodeFunctionCall (new CCodeIdentifier ("g_type_set_qdata"));
+ set_qdata.add_argument (new CCodeIdentifier ("%s_type_id".printf (get_ccode_lower_case_name
(sym, null))));
+ set_qdata.add_argument (quark);
+ set_qdata.add_argument (new CCodeCastExpression (new CCodeUnaryExpression
(CCodeUnaryOperator.ADDRESS_OF, get_interface_info (sym)), "void*"));
+
+ block.add_statement (new CCodeExpressionStatement (set_qdata));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]