[Vala] Is creating dbus interfaces in type modules (plugins) broken?

2012-11-28 Thread PCMan
Hello,
I tried to develop some type modules for my program.
Everything works fine initially and [ModuleInit] registered GObject dynamic
classes automagically as expected.
However, after I move a previously working dbus interface to that type
module, I got crashes.

My source code is here:
http://lxde.git.sourceforge.net/git/gitweb.cgi?p=lxde/lxpanel2;a=summary

A google search lead me to a similar report from others:
https://mail.gnome.org/archives/vala-list/2012-September/msg00125.html

Is this a known bug? Or is there anyway to overcome this?
I like vala a lot and I don't want to rewrite the whole program in C again
just because some little problems.

Thanks in advance.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Generated vapi file for a library not compilable.

2012-11-28 Thread PCMan
Hello,
I got another issue with vala.
I moved the core part of my program to a separate library, and let the main
program call that library.
The library itself compiles correctly.
However, the genrated vapi file is not usable by the main program.
Both parts are written in vala.
The generated vapi file looks like this.

When compiling the main program with --pkg my_vapi_file, I got errors.
The generated vapi file seems to have duplicated nested namespace for
static methods like this.

namespace Lxpanel {

class Applet : Object {
static Lxpanel.Applet? from_file(string...);
}
}

