Sophie

Sophie

distrib > PLD > ac > amd64 > media > dist > by-pkgid > fd2761970a77896f276e13daf3a9620f > files > 97

bonobo-devel-1.0.22-7.amd64.rpm

<HTML
><HEAD
><TITLE
>bonobo-context</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="Bonobo API Reference Manual"
HREF="book1.html"><LINK
REL="UP"
TITLE="Object Activation and Lifecycle"
HREF="bonobo-object-activation.html"><LINK
REL="PREVIOUS"
TITLE="Object Activation and Lifecycle"
HREF="bonobo-object-activation.html"><LINK
REL="NEXT"
TITLE="bonobo-moniker-util"
HREF="bonobo-bonobo-moniker-util.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TH
COLSPAN="4"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="5"
>Bonobo API Reference Manual</FONT
></TH
></TR
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="bonobo-object-activation.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="bonobo-object-activation.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Up</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="bonobo-bonobo-moniker-util.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
></TABLE
></DIV
><H1
><A
NAME="BONOBO-BONOBO-CONTEXT"
>bonobo-context</A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN1161"
></A
><H2
>Name</H2
>bonobo-context&nbsp;--&nbsp;Extensible runtime service interface</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN1164"
></A
><H2
>Synopsis</H2
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="SYNOPSIS"
>&#13;

void        <A
HREF="bonobo-bonobo-context.html#BONOBO-CONTEXT-INIT"
>bonobo_context_init</A
>             (void);
void        <A
HREF="bonobo-bonobo-context.html#BONOBO-CONTEXT-SHUTDOWN"
>bonobo_context_shutdown</A
>         (void);
void        <A
HREF="bonobo-bonobo-context.html#BONOBO-CONTEXT-ADD"
>bonobo_context_add</A
>              (const <GTKDOCLINK
HREF="CORBA-CHAR"
>CORBA_char</GTKDOCLINK
> *context_name,
                                             <GTKDOCLINK
HREF="BONOBO-UNKNOWN"
>Bonobo_Unknown</GTKDOCLINK
> context);
<GTKDOCLINK
HREF="BONOBO-UNKNOWN"
>Bonobo_Unknown</GTKDOCLINK
> <A
HREF="bonobo-bonobo-context.html#BONOBO-CONTEXT-GET"
>bonobo_context_get</A
>           (const <GTKDOCLINK
HREF="CORBA-CHAR"
>CORBA_char</GTKDOCLINK
> *context_name,
                                             <GTKDOCLINK
HREF="CORBA-ENVIRONMENT"
>CORBA_Environment</GTKDOCLINK
> *opt_ev);
<A
HREF="bonobo-bonobo-object.html#BONOBOOBJECT"
>BonoboObject</A
>* <A
HREF="bonobo-bonobo-context.html#BONOBO-CONTEXT-RUNNING-GET"
>bonobo_context_running_get</A
>    (void);
void        <A
HREF="bonobo-bonobo-context.html#BONOBO-RUNNING-CONTEXT-AUTO-EXIT-UNREF"
>bonobo_running_context_auto_exit_unref</A
>
                                            (<A
HREF="bonobo-bonobo-object.html#BONOBOOBJECT"
>BonoboObject</A
> *object);&#13;</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN1180"
></A
><H2
>Description</H2
><P
>The bonobo-context code is designed to provide a way to
expose CORBA contexts through a single C interface. This
is so that language bindings can get away with wrapping
a single function, and yet have access to the whole
Bonobo service framework. Two examples of this are the
MonikerContext and the RunningContext ( see
Bonobo_Context.idl ).</P
><P
>  <DIV
CLASS="EXAMPLE"
><A
NAME="AEN1184"
></A
><P
><B
>Example 1. Getting and using the moniker context</B
></P
><TABLE
BORDER="0"
BGCOLOR="#D8F8D8"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>Bonobo_MonikerContext context;
Bonobo_Unknown        object;

context = bonobo_context_get ("Activation", NULL);

if (context == CORBA_OBJECT_NIL)
	g_error (_("Internal error, no activation context"));

object = Bonobo_MonikerContext_getObject (
	"file:/demo/a.jpeg", "Bonobo/Control", ev);
