Re: [Vala] Defining new virtual signal is possible, but overring it isn't.
You can try code below as solution/workaround. class Foo : GLib.Object { public virtual signal void func() { message(Foo); } } class Bar : Foo { public override void func() { message(Bar); } } int main() { Foo foo = new Bar(); foo.func.connect(() = { message(Main); }); foo.func(); return 0; } Derek Dai On Sun, Dec 16, 2012 at 8:00 PM, vala-list-requ...@gnome.org wrote: Send vala-list mailing list submissions to vala-list@gnome.org To subscribe or unsubscribe via the World Wide Web, visit https://mail.gnome.org/mailman/listinfo/vala-list or, via email, send a message with subject or body 'help' to vala-list-requ...@gnome.org You can reach the person managing the list at vala-list-ow...@gnome.org When replying, please edit your Subject line so it is more specific than Re: Contents of vala-list digest... Today's Topics: 1. Defining new virtual signal is possible, but overring it isn't. (Tal Hadad) -- Message: 1 Date: Sat, 15 Dec 2012 21:00:24 +0200 From: Tal Hadad tal...@hotmail.com To: Vala Mail List vala-list@gnome.org Subject: [Vala] Defining new virtual signal is possible,but overring it isn't. Message-ID: dub118-w23290d650216ac80e0291be5...@phx.gbl Content-Type: text/plain; charset=windows-1255 When I try to: public class A : GLib.Object { public virtual signal void func () {} } public class B : A { public override void func () {} } I get an error from Valac: error: B.func: no suitable method found to override I'm using Vala 0.16.1 I think that this is a critical bug in Vala, or my code is wrong? Thanks, Tal -- ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list End of vala-list Digest, Vol 61, Issue 7 ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] vala-list Digest, Vol 61, Issue 7
Have you tried including signal modifier in overridden method too? This way: public class A : GLib.Object { public virtual signal void func () {} } public class B : A { public override signal void func () {} } 2012/12/16 vala-list-requ...@gnome.org Send vala-list mailing list submissions to vala-list@gnome.org To subscribe or unsubscribe via the World Wide Web, visit https://mail.gnome.org/mailman/listinfo/vala-list or, via email, send a message with subject or body 'help' to vala-list-requ...@gnome.org You can reach the person managing the list at vala-list-ow...@gnome.org When replying, please edit your Subject line so it is more specific than Re: Contents of vala-list digest... Today's Topics: 1. Defining new virtual signal is possible, but overring it isn't. (Tal Hadad) -- Message: 1 Date: Sat, 15 Dec 2012 21:00:24 +0200 From: Tal Hadad tal...@hotmail.com To: Vala Mail List vala-list@gnome.org Subject: [Vala] Defining new virtual signal is possible,but overring it isn't. Message-ID: dub118-w23290d650216ac80e0291be5...@phx.gbl Content-Type: text/plain; charset=windows-1255 When I try to: public class A : GLib.Object { public virtual signal void func () {} } public class B : A { public override void func () {} } I get an error from Valac: error: B.func: no suitable method found to override I'm using Vala 0.16.1 I think that this is a critical bug in Vala, or my code is wrong? Thanks, Tal -- ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list End of vala-list Digest, Vol 61, Issue 7 ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] vala-list Digest, Vol 61, Issue 7
Overriding a signal or making it virtual does not really make sense, does it? A signal does not have a body, as a function would have and signature is always the same, even in child classes. Also your example seems weird, as you have bodys for signals. Regards Am Sonntag, den 16.12.2012, 17:41 +0100 schrieb Nadir Sampaoli: Have you tried including signal modifier in overridden method too? This way: public class A : GLib.Object { public virtual signal void func () {} } public class B : A { public override signal void func () {} } 2012/12/16 vala-list-requ...@gnome.org Send vala-list mailing list submissions to vala-list@gnome.org To subscribe or unsubscribe via the World Wide Web, visit https://mail.gnome.org/mailman/listinfo/vala-list or, via email, send a message with subject or body 'help' to vala-list-requ...@gnome.org You can reach the person managing the list at vala-list-ow...@gnome.org When replying, please edit your Subject line so it is more specific than Re: Contents of vala-list digest... Today's Topics: 1. Defining new virtual signal is possible, but overring it isn't. (Tal Hadad) -- Message: 1 Date: Sat, 15 Dec 2012 21:00:24 +0200 From: Tal Hadad tal...@hotmail.com To: Vala Mail List vala-list@gnome.org Subject: [Vala] Defining new virtual signal is possible,but overring it isn't. Message-ID: dub118-w23290d650216ac80e0291be5...@phx.gbl Content-Type: text/plain; charset=windows-1255 When I try to: public class A : GLib.Object { public virtual signal void func () {} } public class B : A { public override void func () {} } I get an error from Valac: error: B.func: no suitable method found to override I'm using Vala 0.16.1 I think that this is a critical bug in Vala, or my code is wrong? Thanks, Tal -- ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list End of vala-list Digest, Vol 61, Issue 7 ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] vala-list Digest, Vol 61, Issue 7
2012/12/16 JM interfl...@gmx.net Overriding a signal or making it virtual does not really make sense, does it? A signal does not have a body, as a function would have and signature is always the same, even in child classes. Also your example seems weird, as you have bodys for signals. Regards No, signals in Vala can be virtual and can have bodies. GObject offers so called default handles for signals, which can be specified as an offset in the class struct to the handler function pointer. Because the handler is in the class struct, it can be overriden by subclasses, hence the analogy virtual signal. Vala translates the signal body to a virtual function and sets it as the default handler for the signal. - Jonas ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] GSettings and not-available schemas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all: I'm working with GSettings. I want to read org.gnome.desktop.background and want to ensure that my code works even when the schema is not installed (let's say, if the user is using KDE). When I try to access an inexistent schema, I receive this message: (cronopete:15673): GLib-GIO-ERROR **: Settings schema 'org.gnome54.desktop.background' is not installed Trace/breakpoint trap (core dumped) I tried to catch it with try/catch, but I'm unable: always got the core dumped and the code ends. I'm considering to read all the installed schemas and ensure that the one I want is installed before creating the gsettings, but I'm sure there must be a more elegant way of doing it. The question is: how? Thanks! - -- Nos leemos RASTER(Linux user #228804) ras...@rastersoft.com http://www.rastersoft.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlDONkwACgkQXEZvyfy1ha9n2wCeJjijAxLI3wJAvHf1LxxZFAcL WrgAn21u+/iu8P9mRysBADoB9ByBZFVu =Jq+V -END PGP SIGNATURE- ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list