If I remove Lxpanel.Applet manually and just use Applet, it works.
I like vala a lot and want to continue use it for my project, so I hope
that someone knows how to fix it. Otherwise I may have to rewrite the
program in plain C/GObject, which is a pain. :-(

All of the errors I got are like these:
  VALAC  lxpanel2_vala.stamp
lxpanel-applet.vapi:10.27-10.49: error: The type name `Lxpanel.AppletInfo'
could not be found
public static GLib.Listweak Lxpanel.AppletInfo get_all_types ();
^^^
lxpanel-applet.vapi:13.10-13.35: error: The type name `Lxpanel.AppletInfo'
could not be found
public unowned Lxpanel.AppletInfo get_info ();
   ^^
lxpanel-applet.vapi:18.17-18.30: error: The type name `Lxpanel.Applet'
could not be found
public static Lxpanel.Applet? new_from_type_name (string type_name);
  ^^
lxpanel-applet.vapi:19.44-19.61: error: The type name `Lxpanel.AppletInfo'
could not be found
public static void register_applet_info (Lxpanel.AppletInfo info);
 ^^
lxpanel-applet.vapi:34.10-34.29: error: The type name
`Lxpanel.AppletModule' could not be found
public Lxpanel.AppletModule? module;
   
lxpanel-applet.vapi:40.10-40.23: error: The type name `Lxpanel.Applet'
could not be found
public Lxpanel.Applet? create_new ();
   ^^
lxpanel-applet.vapi:41.17-41.34: error: The type name `Lxpanel.AppletInfo'
could not be found
public static Lxpanel.AppletInfo? from_file (string applet_id, string
info_path);
  ^^
lxpanel-applet.vapi:74.24-74.37: error: The type name `Lxpanel.Button'
could not be found
public class Drawer : Lxpanel.Button {
  ^^
lxpanel-applet.vapi:75.13-75.25: error: The type name `Lxpanel.Popup' could
not be found
protected Lxpanel.Popup? popup;
  ^
lxpanel-applet.vapi:80.28-80.41: error: The type name `Lxpanel.Button'
could not be found
public class MenuButton : Lxpanel.Button {
  ^^
Compilation failed: 10 error(s), 0 warning(s)

Thank you guys!
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Generated vapi file for a library not compilable.

2012-11-28 Thread PCMan
Sorry that I forgot to paste the complete vapi file generated
It's here:
http://pastebin.com/v2j6CnXq

Thanks a lot!

On Thu, Nov 29, 2012 at 10:13 AM, PCMan pcman...@gmail.com wrote:

 Hello,
 I got another issue with vala.
 I moved the core part of my program to a separate library, and let the
 main program call that library.
 The library itself compiles correctly.
 However, the genrated vapi file is not usable by the main program.
 Both parts are written in vala.
 The generated vapi file looks like this.

 When compiling the main program with --pkg my_vapi_file, I got errors.
 The generated vapi file seems to have duplicated nested namespace for
 static methods like this.

 namespace Lxpanel {

 class Applet : Object {
 static Lxpanel.Applet? from_file(string...);
 }
 }

 If I remove Lxpanel.Applet manually and just use Applet, it works.
 I like vala a lot and want to continue use it for my project, so I hope
 that someone knows how to fix it. Otherwise I may have to rewrite the
 program in plain C/GObject, which is a pain. :-(

 All of the errors I got are like these:
   VALAC  lxpanel2_vala.stamp
 lxpanel-applet.vapi:10.27-10.49: error: The type name `Lxpanel.AppletInfo'
 could not be found
 public static GLib.Listweak Lxpanel.AppletInfo get_all_types ();
 ^^^
 lxpanel-applet.vapi:13.10-13.35: error: The type name
 `Lxpanel.AppletInfo' could not be found
 public unowned Lxpanel.AppletInfo get_info ();
^^
 lxpanel-applet.vapi:18.17-18.30: error: The type name `Lxpanel.Applet'
 could not be found
 public static Lxpanel.Applet? new_from_type_name (string type_name);
   ^^
 lxpanel-applet.vapi:19.44-19.61: error: The type name `Lxpanel.AppletInfo'
 could not be found
 public static void register_applet_info (Lxpanel.AppletInfo info);
  ^^
 lxpanel-applet.vapi:34.10-34.29: error: The type name
 `Lxpanel.AppletModule' could not be found
  public Lxpanel.AppletModule? module;

 lxpanel-applet.vapi:40.10-40.23: error: The type name `Lxpanel.Applet'
 could not be found
  public Lxpanel.Applet? create_new ();
^^
 lxpanel-applet.vapi:41.17-41.34: error: The type name `Lxpanel.AppletInfo'
 could not be found
  public static Lxpanel.AppletInfo? from_file (string applet_id, string
 info_path);
   ^^
 lxpanel-applet.vapi:74.24-74.37: error: The type name `Lxpanel.Button'
 could not be found
 public class Drawer : Lxpanel.Button {
   ^^
 lxpanel-applet.vapi:75.13-75.25: error: The type name `Lxpanel.Popup'
 could not be found
 protected Lxpanel.Popup? popup;
   ^
 lxpanel-applet.vapi:80.28-80.41: error: The type name `Lxpanel.Button'
 could not be found
 public class MenuButton : Lxpanel.Button {
   ^^
 Compilation failed: 10 error(s), 0 warning(s)

 Thank you guys!


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Generated vapi file for a library not compilable.

2012-11-28 Thread Axel FILMORE
On Thu, 29 Nov 2012 10:13:40 +0800
PCMan pcman...@gmail.com wrote:

 Hello,
 I got another issue with vala.
 I moved the core part of my program to a separate library, and let
 the main program call that library.
 The library itself compiles correctly.
 However, the genrated vapi file is not usable by the main program.
 Both parts are written in vala.
 The generated vapi file looks like this.
 
 When compiling the main program with --pkg my_vapi_file, I got
 errors. The generated vapi file seems to have duplicated nested
 namespace for static methods like this.

I had a similar problem doing this :

namespace Panel {
public class MenuApplet {
}
}

public static AppletType register () {

applet_type.id = typeof (MenuApplet); //  it's PanelMenuApplet
return applet_type;
}

I found that the type *is not* MenuApplet but PanelMenuApplet,
I just removed the namespaces for Panel Applet that fixed the problem :

public class MenuApplet {
}


public static AppletType register () {

applet_type.id = typeof (MenuApplet);
return applet_type;
}

:)

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Generated vapi file for a library not compilable.

2012-11-28 Thread PCMan
Thanks for sharing.
Manually editing the vapi file works for me too, but this is only a
workaround.
After regeneration of vapi files, the changes are gone and need to be done
again.
There must be something wrong in valac or my compiler settings.
We need a way to generate correct vapi files from vala code directly.
So, it seems that it's a bug in valac?


On Thu, Nov 29, 2012 at 12:07 PM, Axel FILMORE axel.film...@gmail.comwrote:

 On Thu, 29 Nov 2012 10:13:40 +0800
 PCMan pcman...@gmail.com wrote:

  Hello,
  I got another issue with vala.
  I moved the core part of my program to a separate library, and let
  the main program call that library.
  The library itself compiles correctly.
  However, the genrated vapi file is not usable by the main program.
  Both parts are written in vala.
  The generated vapi file looks like this.
 
  When compiling the main program with --pkg my_vapi_file, I got
  errors. The generated vapi file seems to have duplicated nested
  namespace for static methods like this.

 I had a similar problem doing this :

 namespace Panel {
 public class MenuApplet {
 }
 }

 public static AppletType register () {

 applet_type.id = typeof (MenuApplet); //  it's PanelMenuApplet
 return applet_type;
 }

 I found that the type *is not* MenuApplet but PanelMenuApplet,
 I just removed the namespaces for Panel Applet that fixed the problem :

 public class MenuApplet {
 }


 public static AppletType register () {

 applet_type.id = typeof (MenuApplet);
 return applet_type;
 }

 :)


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Generated vapi file for a library not compilable.

2012-11-28 Thread Axel FILMORE
On Thu, 29 Nov 2012 13:09:53 +0800
PCMan pcman...@gmail.com wrote:

 Thanks for sharing.
 Manually editing the vapi file works for me too, but this is only a
 workaround.
 After regeneration of vapi files, the changes are gone and need to be
 done again.
 There must be something wrong in valac or my compiler settings.
 We need a way to generate correct vapi files from vala code directly.
 So, it seems that it's a bug in valac?

I done like this in the library :
http://bazaar.launchpad.net/~axel-filmore/valadesktop/spanel-lib/view/head:/src/PanelApplet.vala
http://bazaar.launchpad.net/~axel-filmore/valadesktop/spanel-lib/view/head:/vapi/libspanel.vapi

And like this in the application :
http://bazaar.launchpad.net/~axel-filmore/valadesktop/spanel/view/head:/src/Applets/Weather/WeatherApplet.vala

I don't use any namespace for Applets :)

I don't have the technical explanation however.

:P
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list