Created gdbus-codegen helper in the gnome module.

pull/54/merge
Jussi Pakkanen 10 years ago
parent 9e1700cbfe
commit 9741f75277
  1. 18
      modules/gnome.py
  2. 10
      test cases/frameworks/7 gnome/gdbus/com.example.Sample.xml
  3. 8
      test cases/frameworks/7 gnome/gdbus/gdbusprog.c
  4. 9
      test cases/frameworks/7 gnome/gdbus/meson.build
  5. 2
      test cases/frameworks/7 gnome/meson.build

@ -89,6 +89,24 @@ class GnomeModule:
target_g = build.CustomTarget(targetname, state.subdir, kwargs)
return target_g
def gdbus_codegen(self, state, args, kwargs):
if len(args) != 2:
raise MesonException('Gdbus_codegen takes two arguments, name and xml file.')
namebase = args[0]
xml_file = args[1]
cmd = ['gdbus-codegen']
if 'interface_prefix' in kwargs:
cmd += ['--interface-prefix', kwargs.pop('interface_prefix')]
if 'namespace' in kwargs:
cmd += ['--c-namespace', kwargs.pop('namespace')]
cmd += ['--generate-c-code', os.path.join(state.subdir, namebase), '@INPUT@']
outputs = [namebase + '.c', namebase + '.h']
custom_kwargs = {'input' : xml_file,
'output' : outputs,
'command' : cmd
}
return build.CustomTarget(namebase + '-gdbus', state.subdir, custom_kwargs)
def initialize():
mlog.log('Warning, glib compiled dependencies will not work until this upstream issue is fixed:',
mlog.bold('https://bugzilla.gnome.org/show_bug.cgi?id=745754'))

@ -0,0 +1,10 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="com.example">
<method name="Hello">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="s" name="greeting"/>
</method>
</interface>
</node>

@ -0,0 +1,8 @@
#include"generated-gdbus.h"
int main(int argc, char **argv) {
SampleComExample *s;
s = sample_com_example_skeleton_new();
g_object_unref(s);
return 0;
}

@ -0,0 +1,9 @@
gdbus_src = gnome.gdbus_codegen('generated-gdbus', 'com.example.Sample.xml',
interface_prefix : 'com.example.',
namespace : 'Sample')
gdbus_exe = executable('gdbus-test', 'gdbusprog.c',
gdbus_src,
include_directories : include_directories('..'),
dependencies : giounix)
test('gdbus', gdbus_exe)

@ -2,6 +2,7 @@ project('gobject-introspection', 'c')
gnome = import('gnome')
gio = dependency('gio-2.0')
giounix = dependency('gio-unix-2.0')
glib = dependency('glib-2.0')
gobj = dependency('gobject-2.0')
gir = dependency('gobject-introspection-1.0')
@ -10,4 +11,5 @@ gmod = dependency('gmodule-2.0')
subdir('resources')
subdir('gir')
subdir('schemas')
subdir('gdbus')

Loading…
Cancel
Save