Tal Hadad | 22 May 18:59
Picon
Favicon

[Vala] After transfering ownership of compact class, Vala still call free method


I'm trying to write a nodes system which is tree based. Not matter how it
works, this is part of the code:

NodesRoot root = new NodesRoot ();
stdout.printf ("Root created\n");
unowned NodesUnit unit = root.prepend_unit ();
if (unit == null)
stderr.printf ("Not working!");
stdout.printf ("Unit created\n");
Node node = new Node ();
stdout.printf ("Node created\n");
unit.prepend_node ((owned)node);
stdout.printf ("Node prepended\n");

node = null;// Ensure that node will be free before root if it will.
stdout.printf ("Node is null\n");

this is the runtime:
Root created
Unit created
Node created
Node prepended
Node is null
*** glibc detected *** ./simple_triangle: free(): invalid pointer: 0x000000000190cc40 ***
======= Backtrace: =========
(big memory trace)

I've noticed that in the generated C code, node get freed by Vala.
Why is it happening if I transferred ownership for the method?
(Continue reading)

Favicon
Gravatar

[Vala] How to append element to Variant array of tuples?

Hi!

In my app I use Settings with key defined in schema as follows:

a(sbsyssbyqqqq)

I am able to retreive it with

Variant mykey = settings.get_value("mykey");

The question is:

how can I add an element to end of this array and store that value in
the settings?

It could be interpret as a much more general question:

how to add in Vala an element to existing Variant if VariantType is
array of tuples?

Thank you in advance,

your help will be really appreciated.

m.
Picon

[Vala] How to set the type of the elements in a container on bindings.

Hello vala-list,
  I'm generating a Vala binding for a C library using vapigen and I've
managed to set the type of the elements by using the GObject
Introspection's "element-type" annotation for both the parameters and
return values of functions, but now I need a way to do the same thing for
the element type of object memebers.

  A simple example of what I want:
public class MyObject : GLib.Object{
    public weak GLib.SList<AnotherObject> object_list;
}

  And this is what I've generated so far:
public class MyObject : GLib.Object{
    public weak GLib.SList<void*> object_list;
}

  I've taken a look at the GIDL metadata and also the GObject
Instrospection documentations, but i've found nothing that suits my needs.
If there's still no way (or will never be) to do this, I guess there's no
problem leaving the element type as "void*" in the generated .vapi files.

Regards, and thanks!

Alex
_______________________________________________
vala-list mailing list
vala-list@...
(Continue reading)

Alberto Mardegan | 15 May 13:21
Favicon
Gravatar

[Vala] Floating references

Hi all,
  I have defined (in C) a GObject subclass which defines a virtual
method which should create a new GtkWidget:

========
/**
 * ap_application_plugin_build_widget:
 * @self: the #ApApplicationPlugin.
 *
 * Returns: (transfer floating): a #GtkWidget, or %NULL.
 */
GtkWidget *
ap_application_plugin_build_widget (ApApplicationPlugin *self)
{
    g_return_val_if_fail (AP_IS_APPLICATION_PLUGIN (self), NULL);
    return AP_APPLICATION_PLUGIN_GET_CLASS (self)->build_widget (self);
}
========

Then, I have a subclass of ApApplicationPlugin, written in Vala, which
should reimplement the build_widget() virtual method. But is it possible
to write it so that it returns a floating reference?
I tried:

========
    [ CCode ( returns_floating_reference = true ) ]
    public override unowned Gtk.Widget build_widget () {
        return new Gtk.Label ("Hello world!");
    }
========
(Continue reading)

D.H. Bahr | 14 May 19:09
Picon
Favicon
Gravatar

[Vala] printing int64 value to standard output

Hello there, how can I print an int64 variable to stdout??

int64 timestamp = 1234151912;
stdout.printf("%?", timestamp);

Best regards,
--

