2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
4
<!ENTITY dbus-binding-tool SYSTEM "dbus-binding-tool.xml">
5
<!ENTITY version SYSTEM "version.xml">
7
<refentry id="dbus-glib-DBus-GLib-low-level">
9
<refentrytitle role="top_of_page" id="dbus-glib-DBus-GLib-low-level.top_of_page">DBus GLib low level</refentrytitle>
10
<manvolnum>3</manvolnum>
11
<refmiscinfo>DBUS-GLIB Library</refmiscinfo>
15
<refname>DBus GLib low level</refname>
16
<refpurpose>DBus lower level functions</refpurpose>
18
<refsect1 id="dbus-glib-DBus-GLib-low-level.stability-level">
19
<title>Stability Level</title>
20
Unstable, unless otherwise indicated
23
<refsynopsisdiv id="dbus-glib-DBus-GLib-low-level.synopsis" role="synopsis">
24
<title role="synopsis.title">Synopsis</title>
27
<link linkend="void">void</link> <link linkend="dbus-set-g-error">dbus_set_g_error</link> (<link linkend="GError">GError</link> **gerror,
28
<link linkend="DBusError">DBusError</link> *derror);
29
<link linkend="void">void</link> <link linkend="dbus-connection-setup-with-g-main">dbus_connection_setup_with_g_main</link> (<link linkend="DBusConnection">DBusConnection</link> *connection,
30
<link linkend="GMainContext">GMainContext</link> *context);
31
<link linkend="void">void</link> <link linkend="dbus-server-setup-with-g-main">dbus_server_setup_with_g_main</link> (<link linkend="DBusServer">DBusServer</link> *server,
32
<link linkend="GMainContext">GMainContext</link> *context);
44
<refsect1 id="dbus-glib-DBus-GLib-low-level.description" role="desc">
45
<title role="desc.title">Description</title>
47
These functions can be used to access lower level of DBus.</para>
52
<refsect1 id="dbus-glib-DBus-GLib-low-level.details" role="details">
53
<title role="details.title">Details</title>
54
<refsect2 id="dbus-set-g-error" role="function">
55
<title>dbus_set_g_error ()</title>
56
<indexterm zone="dbus-set-g-error"><primary sortas="dbus_set_g_error">dbus_set_g_error</primary></indexterm><programlisting><link linkend="void">void</link> dbus_set_g_error (<link linkend="GError">GError</link> **gerror,
57
<link linkend="DBusError">DBusError</link> *derror);</programlisting>
59
Store the information from a DBus method error return into a
60
GError. For the normal case of an arbitrary remote process,
61
the error code will be DBUS_GERROR_REMOTE_EXCEPTION. Now,
62
DBus errors have two components; a message and a "name".
63
The former is an arbitrary (normally American English) string.
64
The second is a string like com.example.FooFailure which
65
programs can use as a conditional source. Because a GError
66
only has one string, we use a hack to encode both values:
69
<human readable string><null><error name><null>
72
You can use the following code to retrieve both values:
75
<informalexample><programlisting>const char *msg = error->message;
76
size_t len = strlen(msg);
77
const char *error_name = msg+len+1;</programlisting></informalexample></para>
79
</para><variablelist role="params">
80
<varlistentry><term><parameter>gerror</parameter> :</term>
81
<listitem><simpara> an error
82
</simpara></listitem></varlistentry>
83
<varlistentry><term><parameter>derror</parameter> :</term>
85
</simpara></listitem></varlistentry>
86
</variablelist></refsect2>
87
<refsect2 id="dbus-connection-setup-with-g-main" role="function">
88
<title>dbus_connection_setup_with_g_main ()</title>
89
<indexterm zone="dbus-connection-setup-with-g-main"><primary sortas="dbus_connection_setup_with_g_main">dbus_connection_setup_with_g_main</primary></indexterm><programlisting><link linkend="void">void</link> dbus_connection_setup_with_g_main (<link linkend="DBusConnection">DBusConnection</link> *connection,
90
<link linkend="GMainContext">GMainContext</link> *context);</programlisting>
92
Sets the watch and timeout functions of a <link linkend="DBusConnection"><type>DBusConnection</type></link>
93
to integrate the connection with the GLib main loop.
94
Pass in <link linkend="NULL--CAPS"><type>NULL</type></link> for the <link linkend="GMainContext"><type>GMainContext</type></link> unless you're
95
doing something specialized.
98
If called twice for the same context, does nothing the second
99
time. If called once with context A and once with context B,
100
context B replaces context A as the context monitoring the
103
</para><variablelist role="params">
104
<varlistentry><term><parameter>connection</parameter> :</term>
105
<listitem><simpara> the connection
106
</simpara></listitem></varlistentry>
107
<varlistentry><term><parameter>context</parameter> :</term>
108
<listitem><simpara> the <link linkend="GMainContext"><type>GMainContext</type></link> or <link linkend="NULL--CAPS"><type>NULL</type></link> for default context
109
</simpara></listitem></varlistentry>
110
</variablelist></refsect2>
111
<refsect2 id="dbus-server-setup-with-g-main" role="function">
112
<title>dbus_server_setup_with_g_main ()</title>
113
<indexterm zone="dbus-server-setup-with-g-main"><primary sortas="dbus_server_setup_with_g_main">dbus_server_setup_with_g_main</primary></indexterm><programlisting><link linkend="void">void</link> dbus_server_setup_with_g_main (<link linkend="DBusServer">DBusServer</link> *server,
114
<link linkend="GMainContext">GMainContext</link> *context);</programlisting>
116
Sets the watch and timeout functions of a <link linkend="DBusServer"><type>DBusServer</type></link>
117
to integrate the server with the GLib main loop.
118
In most cases the context argument should be <link linkend="NULL--CAPS"><type>NULL</type></link>.
121
If called twice for the same context, does nothing the second
122
time. If called once with context A and once with context B,
123
context B replaces context A as the context monitoring the
126
</para><variablelist role="params">
127
<varlistentry><term><parameter>server</parameter> :</term>
128
<listitem><simpara> the server
129
</simpara></listitem></varlistentry>
130
<varlistentry><term><parameter>context</parameter> :</term>
131
<listitem><simpara> the <link linkend="GMainContext"><type>GMainContext</type></link> or <link linkend="NULL--CAPS"><type>NULL</type></link> for default
132
</simpara></listitem></varlistentry>
133
</variablelist></refsect2>