[Vala] Cairo matrix multiply vapi question

2014-12-16 Thread Donn
Hi, Not sure if I've found a bug or am simply thick. I'm going with the latter :D At: https://git.gnome.org/browse/vala/plain/vapi/cairo.vapi Down near the end, under the public struct Matrix, look for: public void multiply (Matrix a, Matrix b); In the Cairo C docs, it looks like this: void

Re: [Vala] Cairo matrix multiply vapi question

2014-12-16 Thread Donn
On 16/12/2014 12:01, Luca Bruno wrote: .multiply() is a method of Mmatrix. Therefore you call multiply on an instance of Matrix which is the one that will get modified. Ah, thanks Luca. \d ___ vala-list mailing list vala-list@gnome.org

Re: [Vala] Recursive foreaching

2013-11-25 Thread Donn
On 25/11/2013 16:07, r...@no-log.org wrote: It's my first attempt in vala : https://sourceforge.net/projects/valatreeobjects/files/ Thanks for your reply. I just had a look at some of the code and it feels a little over my head. I'll try again when I get a moment. Any chance of you

Re: [Vala] Recursive foreaching

2013-11-22 Thread Donn
Anyone? Is there anything in the glibrary that I should look into? Or maybe generators, like Python has? \d ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list

[Vala] Recursive foreaching

2013-11-21 Thread Donn
I have a tree of nodes, something like this in pseudocode: class Node ArrayList kidnodes Node parent So - each node has kids and a parent. I find myself wanting to foreach over the tree from code that is not within a Node. Right now, I'm doing this kind of thing: class Node ... public

Re: [Vala] Printfing an object

2013-11-19 Thread Donn
On 19/11/2013 10:12, Abderrahim Kitouni wrote: %p.printf(your_object) Ah. Big thanks! btw, you don't need when dealing with instances of classes, Ahhh two :D Will have a look. your classes inherit from GLib.Object, you can use your_object.get_type().name() (I'm writing this from memory,

Re: [Vala] Printfing an object

2013-11-19 Thread Donn
Here's some code: --- public class Obj : Object { public string foo; } public void main() { var o = new Obj(); var o1 = new Obj(); var o2 = new Obj(); stdout.printf(o %p\n, o); stdout.printf(o1 %p\n, o1); stdout.printf(o2 %p\n, o2); //YAY!!! string s =

Re: [Vala] Printfing an object

2013-11-19 Thread Donn
On 19/11/2013 10:50, Nor Jaidi Tuah wrote: The answer will be obvious if you try this: var b = new Obj(); var b1 = b; print (%p %p %p %p, b, b1, b, b1); Obvious might be a little bold :) I get these numbers: 0xffa0c0 0xffa0c0 0x7fffbbedcfe0 0x7fffbbedcfe8 I read the first two as

Re: [Vala] Printfing an object

2013-11-19 Thread Donn
On 20/11/2013 02:12, Nor Jaidi Tuah wrote: Exactly. Told you it's obvious :-) Ha ha! You did. Thanks for your help. \d ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list

Re: [Vala] Multiple properties, one signal for any change. [RESOLVED]

2013-11-17 Thread Donn
On 17/11/2013 11:14, Luca Bruno wrote: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#GObject-notify In vala should be obj.notify.connect (...). Sweet, thanks. Small demo: public class Stuff : Object { public string prop1 {get;set;} public string prop2

[Vala] Printfing an object

2013-11-17 Thread Donn
Hi, In python one can print (someobject) and get a nice hash kind of thing. Is there any equiv way of printf-ing an object in vala/gobj? e.g. __main__.A instance at 0x1989320 At the moment I'm making a repr() method (via a static counter to generate a unique number per new instance) and

Re: [Vala] Printfing an object

2013-11-17 Thread Donn
On 17/11/2013 16:03, Luca Bruno wrote: It's not possible to do that for every type. Anything wrong with this approach? public class Obj : Object { public string foo; } public void main() { var o = new Obj(); var o1 = new Obj(); var o2 = new Obj(); stdout.printf(%p\n, o); //-- gives

[Vala] Multiple properties, one signal for any change.

2013-11-16 Thread Donn
Hi, Let's say I have a class that holds a bunch of properties: public class Prop : Object { public double x {get; set; default=0.0;} public double y {get; set; default=0.0;} public double r {get; set; default=0.0;} public double g {get; set; default=0.0;} public double b

