[Telepathy-commits] [telepathy-doc/master] 2009-12-15 Murray Cumming <murrayc at murrayc.com>
Murray Cumming
murrayc at murrayc.com
Tue Jan 20 01:47:43 PST 2009
* configure.ac:
* docs/examples/basics_dbus_python/Makefile.am:
* docs/examples/basics_dbus_python/example.py
* docs/book/C/telepathy.xml: Basics: Add a little example of calling a
D-Bus method with Python.
* docs/book/insert-example-code.py: Read .py files as well as .h and .cc
files.
---
ChangeLog | 11 +
configure.ac | 1 +
docs/book/C/telepathy.xml | 7 +
docs/book/insert_example_code.pl | 3 +-
docs/examples/Makefile.am | 2 +-
docs/examples/basics_dbus_python/.deps/main.Po | 300 ++++++++++++++++++++++++
docs/examples/basics_dbus_python/Makefile.am | 4 +
docs/examples/basics_dbus_python/example.py | 41 ++++
8 files changed, 367 insertions(+), 2 deletions(-)
create mode 100644 docs/examples/basics_dbus_python/.deps/main.Po
create mode 100644 docs/examples/basics_dbus_python/Makefile.am
create mode 100644 docs/examples/basics_dbus_python/example.py
diff --git a/ChangeLog b/ChangeLog
index 12e6be7..731fceb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
2009-12-15 Murray Cumming <murrayc at murrayc.com>
* configure.ac:
+ * docs/examples/basics_dbus_python/Makefile.am:
+ * docs/examples/basics_dbus_python/example.py
+ * docs/book/C/telepathy.xml: Basics: Add a little example of calling a
+ D-Bus method with Python.
+
+ * docs/book/insert-example-code.py: Read .py files as well as .h and .cc
+ files.
+
+2009-12-15 Murray Cumming <murrayc at murrayc.com>
+
+ * configure.ac:
* docs/examples/basics_dbus_glib/Makefile.am:
* docs/examples/basics_dbus_glib/main.c
* docs/book/C/telepathy.xml: Basics: Add a little example of calling a
diff --git a/configure.ac b/configure.ac
index 90eb3f9..56f6f4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_OUTPUT([
docs/Makefile
docs/examples/Makefile
docs/examples/basics_dbus_glib/Makefile
+ docs/examples/basics_dbus_python/Makefile
docs/examples/connect/Makefile
docs/examples/list_all_protocols/Makefile
docs/examples/list_contacts/Makefile
diff --git a/docs/book/C/telepathy.xml b/docs/book/C/telepathy.xml
index cf841f6..dd4a5dc 100644
--- a/docs/book/C/telepathy.xml
+++ b/docs/book/C/telepathy.xml
@@ -116,6 +116,13 @@ of the Telapathy specification.
<sect2 id="sec-basics-dbus-python">
<title>Using D-Bus from Python</title>
<para>TODO</para>
+
+ <sect3>
+ <title>Example</title>
+ <para>This example used Python to call the <literal>Notify()</literal> method on the <literal>org.freedesktop.Notification</literal> interface of the desktop notification service at the <literal>/org/freedesktop/Notification</literal> path.</para>
+ <para><ulink url="&url_examples_base;basics_dbus_python">Source Code</ulink></para>
+ </sect3>
+
</sect2>
</sect1>
diff --git a/docs/book/insert_example_code.pl b/docs/book/insert_example_code.pl
index 4f312f8..52f6770 100755
--- a/docs/book/insert_example_code.pl
+++ b/docs/book/insert_example_code.pl
@@ -29,10 +29,11 @@
my @source_files = grep(/\.c$/, @dir_contents);
my @header_files = grep(/\.h$/, @dir_contents);
+ my @python_source_files = grep(/\.py$/, @dir_contents);
print "<!-- start inserted example code -->\n";
- foreach $source_file (@header_files, @source_files)
+ foreach $source_file (@header_files, @source_files, @python_source_files)
{
print "<para>File: <filename>${source_file}</filename>\n";
print "</para>\n";
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
index b4711e3..de73ecf 100644
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/docs/Makefile_web.am_fragment
-example_dirs = basics_dbus_glib connect list_all_protocols list_contacts set_presence send_message
+example_dirs = basics_dbus_glib basics_dbus_python connect list_all_protocols list_contacts set_presence send_message
SUBDIRS = $(example_dirs)
diff --git a/docs/examples/basics_dbus_python/.deps/main.Po b/docs/examples/basics_dbus_python/.deps/main.Po
new file mode 100644
index 0000000..4a210e7
--- /dev/null
+++ b/docs/examples/basics_dbus_python/.deps/main.Po
@@ -0,0 +1,300 @@
+main.o: main.c /opt/gnome220/include/dbus-1.0/dbus/dbus-glib.h \
+ /opt/gnome220/include/glib-2.0/glib-object.h \
+ /opt/gnome220/include/glib-2.0/gobject/gboxed.h \
+ /opt/gnome220/include/glib-2.0/gobject/gtype.h \
+ /opt/gnome220/include/glib-2.0/glib.h \
+ /opt/gnome220/include/glib-2.0/glib/galloca.h \
+ /opt/gnome220/include/glib-2.0/glib/gtypes.h \
+ /opt/gnome220/lib/glib-2.0/include/glibconfig.h \
+ /opt/gnome220/include/glib-2.0/glib/gmacros.h \
+ /usr/lib/gcc/i486-linux-gnu/4.3.2/include/stddef.h \
+ /usr/lib/gcc/i486-linux-gnu/4.3.2/include-fixed/limits.h \
+ /usr/lib/gcc/i486-linux-gnu/4.3.2/include-fixed/syslimits.h \
+ /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
+ /usr/include/gnu/stubs-32.h /usr/include/bits/posix1_lim.h \
+ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \
+ /usr/include/bits/posix2_lim.h \
+ /usr/lib/gcc/i486-linux-gnu/4.3.2/include/float.h \
+ /opt/gnome220/include/glib-2.0/glib/garray.h \
+ /opt/gnome220/include/glib-2.0/glib/gasyncqueue.h \
+ /opt/gnome220/include/glib-2.0/glib/gthread.h \
+ /opt/gnome220/include/glib-2.0/glib/gerror.h \
+ /opt/gnome220/include/glib-2.0/glib/gquark.h \
+ /opt/gnome220/include/glib-2.0/glib/gutils.h \
+ /usr/lib/gcc/i486-linux-gnu/4.3.2/include/stdarg.h \
+ /opt/gnome220/include/glib-2.0/glib/gatomic.h \
+ /opt/gnome220/include/glib-2.0/glib/gbacktrace.h /usr/include/signal.h \
+ /usr/include/bits/sigset.h /usr/include/bits/types.h \
+ /usr/include/bits/typesizes.h /usr/include/bits/signum.h \
+ /usr/include/time.h /usr/include/bits/siginfo.h \
+ /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
+ /usr/include/bits/sigstack.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/bits/sigthread.h \
+ /opt/gnome220/include/glib-2.0/glib/gbase64.h \
+ /opt/gnome220/include/glib-2.0/glib/gbookmarkfile.h \
+ /usr/include/bits/time.h /opt/gnome220/include/glib-2.0/glib/gcache.h \
+ /opt/gnome220/include/glib-2.0/glib/glist.h \
+ /opt/gnome220/include/glib-2.0/glib/gmem.h \
+ /opt/gnome220/include/glib-2.0/glib/gslice.h \
+ /opt/gnome220/include/glib-2.0/glib/gchecksum.h \
+ /opt/gnome220/include/glib-2.0/glib/gcompletion.h \
+ /opt/gnome220/include/glib-2.0/glib/gconvert.h \
+ /opt/gnome220/include/glib-2.0/glib/gdataset.h \
+ /opt/gnome220/include/glib-2.0/glib/gdate.h \
+ /opt/gnome220/include/glib-2.0/glib/gdir.h \
+ /opt/gnome220/include/glib-2.0/glib/gfileutils.h \
+ /opt/gnome220/include/glib-2.0/glib/ghash.h \
+ /opt/gnome220/include/glib-2.0/glib/ghook.h \
+ /opt/gnome220/include/glib-2.0/glib/giochannel.h \
+ /opt/gnome220/include/glib-2.0/glib/gmain.h \
+ /opt/gnome220/include/glib-2.0/glib/gpoll.h \
+ /opt/gnome220/include/glib-2.0/glib/gslist.h \
+ /opt/gnome220/include/glib-2.0/glib/gstring.h \
+ /opt/gnome220/include/glib-2.0/glib/gunicode.h \
+ /opt/gnome220/include/glib-2.0/glib/gkeyfile.h \
+ /opt/gnome220/include/glib-2.0/glib/gmappedfile.h \
+ /opt/gnome220/include/glib-2.0/glib/gmarkup.h \
+ /opt/gnome220/include/glib-2.0/glib/gmessages.h \
+ /opt/gnome220/include/glib-2.0/glib/gnode.h \
+ /opt/gnome220/include/glib-2.0/glib/goption.h \
+ /opt/gnome220/include/glib-2.0/glib/gpattern.h \
+ /opt/gnome220/include/glib-2.0/glib/gprimes.h \
+ /opt/gnome220/include/glib-2.0/glib/gqsort.h \
+ /opt/gnome220/include/glib-2.0/glib/gqueue.h \
+ /opt/gnome220/include/glib-2.0/glib/grand.h \
+ /opt/gnome220/include/glib-2.0/glib/grel.h \
+ /opt/gnome220/include/glib-2.0/glib/gregex.h \
+ /opt/gnome220/include/glib-2.0/glib/gscanner.h \
+ /opt/gnome220/include/glib-2.0/glib/gsequence.h \
+ /opt/gnome220/include/glib-2.0/glib/gshell.h \
+ /opt/gnome220/include/glib-2.0/glib/gspawn.h \
+ /opt/gnome220/include/glib-2.0/glib/gstrfuncs.h \
+ /opt/gnome220/include/glib-2.0/glib/gtestutils.h \
+ /opt/gnome220/include/glib-2.0/glib/gthreadpool.h \
+ /opt/gnome220/include/glib-2.0/glib/gtimer.h \
+ /opt/gnome220/include/glib-2.0/glib/gtree.h \
+ /opt/gnome220/include/glib-2.0/glib/gurifuncs.h \
+ /opt/gnome220/include/glib-2.0/gobject/genums.h \
+ /opt/gnome220/include/glib-2.0/gobject/gobject.h \
+ /opt/gnome220/include/glib-2.0/gobject/gvalue.h \
+ /opt/gnome220/include/glib-2.0/gobject/gparam.h \
+ /opt/gnome220/include/glib-2.0/gobject/gclosure.h \
+ /opt/gnome220/include/glib-2.0/gobject/gsignal.h \
+ /opt/gnome220/include/glib-2.0/gobject/gmarshal.h \
+ /opt/gnome220/include/glib-2.0/gobject/gparamspecs.h \
+ /opt/gnome220/include/glib-2.0/gobject/gsourceclosure.h \
+ /opt/gnome220/include/glib-2.0/gobject/gtypemodule.h \
+ /opt/gnome220/include/glib-2.0/gobject/gtypeplugin.h \
+ /opt/gnome220/include/glib-2.0/gobject/gvaluearray.h \
+ /opt/gnome220/include/glib-2.0/gobject/gvaluetypes.h \
+ /opt/gnome220/include/dbus-1.0/dbus/dbus-shared.h \
+ /opt/gnome220/include/dbus-1.0/dbus/dbus-gtype-specialized.h
+
+/opt/gnome220/include/dbus-1.0/dbus/dbus-glib.h:
+
+/opt/gnome220/include/glib-2.0/glib-object.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gboxed.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gtype.h:
+
+/opt/gnome220/include/glib-2.0/glib.h:
+
+/opt/gnome220/include/glib-2.0/glib/galloca.h:
+
+/opt/gnome220/include/glib-2.0/glib/gtypes.h:
+
+/opt/gnome220/lib/glib-2.0/include/glibconfig.h:
+
+/opt/gnome220/include/glib-2.0/glib/gmacros.h:
+
+/usr/lib/gcc/i486-linux-gnu/4.3.2/include/stddef.h:
+
+/usr/lib/gcc/i486-linux-gnu/4.3.2/include-fixed/limits.h:
+
+/usr/lib/gcc/i486-linux-gnu/4.3.2/include-fixed/syslimits.h:
+
+/usr/include/limits.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/include/gnu/stubs-32.h:
+
+/usr/include/bits/posix1_lim.h:
+
+/usr/include/bits/local_lim.h:
+
+/usr/include/linux/limits.h:
+
+/usr/include/bits/posix2_lim.h:
+
+/usr/lib/gcc/i486-linux-gnu/4.3.2/include/float.h:
+
+/opt/gnome220/include/glib-2.0/glib/garray.h:
+
+/opt/gnome220/include/glib-2.0/glib/gasyncqueue.h:
+
+/opt/gnome220/include/glib-2.0/glib/gthread.h:
+
+/opt/gnome220/include/glib-2.0/glib/gerror.h:
+
+/opt/gnome220/include/glib-2.0/glib/gquark.h:
+
+/opt/gnome220/include/glib-2.0/glib/gutils.h:
+
+/usr/lib/gcc/i486-linux-gnu/4.3.2/include/stdarg.h:
+
+/opt/gnome220/include/glib-2.0/glib/gatomic.h:
+
+/opt/gnome220/include/glib-2.0/glib/gbacktrace.h:
+
+/usr/include/signal.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/bits/signum.h:
+
+/usr/include/time.h:
+
+/usr/include/bits/siginfo.h:
+
+/usr/include/bits/sigaction.h:
+
+/usr/include/bits/sigcontext.h:
+
+/usr/include/bits/sigstack.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sigthread.h:
+
+/opt/gnome220/include/glib-2.0/glib/gbase64.h:
+
+/opt/gnome220/include/glib-2.0/glib/gbookmarkfile.h:
+
+/usr/include/bits/time.h:
+
+/opt/gnome220/include/glib-2.0/glib/gcache.h:
+
+/opt/gnome220/include/glib-2.0/glib/glist.h:
+
+/opt/gnome220/include/glib-2.0/glib/gmem.h:
+
+/opt/gnome220/include/glib-2.0/glib/gslice.h:
+
+/opt/gnome220/include/glib-2.0/glib/gchecksum.h:
+
+/opt/gnome220/include/glib-2.0/glib/gcompletion.h:
+
+/opt/gnome220/include/glib-2.0/glib/gconvert.h:
+
+/opt/gnome220/include/glib-2.0/glib/gdataset.h:
+
+/opt/gnome220/include/glib-2.0/glib/gdate.h:
+
+/opt/gnome220/include/glib-2.0/glib/gdir.h:
+
+/opt/gnome220/include/glib-2.0/glib/gfileutils.h:
+
+/opt/gnome220/include/glib-2.0/glib/ghash.h:
+
+/opt/gnome220/include/glib-2.0/glib/ghook.h:
+
+/opt/gnome220/include/glib-2.0/glib/giochannel.h:
+
+/opt/gnome220/include/glib-2.0/glib/gmain.h:
+
+/opt/gnome220/include/glib-2.0/glib/gpoll.h:
+
+/opt/gnome220/include/glib-2.0/glib/gslist.h:
+
+/opt/gnome220/include/glib-2.0/glib/gstring.h:
+
+/opt/gnome220/include/glib-2.0/glib/gunicode.h:
+
+/opt/gnome220/include/glib-2.0/glib/gkeyfile.h:
+
+/opt/gnome220/include/glib-2.0/glib/gmappedfile.h:
+
+/opt/gnome220/include/glib-2.0/glib/gmarkup.h:
+
+/opt/gnome220/include/glib-2.0/glib/gmessages.h:
+
+/opt/gnome220/include/glib-2.0/glib/gnode.h:
+
+/opt/gnome220/include/glib-2.0/glib/goption.h:
+
+/opt/gnome220/include/glib-2.0/glib/gpattern.h:
+
+/opt/gnome220/include/glib-2.0/glib/gprimes.h:
+
+/opt/gnome220/include/glib-2.0/glib/gqsort.h:
+
+/opt/gnome220/include/glib-2.0/glib/gqueue.h:
+
+/opt/gnome220/include/glib-2.0/glib/grand.h:
+
+/opt/gnome220/include/glib-2.0/glib/grel.h:
+
+/opt/gnome220/include/glib-2.0/glib/gregex.h:
+
+/opt/gnome220/include/glib-2.0/glib/gscanner.h:
+
+/opt/gnome220/include/glib-2.0/glib/gsequence.h:
+
+/opt/gnome220/include/glib-2.0/glib/gshell.h:
+
+/opt/gnome220/include/glib-2.0/glib/gspawn.h:
+
+/opt/gnome220/include/glib-2.0/glib/gstrfuncs.h:
+
+/opt/gnome220/include/glib-2.0/glib/gtestutils.h:
+
+/opt/gnome220/include/glib-2.0/glib/gthreadpool.h:
+
+/opt/gnome220/include/glib-2.0/glib/gtimer.h:
+
+/opt/gnome220/include/glib-2.0/glib/gtree.h:
+
+/opt/gnome220/include/glib-2.0/glib/gurifuncs.h:
+
+/opt/gnome220/include/glib-2.0/gobject/genums.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gobject.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gvalue.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gparam.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gclosure.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gsignal.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gmarshal.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gparamspecs.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gsourceclosure.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gtypemodule.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gtypeplugin.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gvaluearray.h:
+
+/opt/gnome220/include/glib-2.0/gobject/gvaluetypes.h:
+
+/opt/gnome220/include/dbus-1.0/dbus/dbus-shared.h:
+
+/opt/gnome220/include/dbus-1.0/dbus/dbus-gtype-specialized.h:
diff --git a/docs/examples/basics_dbus_python/Makefile.am b/docs/examples/basics_dbus_python/Makefile.am
new file mode 100644
index 0000000..6e633c3
--- /dev/null
+++ b/docs/examples/basics_dbus_python/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/docs/examples/Makefile.am_fragment
+
+#Dist the example:
+EXTRA_DIST = example.py
diff --git a/docs/examples/basics_dbus_python/example.py b/docs/examples/basics_dbus_python/example.py
new file mode 100644
index 0000000..63ca637
--- /dev/null
+++ b/docs/examples/basics_dbus_python/example.py
@@ -0,0 +1,41 @@
+# Copyright 2009 Collabora Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2
+# as published by the Free Software Foundation.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import dbus
+
+# Connect to the bus:
+bus = dbus.SessionBus()
+
+# Get a proxy for the remote object:
+proxy = bus.get_object('org.freedesktop.Notifications',
+ '/org/freedesktop/Notifications',
+ 'org.freedesktop.Notifications')
+
+
+# Call a method on the interface of the remote object: */
+actions = dbus.Array('s')
+hints = dbus.Dictionary({}, signature=dbus.Signature('sv'))
+notification_id = proxy.Notify("dbus python example",
+ (dbus.UInt32)(0),
+ '', # icon-name
+ 'Example Notification',
+ 'This is an example notification via dbus with Python.',
+ actions,
+ hints,
+ 0)
+
+
+
+
--
1.5.6.5
More information about the Telepathy-commits
mailing list