Re: [Vala] PanelApplet example



Quikee <quikee gmail com> writes:

I am also trying to create an example panel applet in vala but have
not succeeded. The example looks like this:

panel.vala

using GLib;
using Panel;


public class MainApplet : GLib.Object {

      public static bool panelFactory(Applet applet, string iid, pointer userData) {
              var button = new Gtk.Button();
              applet.add(button);
              applet.show_all();

Check (print on the stdout, use debugger - in any way) - if the applet is null
or not.

              return false;
      }
      
      public static int main (string[] args) {
              return Applet.factory_main("OAFIID:Vala_Applet_Factory",
typeof(Panel.Applet), MainApplet.panelFactory, "1.0");
      }
}

panel.server

<oaf_info>

      <oaf_server iid="OAFIID:Vala_Applet_Factory" type="exe"
location="/home/quikee/projects/panel">
              <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="Vala Panel Example"/>
              <oaf_attribute name="description" type="string" value="Vala Panel Example"/>
      </oaf_server>

      <oaf_server iid="OAFIID:Vala_Applet" type="factory"
location="OAFIID:Vala_Applet_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="Vala Panel Example"/>
              <oaf_attribute name="description" type="string" value="Vala Panel Example"/>
              <oaf_attribute name="panel:category" type="string" value="Utility"/>
              <oaf_attribute name="panel:icon" type="string" value="computer.png"/>
      </oaf_server>

</oaf_info>

The example just seg. faults if it is executed. Any ideas what might be wrong?


May be gdb will be helpful? It will at least show where is the problem.
Defensive programing may also help.

Best regards,
Tomaz


Regards
-- 
I've probably left my head... somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)




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