...
     </PRE
></TD
></TR
></TABLE
></DIV
></P
><P
>The list of contexts is open and may be expanded in the future,
currently there are the following:
  <P
></P
><UL
><LI
><P
>        Activation - Bonobo/MonikerContext
      </P
></LI
><LI
><P
>        Running - Bonobo/RunningContext
      </P
></LI
></UL
></P
><P
>The running context is particularly useful for ensuring that
server processes exit cleanly when all their objects and
derived objects are dead. To do this we can simply do the
following:</P
><P
>  <DIV
CLASS="EXAMPLE"
><A
NAME="AEN1195"
></A
><P
><B
>Example 2. How to get a factory to quit when it is idle</B
></P
><TABLE
BORDER="0"
BGCOLOR="#D8F8D8"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>static void
last_unref_exit_cb (gpointer      context,
		    BonoboObject *factory)
{
        bonobo_object_unref (factory);
	<GTKDOCLINK
HREF="GTK-MAIN-QUIT"
>gtk_main_quit</GTKDOCLINK
>();
}
...
int main (int argc, char **argv)
{
	...
	bonobo_running_context_ignore_object (BONOBO_OBJREF (object));

	gtk_signal_connect (GTK_OBJECT (<A
HREF="bonobo-bonobo-context.html#BONOBO-CONTEXT-RUNNING-GET"
>bonobo_context_running_get</A
>()),
			    "last_unref", last_unref_exit_cb, factory);
	...
	<A
HREF="bonobo-bonobo-main.html#BONOBO-MAIN"
>bonobo_main</A
>();
}
    </PRE
></TD
></TR
></TABLE
></DIV
></P
><P
>  Since this is a commonly used thing there is a helper to make this
easier:
  <DIV
CLASS="EXAMPLE"
><A
NAME="AEN1202"
></A
><P
><B
>Example 3. How to get a factory to quit when it is idle</B
></P
><TABLE
BORDER="0"
BGCOLOR="#D8F8D8"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>bonobo_running_context_auto_exit_unref (factory) 
    </PRE
