1
<refentry id="libbonobo-bonobo-context">
3
<refentrytitle>bonobo-context</refentrytitle>
4
<manvolnum>3</manvolnum>
5
<refmiscinfo>LIBBONOBO Library</refmiscinfo>
9
<refname>bonobo-context</refname><refpurpose>Extensible runtime service interface</refpurpose>
12
<refsynopsisdiv><title>Synopsis</title>
17
<link linkend="Bonobo-Unknown">Bonobo_Unknown</link> <link linkend="bonobo-context-get">bonobo_context_get</link> (const <link linkend="CORBA-char">CORBA_char</link> *context_name,
18
<link linkend="CORBA-Environment">CORBA_Environment</link> *opt_ev);
19
void <link linkend="bonobo-context-add">bonobo_context_add</link> (const <link linkend="CORBA-char">CORBA_char</link> *context_name,
20
<link linkend="Bonobo-Unknown">Bonobo_Unknown</link> context);
21
<link linkend="BonoboObject">BonoboObject</link>* <link linkend="bonobo-context-running-get">bonobo_context_running_get</link> (void);
22
void <link linkend="bonobo-running-context-auto-exit-unref">bonobo_running_context_auto_exit_unref</link>
23
(<link linkend="BonoboObject">BonoboObject</link> *object);
32
<title>Description</title>
34
The bonobo-context code is designed to provide a way to
35
expose CORBA contexts through a single C interface. This
36
is so that language bindings can get away with wrapping
37
a single function, and yet have access to the whole
38
Bonobo service framework. Two examples of this are the
39
MonikerContext and the RunningContext ( see
45
<title>Getting and using the moniker context</title>
47
Bonobo_MonikerContext context;
48
Bonobo_Unknown object;
50
context = bonobo_context_get ("Activation", NULL);
52
if (context == CORBA_OBJECT_NIL)
53
g_error (_("Internal error, no activation context"));
55
object = Bonobo_MonikerContext_getObject (
56
"file:/demo/a.jpeg", "Bonobo/Control", ev);
63
The list of contexts is open and may be expanded in the future,
64
currently there are the following:
68
Activation - Bonobo/MonikerContext
73
Running - Bonobo/RunningContext
80
The running context is particularly useful for ensuring that
81
server processes exit cleanly when all their objects and
82
derived objects are dead. To do this we can simply do the
87
<title>How to get a factory to quit when it is idle</title>
90
last_unref_exit_cb (gpointer context,
91
BonoboObject *factory)
93
bonobo_object_unref (factory);
94
<link linkend="gtk-main-quit">gtk_main_quit</link>();
97
int main (int argc, char **argv)
100
bonobo_running_context_ignore_object (BONOBO_OBJREF (object));
102
gtk_signal_connect (GTK_OBJECT (<link linkend="bonobo-context-running-get">bonobo_context_running_get</link>()),
103
"last_unref", last_unref_exit_cb, factory);
105
<link linkend="bonobo-main">bonobo_main</link>();
111
Since this is a commonly used thing there is a helper to make this
114
<title>How to get a factory to quit when it is idle</title>
116
bonobo_running_context_auto_exit_unref (factory)
123
<title>Details</title>
125
<title><anchor id="bonobo-context-get">bonobo_context_get ()</title>
126
<programlisting><link linkend="Bonobo-Unknown">Bonobo_Unknown</link> bonobo_context_get (const <link linkend="CORBA-char">CORBA_char</link> *context_name,
127
<link linkend="CORBA-Environment">CORBA_Environment</link> *opt_ev);</programlisting>
129
The most useful context is named 'Activation' and returns
130
the IDL:Bonobo/ActivationContext:1.0 interface.</para>
133
</para><informaltable pgwide="1" frame="none" role="params">
135
<colspec colwidth="2*">
136
<colspec colwidth="8*">
138
<row><entry align="right"><parameter>context_name</parameter> :</entry>
139
<entry> the name of the context
141
<row><entry align="right"><parameter>opt_ev</parameter> :</entry>
142
<entry> optional Environment, or NULL
144
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a new reference to a global Bonobo context or CORBA_OBJECT_NIL
146
</tbody></tgroup></informaltable></refsect2>
148
<title><anchor id="bonobo-context-add">bonobo_context_add ()</title>
149
<programlisting>void bonobo_context_add (const <link linkend="CORBA-char">CORBA_char</link> *context_name,
150
<link linkend="Bonobo-Unknown">Bonobo_Unknown</link> context);</programlisting>
152
This function adds a new context to the context system</para>
155
</para><informaltable pgwide="1" frame="none" role="params">
157
<colspec colwidth="2*">
158
<colspec colwidth="8*">
160
<row><entry align="right"><parameter>context_name</parameter> :</entry>
161
<entry> the name to refer to the context by
163
<row><entry align="right"><parameter>context</parameter> :</entry>
164
<entry> The Bonobo_Unknown; a ref. is taken on this.
166
</tbody></tgroup></informaltable></refsect2>
168
<title><anchor id="bonobo-context-running-get">bonobo_context_running_get ()</title>
169
<programlisting><link linkend="BonoboObject">BonoboObject</link>* bonobo_context_running_get (void);</programlisting>
172
</para><informaltable pgwide="1" frame="none" role="params">
174
<colspec colwidth="2*">
175
<colspec colwidth="8*">
177
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>
181
</tbody></tgroup></informaltable></refsect2>
183
<title><anchor id="bonobo-running-context-auto-exit-unref">bonobo_running_context_auto_exit_unref ()</title>
184
<programlisting>void bonobo_running_context_auto_exit_unref
185
(<link linkend="BonoboObject">BonoboObject</link> *object);</programlisting>
188
</para><informaltable pgwide="1" frame="none" role="params">
190
<colspec colwidth="2*">
191
<colspec colwidth="8*">
193
<row><entry align="right"><parameter>object</parameter> :</entry>
198
</tbody></tgroup></informaltable></refsect2>