var register_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_register_type".printf (get_ccode_lower_case_name (type_symbol, null))));
register_call.add_argument (new CCodeIdentifier (module_init_param_name));
ccode.add_expression (register_call);
+
+ var iface = type_symbol as Interface;
+ if (iface != null) {
+ string? dbus_name = GDBusModule.get_dbus_name(type_symbol);
+
+ if (dbus_name != null) {
+ string proxy_cname = get_ccode_lower_case_prefix (type_symbol) + "proxy";
+ var register_proxy = new CCodeFunctionCall (new CCodeIdentifier ("%s_register_dynamic_type".printf (proxy_cname)));
+ register_proxy.add_argument (new CCodeIdentifier (module_init_param_name));
+ ccode.add_expression (register_proxy);
+ }
+ }
}
/**
}
}
- result += "G_IMPLEMENT_INTERFACE (%s, %sproxy_%sinterface_init) ".printf (
+ string interface_macro;
+
+ if (in_plugin) {
+ interface_macro = "G_IMPLEMENT_INTERFACE_DYNAMIC";
+ } else {
+ interface_macro = "G_IMPLEMENT_INTERFACE";
+ }
+
+ result += "%s (%s, %sproxy_%sinterface_init) ".printf (
+ interface_macro,
get_ccode_upper_case_name (iface, "TYPE_"),
get_ccode_lower_case_prefix (main_iface),
get_ccode_lower_case_prefix (iface));
var proxy_get_type = new CCodeFunction (get_type_name, "GType");
proxy_get_type.attributes = "G_GNUC_CONST";
decl_space.add_function_declaration (proxy_get_type);
+
+ if (in_plugin) {
+ var proxy_register_type = new CCodeFunction ("%sproxy_register_dynamic_type".printf (get_ccode_lower_case_prefix (iface)));
+ proxy_register_type.add_parameter (new CCodeParameter ("module", "GTypeModule*"));
+ decl_space.add_function_declaration (proxy_register_type);
+ }
}
public override void visit_interface (Interface iface) {
cfile.add_type_declaration (new CCodeTypeDefinition ("GDBusProxy", new CCodeVariableDeclarator (cname)));
cfile.add_type_declaration (new CCodeTypeDefinition ("GDBusProxyClass", new CCodeVariableDeclarator (cname + "Class")));
- var define_type = new CCodeFunctionCall (new CCodeIdentifier ("G_DEFINE_TYPE_EXTENDED"));
+ string type_macro;
+
+ if (in_plugin) {
+ type_macro = "G_DEFINE_DYNAMIC_TYPE_EXTENDED";
+ } else {
+ type_macro = "G_DEFINE_TYPE_EXTENDED";
+ }
+
+ var define_type = new CCodeFunctionCall (new CCodeIdentifier (type_macro));
define_type.add_argument (new CCodeIdentifier (cname));
define_type.add_argument (new CCodeIdentifier (lower_cname));
define_type.add_argument (new CCodeIdentifier ("G_TYPE_DBUS_PROXY"));
generate_signal_handler_function (iface);
+ if (in_plugin) {
+ var proxy_class_finalize = new CCodeFunction (lower_cname + "_class_finalize", "void");
+ proxy_class_finalize.add_parameter (new CCodeParameter ("klass", cname + "Class*"));
+ proxy_class_finalize.modifiers = CCodeModifiers.STATIC;
+ cfile.add_function (proxy_class_finalize);
+
+ var proxy_type_init = new CCodeFunction (lower_cname + "_register_dynamic_type", "void");
+ proxy_type_init.add_parameter (new CCodeParameter ("module", "GTypeModule*"));
+ push_function (proxy_type_init);
+ var call_register_type = new CCodeFunctionCall (new CCodeIdentifier (lower_cname + "_register_type"));
+ call_register_type.add_argument (new CCodeIdentifier ("module"));
+ ccode.add_expression (call_register_type);
+ pop_function ();
+ cfile.add_function(proxy_type_init);
+ }
+
var proxy_instance_init = new CCodeFunction (lower_cname + "_init", "void");
proxy_instance_init.add_parameter (new CCodeParameter ("self", cname + "*"));
proxy_instance_init.modifiers = CCodeModifiers.STATIC;