From: Xavier Claessens Date: Fri, 11 Apr 2008 13:11:22 +0000 (+0000) Subject: Update tools from tp-glib 0.7.6 X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=92236b5ccc020a1e1062fbf8305a1bd8d2afb932 Update tools from tp-glib 0.7.6 svn path=/trunk/; revision=915 --- diff --git a/tools/Makefile.am b/tools/Makefile.am index 4bf514f1..bd1f4c00 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,11 @@ +abs_top_builddir = @abs_top_builddir@ + +noinst_SCRIPTS = telepathy-glib-env + +telepathy-glib-env: telepathy-glib-env.in Makefile + sed -e 's![@]abs_top_builddir[@]!$(abs_top_builddir)!' $< > $@ + chmod +x $@ + EXTRA_DIST = \ c-constants-generator.xsl \ check-coding-style.mk \ @@ -15,8 +23,14 @@ EXTRA_DIST = \ glib-ginterface-gen.py \ glib-gtypes-generator.py \ glib-signals-marshal-gen.py \ + gobject-foo.py \ identity.xsl \ - libglibcodegen.py + libglibcodegen.py \ + ls-interfaces.xsl \ + make-all-async.xsl \ + spec-to-introspect.xsl \ + telepathy-glib-env.in \ + with-session-bus.sh CLEANFILES = libglibcodegen.pyc libglibcodegen.pyo $(noinst_SCRIPTS) @@ -31,11 +45,11 @@ glib-gtypes-generator.py: libglibcodegen.py glib-signals-marshal-gen.py: libglibcodegen.py touch $@ -TELEPATHY_GLIB_SRCDIR = $(top_srcdir)/../telepathy-glib -maintainer-update-from-telepathy-glib: +TELEPATHY_SPEC_SRCDIR = $(top_srcdir)/../telepathy-spec +maintainer-update-from-telepathy-spec: set -e && cd $(srcdir) && \ for x in $(EXTRA_DIST); do \ - if test -f $(TELEPATHY_GLIB_SRCDIR)/tools/$$x; then \ - cp $(TELEPATHY_GLIB_SRCDIR)/tools/$$x $$x; \ + if test -f $(TELEPATHY_SPEC_SRCDIR)/tools/$$x; then \ + cp $(TELEPATHY_SPEC_SRCDIR)/tools/$$x $$x; \ fi; \ done diff --git a/tools/doc-generator.xsl b/tools/doc-generator.xsl index 83b42dc5..8fd4dd3a 100644 --- a/tools/doc-generator.xsl +++ b/tools/doc-generator.xsl @@ -2,7 +2,7 @@ The master copy of this stylesheet is in the Telepathy spec repository - please make any changes there. -Copyright (C) 2006, 2007 Collabora Limited +Copyright (C) 2006-2008 Collabora Limited This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -12,20 +12,27 @@ version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --> + xmlns:html="http://www.w3.org/1999/xhtml" + exclude-result-prefixes="tp html"> + + + + + + @@ -33,7 +40,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + + + + + +
+ +
@@ -90,7 +104,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- +
@@ -141,13 +155,32 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -

Properties:

+

Telepathy Properties:

+

Accessed using the + Telepathy + Properties interface.

-

Interface has no properties.

+

Interface has no Telepathy + properties.

+
+
+ + + +

D-Bus core Properties:

+

Accessed using the + org.freedesktop.DBus.Properties interface.

+
+ +
+
+ +

Interface has no D-Bus core + properties.

