[Vala] glib-enums as properties?

2008-07-10 Thread Hannes Matuschek
Hi,

I've tried to define a enum from GLib (RegexCompileFlags) as a
construction-property.

The attached code fails to compile at C-level due missing definition of
'G_TYPE_REGEX_COMPILE_FLAGS'!

Tested with current release and svn (rev. 1690)

Should I file a bug?

Hannes
using GLib;


public class Main: Object
{
  /*
Don't work:
  All but..

Not found at all but defined in vapi:
  ProcessSignal, LocaleCategory
  
Work:
  ParamFlags,   -- 'G_TYPE_PARAM_FLAGS' defined in gobject/gparamspecs.h 
  IOCondition   -- 'G_TYPE_IO_CONDITION' defined in 
gobject/gsourceclosure.h 
  */
  
  public RegexCompileFlags cflags { get; construct; }
 
  public static int main (string[] args)
  {
return 0;
  }
}



smime.p7s
Description: S/MIME Cryptographic Signature
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] DBus signals and non-static methods

2008-05-24 Thread Hannes Matuschek
It looks like there is a problem connecting non-static methods to DBus
signals.

The attached code compiles well but produce critical warnings on DBus
events. The static handler works well, but the instance-method-handler
produce following warning:

 ** (process:15681): CRITICAL **: test_method_handler: assertion `IS_TEST 
 (self)' failed

The instance-method-handler has following signature (in C):
 static void test_method_handler (Test* self, DBusGProxy* sender, const char* 
 id);
But will be called as test_method_handler(DBusGProxy* sender, const
char* id, Test* self)

I have no idea of dbus but in my opinion there is a function missing in
the dbus-glib. dbus-glib only provides the function
dbus_g_proxy_connect_signal() which simply calls
g_signal_connect_closure_by_id().

In my opinion DBusGProxy also needs
dbus_g_proxy_connect_signal_object() to connect to non-static-methods
of objects.

Any ideas?!?

using GLib;


class Test: Object
{   
private DBus.Connection conn;
private dynamic DBus.Object manager; 


public static void static_handler(dynamic DBus.Object sender, string id){
message(static-handler: %s, id);
}

public void method_handler(dynamic DBus.Object sender, string id){
message(method-handler: %s, id);
}


construct{
conn= DBus.Bus.get(DBus.BusType.SYSTEM);
manager = conn.get_object(org.freedesktop.Hal,
  /org/freedesktop/Hal/Manager,
  org.freedesktop.Hal.Manager);

manager.DeviceAdded += static_handler;
manager.DeviceAdded += method_handler;
}

 
public static int main(string[] args)
{
MainLooploop  = new MainLoop(null, false);
var my_obj = new Test(); 

loop.run();

return 0;
}
}




smime.p7s
Description: S/MIME Cryptographic Signature
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list