gtk+-2.0: Do not use const with GtkTreePath
[vala-lang.git] / codegen / valadbusinterfaceregisterfunction.vala
blob2eec9488ddff171c389aecd234c37a65045ca0aa
1 /* valadbusinterfaceregisterfunction.vala
3 * Copyright (C) 2009 Didier Villevalois
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Didier Villevalois <ptitjes@free.fr>
23 using GLib;
25 /**
26 * C function to register an interface at runtime.
28 public class Vala.DBusInterfaceRegisterFunction : InterfaceRegisterFunction {
30 public DBusInterfaceRegisterFunction (Interface iface, CodeContext context) {
31 base(iface, context);
34 public override CCodeFragment get_type_interface_init_statements () {
35 var frag = base.get_type_interface_init_statements ();
37 var quark_dbus_proxy = new CCodeFunctionCall (new CCodeIdentifier ("g_quark_from_string"));
38 quark_dbus_proxy.add_argument (new CCodeConstant ("\"ValaDBusInterfaceProxyType\""));
40 var func = new CCodeFunctionCall (new CCodeIdentifier ("g_type_set_qdata"));
41 func.add_argument (new CCodeIdentifier ("%s_type_id".printf (interface_reference.get_lower_case_cname
42 (null))));
43 func.add_argument (quark_dbus_proxy);
44 func.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier
45 ("%s_dbus_proxy_get_type".printf (interface_reference.get_lower_case_cname (null)))));
47 frag.append (new CCodeExpressionStatement (func));
49 return frag;