Re: [Vala] Default enum's values' nick

2013-11-07 Thread Donn
On 08/11/2013 02:43, Daniel Espinosa wrote: Do you know how can I change default nick? I'm not sure - haven't had a chance to try this yet - but have a look at this link: http://blog.yorba.org/jim/2011/05/a-few-of-my-favorite-vala-things-enums.html \d

Re: [Vala] Gdk event handler cast mystery

2013-10-31 Thread Donn Ingle
On 30 October 2013 18:45, Evan Nemerson e...@coeus-group.com wrote: Use the relevant Gdk.Event member instead: Gdk.EventButton eb = event.button; Ah! Super thanks. \d ___ vala-list mailing list vala-list@gnome.org

[Vala] General tree walking question

2013-10-31 Thread Donn Ingle
Hi, Apologies if this is OT. I am trying to do this in Vala. This is a general tree walking question. I'm a bit thick and trees really kill my brain. Here's the situation: I have a Thing class that contains an ArrayList of (potentially) many other Things. This all results in a tree where Things

Re: [Vala] ArrayList reference count question

2013-10-30 Thread Donn Ingle
On 28 October 2013 19:50, Andre Masella an...@masella.name wrote: Andre, Just a quick thanks for your help. \d ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list

[Vala] Gdk event handler cast mystery