></TD
></TR
></TABLE
></DIV
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN1205"
></A
><H2
>Details</H2
><DIV
CLASS="REFSECT2"
><A
NAME="AEN1207"
></A
><H3
><A
NAME="BONOBO-CONTEXT-INIT"
></A
>bonobo_context_init ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void        bonobo_context_init             (void);</PRE
></TD
></TR
></TABLE
><P
>Sets up the context system, internal use only, called
by bonobo_init.</P
><P
></P
></DIV
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN1213"
></A
><H3
><A
NAME="BONOBO-CONTEXT-SHUTDOWN"
></A
>bonobo_context_shutdown ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void        bonobo_context_shutdown         (void);</PRE
></TD
></TR
></TABLE
><P
>Shuts down the context system, internal use only</P
><P
></P
></DIV
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN1219"
></A
><H3
><A
NAME="BONOBO-CONTEXT-ADD"
></A
>bonobo_context_add ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void        bonobo_context_add              (const <GTKDOCLINK
HREF="CORBA-CHAR"
>CORBA_char</GTKDOCLINK
> *context_name,
                                             <GTKDOCLINK
HREF="BONOBO-UNKNOWN"
>Bonobo_Unknown</GTKDOCLINK
> context);</PRE
></TD
></TR
></TABLE
><P
>This function adds a new context to the context system</P
><P
></P
><P
></P
><TABLE
CLASS="VARIABLELIST"
BORDER="0"
CELLSPACING="0"
CELLPADDING="4"
WIDTH="100%"
BGCOLOR="#FFD0D0"
><TBODY
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1228"><SPAN
STYLE="white-space: nowrap"
><TT
CLASS="PARAMETER"
><I
>context_name</I
></TT
>&nbsp;:</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
> the name to refer to the context by</P
></TD
></TR
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1233"><SPAN
STYLE="white-space: nowrap"
><TT
CLASS="PARAMETER"
><I
>context</I
></TT
>&nbsp;:</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
> The Bonobo_Unknown; a ref. is taken on this.</P
></TD
></TR
></TBODY
></TABLE
></DIV
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN1238"
></A
><H3
><A
NAME="BONOBO-CONTEXT-GET"
></A
>bonobo_context_get ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
><GTKDOCLINK
HREF="BONOBO-UNKNOWN"
>Bonobo_Unknown</GTKDOCLINK
> bonobo_context_get           (const <GTKDOCLINK
HREF="CORBA-CHAR"
>CORBA_char</GTKDOCLINK
> *context_name,
                                             <GTKDOCLINK
HREF="CORBA-ENVIRONMENT"
>CORBA_Environment</GTKDOCLINK
> *opt_ev);</PRE
></TD
></TR
></TABLE
><P
>The most useful context is named 'Activation' and returns
the IDL:Bonobo/ActivationContext:1.0 interface.</P
><P
></P
><P
></P
><TABLE
CLASS="VARIABLELIST"
BORDER="0"
CELLSPACING="0"
CELLPADDING="4"
WIDTH="100%"
BGCOLOR="#FFD0D0"
><TBODY
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1248"><SPAN
STYLE="white-space: nowrap"
><TT
CLASS="PARAMETER"
><I
>context_name</I
></TT
>&nbsp;:</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
> the name of the context</P
></TD
></TR
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1253"><SPAN
STYLE="white-space: nowrap"
><TT
CLASS="PARAMETER"
><I
>opt_ev</I
></TT
>&nbsp;:</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
> optional Environment, or NULL</P
></TD
></TR
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1258"><SPAN
STYLE="white-space: nowrap"
><I
CLASS="EMPHASIS"
>Returns</I
> :</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
> a new reference to a global Bonobo context or CORBA_OBJECT_NIL</P
></TD
></TR
></TBODY
></TABLE
></DIV
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN1263"
></A
><H3
><A
NAME="BONOBO-CONTEXT-RUNNING-GET"
></A
>bonobo_context_running_get ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
><A
HREF="bonobo-bonobo-object.html#BONOBOOBJECT"
>BonoboObject</A
>* bonobo_context_running_get    (void);</PRE
></TD
></TR
></TABLE
><P
></P
><P
></P
><TABLE
CLASS="VARIABLELIST"
BORDER="0"
CELLSPACING="0"
CELLPADDING="4"
WIDTH="100%"
BGCOLOR="#FFD0D0"
><TBODY
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1270"><SPAN
STYLE="white-space: nowrap"
><I
CLASS="EMPHASIS"
>Returns</I
> :</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
>&#13;</P
></TD
></TR
></TBODY
></TABLE
></DIV
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN1275"
></A
><H3
><A
NAME="BONOBO-RUNNING-CONTEXT-AUTO-EXIT-UNREF"
></A
>bonobo_running_context_auto_exit_unref ()</H3
><TABLE
BORDER="0"
BGCOLOR="#D6E8FF"
WIDTH="100%"
CELLPADDING="6"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void        bonobo_running_context_auto_exit_unref
                                            (<A
HREF="bonobo-bonobo-object.html#BONOBOOBJECT"
>BonoboObject</A
> *object);</PRE
></TD
></TR
></TABLE
><P
></P
><P
></P
><TABLE
CLASS="VARIABLELIST"
BORDER="0"
CELLSPACING="0"
CELLPADDING="4"
WIDTH="100%"
BGCOLOR="#FFD0D0"
><TBODY
><TR
><TD
ALIGN="RIGHT"
VALIGN="TOP"
WIDTH="20%"
><A
NAME="AEN1282"><SPAN
STYLE="white-space: nowrap"
><TT
CLASS="PARAMETER"
><I
>object</I
></TT
>&nbsp;:</SPAN
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="80%"
><P
>&#13;</P
></TD
></TR
></TBODY
></TABLE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><BR
CLEAR="all"><BR><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="bonobo-object-activation.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="bonobo-object-activation.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Up</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="bonobo-bonobo-moniker-util.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="left"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Object Activation and Lifecycle</B
></FONT
></TD
><TD
COLSPAN="2"
ALIGN="right"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>bonobo-moniker-util</B
></FONT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>