Re: Creating an applet for gnome 2.0



Hi,

On Wed, 2002-08-14 at 09:13, Chris Picton wrote:
> 
> Hi
> 
> I am a beginner at gtk/gnome programming
> 
> I have a simple gtk+ 2.0 application I have written.  I would like to
> make it into a panel applet.
> 
> Following the instructions in 'Panel Applet Writer's Reference Manual' -
> located in /usr/share/gtk-doc/html/panel-applet/libpanel-applet.html on
> my machine, I have done the following:
> 
> I have replace my 'main' function with:
> ----
> PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_MultiresApplet_Factory",
>                              PANEL_TYPE_APPLET,
>                              "Multires Applet",
>                              "0",
>                              multires_applet_fill,
>                              NULL);
> ----
> 
> If I try run it manually, I get the following error:
> 
> -------------------------------------
> aleph-null:~/Development/gnome/multires$ ./multires 
> 
> (multires:28542): GConf-CRITICAL **: file gconf-client.c: line 545
> (gconf_client_add_dir): assertion `gconf_valid_key (dirname, NULL)'
> failed
> ---------------------------------------

This is because of the white space in "Multires Applet".  The applet
code tries to associate the applet configuration to a gconf key using
the provided name, but gconf keys can't have white spaces (probably
there should be a check in libpanel-applet though).


> I have created a bonobo server file (I have manually wrapped long lines
> for this email)
> ------------
> <oaf_server iid="OAFIID:GNOME_MultiresApplet_Factory" type="exe" 
> 	location="/home/chrisp/Development/gnome/multires/multires">
> 
>         <oaf_attribute name="repo_ids" type="stringv">
>                 <item value="IDL:Bonobo/GenericFactory:1.0"/>
>                 <item value="IDL:Bonobo/Unknown:1.0"/>
>         </oaf_attribute>
>         <oaf_attribute name="name" type="string" 
> 		value="Multires Applet Factory"/>
>         <oaf_attribute name="description" type="string" 
> 		value="MUltires applet factory Description"/>
> </oaf_server>
> 
> <oaf_server iid="OAFIID:GNOME_MultiresApplet" type="factory"
>             location="OAFIID:GNOME_MultiresApplet_Factory">
> 
>         <oaf_attribute name="repo_ids" type="stringv">
>                 <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
>                 <item value="IDL:Bonobo/Control:1.0"/>
>                 <item value="IDL:Bonobo/Unknown:1.0"/>
>         </oaf_attribute>
>         <oaf_attribute name="name" type="string" value="Multires
> Applet"/>
>         <oaf_attribute name="description" type="string" 
> 		value="My first applet for the GNOME2 panel"/>
>         <oaf_attribute name="panel:category" type="string"
> 		value="Utility"/>
>         <oaf_attribute name="panel:icon" type="string"
> 		value="gnome-applets.png"/>
> </oaf_server>
> </oaf_info>
> ------------
> 
> This file is in /usr/lib/bonobo/servers.
> 

I'm not sure, but this looks right.  Try:

$ bonobo-activation-run-query "repo_ids.has('IDL:GNOME/Vertigo/PanelAppletShell:1.0')"

to see if bonobo-activation-server is picking up your server file.  You
should get back your applet's OAFIID (among the other applets).  The
full query (as used by gnome-panel) is:

"has_all (repo_ids, ['IDL:Bonobo/Control:1.0',
                    'IDL:GNOME/Vertigo/PanelAppletShell:1.0']) &&
 defined (panel:icon) && defined (panel:category)"

so you can try that too the be sure.

HTH,
Gustavo





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]