@@ -219,6 +252,36 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +
+ + + + - + + + , + + + read-only + + + write-only + + + read/write + + + access: + + + +
+
+ +
+
+
@@ -626,13 +689,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA float: right; font-style: italic; } - .method { + .method, .signal, .property { margin-left: 1em; margin-right: 4em; } - .signal { - margin-left: 1em; - margin-right: 4em; + .rationale { + font-style: italic; + border-left: 0.25em solid #808080; + padding-left: 0.5em; } @@ -650,19 +714,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Interfaces

    - +
- +

Index

Index of interfaces

    - +
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py index 4ff78cd0..fede212d 100644 --- a/tools/glib-client-gen.py +++ b/tools/glib-client-gen.py @@ -46,6 +46,8 @@ class Generator(object): self.basename = basename self.group = opts.get('--group', None) self.iface_quark_prefix = opts.get('--iface-quark-prefix', None) + self.tp_proxy_api = tuple(map(int, + opts.get('--tp-proxy-api', '0').split('.'))) self.proxy_cls = opts.get('--subclass', 'TpProxy') + ' *' self.proxy_arg = opts.get('--subclass', 'void') + ' *' self.proxy_assert = opts.get('--subclass-assert', 'TP_IS_PROXY') @@ -142,7 +144,7 @@ class Generator(object): if args: self.b('static void') - self.b('%s (DBusGProxy *proxy,' % collect_name) + self.b('%s (DBusGProxy *proxy G_GNUC_UNUSED,' % collect_name) for arg in args: name, info, tp_type, elt = arg @@ -208,7 +210,7 @@ class Generator(object): self.b('static void') self.b('%s (TpProxy *tpproxy,' % invoke_name) - self.b(' GError *error,') + self.b(' GError *error G_GNUC_UNUSED,') self.b(' GValueArray *args,') self.b(' GCallback generic_callback,') self.b(' gpointer user_data,') @@ -721,6 +723,7 @@ class Generator(object): self.b(' 0,') self.b(' error, user_data, weak_object);') + self.b(' g_error_free (error);') self.b(' return NULL;') self.b(' }') self.b('') @@ -801,12 +804,12 @@ class Generator(object): member_lc) self.b('static void') - self.b('%s (TpProxy *self,' % reentrant_invoke) + self.b('%s (TpProxy *self G_GNUC_UNUSED,' % reentrant_invoke) self.b(' GError *error,') self.b(' GValueArray *args,') - self.b(' GCallback unused,') - self.b(' gpointer user_data,') - self.b(' GObject *unused2)') + self.b(' GCallback unused G_GNUC_UNUSED,') + self.b(' gpointer user_data G_GNUC_UNUSED,') + self.b(' GObject *unused2 G_GNUC_UNUSED)') self.b('{') self.b(' _%s_%s_run_state_%s *state = user_data;' % (self.prefix_lc, iface_lc, member_lc)) @@ -1026,17 +1029,23 @@ class Generator(object): signals = node.getElementsByTagName('signal') methods = node.getElementsByTagName('method') - self.b('static inline void') - self.b('%s_add_signals_for_%s (DBusGProxy *proxy)' - % (self.prefix_lc, name.lower())) - self.b('{') + if signals: + self.b('static inline void') + self.b('%s_add_signals_for_%s (DBusGProxy *proxy)' + % (self.prefix_lc, name.lower())) + self.b('{') - for signal in signals: - self.do_signal_add(signal) + if self.tp_proxy_api >= (0, 7, 6): + self.b(' if (!tp_proxy_dbus_g_proxy_claim_for_signal_adding ' + '(proxy))') + self.b(' return;') - self.b('}') - self.b('') - self.b('') + for signal in signals: + self.do_signal_add(signal) + + self.b('}') + self.b('') + self.b('') for signal in signals: self.do_signal(name, signal) @@ -1080,17 +1089,20 @@ class Generator(object): self.b(' * #TpProxy::interface-added.') self.b(' */') self.b('static void') - self.b('%s_%s_add_signals (TpProxy *self,' + self.b('%s_%s_add_signals (TpProxy *self G_GNUC_UNUSED,' % (self.prefix_lc, self.group)) self.b(' guint quark,') self.b(' DBusGProxy *proxy,') - self.b(' gpointer unused)') + self.b(' gpointer unused G_GNUC_UNUSED)') self.b('{') for node in nodes: iface = node.getElementsByTagName('interface')[0] self.iface_dbus = iface.getAttribute('name') + signals = node.getElementsByTagName('signal') + if not signals: + continue name = node.getAttribute('name').replace('/', '').lower() self.iface_uc = name.upper() self.b(' if (quark == %s)' % self.get_iface_quark()) @@ -1114,7 +1126,7 @@ def types_to_gtypes(types): if __name__ == '__main__': options, argv = gnu_getopt(sys.argv[1:], '', ['group=', 'subclass=', 'subclass-assert=', - 'iface-quark-prefix=']) + 'iface-quark-prefix=', 'tp-proxy-api=']) opts = {} diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py index 0c7c419e..36f3242b 100644 --- a/tools/glib-ginterface-gen.py +++ b/tools/glib-ginterface-gen.py @@ -204,7 +204,7 @@ class Generator(object): base_init_code.extend(self.do_signal(signal)) self.b('static inline void') - self.b('%s%s_base_init_once (gpointer klass)' + self.b('%s%s_base_init_once (gpointer klass G_GNUC_UNUSED)' % (self.prefix_, node_name_lc)) self.b('{') self.b(' static TpDBusPropertiesMixinPropInfo properties[%d] = {' diff --git a/tools/gobject-foo.py b/tools/gobject-foo.py new file mode 100644 index 00000000..5921cab8 --- /dev/null +++ b/tools/gobject-foo.py @@ -0,0 +1,81 @@ +#!/usr/bin/python + +# gobject-foo.py: generate standard GObject type macros etc. +# +# The master copy of this program is in the telepathy-glib repository - +# please make any changes there. +# +# Copyright (C) 2007 Collabora Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +def gobject_header(head, tail, as_interface=False): + out = [] + o = out.append + + name = head + '_' + tail + MixedCase = name.replace('_', '') + lower_case = name.lower() + UPPER_CASE = name.upper() + + gtype = head.upper() + '_TYPE_' + tail.upper() + + o("typedef struct _%s %s;" % (MixedCase, MixedCase)) + o("typedef struct _%sClass %sClass;" % (MixedCase, MixedCase)) + o("typedef struct _%sPrivate %sPrivate;" % (MixedCase, MixedCase)) + o("") + o("GType %s_get_type (void);" % lower_case) + o("") + + o("#define %s \\" % gtype) + o(" (%s_get_type ())" % lower_case) + + o("#define %s(obj) \\" % UPPER_CASE) + o(" (G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, \\" % gtype) + o(" %s))" % MixedCase) + + if not as_interface: + o("#define %s_CLASS(klass) \\" % UPPER_CASE) + o(" (G_TYPE_CHECK_CLASS_CAST ((klass), %s, \\" % gtype) + o(" %sClass))" % MixedCase) + + o("#define %s_IS_%s(obj) \\" % (head.upper(), tail.upper())) + o(" (G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))" % gtype) + + if not as_interface: + o("#define %s_IS_%s_CLASS(klass) \\" % (head.upper(), tail.upper())) + o(" (G_TYPE_CHECK_CLASS_TYPE ((klass), %s))" % gtype) + + o("#define %s_GET_CLASS(obj) \\" % UPPER_CASE) + o(" (G_TYPE_INSTANCE_GET_CLASS ((obj), %s, \\" % gtype) + o(" %sClass))" % MixedCase) + + return out + +if __name__ == '__main__': + import sys + from getopt import gnu_getopt + + options, argv = gnu_getopt(sys.argv[1:], '', ['interface']) + + as_interface = False + + for opt, val in options: + if opt == '--interface': + as_interface = True + + head, tail = argv + + print '\n'.join(gobject_header(head, tail, as_interface=as_interface)) diff --git a/tools/ls-interfaces.xsl b/tools/ls-interfaces.xsl new file mode 100644 index 00000000..22c4ff5e --- /dev/null +++ b/tools/ls-interfaces.xsl @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/tools/make-all-async.xsl b/tools/make-all-async.xsl new file mode 100644 index 00000000..634ee3ca --- /dev/null +++ b/tools/make-all-async.xsl @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/spec-to-introspect.xsl b/tools/spec-to-introspect.xsl new file mode 100644 index 00000000..980604ac --- /dev/null +++ b/tools/spec-to-introspect.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/telepathy-glib-env.in b/tools/telepathy-glib-env.in new file mode 100644 index 00000000..ddc47bfd --- /dev/null +++ b/tools/telepathy-glib-env.in @@ -0,0 +1,9 @@ +#!/bin/sh +abs_top_builddir="@abs_top_builddir@" +export abs_top_builddir +LD_LIBRARY_PATH="${abs_top_builddir}/telepathy-glib/.libs${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}" +export LD_LIBRARY_PATH +G_DEBUG="fatal_criticals,fatal_warnings${G_DEBUG:+",${G_DEBUG}"}" +export G_DEBUG + +exec "$@" diff --git a/tools/with-session-bus.sh b/tools/with-session-bus.sh new file mode 100644 index 00000000..26d9f248 --- /dev/null +++ b/tools/with-session-bus.sh @@ -0,0 +1,73 @@ +#!/bin/sh +# with-session-bus.sh - run a program with a temporary D-Bus session daemon +# +# The canonical location of this program is the telepathy-glib tools/ +# directory, please synchronize any changes with that copy. +# +# Copyright (C) 2007 Collabora Ltd. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +set -e + +me=with-session-bus + +dbus_daemon_args="--print-address=5 --print-pid=6 --fork" + +usage () +{ + echo "usage: $me [options] -- program [program_options]" >&2 + echo "Requires write access to the current directory." >&2 + exit 2 +} + +while test "z$1" != "z--"; do + case "$1" in + --session) + dbus_daemon_args="$dbus_daemon_args --session" + shift + ;; + --config-file=*) + # FIXME: assumes config file doesn't contain any special characters + dbus_daemon_args="$dbus_daemon_args $1" + shift + ;; + *) + usage + ;; + esac +done +shift +if test "z$1" = "z"; then usage; fi + +exec 5> $me-$$.address +exec 6> $me-$$.pid + +cleanup () +{ + pid=`head -n1 $me-$$.pid` + if test -n "$pid" ; then + echo "Killing temporary bus daemon: $pid" >&2 + kill -INT "$pid" + fi + rm -f $me-$$.address + rm -f $me-$$.pid +} + +trap cleanup INT HUP TERM +dbus-daemon $dbus_daemon_args + +{ echo -n "Temporary bus daemon is "; cat $me-$$.address; } >&2 +{ echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid; } >&2 + +e=0 +DBUS_SESSION_BUS_ADDRESS="`cat $me-$$.address`" +export DBUS_SESSION_BUS_ADDRESS +"$@" || e=$? + +trap - INT HUP TERM +cleanup + +exit $e