-- 

                                                         Sw.E. D.H. Bahr
                                         Nova Desktop Development Leader
                                      CESOL (Free/Libre Software Centre)
                                UCI (University of Informatics Sciences)
                                                            Havana, Cuba

10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
Nor Jaidi Tuah | 14 May 10:59

[Vala] GLib.debug woe

Under 0.17.0 (latest vala), GLib.debug doesn't seem to do anything.

Anything I need to do to make it operational?

hand
Nor Jaidi Tuah
Shawn Ferris | 12 May 01:33
Picon

Re: [Vala] regex to get some multiline text

On Wed, May 9, 2012 at 5:17 PM, Shawn Ferris <shawn.ferris@...> wrote:

> I'm not 100% sure on your use case, I didn't read it thoroughly, but I
>> believe you need to add a loop:
>>
>>
> Oops.. I may have misunderstood your question.. I think you need to enable
> multiline, which I believe is:
>
>         Regex r = /\s*(?P<start>.*)\s*%tag:(?P<**k
> ey>.*)%\s*(?P<content>.*)\s*%**endtag%\s*(?P<end>.*)/m;
>
> Note the m (multiline compiler flag) following the regexp. I'm not 100%
> sure on that syntax as I'm used to:
>
>         Regex r = new Regex(""" \s*(?P<start>.*)\s*%tag:(?P<**
> key>.*)%\s*(?P<content>.*)\s*%**endtag%\s*(?P<end>.*) """,
> RegexCompileFlags.MULTILINE);
>

I inadvertently left the list off this reply.. However, MULTILINE was still
not enough.. '.' (dot) still wont match newlines w/o also
setting RegexCompileFlags.DOTALL.
_______________________________________________
vala-list mailing list
vala-list@...
http://mail.gnome.org/mailman/listinfo/vala-list
(Continue reading)

Edwin DLCA | 9 May 21:25
Picon

[Vala] libwebkit-dev windows

Best regards.
I searched a lot or maybe I'm doing wrong but can not find where to download
 libwebkit.dll libwebkit-dev and windows, libwebkit I managed, but I
try to compile
with valac wondows but I can not find it.
Anyone know where I can download?
_______________________________________________
vala-list mailing list
vala-list@...
http://mail.gnome.org/mailman/listinfo/vala-list
pancake | 9 May 17:19

[Vala] cbang

A transpiler for C designed to program systems (kernels and so on).

i find it interesting.. and maybe Vala can get some ideas from this project.

http://blog.lse.epita.fr/articles/12-c---system-oriented-programming.html
Picon
Favicon

[Vala] regex to get some multiline text

I try write a regular expresion to get some text, something like this:

int main () {
         string the_string = """
          start text line 1
          start text line 2
          %tag:keytag%
          the content betwen tag line1
          %endtag%
          the end line 1
          the end line 2
          """;

         Regex r = 
/\s*(?P<start>.*)\s*%tag:(?P<key>.*)%\s*(?P<content>.*)\s*%endtag%\s*(?P<end>.*)/;
         MatchInfo info;
         if(r.match(the_string, 0, out info)) {
             var s = info.fetch_named("start");
             var key = info.fetch_named("key");
             var cont = info.fetch_named("content");
             var e = info.fetch_named("end");

             print("%s\n",s);
             print("%s\n",key);
             print("%s\n",cont);
             print("%s\n",e);
         }

         return 0;
}
(Continue reading)

Klaus Rotter | 8 May 21:37
Picon

[Vala] [genie] closures in genie

Hello!

An old (deprecated) way to define closures in genie is e.g:

   var button = new Button.with_label("Click me!")
   button.clicked += def()
     button.label = "Thank you"

However, the compiler throws a warning, that this way is deprecated and 
recommends 'connect' instead. But, I really can't figure out the syntax 
connect works. Has anybody an example for this? Thank you!

--

-- 
  Klaus Rotter * klaus at rotters dot de * www.rotters.de

Gmane