2013-10-30 Thread Donn Ingle
Hello; partial code: -- private bool handle_events(Gdk.Event event) { if (event.type == Gdk.EventType.BUTTON_PRESS) { Gdk.EventButton eb = (Gdk.EventButton) event; //Now I can use eb for e.g. eb.state or eb.x ... etc. -- When I try to compile, I get an error. It seems to be an

Re: [Vala] ArrayList reference count question

2013-10-28 Thread Donn Ingle
On 27 October 2013 15:59, Andre Masella an...@masella.name wrote: The increase in reference happens inside ArrayList *before* it returns the value. Ok, got it. You can't assign an owned variable to an unowned variable and expect good things to happen because there might be no other owners

Re: [Vala] ArrayList reference count question

2013-10-27 Thread Donn Ingle
On 26 October 2013 16:08, Andre Masella an...@masella.name wrote: If you look at the generated code, after the printf method, it will free the temporary variable created when it accessed L[0]. Ah. I see. Is there no way to assign L[0] to some kind of weak variable so there's no inc? I tried:

[Vala] Gee ArrayList item question

2013-10-26 Thread Donn Ingle
Hi, Probably a silly question from a permanent newb. See this code: using Gee; int main() { var L = new ArrayListint(); L.add(10); L.add(20); L.add(30); L.insert (2, 50); int x=0; foreach (int i in L) { //This line shows indexes 0,1,2,3 stdout.printf (%d and %d\n, i,

Re: [Vala] Gee ArrayList item question

2013-10-26 Thread Donn Ingle
On 26 October 2013 10:47, Nor Jaidi Tuah norjaidi.t...@ubd.edu.bn wrote: Concerning L.index_of(x): L.index_of(0) = -1 because 0 is not in L. L.index_of(1) = -1 because 1 is not in L. Concerning L.index_of(i): L.index_of(10) = 0 because L[0] is 10. L.index_of(20) = 1

[Vala] ArrayList reference count question

2013-10-26 Thread Donn Ingle
Hello again, Another newb question about ref counts: --- using Gee; public class Obj : Object { public string id; public Obj(string id) { this.id = id; } } public void foo( Obj o) { //It seems o here is a pointer - i.e. it has not inc the ref_count. stdout.printf(In func foo, o

Re: [Vala] Assist with compile issue re Cairo.PathData

2013-10-16 Thread Donn Ingle
Evan, thanks for that detailed email. There's a lot to digest, so I better get on it. All the best, /d ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list

[Vala] Assist with compile issue re Cairo.PathData

2013-10-15 Thread Donn Ingle
Hello, I'm sure this is my small brain and lack of experience, but I can't get past this compile error. I will paste a complete sample below. --- using Gee; using Cairo; // Compile with: valac --pkg gee-1.0 --pkg gtk+-3.0 -X -lm cairopath.compile.bug.vala -o test public abstract class Shape :

Re: [Vala] Assist with compile issue re Cairo.PathData

2013-10-15 Thread Donn Ingle
array.. A quick glance at the cairo vapi, and I think you really want this?: Cairo.PathData[] data = path.data; I feel disturbed by that ;) Not sure why. The code I'm trying to Vala-ize is here: http://cairographics.org/manual/cairo-Paths.html#cairo-path-data-t (scroll down a wee bit to

Re: [Vala] Mad question - C to Vala

2013-05-23 Thread Donn
On 22/05/2013 17:59, Mario Daniel Ruiz Saavedra wrote: I asked that some time ago, and no, there isn't anything like that, Yeah, I figured :) Ah well. \d ___ vala-list mailing list vala-list@gnome.org

Re: [Vala] Mad question - C to Vala

2013-05-23 Thread Donn
On 22/05/2013 18:19, Steven Oliver wrote: Interesting idea in this case though. You want a tool to translate (C) to a language (Vala) which in turn just translates it back to its original language (C). To bad the compiler doesn't have a reverse gear! Ha! Indeed. calav -o

Re: [Vala] Vala and Cairo 1.12

2013-05-19 Thread Donn
On 18/05/2013 16:57, Jonas Kulla wrote: It's basically the same as declaring foreign functions in C. Let's say you want to use the function 'int cairo_do_foo()' from Vala, you would write something like: namespace Cairo { [CCode (cname=cairo_do_foo)] extern int do_foo(); } The

Re: [Vala] memory management with structs [Solved]

2013-05-19 Thread Donn
On 18/05/2013 16:46, Jonas Kulla wrote: i.e. How do you create a class that does*not* inherit from GObject? By not specifying a parent class, ie. just class MyKlass { ... }. Thanks! \d ___ vala-list mailing list vala-list@gnome.org

Re: [Vala] memory management with structs (OT a bit)

2013-05-18 Thread Donn
On 18/05/2013 12:15, Luca Bruno wrote: You can use classes that don't inherit from GObject, which are lighter. Are such classes the [Compact] classes, or is any class that does not specify a parent class automatically a light class? \d ___ vala-list

Re: [Vala] memory management with structs (OT a bit)

2013-05-18 Thread Donn
On 18/05/2013 13:40, Jonas Kulla wrote: no, compact classes are even simpler than non-Gobject classes. The latter still have reference count and can be extended, whereas compact classes are mostly classified structs without ref count which also cannot be extended in subclasses. Okay, but did

Re: [Vala] Vala and Cairo 1.12

2013-05-15 Thread Donn
On 15/05/2013 02:23, Evan Nemerson wrote: I just pushed a bunch of changes to the vala cairo bindings. If something is still missing, please file a bug. Thanks Evan, however I'm not sure where these bindings can be found online. Once fetched, would I simply drop them over my current file:

Re: [Vala] Vala and Cairo 1.12

2013-05-15 Thread Donn
On 14/05/2013 19:59, Jonas Kulla wrote: some vapis are auto-generated (mostly for glib based libraries I think), but most are hand written and maintained AFAIK. Okay, thanks. I didn't know this. I was wondering how the appropriate cairo_destroy stuff got into my code when I never call these

Re: [Vala] Vala and Cairo 1.12

2013-05-15 Thread Donn
On 15/05/2013 15:05, Evan Nemerson wrote: https://git.gnome.org/browse/vala/plain/vapi/cairo.vapi Great, thanks. pass a --vapidir option to valac so it knows where to look for it. I'm also using gtk, and I see a deps file that specifies 'cairo' - this is all in /usr/share/vala/vapi

[Vala] Vala and Cairo 1.12

2013-05-14 Thread Donn
Hi, Vapi files mystify me. Does anyone know where I can get a vapi (and anything else I'd need) such that I can use Cairo 1.12? Or, perhaps someone can help me generate it? BTW - The valadoc.org/cairo seems to be about version 1.0 of cairo - so it's also out of date. \d

[Vala] Gee namespace error.

2013-04-26 Thread Donn
Hi, Doing some of the samples and hit a problem with libgee. I'm getting this error: The root namespace already contains a definition for `Gee' Specs: Vala 0.18.1 on (Ubuntu 12.10) libgee-dev 0.6.4-2 Source to reproduce is from the samples: -- Using Gee; void main () { var list = new

Re: [Vala] Gee namespace error [SOLVED]

2013-04-26 Thread Donn
On 26/04/2013 09:07, Donn wrote: I'm getting this error: The root namespace already contains a definition for `Gee' Got it. The problem was: Using Gee; It should be lower-case using Gee; - Sheesh! \d ___ vala-list mailing list vala-list

Re: [Vala] Gee namespace error.

2013-04-26 Thread Donn
On 26/04/2013 19:21, Canek Peláez Valdés wrote: It's using (lowcase u), not Using. Thanks Canek; I also figured that out - but no thanks to that error message! \d ___ vala-list mailing list vala-list@gnome.org

Re: [Vala] How to generate .gir files from a Vala library?

2013-04-23 Thread Donn
On 23/04/2013 09:46, Andres G. Aragoneses wrote: On 23/04/13 08:15, Luca Bruno wrote: Il 23/04/2013 00:54, Andres G. Aragoneses ha scritto: Hello, I'm kind of a Vala newbie, can anyone tell me a quick way, or a proper URL where to get some docs, about how to generate .gir files from a Vala

Re: [Vala] Vala in Python - More progress and a question

2013-04-21 Thread Donn
On 20/04/2013 21:14, Evan Nemerson wrote: .. it's generally a good idea to use GObject-style construction [1]. In your original example, simply replace public RedSquare() with construct and it should work as expected. Appreciate that, thanks. I shall read up and hack it thus. A question?

Re: [Vala] Vala in Python - More progress and a question

2013-04-21 Thread Donn
On 21/04/2013 09:53, Evan Nemerson wrote: When you load a shared library the memory actually used is shared not just within the same process, but across all processes using that library. In all likelihood, some other process (like gnome-shell) is already using Clutter and your program using

Re: [Vala] Vala in Python - Some progress and a question

2013-04-20 Thread Donn
A follow-up. Progress In the python file (test.py) I got the idea to explicitly call the new() method of the RedSquare object. I saw it when I did a dir() in Python. (I first got the idea when I saw how a Clutter.Color was instanced - with Clutter.Color.new() - in Python, this is

Re: [Vala] Vala in Python - Some progress and a question

2013-04-20 Thread Donn
On 20/04/2013 16:27, Sam Wilson wrote: I could be mistaken, but python uses line buffering, so if you put a '\n' on the end of your printf's you might get the text to show up right away. You, Sir, are a genius. Hat tip. \d ___ vala-list mailing list

[Vala] Vala in Python

2013-04-19 Thread Donn
Hi, (I have attached three files - hope that's ok.) I'm trying to make library that I then employ within Python3. I am hacking from the awesome work done here: https://github.com/tliron/pygobject-example (The example Logging object works very well.) I'm trying to make a Clutter Actor (in

Re: [Vala] Clutter actor class in Vala (newb)

2013-04-11 Thread Donn
On 10/04/2013 19:12, Erick Pérez Castellanos wrote: What you're missing is this: Ah, thanks! I'll poke around now. Although I'm not pretty sure, you should check about the preferred way of custom painting an actor. Speaking of this, here's a vala-related question:

Re: [Vala] Clutter actor class in Vala (newb)

2013-04-11 Thread Donn
On 11/04/2013 10:58, Arnel A. Borja wrote: Vala will automatically add code to decrease its references by one (unref) once the block where it belongs ends (in this case, the class constructor). Gotcha. Thanks for the help. \d ___ vala-list

Re: [Vala] [Genie] Signals and callbacks

2013-04-11 Thread Donn
On 11/04/2013 15:40, Alex Stefan Kaye wrote: def on_clicked(ev:Clutter.ButtonEvent) This gives me the following error: error: Argument 1: Cannot convert from `MyClass.on_click' to `Clutter.Actor.button_press_event' Nearest I can tell with my own Newb-o-vision ;) is that the signature of

Re: [Vala] Clutter actor class in Vala (newb)

2013-04-10 Thread Donn
On 09/04/2013 17:16, JM wrote: Have you tried the clutter sample code from the vala site? https://live.gnome.org/Vala/ClutterSamples Hi, Yes, I've certainly been there. The code on that page does not include a way to sub class* a Clutter.Actor * Make a class from. Not sure if my wording is

[Vala] Clutter actor class in Vala (newb)

2013-04-09 Thread Donn
Greetings, hope this is the right list for getting help. I'm fiddling with Vala and am interested in Clutter + Cairo. (I come from Python, so this whole gObject and C world is very scary.) Below's the short code I am trying to get working. I wanted to create an Actor class and then add it to