MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/local/ssl/share/gtk-doc/html/libbonobo/libbonobo-bonobo-item-handler.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>BonoboItemHandler</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="Libbonobo Reference Manual">
<link rel="up" href="monikers.html" title="Monikers">
<link rel="prev" href="libbonobo-bonobo-moniker-extender.html" title="BonoboMonikerExtender">
<link rel="next" href="libbonobo-bonobo-item-container.html" title="BonoboItemContainer">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="general.html" title="General">
<link rel="chapter" href="factories.html" title="Objects, Factories, Reference Counting">
<link rel="chapter" href="property-bags.html" title="Property Bags, Events, Listeners">
<link rel="chapter" href="monikers.html" title="Monikers">
<link rel="chapter" href="streams.html" title="Storages and Streams">
<link rel="chapter" href="persist.html" title="Persistency">
<link rel="chapter" href="misc.html" title="Miscellaneous">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libbonobo-bonobo-moniker-extender.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="monikers.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Libbonobo Reference Manual</th>
<td><a accesskey="n" href="libbonobo-bonobo-item-container.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2771002" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2771236" class="shortcut">Description</a>
                  &#160;|&#160;
                  <a href="#id2771204" class="shortcut">Object Hierarchy</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libbonobo-bonobo-item-handler"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2771002"></a><span class="refentrytitle">BonoboItemHandler</span>
</h2>
<p>BonoboItemHandler &#8212; Simple Moniker Arguments</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<a name="BonoboItemHandler"></a><pre class="synopsis">



            <a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler-struct">BonoboItemHandler</a>;
            <a href="libbonobo-bonobo-item-handler.html#BonoboItemHandlerClass">BonoboItemHandlerClass</a>;
<a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a>* <a href="libbonobo-bonobo-item-handler.html#bonobo-item-handler-new">bonobo_item_handler_new</a>  (BonoboItemHandlerEnumObjectsFn enum_objects,
                                             BonoboItemHandlerGetObjectFn get_object,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);
<a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a>* <a href="libbonobo-bonobo-item-handler.html#bonobo-item-handler-new-closure">bonobo_item_handler_new_closure</a>
                                            (<a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *enum_objects,
                                             <a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *get_object);
<a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a>* <a href="libbonobo-bonobo-item-handler.html#bonobo-item-handler-construct">bonobo_item_handler_construct</a>
                                            (<a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a> *handler,
                                             <a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *enum_objects,
                                             <a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *get_object);
            <a href="libbonobo-bonobo-item-handler.html#BonoboItemOption">BonoboItemOption</a>;
<a
href="/usr/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html#GSList"
>GSList</a>*     <a href="libbonobo-bonobo-item-handler.html#bonobo-item-option-parse">bonobo_item_option_parse</a>        (const char *option_string);
void        <a href="libbonobo-bonobo-item-handler.html#bonobo-item-options-free">bonobo_item_options_free</a>        (<a
href="/usr/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html#GSList"
>GSList</a> *options);


</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2771204"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">

  <a
href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
   +----<a href="libbonobo-bonobo-object.html#BonoboObject">BonoboObject</a>
         +----BonoboItemHandler
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2771236"></a><h2>Description</h2>
<p>
    Sometimes you want to pass "arguments" to a component.
    Consider the component with the following OAFIID:
</p>
<p><code class="literal">OAFIID:GNOME_FileSelector</code></p>
<p>
    You might want to be able to set configuration options from
    its moniker name, without having to ever use the property bag
    API. For example:</p>
<p><code class="literal">
    OAFIID:GNOME_FileSelector!AcceptMimeTypes=image/*</code></p>
<div class="refsect2" lang="en">
<a name="id2771275"></a><h3>Implementing it</h3>
<p>
	Create a BonoboItemHandler.  This component will
	let you do argument parsing of any kind.</p>
<p>
	You have to provide two functions: <code class="function">enumObjects</code>
	(this can be empty) and <code class="function">getObject</code>.</p>
<p>The getObject function will be called when the moniker
	mechanism is trying to resolve a set of arguments to your
	function.</p>
<p>Like this:</p>
<div class="informalexample"><pre class="programlisting">
Bonobo_Unknown
getObject (BonoboItemHandler *h, const char *item_name,
           gboolean only_if_exists, gpointer data,
           CORBA_Environment *ev)
{
        MyData *m = data;
                                                                        
        if (strcmp (item_name, "friendly") == 0){
                m-&gt;friendly = true;
        }
                                                                        
        /* we just return ourselves */
        return bonobo_object_dup_ref (bonobo_object_corba_objref (h), NULL);
}
	</pre></div>
<p>
	So basically during the `getObject' operation you will be
	given a chance to process the `item_name' string which is
	basically like a command line argument (for the sake of
	explaining this) and based on this information you can
	customize your component.
    </p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771340"></a><h3>Sample functions</h3>
<p>
	Sometimes you will want to specify a bunch of options to
	configure your component, like this:
    </p>
<p><code class="literal">OAFIID:MyComponent!visible=true;image=blah.png</code></p>
<p>
	So we are separating the various options with semi-colons
	here.  To simplify your code, we have provided a couple of
	functions that given the following string:</p>
<p><code class="literal">visible=true;image=blah.png</code></p>
<p>Will return a GList split with BonoboItemOptions:</p>
<div class="informalexample"><pre class="programlisting">
GSList *l, *x;
									
x = bonobo_item_option_parse ("visible=true;image=blah.png");
									
for (l = x; l != NULL; l++){
	BonoboItemOption *io = l-&gt;data;
									
	printf ("Key=<code class="literal">s</code>, Value=<code class="literal">s</code>\n", io-&gt;key, io-&gt;value);
}
bonobo_item_option_free (x);
	</pre></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2771413"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2771423"></a><h3>
<a name="BonoboItemHandler-struct"></a>BonoboItemHandler</h3>
<a class="indexterm" name="id2771436"></a><pre class="programlisting">typedef struct _BonoboItemHandler BonoboItemHandler;</pre>
<p>
Bonobo::ItemHandler implementation
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771453"></a><h3>
<a name="BonoboItemHandlerClass"></a>BonoboItemHandlerClass</h3>
<a class="indexterm" name="id2771466"></a><pre class="programlisting">typedef struct {
	BonoboObjectClass parent_class;

	POA_Bonobo_ItemContainer__epv epv;
} BonoboItemHandlerClass;
</pre>
<p>
BonoboItemHandler class
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771483"></a><h3>
<a name="bonobo-item-handler-new"></a>bonobo_item_handler_new ()</h3>
<a class="indexterm" name="id2771496"></a><pre class="programlisting"><a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a>* bonobo_item_handler_new  (BonoboItemHandlerEnumObjectsFn enum_objects,
                                             BonoboItemHandlerGetObjectFn get_object,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);</pre>
<p>
Creates a new BonoboItemHandler object.  These are used to hold
client sites.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>enum_objects</code></em>&#160;:</span></td>
<td> callback invoked for Bonobo::ItemContainer::enum_objects
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>get_object</code></em>&#160;:</span></td>
<td> callback invoked for Bonobo::ItemContainer::get_objects
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> extra data passed on the callbacks
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The newly created BonoboItemHandler object
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771606"></a><h3>
<a name="bonobo-item-handler-new-closure"></a>bonobo_item_handler_new_closure ()</h3>
<a class="indexterm" name="id2771620"></a><pre class="programlisting"><a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a>* bonobo_item_handler_new_closure
                                            (<a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *enum_objects,
                                             <a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *get_object);</pre>
<p>
Creates a new BonoboItemHandler object.  These are used to hold
client sites.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>enum_objects</code></em>&#160;:</span></td>
<td> closure invoked for Bonobo::ItemContainer::enum_objects
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>get_object</code></em>&#160;:</span></td>
<td> closure invoked for Bonobo::ItemContainer::get_objects
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The newly created BonoboItemHandler object
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771706"></a><h3>
<a name="bonobo-item-handler-construct"></a>bonobo_item_handler_construct ()</h3>
<a class="indexterm" name="id2771720"></a><pre class="programlisting"><a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a>* bonobo_item_handler_construct
                                            (<a href="libbonobo-bonobo-item-handler.html#BonoboItemHandler">BonoboItemHandler</a> *handler,
                                             <a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *enum_objects,
                                             <a
href="/usr/share/gtk-doc/html/gobject/gobject-Closures.html#GClosure"
>GClosure</a> *get_object);</pre>
<p>
Constructs the <em class="parameter"><code>container</code></em> BonoboObject using the provided closures
for the actual implementation.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>handler</code></em>&#160;:</span></td>
<td> The handler object to construct
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>enum_objects</code></em>&#160;:</span></td>
<td> The closure implementing enumObjects
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>get_object</code></em>&#160;:</span></td>
<td> The closure implementing getObject
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The constructed BonoboItemContainer object.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771834"></a><h3>
<a name="BonoboItemOption"></a>BonoboItemOption</h3>
<a class="indexterm" name="id2771847"></a><pre class="programlisting">typedef struct {
	char *key;
	char *value;
} BonoboItemOption;
</pre>
<p>
A key-value pair.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771864"></a><h3>
<a name="bonobo-item-option-parse"></a>bonobo_item_option_parse ()</h3>
<a class="indexterm" name="id2771876"></a><pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html#GSList"
>GSList</a>*     bonobo_item_option_parse        (const char *option_string);</pre>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_string</code></em>&#160;:</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2771933"></a><h3>
<a name="bonobo-item-options-free"></a>bonobo_item_options_free ()</h3>
<a class="indexterm" name="id2771946"></a><pre class="programlisting">void        bonobo_item_options_free        (<a
href="/usr/share/gtk-doc/html/glib/glib-Singly-Linked-Lists.html#GSList"
>GSList</a> *options);</pre>
<p>
Use this to release a list returned by <a href="libbonobo-bonobo-item-handler.html#bonobo-item-option-parse"><code class="function">bonobo_item_option_parse()</code></a></p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>options</code></em>&#160;:</span></td>
<td> a GSList of BonoboItemOption structures that was returned by <a href="libbonobo-bonobo-item-handler.html#bonobo-item-option-parse"><code class="function">bonobo_item_option_parse()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2772019"></a><h2>See Also</h2>
<p>
   A simplistic implementation exists in <a href="libbonobo-bonobo-item-container.html#BonoboItemContainer"><span class="type">BonoboItemContainer</span></a>.
</p>
</div>
</div>
</body>
</html>