[Vala] Accessing properties of a Map.Entry from a read-only Gee map causes compiler warning

2015-11-19 Thread Nicolas Laplante
I have the following map declaration:

Map transactions_by_date = new
HashMap ();

Then I iterate over its entries:

foreach (Map.Entry entry in
transactions_by_date.entries) {

// ...
// ...

}

Within this loop, whenver I access entry.key or entry.value, I get the
following compiler warning:

src/ui/tree_store_transaction.vala:284:14: warning: assignment discards
‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 debug ("transaction group: %s (%d
transaction(s))", entry.key.to_string (), entry.value.size);

I get this warning for each line accessing properties of the "entry"
variable. Is this normal?
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Implicit array size for function allocating an array

2014-12-16 Thread Nicolas CARRIER

Hello,

I'm trying to bind a C function which has the following prototype:

int sos_addresses_to_string(const struct sos_address *addresses,
char ***string_addresses, int nb);

It's job is to convert an array of addresses, into an array of their string 
representation. So both the addresses array (in input) and the string_addresses 
array will have the same size which is nb. So in output, string_addresses will 
point to an allocated array of allocated char buffers.


I tried to bind it this way:

namespace Sos {
public struct Address {
...
		public static int array_to_string([CCode (array_length_pos = 3)] Address 
addresses[], [CCode (array_length = false] out string[] string_addresses);

}
}

and to use it with the following minimal code example:

public static int main(string[] args)
{
string[] strings;
Sos.Address[] addrs;
// the following call just populates the initial addrs array
Sos.Server.get_server_addresses(mambo, out addrs);
Sos.Address.array_to_string(addrs, out strings);
stdout.printf(@str_addr: $(strings[0])\n);
return Posix.EXIT_SUCCESS;
}

This approach works, but valgrind complains that the pointed string, in the 
returned array, isn't freed. In fact, in the generated code, _vala_array_free is 
called with an array length of -1, so only the array is freed, not the pointed 
addresses.


I tried to add array_length_cexpr = addresses.length but it didn't do 
anything, unless I remove 'array_length = false', but in this case, an extra 
parameter is added and the code doesn't compile any-more.



What would be the best solution to this issue in your opinion ?

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


[Vala] name containing a space in array liberation function

2014-12-15 Thread Nicolas CARRIER

Hello,
I'm using a binding I made for a library of ours.
This library uses a struct for manipulating various kind of addresses, which I 
have bound like (in the Sos namespace):


[CCode (cname = struct sos_address, has_type_id = false,
default_value = {.aaddr = { .addr = { .sa_family = 0, .sa_data = 
{0)]
public struct Address {
public AddressType type;
[CCode (cname = aaddr.addr)]
public Posix.SockAddr addr;
[CCode (cname = aaddr.in)]
public Posix.SockAddrIn in;
... other members ...
}

I use a function which creates an array of these addresses, bound as follows:

[CCode (lower_case_cprefix = sos_server_)]
namespace Server {
public int get_server_addresses(string? service,
[CCode (array_length_type = uint32_t)]
out Address[] addresses);
...
}

When I try to compile the following program:

public static int main(string[] args){
Sos.Address[] addrs;
Sos.Server.get_server_addresses(mambo, out addrs);
return Posix.EXIT_SUCCESS;
}

the following array liberation function is generated:

...
static void _vala_struct sos_address_array_free (struct sos_address* array, gint 
array_length) {

...

which doesn't compile because of the extra ' ' character between _vala_struct 
and sos_address_array_free.



By replacing the line:
string cname = _vala_%s_array_free.printf (get_ccode_name (st));

with:
string cname = _vala_%s_array_free.printf (get_ccode_name (st)).replace( , 
_);


In append_struct_array_free() in codegen/valaccodearraymodule.vala (first line), 
I managed to get the correct (from a C point of view):


...
static void _vala_struct_sos_address_array_free (struct sos_address* array, gint 
array_length) {

...

I tested this patch in the version we use (0.20.1) and things seem to go well. 
The patch can't apply as is on the current HEAD, but can be rewritten easily.



Do you think this patch is the correct way of doing things ?
Could you consider it for inclusion, or provide another fix for the issue ?
Or am I doing things the wrong way in the first place, in my vala or vapi file ?

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


[Vala] unused variable warning in generated C code

2014-12-12 Thread Nicolas CARRIER

Hello,
When I compile the following code :

public static int main(string[] args) {
int[] b = { 2, 4, 6, 8 };
foreach (int a in b)
stdout.printf(%d\n, a);
return 0;
}

with :

$ valac -C main.vala
$ gcc -Wunused-variable main.c -o main $(pkg-config --cflags --libs glib-2.0)


I get the following warning :
main.c: In function ‘_vala_main’:
main.c:38:8: attention : unused variable ‘_a_collection_size_’ 
[-Wunused-variable]
   gint _a_collection_size_ = 0;
^
What is the reason for this warning ?
Is it possible to get rid of it ?


PS: valac --version gives Vala 0.26.1.

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


Re: [Vala] unused variable warning in generated C code

2014-12-12 Thread Nicolas CARRIER



Date: Fri, 12 Dec 2014 10:54:53 +0100
From: Luca Bruno lethalma...@gmail.com

On 12/12/2014 10:46, Nicolas CARRIER wrote:

Hello,
When I compile the following code :

public static int main(string[] args) {
 int[] b = { 2, 4, 6, 8 };
 foreach (int a in b)
 stdout.printf(%d\n, a);
 return 0;
}

with :

$ valac -C main.vala
$ gcc -Wunused-variable main.c -o main $(pkg-config --cflags --libs
glib-2.0)


I get the following warning :
main.c: In function ?_vala_main?:
main.c:38:8: attention : unused variable ?_a_collection_size_?
[-Wunused-variable]
gint _a_collection_size_ = 0;
 ^
What is the reason for this warning ?

Valac not clever enough to delete unused C variables.


Is it possible to get rid of it ?

Yes, ignore C warnings. Or fix vala, in this case it's not easy so I
don't suggest doing it :)



Thank you for your answer.
The problem is that when I compile vala code with the warning compilations flags 
our build system enables, I have a lot of warnings. This one is only one amongst 
others.

The risk is high to miss a real one in the mass...

Is it planned to cleanup this aspect of the generated C code ?

It would be interesting to dig into the code myself, but for now, I am not 
sufficiently skilled in vala, so it would take too much time I think.



Concerning the other warnings I have, do you think it's worth it to submit them 
to the mailing list ? Or will the answers be of the same kind ?


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


[Vala] error: Non-constant field initializers, but the initializer seems constant

2014-12-12 Thread Nicolas CARRIER

Hello,
I have this kind of pattern in my code:

namespace Plop {
int my_int = -1;
static void check_my_int_is_initialized() {
if (my_int  0)
my_int = 42;
}
public static int main(string[] args) {
check_my_int_is_initialized();
stdout.printf(@my_int is $my_int\n);
return 0;
}
}

and when I try to compile it, I get the following error:
$ valac main.vala
main.vala:2.2-2.11: error: Non-constant field initializers not supported in this 
context

int my_int = -1;
^^
Compilation failed: 1 error(s), 0 warning(s)

I don't understand the issue, because I would've though that -1 is a constant 
value. Isn't it the case for vala ? Or is it an inadequate error message for 
another error which I am missing ?


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


Re: [Vala] error: Non-constant field initializers, but the initializer seems constant

2014-12-12 Thread Nicolas CARRIER

From: Luca Bruno lethalman88 gmail com
To: vala-list gnome org

On 12/12/2014 15:31, Nicolas CARRIER wrote:

namespace Plop {
int my_int = -1;
static void check_my_int_is_initialized() {
if (my_int  0)
my_int = 42;
}
public static int main(string[] args) {
check_my_int_is_initialized();
stdout.printf(@my_int is $my_int\n);
return 0;
}
}

That's an interesting bug. I think vala threats that -1 as unary
operator of negation. Should be trivial to fix. Feel free to report a bug.

---

Ok ! Thank for the explanation.

I haven't used bugzilla yet. I will try to submit my first bug ASAP.

PS: I don't receive the mails from the mailing list, it's really annoying, I 
have to copy / paste from the mailing-list's site in order to answer...

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


Re: [Vala] unused variable warning in generated C code

2014-12-12 Thread Nicolas CARRIER

From: Luca Bruno lethalman88 gmail com
To: vala-list gnome org

On 12/12/2014 14:18, Nicolas CARRIER wrote:


The problem is that when I compile vala code with the warning
compilations flags our build system enables, I have a lot of warnings.
This one is only one amongst others.
The risk is high to miss a real one in the mass...

If it's the case that a warning is a bug in the generated code, then
it's a bug in vala.

In fact, I'm talking about C warnings due to errors in my vala code.



Is it planned to cleanup this aspect of the generated C code ?

Yes, not a priority as those warnings can be ignored. But I accept patches.

Ok, I will give a try, but I can't guarantee the result ^^


Concerning the other warnings I have, do you think it's worth it to
submit them to the mailing list ? Or will the answers be of the same
kind ?

This is the mailing list, you meant bugzilla?

No, I wasn't clear enough, sorry but my english isn't as good as I'd like it to 
be.

I was asking if it would be interesting to send the warnings to the mailing, in 
order to find out if they are caused by errors in my vala code, or not.
Generally speaking, shall I ignore all C warnings if valac issues no warning in 
the vala code himself ?

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


Re: [Vala] error: Non-constant field initializers, but the initializer seems constant

2014-12-12 Thread Nicolas CARRIER

 No need to, fixed in master. Nice catch, thanks.

I have backported the patch for our version of vala (0.20.1) and it works like a 
charm.

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


Re: [Vala] Generics and Contract Programming

2011-06-24 Thread Nicolas

Hi Chris,

1) For assertations, try this:

[indent=4]

def static foo (ref args : array of string, opts : T, ...) of T
requires (args.length  1)
// do something

init
print hello world

2) For generics, try this:

[indent=4]

class Wrapper of G : GLib.Object

data : private G

def set_data(data : G)
this.data = data

def get_data() : G
return this.data

init
var wrapper = new Wrapper of string
wrapper.set_data(test)
var data = wrapper.get_data()

Regards,
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] OptionContext not setting reference

2011-06-24 Thread Nicolas

Hello again !

The problem in your program is: args = args[1:args.length]
The first arg is not taken by the program, so just delete this 
unecessary line, and it works !


Regards,
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Genie] Anonymous functions

2011-06-24 Thread Nicolas

Chris,

I'm not sure genie support closure, if someone can confirm...
For the delegate, try something like this:

[indent=4]

delegate DelegateType (a : int) : bool

def f1 (a:int) : bool
print testing delegate value %d, a
return true

def f2 (d:DelegateType, a:int)
var c = d (a)

init
f2 (f1, 5)

Regards,
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] GLib Command Parsing

2011-06-19 Thread Nicolas

Hi Chris,

Try this:

[indent=4]

version : bool = false
const my_options : array of OptionEntry = {{version, 'V', 0, 
OptionArg.NONE, ref version, Show application's version, null}, {null}}


init
print Hello

See you,
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Geani] Is Dead?

2011-05-24 Thread Nicolas

Hi Cristian,

I have made many of the genie sample in valaide code site (nikobordx).
Remember that many of the samples are a little bit out of date (but 
working, example: signal syntax has changed).

The gtk samples are for gtk2 and i don't know if it's working for gtk3.

See you,
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Setting image on a button?

2011-05-17 Thread Nicolas Joseph
Hello,

Le 16/05/11 à 18:33, Damien Radtke a écrit :
 I'm trying to add an image to a button, but it doesn't display. I'm loading
 one of the stock images, and can get it to display fine on its own, but it
 doesn't show after placed on a button with set_image(). I've also looked
 into the gtk-button-images setting to see if it's disabled, but
 Gtk.Settings doesn't seem to support that property.

 Using vala 0.11.5.

You can see an example here: 
http://bazaar.launchpad.net/~valide/valide/trunk/view/head:/libvalide/utils.vala#L320

You probably forget image.show()



signature.asc
Description: Digital signature
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Setting image on a button?

2011-05-17 Thread Nicolas Joseph
Hello,

Le 16/05/11 à 18:33, Damien Radtke a écrit :
 I'm trying to add an image to a button, but it doesn't display. I'm loading
 one of the stock images, and can get it to display fine on its own, but it
 doesn't show after placed on a button with set_image(). I've also looked
 into the gtk-button-images setting to see if it's disabled, but
 Gtk.Settings doesn't seem to support that property.

 Using vala 0.11.5.

You can see an example here: 
http://bazaar.launchpad.net/~valide/valide/trunk/view/head:/libvalide/utils.vala#L320

You probably forget image.show()

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


Re: [Vala] Vala to Genie

2011-02-23 Thread Nicolas

Hi,

What happens if you simple declare the class like this:

class GenieItem : Match

And let all properties untouched.
Nicolas.


No success:

genie-test-plugin.gs:41.12-41.20: error: syntax error, expected
identifier
   prop construct title : string
^
Compilation failed: 1 error(s), 1 warning(s)
   


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


Re: [Vala] Genie async methods

2011-02-21 Thread Nicolas

Hi,
I don't test this code but i suppose is:

def search (query : Query) : async ResultSet? raises SearchError

Is it working ?
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Genie async methods

2011-02-21 Thread Nicolas

Try this:

def async search (query : Query) : ResultSet? raises SearchError

Don't forget to build with --pkg gio-2.0

Nicolas.


Nope, neither when swapped async and ResultSet.

Compilation failed: 1 error(s), 1 warning(s)
 def search (query : Query) : async ResultSet? raises SearchError
^
   

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


Re: [Vala] Vala to Genie

2011-02-21 Thread Nicolas

What happens if you declare the function as static ?
def static register_plugin()

For the second error, what happens if you declare the class like this:
class Connect : Object, Match

Nicolas.


Yeah! It works. Probably need to move this to Genie wiki.

But I fall into another issues so need some more help :)

 def register_plugin()
   DataSink.PluginRegistry.get_default().register_plugin(
 typeof (GeniePlugin),
Genie Example, // Plugin title
 _ (Synapse plugin example wiritten in Genie language),
 terminal,// icon name
 register_plugin,  // reference to this function
...
   );

valac complains:

genie-test-plugin.gs:25.206-25.220: error: Cannot create delegate
without target for instance method or closure
 register_plugin, // reference to this function


Also need to translate following:

 private class Connect : Object, Match {
   // from Match interface
   public string title { get; construct set; }
   public string description   { get; set; }
   public string icon_name { get; construct set; }
   public bool   has_thumbnail { get; construct set; }
   public string thumbnail_path{ get; construct set; }
   public intdefault_relevancy { get; set; default = 0; }
   public MatchType match_type { get; construct set; }

I made something like this:

class Connect : Object implements Match

   prop title : string
   prop description : string
   prop icon_name : string
   prop has_thumbnail : bool
   prop thumbnail_path : bool
   prop match_type : MatchType

Valac complains here:

genie-test-plugin.gs:44.7-44.25: error: Type and/or accessors of
overriding property `Synapse.GeniePlugin.GenieItem.title' do not match
overridden property `Synapse.Match.title'.
   prop title : string
   ^^^
genie-test-plugin.gs:46.7-46.29: error: Type and/or accessors of
overriding property `Synapse.GeniePlugin.GenieItem.icon_name' do not
match overridden property `Synapse.Match.icon_name'.
   prop icon_name : string
   ^^^

etc.

I'am begginer in Vala and Genie so dont
   


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


Re: [Vala] Ctags support?

2011-02-18 Thread Nicolas Joseph

On Sat, 12 Feb 2011 16:24:48 -0600, Damien Radtke wrote:

Does anyone know if there's a ctags build that supports vala?


Another copy of the sources proposed by Abderrahim: 
http://bazaar.launchpad.net/~valide/valide/trunk/files/head:/ctags-vala/

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


Re: [Vala] [ANNOUNCE] Vala 0.11.3 - Compiler for the GObject type system

2011-01-07 Thread Nicolas Joseph

Hi,

On Wed, 05 Jan 2011 23:41:09 +0100, Jürg Billeter wrote:

We are pleased to announce version 0.11.3 of Vala, a compiler for the
GObject type system.

Vala 0.11.3 is now available for download at:
   http://download.gnome.org/sources/vala/0.11/

This is a development release leading toward 0.12.

Changes since 0.11.2
 * Support BusName sender parameter in GDBus servers.
 * More refactoring in the code generator.
 * Many bug fixes and binding updates.

Vala is a new programming language that aims to bring modern 
programming

language features to GNOME developers without imposing any additional
runtime requirements and without using a different ABI compared to
applications and libraries written in C.

valac, the Vala compiler, is a self-hosting compiler that translates
Vala source code into C source and header files. It uses the GObject
type system to create classes and interfaces declared in the Vala 
source

code.

The syntax of Vala is similar to C#, modified to better fit the 
GObject

type system. Vala supports modern language features as the following:

* Interfaces
* Properties
* Signals
* Foreach
* Lambda expressions
* Type inference for local variables
* Generics
* Non-null types
* Assisted memory management
* Exception handling

Vala is designed to allow access to existing C libraries, especially
GObject-based libraries, without the need for runtime bindings. All 
that
is needed to use a library with Vala is an API file, containing the 
class

and method declarations in Vala syntax. Vala currently comes with
bindings for GLib and GTK+. It's planned to provide generated 
bindings for

the full GNOME Platform at a later stage.

Using classes and methods written in Vala from an application written 
in
C is not difficult. The Vala library only has to install the 
generated
header files and C applications may then access the GObject-based API 
of
the Vala library as usual. It should also be easily possible to write 
a

bindings generator for access to Vala libraries from applications
written in e.g. C# as the Vala parser is written as a library, so 
that

all compile-time information is available when generating a binding.

More information about Vala is available at

http://www.vala-project.org/


Jürg Billeter



FYI, the binaries for Windows are moved to a new location: 
https://code.google.com/p/vala-win32/

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


Re: [Vala] Can't compile ValaIde from source...

2010-12-30 Thread Nicolas Joseph

Hi,

On Thu, 16 Dec 2010 02:02:31 +0300, Alexey Savartsov
asavart...@gmail.com wrote:
 Hi!
 
 I can't compile valaide too.
 
 I built glib/gtk+/vala etc. from sources, installed to /usr/local on
 Mac OS X 10.6.5
 
 All the stuff I have:
 
 atk-1.30.0
 gettext-0.17
 gtk+-2.20.1
 libglade-2.6.4
 libpng-1.2.44
 pango-1.28.3
 tiff-3.9.4
 bzr-2.2.2
 gtksourceview-2.11.2
 libsvg-0.1.4
 vala-0.11.2
 glib-2.24.2
 intltool-0.41.0
 gdl-2.28.2
 jpeg-8b
 libiconv-1.13.1
 libxml2-2.7.7
 pkg-config-0.25
 
 Then I got valaide from bzr
 
 ./waf configure
 Checking for program gcc or cc   : /usr/bin/gcc 
 Checking for program cpp : /usr/bin/cpp 
 Checking for program ar  : /usr/bin/ar 
 Checking for program ranlib  : /usr/bin/ranlib 
 Checking for gcc : ok  
 Checking for program valac   : /usr/local/bin/valac 
 Checking for gobject-2.0 : yes 
 Checking for gthread-2.0 : yes 
 Checking for program version valac = 0.1.6 : ok 0.11.2 
 Checking for program msgfmt : /usr/local/bin/msgfmt 
 Checking for program intltool-merge : /usr/local/bin/intltool-merge 
 Checking for header locale.h: yes 
 Checking for program valadoc: not found 
 Checking for glib-2.0 = 2.18.0 : yes 
 Checking for gio-2.0 = 2.18.0  : yes 
 Checking for gobject-2.0 = 2.18.0  : yes 
 Checking for gmodule-2.0 = 2.18.0  : yes 
 Checking for gtk+-2.0 = 2.18.0 : yes 
 Checking for libxml-2.0 = 2.5.0: yes 
 Checking for gtksourceview-2.0 = 2.10.0: yes 
 Checking for libvala-0.12 = 0.11.0 : yes 
 Checking for gdl-1.0 = 2.28: yes 
 Checking for unique-1.0 = 1.0.0: no 
 'configure' finished successfully (0.603s)
 
 When i run ./waf I get this error:
 
 error: Package `vala-0.12' not found in specified Vala API
 directories or GObject-Introspection GIR directories
 
 
 ./waf
 Waf: Entering directory `/usr/local/src/build/valide/_build_'
 [  1/189] valac: libvalide/frame.vala libvalide/encoding.vala
 libvalide/document-close-dialog.vala libvalide/searching.vala
 libvalide/compiler.vala libvalide/valac.vala
 libvalide/recent-manager-ui.vala libvalide/uimanager.vala
 libvalide/template-manager.vala libvalide/document-manager.vala
 libvalide/builder-manager.vala libvalide/split-source-view.vala
 libvalide/template.vala libvalide/project-dialog-options.vala
 libvalide/statusbar.vala libvalide/project-dialog.vala
 libvalide/plugin.vala libvalide/libyaml-glib/src/loader.vala
 libvalide/libyaml-glib/src/buildable.vala
 libvalide/libyaml-glib/src/writer.vala
 libvalide/libyaml-glib/src/libyaml-glib.vala
 libvalide/libyaml-glib/src/builder.vala
 libvalide/libyaml-glib/src/error.vala libvalide/project.vala
 libvalide/plugin-registrar.vala libvalide/document-message.vala
 libvalide/utils.vala libvalide/plugin-manager.vala
 libvalide/plugin-preferences.vala
 libvalide/abstract-config-manager.vala
 libvalide/preferences-dialog.vala libvalid
  e/document.vala libvalide/goto-dialog.vala
 libvalide/config-manager.vala libvalide/project-dialog-remove.vala
 libvalide/source-buffer.vala libvalide/aboutdialog.vala
 libvalide/project-manager.vala libvalide/builder.vala
 libvalide/fullscreen-toolbar.vala libvalide/window.vala
 libvalide/executable-manager.vala
 libvalide/ui/abstract-preferences-dialog.vala
 libvalide/ui/abstract-executable-preferences.vala
 libvalide/ui/abstract-project-dialog-options.vala
 libvalide/ui/abstract-project-dialog-remove.vala
 libvalide/ui/abstract-project-dialog.vala
 libvalide/ui/abstract-native-builder-preferences.vala
 libvalide/ui/abstract-close-dialog.vala libvalide/native-builder.vala
 libvalide/source-view.vala libvalide/executable.vala -
 _build_/default/libvalide/frame.c
 _build_/default/libvalide/valide-0.0.h
 _build_/default/libvalide/valide-0.0.vapi
 _build_/default/libvalide/valide-0.0.deps
 _build_/default/libvalide/encoding.c
 _build_/default/libvalide/valide-0.0.h _build_/default/libvalide/val
  ide-0.0.vapi _build_/default/libvalide/valide-0.0.deps
 _build_/default/libvalide/document-close-dialog.c
 _build_/default/libvalide/valide-0.0.h
 _build_/default/libvalide/valide-0.0.vapi
 _build_/default/libvalide/valide-0.0.deps
 _build_/default/libvalide/searching.c
 _build_/default/libvalide/valide-0.0.h
 _build_/default/libvalide/valide-0.0.vapi
 _build_/default/libvalide/valide-0.0.deps
 _build_/default/libvalide/compiler.c
 _build_/default/libvalide/valide-0.0.h
 _build_/default/libvalide/valide-0.0.vapi
 _build_/default/libvalide/valide-0.0.deps
 _build_/default/libvalide/valac.c
 _build_/default/libvalide/valide-0.0.h
 _build_/default/libvalide/valide-0.0.vapi
 _build_/default/libvalide/valide-0.0.deps
 _build_/default/libvalide/recent-manager-ui.c
 _build_/default/libvalide/valide-0.0.h
 _build_/default/libvalide/valide-0.0.vapi
 

Re: [Vala] [Genie] dict with int keys segfaults

2010-11-29 Thread Nicolas

Hi Stefano,

I tested your code with latest vala svn and libgee 0.6, and it works as 
expected !

Try to update vala.

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


Re: [Vala] Blitzen: A Vala Application Server

2010-11-14 Thread Nicolas Joseph
Hi,

Le 14/11/2010 15:30, pancake a écrit :
 On Sun, 14 Nov 2010 11:22:37 + (UTC)
 Samuel CUELLA samuel.cue...@supinfo.com wrote:
 
 Hi,

 Where's the source repository? I can't find any svn/git/..
 For the moment, the repository is not accessible from the internet. I'll 
 import
 it into the sourceforge subversion service when I have time. That means I'll 
 do
 it, but I can't tell you when. If you want to work on the source code or 
 apply
 patches, please do it against the latest release tarball. Just send your 
 patches
 at b...@blitzen.org, or use sf tracker, as written on the 'Contributing' 
 page of
 the website.
 
 Why non use git or hg? svn and sourceforge are imho worst solutions for 
 developers.
 I stopped using sourceforge for security reasons (their servers are not really
 secure places) and because of their license agreement and service shutdown 
 times.
 

Free Software Needs Free Tools: http://mako.cc/writing/hill-free_tools.html

gitorious and launchpad are my two prefered tools.

 If you use svn/cvs or any other traditional control version system you end up
 depending on a network link in order to work with it which results in slower
 work (diffing code, checking out code, ..). and it's less optimal when you 
 work with
 more people.
 
 I understand that this is just a personal opinion, feel free to use what you 
 like :)
 
 I tried to write a simple webapp but I faced the following issues:

  * There's no sne-server.h installed , so i had to copy them manually with 
 Fixed
  * There's no pkgconfig file that setups gcc flags correctly. I had to split
the build in two steps (valac+gcc)
 Fixed
 Thank you for reporting bugs ! These two of them have been fixed in the 
 latest
 release (blitzen-0.0.8-r1) available on sourceforge. You just made me realize
 that I had a manually created 'stk.pc' on my system that was not part of the
 dist and not part of the project at all. Don't hesitate to point out any of
 these 'features'.
  * The webapp is loaded correctly, but segfaults when running. You may find
the sourcecode here:
   http://lolcathost.org/b/stk.tar.gz
 As written in my first answer, this is working on my system(tm). I don't 
 know
 how this got wrong, but I suspect the deployment process. Try to use the
 Makefile linked in my previous post, and look at the documentation deployment
 hints at http://blitzen.sourceforge.net/manual/ch03s03.html.
 If it still don't work, please let me know. I really want to fix it if 
 necessary.
 
 Uhm, i have updated to 0.8-r1 and used the makefile of the manual and now it
 seems to work fine. thanks :)
 
 It would be nice to have some help or flags handled by blitzen binary, to
 specify different configuration file, show version or so.
 We(I in fact) are accepting patches ;)
 
 Until I can fetch the development repository I prefer to report bugs instead 
 of
 sending patches because i devel src is usually not the same in the last 
 release.
 
 Vlad and me are planing to add support for Stk in GtkON
 Somebody just dragged my attention to your project some days ago. I'm really
 missing your point there. What's the purpose of GtkON ? I mean, it's 
 generating
 Vala code out of an XML file with mixed UI definition and code. Don't take it
 personal, but I think it's a very, very bad idea, at least for real
 applications. It might be OK for rapid prototyping. But in my opinion, that's
 not the big problem. The big problem is why using this ? libglade have been
 around for years, GtkBuilder is now integrated directly in gtk and glade is 
 able
 to generate XML for it. Why using something like GtkON when you can use 
 glade to
 design your interface and something /built into/ Gtk to load it ? GtkBuilder 
 is
 available for any language that has a gtk binding, including Vala, but not
 restricted to it. For me, that's making GtkON pretty useless.
 
 The purpose of GtkON is to provide a simpler syntax for the XML parsed by 
 GtkAML.
 
 It generates vala code from a simpler syntax which results in a 
 container-oriented
 programming language which is much cleaner for UI development.
 
 The reason I prefer gtkaml before gtkbuilder is because most of the UIs are 
 just
 static, and it is not necessary to perform this task every time you execute 
 the
 program, maybe the cost is not noticable in your machine, but my phone and 
 laptop
 does.
 
 I understand that from the design point of having everything separated in a 
 MVC
 way makes the development much more clean, but gtkaml does not forces you to
 mix this, it's just a way to have static UIs definitions in separated files, 
 then
 you can put the logic somewhere else.
 
 Something that really anoyis me when using glade or xml definition for 
 container
 constructions is the fact that even the properties and signals links are 
 defined
 in separated places which makes me read up to 3 files at a time in order to
 understand what does what with what and where (yeah :P).
 
 And certainly.. using glade 

[Vala] Problem building vapigen

2010-11-10 Thread Nicolas

Hi,

I'm trying to build last vala from svn and i connot build vapigen 
(./configure --enable-vapigen)


gmake[4]: entrant dans le répertoire « 
/usr/home/niko/Desktop/Divers/vala/vapigen »

  CC valavapicheck.o
valavapicheck.c: In function 'vala_vapi_check_construct':
valavapicheck.c:152: error: 'SOURCE_FILE_TYPE_SOURCE' undeclared (first 
use in this function)
valavapicheck.c:152: error: (Each undeclared identifier is reported only 
once

valavapicheck.c:152: error: for each function it appears in.)
gmake[4]: *** [valavapicheck.o] Erreur 1
gmake[4]: quittant le répertoire « 
/usr/home/niko/Desktop/Divers/vala/vapigen »


Do you have this problem too ?

Regards,
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Problem building vapigen

2010-11-10 Thread Nicolas

Hi Evan,

Yes i mean git.
After deleting everything and refetching vala, it build !

Thank you,
Nicolas.



On Wed, 2010-11-10 at 18:50 +0100, Nicolas wrote:
   

Hi,

I'm trying to build last vala from svn and i connot build vapigen
(./configure --enable-vapigen)
 

I'm assuming you meant git. SVN hasn't been updated in ~ 2 years.

   

gmake[4]: entrant dans le répertoire «
/usr/home/niko/Desktop/Divers/vala/vapigen »
CC valavapicheck.o
valavapicheck.c: In function 'vala_vapi_check_construct':
valavapicheck.c:152: error: 'SOURCE_FILE_TYPE_SOURCE' undeclared (first
use in this function)
valavapicheck.c:152: error: (Each undeclared identifier is reported only
once
valavapicheck.c:152: error: for each function it appears in.)
gmake[4]: *** [valavapicheck.o] Erreur 1
gmake[4]: quittant le répertoire «
/usr/home/niko/Desktop/Divers/vala/vapigen »

Do you have this problem too ?
 

It looks like what is happening is your vapigen is being built with an
old libvala vapi (probably the version installed in your system).
Someone had a similar issue a while back in IRC, and they solved it by
building and installing valac without vapigen, then building and
installing with vapigen. A bit of a hack, I know, but I haven't been
able to reproduce the issue, so I have no idea what is really going on.

Is there anything interesting about your environment? Are you trying to
build out of tree or anything like that? Is it a fresh checkout?


-Evan



   


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


[Vala] Problem converting c to vala/genie

2010-11-01 Thread Nicolas

Hello,

I'm trying to use a c library in genie and i have a question about 
converting code.

This is the c code who makes me crazy !

The struct:
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
   Object *myboject
};

Now in the function:
Widget_Data *wd;
wd = ELM_NEW(Widget_Data); -- this is the problem

The ELM_NEW is declared like this in the header file:
#define ELM_NEW(t) calloc(1, sizeof(t))

How can i convert this on genie (or vala), at least it is possible ?
Thanks you in advance,
Nicolas.


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


Re: [Vala] Problem converting c to vala/genie

2010-11-01 Thread Nicolas

Hi Jamie,

Thanks for your response.
I'm trying to create the vapi for the Elementary library from E17 (only 
widget creation part, the rest is already done).


I have another question, how to do this:

How can i pass my struct Widget_Data to void* data ?
elm_widget_data_set(Evas_Object *obj, void *data);

How can i create in the vapi this: void (*func) (Evas_Object *obj) ?
elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));

C sample:
elm_widget_del_hook_set(obj, _del_hook)

static void
 _del_hook(Evas_Object *obj)
 {
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
// delete hook - on delete of object delete object struct etc.
free(wd);
 }

Thanks to everyone in advance,
Nicolas.



Im not sure what you mean - are you using or porting the code in the c
library?

If you are using a c library in Genie/vala then you need to create a
vapi file for it

if you are porting a c library to genie/vala then you dont need to
specify ELM_NEW as construction is done for you :

var wd = new Widget_Data

hope that helps

jamie
   



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


Re: [Vala] Problem converting c to vala/genie

2010-11-01 Thread Nicolas

Hi and thanks for your response.
I'm already using this old vapi and updated it, the vapi i try to create 
is from the eml_widget.h.

With this file, it's possible to create new elementary widget.

Nicolas.


You can find bindings for Elementary library at

http://trac.enlightenment.org/e/browser/trunk/BINDINGS/vala
(see vapi subdir)
   



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


Re: [Vala] [ANNOUNCE] Vala 0.10.1 - Compiler for the GObject type system

2010-10-26 Thread Nicolas Joseph
Hello,

Le 26/10/2010 20:33, Jürg Billeter a écrit :
 We are pleased to announce version 0.10.1 of Vala, a compiler for the
 GObject type system.
 
 Vala 0.10.1 is now available for download at:
http://download.gnome.org/sources/vala/0.10/
 
 Changes since 0.10.0
  * Remove outdated GTK+ 3 bindings.
  * Many bug fixes and binding updates.
 
 Vala is a new programming language that aims to bring modern programming
 language features to GNOME developers without imposing any additional
 runtime requirements and without using a different ABI compared to
 applications and libraries written in C.
 
 valac, the Vala compiler, is a self-hosting compiler that translates
 Vala source code into C source and header files. It uses the GObject
 type system to create classes and interfaces declared in the Vala source
 code.
 
 The syntax of Vala is similar to C#, modified to better fit the GObject
 type system. Vala supports modern language features as the following:
 
 * Interfaces
 * Properties
 * Signals
 * Foreach
 * Lambda expressions
 * Type inference for local variables
 * Generics
 * Non-null types
 * Assisted memory management
 * Exception handling
 
 Vala is designed to allow access to existing C libraries, especially
 GObject-based libraries, without the need for runtime bindings. All that
 is needed to use a library with Vala is an API file, containing the class
 and method declarations in Vala syntax. Vala currently comes with
 bindings for GLib and GTK+. It's planned to provide generated bindings for
 the full GNOME Platform at a later stage.
 
 Using classes and methods written in Vala from an application written in
 C is not difficult. The Vala library only has to install the generated
 header files and C applications may then access the GObject-based API of
 the Vala library as usual. It should also be easily possible to write a
 bindings generator for access to Vala libraries from applications
 written in e.g. C# as the Vala parser is written as a library, so that
 all compile-time information is available when generating a binding.
 
 More information about Vala is available at
 
 http://www.vala-project.org/
 
 
 Jürg Billeter
 
 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list

The code doesn't compile:

valaccodeconstant.vala:41.11-41.18: error: The expression `string' does
not denote an array
assert (_name[0] == '\');




signature.asc
Description: OpenPGP digital signature
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [ANNOUNCE] Vala 0.10.1 - Compiler for the GObject type system

2010-10-26 Thread Nicolas Joseph
Le 26/10/2010 21:08, Jürg Billeter a écrit :
 On Tue, 2010-10-26 at 20:50 +0200, Nicolas Joseph wrote:
   
 The code doesn't compile:

 valaccodeconstant.vala:41.11-41.18: error: The expression `string' does
 not denote an array
  assert (_name[0] == '\');
 
 Do not use valac 0.11.x to build valac 0.10.x from git. Either use
 tarball releases or build with valac 0.10.x (or late 0.9.x) versions.

 Jürg

   
Sorry, thank's.



signature.asc
Description: OpenPGP digital signature
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Genie syntax for connect

2010-10-13 Thread Nicolas

Hi Phil,

Correct code is:
[indent=4]

uses
Gtk

init
Gtk.init (ref args)
var test = new TestWindow ()
test.show_all ()
Gtk.main ()

class TestWindow : Window
slider: HScale
spin_box : SpinButton
init
title = Test Window
default_height = 20
default_width = 300
window_position = WindowPosition.CENTER
destroy.connect(Gtk.main_quit)
spin_box = new SpinButton.with_range (0, 130, 1)
spin_box.value = 35
slider = new HScale.with_range (0, 130, 1)
spin_box.value_changed.connect(spinbox_value)
slider.value_changed.connect (slider_value)
var hbox = new HBox (true, 5)
var button = new Button.with_label(Exit)
button.clicked.connect(Gtk.main_quit)
hbox.add (spin_box)
hbox.add (slider)
hbox.add (button)
add (hbox)

def slider_value()
spin_box.set_value(slider.get_value())

def spinbox_value()
slider.set_value(spin_box.get_value())

I also update the [Genie] Synchronizing Widgets in code.valaide.org
See you,
Nicolas.

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


Re: [Vala] [Genie] Problem with enums in genie

2010-09-28 Thread Nicolas

Hi,

Thanks you Jamie, i can access my enum !

I have a simple question about enum, why if i change 'value1 = 15' by 
'value1 = 15', valac does not return an error, only gcc (error: 
enumerator value for 'ENUM_TEST_value1' is not an integer constant)


[indent=4]

enum EnumTest
value1 = 15

init
print (%d, EnumTest.value1)

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


Re: [Vala] [Genie] Problem with enums in genie

2010-09-27 Thread Nicolas

Hello,

There is a long time that I did not use enums in my code and now I see 
that it no longer works as before, what's the problem?


[indent=4]

enum EnumTest
value1 = Hello !

init
print EnumTest.value1


test-enum.gs:7.11-7.25: error: Access to private member 
`EnumTest.value1' denied


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


[Vala] [Genie] is this a bug ?

2010-09-23 Thread Nicolas

Hi,

I'm developping a program and i made a mistake in my code, i think i 
found a bug.
If i call my gtk window class test and in this class i create a gtk 
button named test, vala does not report an error, only gcc.


Test program:

[indent=4]

// Build with valac --pkg gtk+-2.0 yourfile.gs

uses
Gtk

class test : Window

init
title = Test Window
default_height = 250
default_width = 250
window_position = WindowPosition.CENTER
destroy.connect(Gtk.main_quit)
var test = new Button()
add(test)

init
Gtk.init (ref args)
var testing = new test()
testing.show_all()
Gtk.main()

Is this a bug ?
Nicolas.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] Chain up TextBuffer

2010-09-12 Thread Nicolas

Hi,

I'm developping a program and i need to override a function in 
Gtk.TextBuffer.

This is the code:

[indent=4]

uses
Gtk

class testbuffer : Gtk.TextBuffer

mark : TextMark

init
mark = new TextMark(null, true)

def private override insert_text (iter : TextIter, text : string, 
length : int)

print future function

class test : Window

txtview : TextView
txtbuffer : TextBuffer

init
title = Test
default_height = 270
default_width = 440
window_position = WindowPosition.CENTER
this.destroy.connect(Gtk.main_quit)
txtbuffer = new testbuffer ()
txtview = new TextView.with_buffer(txtbuffer)
this.add(txtview)
this.show_all()

init
Gtk.init (ref args)
var window = new test ()
window.show_all ()
Gtk.main ()

My problem is that i can't write anything in the textview.
Someone can explain me (with code if possible, my english is poor) how 
to chain up ?


Thank in advance,
Nicolas.


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


Re: [Vala] [Genie] Chain up TextBuffer

2010-09-12 Thread Nicolas

Thank you so much Jamie, it works.

I do: super.insert_text(iter, text, length)

Nicolas.


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


Re: [Vala] mysql bindings in genie

2010-09-10 Thread Nicolas

Hi Phil,

Can you try this:
valac --pkg=mysql --Xcc='-lmysqlclient' mysqltest.gs

Nicolas.


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


[Vala] Need for an example of creating new item

2010-08-17 Thread Nicolas Rassat
Hi everyone

I am trying to use the goocanvas binding. But I don't know how to
create a new item by subclassing CanvasItemSimple.

I tried a basic testing by defining:

class Handler: Goo.CanvasItemSimple {
public override bool simple_is_item_at (double x, double y,
Cairo.Context cr, bool is_pointer_event){ return true; } 
public override void simple_paint (Cairo.Context cr, 
Goo.CanvasBounds bounds){} 
public override void simple_update (Cairo.Context cr){}
}

based on the goocanvas.vapi

At compilation time I got:

go.vala:4.1-4.35: warning: unable to chain up to private base
constructor class Handler: Goo.CanvasItemSimple, Goo.CanvasItem {
^^^
/home/nico/progs/goo/go.vala.c: In function ‘handler_class_init’:
/home/nico/progs/goo/go.vala.c:93: attention : assignment from
incompatible pointer type Compilation succeeded - 1 warning(s)

What does that means?

And how should I construct my Handler item?

Does anyone has an example/a snippet/a source code/or anything else that
could help me (I googled a lot but I can't find anything)?

Thanks 

PS: By the way, thanks to all the dev of vala.

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


Re: [Vala] how to declare multi-dimensional arrays in Genie?

2010-07-15 Thread Nicolas



Isn't this a mono-dimensional array with 2 elements ?

Xav

Hi,

I'm not an expert nor a real developer, but multidimensional array 
seem to be like this:


var myarray = new array of uint64[3, 2] = {{13, 64}, {14, 65}, {15, 66}}
or
myarray : array of uint64[3, 2] = new array of uint64[3, 2] = {{13, 64}, 
{14, 65}, {15, 66}}


Is this correct ? Someone can confirm ?

Nicolas.


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


Re: [Vala] Delegate on struct

2010-07-12 Thread Nicolas HENRY
The program works as expected but this is disturbing.

2010/7/12 Jiří Zárevúcky zarevucky.j...@gmail.com:
 Nicolas HENRY píše v Čt 08. 07. 2010 v 01:14 +0200:
 Hello,

 I don't understand why this code produce a warning (vala 0.9.2) :

 public delegate void myDelegateFunc();

 struct MyStruct {
       public myDelegateFunc my_struct_func;
 }

 void main(){
       string a = test;
       var t = MyStruct();
       t.my_struct_func = () = {
               print(a);
       };
       t.my_struct_func();
 }

 .../test.vala.c: In function ‘_vala_main’:
 .../test.vala.c:113: warning: assignment from incompatible pointer type

 Thanks.


 Does the program work as expected? If it does, just ignore C warnings.
 They will get fixed some day (hopefully).



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


[Vala] Delegate on struct

2010-07-07 Thread Nicolas HENRY
Hello,

I don't understand why this code produce a warning (vala 0.9.2) :

public delegate void myDelegateFunc();

struct MyStruct {
public myDelegateFunc my_struct_func;
}

void main(){
string a = test;
var t = MyStruct();
t.my_struct_func = () = {
print(a);
};
t.my_struct_func();
}

.../test.vala.c: In function ‘_vala_main’:
.../test.vala.c:113: warning: assignment from incompatible pointer type

Thanks.


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


Re: [Vala] Delegate on struct

2010-07-07 Thread Nicolas HENRY
Line 113 :

t.my_struct_func = (_tmp0_ = __lambda0__my_delegate_func,
((t.my_struct_func_target_destroy_notify == NULL) ? NULL :
(t.my_struct_func_target_destroy_notify (t.my_struct_func_target),
NULL), t.my_struct_func = NULL, t.my_struct_func_target = NULL,
t.my_struct_func_target_destroy_notify = NULL), t.my_struct_func_target
= block1_data_ref (_data1_), t.my_struct_func_target_destroy_notify =
block1_data_unref, _tmp0_);

test.c :

/* test.c generated by valac, the Vala compiler
 * generated from test.vala, do not modify */


#include glib.h
#include glib-object.h
#include stdlib.h
#include string.h


#define TYPE_MY_STRUCT (my_struct_get_type ())
typedef struct _MyStruct MyStruct;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block1Data Block1Data;

typedef void (*myDelegateFunc) (void* user_data);
struct _MyStruct {
myDelegateFunc my_struct_func;
gpointer my_struct_func_target;
GDestroyNotify my_struct_func_target_destroy_notify;
};

struct _Block1Data {
int _ref_count_;
char* a;
};



GType my_struct_get_type (void);
MyStruct* my_struct_dup (const MyStruct* self);
void my_struct_free (MyStruct* self);
void my_struct_copy (const MyStruct* self, MyStruct* dest);
void my_struct_destroy (MyStruct* self);
static void _lambda0_ (Block1Data* _data1_);
static void __lambda0__my_delegate_func (gpointer self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
void _vala_main (void);



void my_struct_copy (const MyStruct* self, MyStruct* dest) {
dest-my_struct_func = self-my_struct_func;
}


void my_struct_destroy (MyStruct* self) {
((*self).my_struct_func_target_destroy_notify == NULL) ? NULL :
((*self).my_struct_func_target_destroy_notify
((*self).my_struct_func_target), NULL);
self-my_struct_func = NULL;
(*self).my_struct_func_target = NULL;
(*self).my_struct_func_target_destroy_notify = NULL;
}


MyStruct* my_struct_dup (const MyStruct* self) {
MyStruct* dup;
dup = g_new0 (MyStruct, 1);
my_struct_copy (self, dup);
return dup;
}


void my_struct_free (MyStruct* self) {
my_struct_destroy (self);
g_free (self);
}


GType my_struct_get_type (void) {
static volatile gsize my_struct_type_id__volatile = 0;
if (g_once_init_enter (my_struct_type_id__volatile)) {
GType my_struct_type_id;
my_struct_type_id = g_boxed_type_register_static (MyStruct,
(GBoxedCopyFunc) my_struct_dup, (GBoxedFreeFunc) my_struct_free);
g_once_init_leave (my_struct_type_id__volatile, 
my_struct_type_id);
}
return my_struct_type_id__volatile;
}


static void _lambda0_ (Block1Data* _data1_) {
g_print (%s, _data1_-a);
}


static void __lambda0__my_delegate_func (gpointer self) {
_lambda0_ (self);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
++_data1_-_ref_count_;
return _data1_;
}


static void block1_data_unref (Block1Data* _data1_) {
if ((--_data1_-_ref_count_) == 0) {
_g_free0 (_data1_-a);
g_slice_free (Block1Data, _data1_);
}
}


void _vala_main (void) {
Block1Data* _data1_;
MyStruct t = {0};
myDelegateFunc _tmp0_;
_data1_ = g_slice_new0 (Block1Data);
_data1_-_ref_count_ = 1;
_data1_-a = g_strdup (test);
memset (t, 0, sizeof (MyStruct));
t.my_struct_func = (_tmp0_ = __lambda0__my_delegate_func,
((t.my_struct_func_target_destroy_notify == NULL) ? NULL :
(t.my_struct_func_target_destroy_notify (t.my_struct_func_target),
NULL), t.my_struct_func = NULL, t.my_struct_func_target = NULL,
t.my_struct_func_target_destroy_notify = NULL), t.my_struct_func_target
= block1_data_ref (_data1_), t.my_struct_func_target_destroy_notify =
block1_data_unref, _tmp0_);
t.my_struct_func (t.my_struct_func_target);
my_struct_destroy (t);
block1_data_unref (_data1_);
}


int main (int argc, char ** argv) {
g_type_init ();
_vala_main ();
return 0;
}





Le jeudi 08 juillet 2010 à 00:29 +0100, Harry Van Haaren a écrit :
 Hey Nicolas,
 
 Any chance you'd compile with   valac --save-temps  your files etc
 here?
 And then maybe post line 113 from your test.c file so we can see
 what's really going on there?
 
 Cheers, -Harry
 
 On Thu, Jul 8, 2010 at 12:14 AM, Nicolas HENRY ice...@gmail.com
 wrote:
 Hello,
 
 I don't understand why this code produce a warning (vala
 0.9.2) :
 
 public delegate void myDelegateFunc();
 
 struct MyStruct {
public myDelegateFunc my_struct_func;
 }
 
 void main(){
string a = test;
var t = MyStruct();
t.my_struct_func = () = {
print

Re: [Vala] GTK and Property problems

2010-06-27 Thread Nicolas

Hi Andrew,

It's a pleasure to help.
If you want some genie samples, go to http://code.valaide.org/ and into 
the search engine type: genie.


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


Re: [Vala] GTK and Property problems

2010-06-26 Thread Nicolas

Hi,

Why not simply using this:

[indent=4]

// Compile with

uses
Gtk
Gdk

class wMain : GLib.Object

prop main_window : MainWindow

init
var main_window = new MainWindow()
var main_viewport = new Viewport(null, null)

main_window.scrolled_window.add(main_viewport)
main_window.show_all()

main_window.location_entry.activate.connect(on_location_activate)

def on_show_menuitem_activate(show_menuitem:CheckMenuItem)
if show_menuitem.active
print Toggled
main_window.show()
else
print Not Toggled
main_window.hide()

def on_location_activate(location_entry:Gtk.Entry)
print connected



class MainWindow : Gtk.Window

scrolled_window : ScrolledWindow
toolbar : Toolbar
back_button : ToolButton
forward_button : ToolButton
location_entry : Entry

construct(type:Gtk.WindowType=Gtk.WindowType.TOPLEVEL)
GLib.Object(type:type)
this.set_default_size(900, 600)

init
this.delete_event.connect(on_mainwindow_delete_event)

// Toolbar creation
scrolled_window = new ScrolledWindow(null, null)
var vbox = new VBox(false, 0)
var toolbar_hbox = new HBox(true, 0)
toolbar = new Toolbar()
back_button = new ToolButton.from_stock(gtk-go-back)
forward_button = new ToolButton.from_stock(gtk-go-forward)
location_entry = new Entry()

//Toolbar Packing
toolbar.insert(back_button, -1)
toolbar.insert(forward_button, -1)
toolbar_hbox.pack_start(toolbar, false, true)
toolbar_hbox.pack_start(location_entry, false, true)
vbox.pack_start(toolbar_hbox, false, true)
vbox.pack_start(scrolled_window, true, true)
this.add(vbox)


def on_mainwindow_delete_event() : bool
this.hide()
return true


init
Gtk.init (ref args)
new wMain()
Gtk.main()

Sincerly,
Nicolas.


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


Re: [Vala] New params for [ModuleInit]

2010-06-10 Thread Nicolas Joseph
How ?! For this to work requires that the plugin registrar inherits from
TypeModule.

I quickly rewrote the example but it does not work:

$ valac --pkg=gmodule-2.0 --debug *.vala  ./main
 main.vala:10.1-10.41: warning: unable to chain up to private base
 constructor
 public class PluginRegistrar : TypeModule
 ^
 Compilation succeeded - 1 warning(s)

 (process:18546): GLib-GObject-CRITICAL **: g_object_newv: assertion
 `G_TYPE_IS_OBJECT (object_type)' failed
 Erreur de segmentation


And in a real application I have an error like:

g_type_plugin_* invalidly modified type


With the object creation.

2010/6/10 JM interfl...@gmx.net

 Hello Abderrahim
 Thanks for reply!
 I somehow got the error message in a wrong way, because I thought the
 [ModuleInit] annotation itself needed some extra info.
 Now it's working fine again.
 Sorry for the hassle.
 Regards
 Jörn



  Hi,
 
  2010/6/10, JM interfl...@gmx.net:
   Hello everybody
This valac commit shows that there has been some change with
[ModuleInit]:
  
 http://git.gnome.org/browse/vala/commit/?id=5fd7b8cebb983fccdebcd9329671d94c1e5cf826
  
The example on http://live.gnome.org/Vala/TypeModules is showing an
example exactly as I am using it in my application:
  
[ModuleInit]
public Type register_plugin (TypeModule module) {
   // types are registered automatically
   return typeof (MyPlugin);
}
  
Here, valac reports error: [ModuleInit] requires a parameter of type
 `GLib.TypeModule'
public Type init_module() {
 
  I'm not sure I understand your problem, in the example register_plugin
  takes a TypeModule as parameter but from what I see in the error
  message, your init_module doesn't take any parameter, and that's what
  valac is saying.
 
  
Can someone please tell me what the expected usage of
[ModuleInit] would be?
 
  a [ModuleInit] function is called by the application when a plugin is
  loaded. It should have at least a TypeModule argument so that the
  plugin types can be registered dinamically. (It generally returns the
  type of the main plugin class for the application to create an
  instance, but that's not mandatory : the application can find it out
  from e.g. the plugin description file if there is one).
 
  HTH,
  Abderrahim


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




-- 
Nicolas Joseph


module.tar.gz
Description: GNU Zip compressed data
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vala team PPA: missing vala 0.8.1

2010-05-16 Thread Nicolas Joseph
Package updated, thank's!

2010/5/13 Matteo gtla...@gmail.com:
 On Wed, May 12, 2010 at 2:19 AM, Nicolas Joseph
 gege2...@redaction-developpez.com wrote:
 Hi,

 Someone can create the package for the latest version of vala, please?

 --
 Nicolas Joseph

 vala 0.8.1 in the Ubuntu PPA would be much appreciated :)
 Thanks


 --
 Matteo Scotuzzi
 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list




-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Val(a)IDE 0.7.0 - IDE for Vala

2010-05-12 Thread Nicolas Joseph
Hello,

I am pleased to announce version 0.7.0 of Val(a)IDE.

The sources and the binary packages (archlinux, debian, fedora, ubuntu and
MS Windows) are available for download at:
  
http://www.valaide.org/content/downloadhttp://www.google.com/url?sa=Dq=http://www.valaide.org/content/downloadusg=AFQjCNH7wG-KYxYoR7vNP7pidLL9uiqyMg

Changes since 0.6.1
===

 * New dockable interface
 * Redesign start page
 * Open multiple projects
 * Hierarchical view for project files
 * New draw space preferences
 * Bugfixes

 * Plugins:
   * New advanced search plugins
   * Todo: show tasks of all opened documents
   * Todo: add author and priority
   * Opened documents: add menu entries

 * Translations:
   * New italian translation
   * New russian translation

What is Val(a)IDE
=

Val(a)IDE is an Integrated Development Environment (IDE) for the Vala
programming language.

Val(a)IDE is written in Vala and and offers the following features:
 * Syntax highlighting for Vala and Genie
 * Project manager (build/execute)
 * Support for external building systems (waf, make)
 * Plugins: advanced search, symbols browser, tasks manager, files browser,
autocompletion

For more information see:
http://www.valaide.org/http://www.google.com/url?sa=Dq=http://www.valaide.org/usg=AFQjCNHWIn15J0oLYhp5ZXP-nXXKvYdOHg

Thank's to everyone who helped me for this new version!
The Val(a)IDE team
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Val(a)IDE 0.7.0 - IDE for Vala

2010-05-12 Thread Nicolas Joseph
No, this version of waf can't detect a development version. This is fixed in
next versions.

Why you don't use vala 0.8.1?

2010/5/12 pancake panc...@youterm.com

 errr.. broken waf?

 [panc...@bitbox valide]$ ./waf configure
 Checking for program gcc,cc  : ok /usr/bin/gcc
 Checking for program cpp : ok /usr/bin/cpp
 Checking for program ar  : ok /usr/bin/ar
 Checking for program ranlib  : ok /usr/bin/ranlib
 Checking for program valac   : ok /usr/bin/valac
 Checking for gthread-2.0 : ok
 Checking for program version valac = 0.1.6 : not found
  error: valac version too old to be used with this tool
 [panc...@bitbox valide]$ valac
 No source file specified.
 [panc...@bitbox valide]$ valac --version
 Vala 0.8.0.124-67e2f




 On 05/12/10 09:00, Nicolas Joseph wrote:

 Hello,

 I am pleased to announce version 0.7.0 of Val(a)IDE.

 The sources and the binary packages (archlinux, debian, fedora, ubuntu and
 MS Windows) are available for download at:
   http://www.valaide.org/content/download
 http://www.google.com/url?sa=Dq=http://www.valaide.org/content/downloadusg=AFQjCNH7wG-KYxYoR7vNP7pidLL9uiqyMg
 


 Changes since 0.6.1
 ===

  * New dockable interface
  * Redesign start page
  * Open multiple projects
  * Hierarchical view for project files
  * New draw space preferences
  * Bugfixes

  * Plugins:
* New advanced search plugins
* Todo: show tasks of all opened documents
* Todo: add author and priority
* Opened documents: add menu entries

  * Translations:
* New italian translation
* New russian translation

 What is Val(a)IDE
 =

 Val(a)IDE is an Integrated Development Environment (IDE) for the Vala
 programming language.

 Val(a)IDE is written in Vala and and offers the following features:
  * Syntax highlighting for Vala and Genie
  * Project manager (build/execute)
  * Support for external building systems (waf, make)
  * Plugins: advanced search, symbols browser, tasks manager, files
 browser,
 autocompletion

 For more information see:
 http://www.valaide.org/
 http://www.google.com/url?sa=Dq=http://www.valaide.org/usg=AFQjCNHWIn15J0oLYhp5ZXP-nXXKvYdOHg
 


 Thank's to everyone who helped me for this new version!
 The Val(a)IDE team



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



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




-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Vala team PPA: missing vala 0.8.1

2010-05-11 Thread Nicolas Joseph
Hi,

Someone can create the package for the latest version of vala, please?

-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] requires and ensures on setters and getters

2010-05-05 Thread Nicolas HENRY
Hello,

I tried :

class Test:Object{
public int test{get;set requires(value  10);}
}

but it doesn't work.

Actually I use :

class Test:Object{

public void set_test2(int value) requires (value  10) {
this.test = value;
}

public int test{get; private set;}
}

Is there an other solution using requires ?

Thanks.

Nicolas HENRY
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [vapigen] How to replace the abstract by virtual

2010-04-30 Thread Nicolas Joseph
Thank's, few lines below I found the solution:

gtk_source_completion_provider_activate_proposal virtual=0



Work's fine (remove the abstract attribut).

2010/4/30 Abderrahim Kitouni a.kito...@gmail.com

 Hello,

 2010/4/27, Nicolas Joseph gege2...@redaction-developpez.com:
  Hello,
 
  I try to replace an abstract method by a virtual method with this
 metadata:
 
  gtk_source_completion_provider_activate_proposal abstract=0 virtual=1
  But this has no effect.
 The relevant code in vapigen/valagidlparser.vala says (around line 1620):

} else if (nv[0] == abstract) {
if (eval (nv[1]) == 1) {
m.is_abstract = true;
}
}
 i.e it only looks if abstract is set to 1, you can fix it and report a bug
 ;-)

 HTH,
 Abderrahim




-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [vapigen] How to replace the abstract by virtual

2010-04-27 Thread Nicolas Joseph
Hello,

I try to replace an abstract method by a virtual method with this metadata:

gtk_source_completion_provider_activate_proposal abstract=0 virtual=1


But this has no effect.
-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] GtkSourceCompletion segfault

2010-04-26 Thread Nicolas Joseph
Hello,

I test GtkSourceCompletion (include in GtkSourceView 2.10) and I rewrite in
vala this example:
http://git.gnome.org/browse/gtksourceview/tree/tests/test-completion.c?id=GTKSOURCEVIEW_2_10_0

I have a bug for add custom proposals (GtkSourceCompletionWords works fine
except a bug in the binding) as if they were freed, but I don't find problem
with valac.

The bug make a segfault:

*** glibc detected *** ./main: double free or corruption (fasttop):
0x023d5110 ***

Or warning:

Gtk-WARNING **: Failed to set text from markup due to error parsing markup:
Error on line 1 char 13: Invalid UTF-8 encoded text in name - not valid
'\xe0F\xd3\u0001'

Have you an idea?

-- 
Nicolas Joseph
class TestProvider : Gtk.SourceCompletionProvider, Object
{
  Gdk.Pixbuf icon;
  public string name;
  public int priority;
  ListGtk.SourceCompletionItem proposals;

  construct
  {
	  Gdk.Pixbuf icon = this.get_icon ();

this.proposals = new ListGtk.SourceCompletionItem ();
	  this.proposals.prepend (new Gtk.SourceCompletionItem (Proposal 3, Proposal 3, null, null));
	  this.proposals.prepend (new Gtk.SourceCompletionItem (Proposal 2, Proposal 2, null, null));
	  this.proposals.prepend (new Gtk.SourceCompletionItem (Proposal 1, Proposal 1, null, null));
  }

  public unowned string get_name ()
  {
	  return this.name;
  }

  public int get_priority ()
  {
	  return this.priority;
  }

  public bool match (Gtk.SourceCompletionContext context)
  {
	  return true;
  }

  public void populate (Gtk.SourceCompletionContext context)
  {
	  context.add_proposals (this, this.proposals, true);
  }

  public unowned Gdk.Pixbuf get_icon ()
  {
	  if (this.icon == null)
	  {
		  Gtk.IconTheme theme = Gtk.IconTheme.get_default ();
		  this.icon = theme.load_icon (Gtk.STOCK_DIALOG_INFO, 16, 0);
	  }
  	return this.icon;
  }

  public bool activate_proposal (Gtk.SourceCompletionProposal proposal,
 Gtk.TextIter iter)
  {
return true;
  }

  public Gtk.SourceCompletionActivation get_activation ()
  {
return Gtk.SourceCompletionActivation.INTERACTIVE |
	  Gtk.SourceCompletionActivation.USER_REQUESTED;
  }

  public unowned Gtk.Widget get_info_widget (Gtk.SourceCompletionProposal proposal)
  {
return null;
  }

  public int get_interactive_delay ()
  {
return -1;
  }

  public bool get_start_iter (Gtk.SourceCompletionContext context,
  Gtk.SourceCompletionProposal proposal,
  Gtk.TextIter iter)
  {
return false;
  }

  public void update_info (Gtk.SourceCompletionProposal proposal, 
   Gtk.SourceCompletionInfo info)
  {
  }
}

Gtk.SourceView view;
Gtk.SourceCompletion comp;

void destroy_cb (Gtk.Object object)
{
	Gtk.main_quit ();
}

void remember_toggled_cb (Gtk.ToggleButton button)
{
	comp.remember_info_visibility = button.get_active ();
}

void select_on_show_toggled_cb (Gtk.ToggleButton button)
{
	comp.select_on_show = button.get_active ();
}

void show_headers_toggled_cb (Gtk.ToggleButton button)
{
	comp.show_headers = button.get_active ();
}

void toggle_active_property (Object source,
 Object dest,
 string name)
{
	bool val;
	
	source.get (name, out val);
	dest.set (active, val);
}

void show_icons_toggled_cb (Gtk.ToggleButton button)
{
	comp.show_icons = button.get_active ();
}

Gtk.Window create_window ()
{
	Gtk.Window window;
	Gtk.VBox vbox;
	Gtk.HBox hbox;
	Gtk.CheckButton remember;
	Gtk.CheckButton select_on_show;
	Gtk.CheckButton show_headers;
	Gtk.CheckButton show_icons;
	Gtk.SourceCompletion completion;

	window = new Gtk.Window ();
	window.resize (600, 400);

	vbox = new Gtk.VBox (false, 1);
	hbox = new Gtk.HBox (false, 1);

	view = new Gtk.SourceView ();
	Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow (null, null);
	scroll.add (view);

	remember = new Gtk.CheckButton.with_label (Remember info visibility);
	select_on_show = new Gtk.CheckButton.with_label (Select first on show);
	show_headers = new Gtk.CheckButton.with_label (Show headers);
	show_icons = new Gtk.CheckButton.with_label (Show icons);

	completion = view.get_completion ();

	toggle_active_property (completion, remember, remember-info-visibility);
	toggle_active_property (completion, select_on_show, select-on-show);
	toggle_active_property (completion, show_headers, show-headers);
	toggle_active_property (completion, show_icons, show-icons);

	hbox.pack_start (remember, false, false, 0);
	hbox.pack_start (select_on_show, false, false, 0);
	hbox.pack_start (show_headers, false, false, 0);
	hbox.pack_start (show_icons, false, false, 0);
	
	vbox.pack_start (scroll, true, true, 0);
	vbox.pack_end (hbox, false, false, 0);
	
	window.add (vbox);
	
	window.destroy.connect (destroy_cb);
	remember.toggled.connect (remember_toggled_cb);
	select_on_show.toggled.connect (select_on_show_toggled_cb);
	show_headers.toggled.connect (show_headers_toggled_cb

Re: [Vala] GtkSourceCompletion segfault

2010-04-26 Thread Nicolas Joseph
2010/4/26 Jan Hudec b...@ucw.cz

 which clearly implies the caller is going to free the string, so it's
 owned.
 This can be confirmed by reading the documentation.


That works fine now!


 That seems like Gtk.SourceCompletionProvider binding is incorrect.
 I can't find a .vapi binding that class -- where does it come from?


It's in the gtksourceview-2.0 binding:
http://git.gnome.org/browse/vala/tree/vapi/gtksourceview-2.0.vapi#n415

I found some other errors, I'll propose a patch for fixed them.

Thank you very much!
-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] French tutorial

2010-04-24 Thread Nicolas Joseph
Bonjour,

http://nicolasj.developpez.com/gtk/vala/ Commence un peu a dater
http://wikivala.org/

J'ai commencé à traduire quelques tuto présent sur le wiki officiel mais
rien de finalisé actuellement.

2010/4/23 Cyrille Colin co...@univ-metz.fr

 Hi,
 i would be interesting to have a French tutorial for Vala langage and
 other stuff. Is there people interesting in a collaborative work ?
 Cyrille.

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




-- 
Nicolas Joseph
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Maintainer for the gtksourceview-2.0 binding

2010-04-06 Thread Nicolas Joseph
Hello,

There is no maintainer for the gtksourceview-2.0 binding on this page:
http://live.gnome.org/Vala/BindingsStatus

Someone cares? The new release (2.10) included a great new feature for my
project, I can handle myself.
-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] A problem in writing some ValaIde plugin..

2010-03-31 Thread Nicolas Joseph
Hello,

I have added, in trunk, the support for specific compilation configuration
for plugins.

Try the attached sample plugin, I don't have problem.

2010/3/29 Arkadi Viner arkash...@gmail.com

 Hello,
 I'm trying to write a simple plugin for ValaIde, which is called
 'Terminal',
 which should display a terminal window (or maybe there will be an option to
 open more then one..) inside the IDE (like in geany IDE for example..).
 I took most of the code from the TODO plugin and changed it for my needs.
 My
 problem is when I try to create a Terminal widget using -
 this.terminal = new Terminal();
 , it compiles fine but *when I try to run ValaIde it doesn't start and I
 get
 this message:*
 *ark...@arkadi-laptop:~/Projects/valide$ valide
 valide: symbol lookup error:
 /usr/local/lib/valide/plugins/terminal/libterminal.so: undefined symbol:
 vte_terminal_new   *

 *My plugin's code:*

 using Valide;
 using Vte;

 public class Valide_Terminal : Plugin, Object
 {
  private Gtk.ScrolledWindow scrolled_window;

  Terminal terminal; //with this line only it compiles and run fine

  public string path { get; construct set; }

  public Window window { get; construct set; }

  private bool only_load_active_tab
  {
get
{
  return this.window.config_manager.get_boolean (Todo,
 only-load-active-tab);
}
set
{
  this.window.config_manager.set_boolean (Todo,
 only-load-active-tab, value);
}
  }

  construct
  {
this.scrolled_window = new Gtk.ScrolledWindow (null, null);

this.scrolled_window.set_policy (Gtk.PolicyType.AUTOMATIC,
 Gtk.PolicyType.AUTOMATIC);

this.terminal = new Terminal(); //with this line it compiles fine but
 doesn't run...

try
{
  Utils.register_icon (Path.build_filename (Config.PIXMAPS_DIR,
 plugins,
terminal.png),
 terminal-plugin-icon);
}
catch (Error e)
{
  debug (e.message);
}
this.window.add_widget (this.scrolled_window, terminal-plugin,
 _(Terminal),
Window.Placement.BOTTOM,
 terminal-plugin-icon);
  }

  ~Todo ()
  {
this.window.remove_widget (this.scrolled_window);
  }

public Gtk.Widget create_configure_dialog ()
{
  Gtk.VBox vbox;
  Gtk.CheckButton check;

  vbox = new Gtk.VBox (true, 0);

  check = new Gtk.CheckButton.with_label (_(Only load symbols for
 active tab));
  check.set_active (this.only_load_active_tab);
  check.toggled.connect ((s) = {
this.only_load_active_tab = s.get_active ();
  });
  vbox.pack_start (check, true, true, 0);

  return vbox;
  }
 }

 [ModuleInit]
 public Type register_plugin ()
 {
  return typeof (Valide_Terminal);
 }

 public Gtk.Widget create_configure_dialog (Valide_Terminal self)
 {
  return self.create_configure_dialog ();
 }

 Please help..

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




-- 
Nicolas Joseph


terminal.tar.gz
Description: GNU Zip compressed data
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Vala 0.7.10.262 pre-release

2010-03-31 Thread Nicolas Joseph
?

2010/3/31 jp0...@jippii.fi

 Hi,

 Please, apply the patch in

 https://bugzilla.gnome.org/show_bug.cgi?id=613943

 Regards,
 JP


  A new Vala version will be released shortly. To make sure that we have
 not introduced serious regressions, we'd like to invite everyone to test
 the following pre-release and report any regressions or other
 release-critical issues.

 http://www.vala-project.org/downloads/vala-0.7.10.262-39688.tar.bz2

 There have been many fixes and also quite a few enhancements since
 0.7.10. The complete list of changes is available in the ChangeLog and a
 summary will follow with the announcement of the final release.

 Thanks,
 Jürg

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



 --


 __
 Saunalahdelta mullistava uutuus Nokia N97 ja kaiken kattava TotaaliMAX nyt
 ennakkomyynnissä uskomattoman edullisesti! Paketissa puhelut ja viestit
 (3000 min/kpl/kk), huippunopea mobiililaajakaista sekä Nokia N97 yhdellä
 kk-maksulla vain 59,95 e/kk (24 kk sopimus).
 Katso http://saunalahti.fi/totaalimax


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




-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] A problem in writing some ValaIde plugin..

2010-03-30 Thread Nicolas Joseph
2010/3/30 Arkadi Viner arkash...@gmail.com

 (by the way the compiler doesn't recognize throws PluginError so I
 removed it for now... )


Which way? Simply copy the terminal directory in the plugins directory and
execute:

$ ./waf configure
$ ./waf
# ./waf install

-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Can't compile ValaIde from source...

2010-03-13 Thread Nicolas Joseph
Hi,

 Looks like you are missing libunique-dev, try typing this in a terminal

libunique is optional.

  'configure' finished successfully (0.213s)

You don't have a problem here.

2010/3/12 Andrés G. Aragoneses kno...@gmail.com:

 I think the msg is pretty clear, download libunique-devel :)

        Andrés

 El 12/03/10 17:24, Arkadi Viner escribió:
 When I try to compile ValaIDE from source, It writes me:
 ark...@arkadi-laptop:~/Projects/valide-0.6.1$ ./waf configure
 Checking for program gcc                 : ok /usr/bin/gcc
 Checking for program cpp                 : ok /usr/bin/cpp
 Checking for program ar                  : ok /usr/bin/ar
 Checking for program ranlib              : ok /usr/bin/ranlib
 Checking for program valac               : ok /usr/bin/valac
 Checking for gthread-2.0                 : ok
 Checking for program version valac = 0.1.6 : ok 0.7.10
 Checking for program msgfmt                 : ok /usr/bin/msgfmt
 Checking for program intltool-merge         : ok /usr/bin/intltool-merge
 Checking for header locale.h                : ok
 Checking for program valadoc                : not found
 Checking for glib-2.0 = 2.16.0             : ok
 Checking for gio-2.0 = 2.16.0              : ok
 Checking for gobject-2.0 = 2.16.0          : ok
 Checking for gmodule-2.0 = 2.16.0          : ok
 Checking for gtk+-2.0 = 2.16.0             : ok
 Checking for libxml-2.0 = 2.5.0            : ok
 Checking for gtksourceview-2.0 = 2.0.0     : ok
 Checking for vala-1.0 = 0.7.8              : ok
 Checking for unique-1.0 = 1.0.0            : fail
 'configure' finished successfully (0.213s)

 What could be wrong ??
 By the way, I'm using Ubuntu 9.10 64 bit.
 Please help..




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


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




-- 
Nicolas Joseph

Responsable de la rubrique GTK+ de developpez.com /
In charge of the GTK+ section on developpez.com

http://nicolasj.developpez.com
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Fwd: Can't compile ValaIde from source...

2010-03-13 Thread Nicolas Joseph
This problem appeared with vala 0.7.10 and it's fixed in the svn version.

2010/3/13 Arkadi Viner arkash...@gmail.com:
 I call ./waf and I get:

 libvalide/start-page.vala:57.3-57.11: error: class already contains a
 constructor
 libvalide/abstract-text-document.vala:176.15-176.27: error: only automatic
 properties can have default values
 Waf: Leaving directory `/home/arkadi/Projects/valide-0.6.1/_build_'
 Build failed
  - task failed (err #1):
    {task: valac_task utils.vala,encoding.vala 

 Help...

 The full log is here:
 http://pastebin.com/embed_js.php?i=3CHDChw9



 On Sat, Mar 13, 2010 at 1:31 PM, Jan Hudec b...@ucw.cz wrote:

 On Fri, Mar 12, 2010 at 18:24:37 +0200, Arkadi Viner wrote:
  When I try to compile ValaIDE from source, It writes me:
  ark...@arkadi-laptop:~/Projects/valide-0.6.1$ ./waf configure
  Checking for program gcc                 : ok /usr/bin/gcc
  Checking for program cpp                 : ok /usr/bin/cpp
  Checking for program ar                  : ok /usr/bin/ar
  Checking for program ranlib              : ok /usr/bin/ranlib
  Checking for program valac               : ok /usr/bin/valac
  Checking for gthread-2.0                 : ok
  Checking for program version valac = 0.1.6 : ok 0.7.10
  Checking for program msgfmt                 : ok /usr/bin/msgfmt
  Checking for program intltool-merge         : ok /usr/bin/intltool-merge
  Checking for header locale.h                : ok
  Checking for program valadoc                : not found
  Checking for glib-2.0 = 2.16.0             : ok
  Checking for gio-2.0 = 2.16.0              : ok
  Checking for gobject-2.0 = 2.16.0          : ok
  Checking for gmodule-2.0 = 2.16.0          : ok
  Checking for gtk+-2.0 = 2.16.0             : ok
  Checking for libxml-2.0 = 2.5.0            : ok
  Checking for gtksourceview-2.0 = 2.0.0     : ok
  Checking for vala-1.0 = 0.7.8              : ok
  Checking for unique-1.0 = 1.0.0            : fail
  'configure' finished successfully (0.213s)
 
  What could be wrong ??

 Nothing. Call ./waf, too.

 --
                                                 Jan 'Bulb' Hudec 
 b...@ucw.cz


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





--
Nicolas Joseph



-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Can't compile ValaIde from source...

2010-03-13 Thread Nicolas Joseph
2010/3/13 Arkadi Viner arkash...@gmail.com:
 I don't have a package named Install gl-devel in Ubuntu's repositories, but
 I have downloaded the gdl source, compiled, and installed it. I have managed
 to successfully run ./configure but again I can't compile ValaIde:


The package name is libgdl-1-dev: http://packages.ubuntu.com/karmic/libgdl-1-dev

 .
 pi _build_/default/plugins/waf/waf.deps
 _build_/default/plugins/waf/waf-builder.c _build_/default/plugins/waf/waf.h
 _build_/default/plugins/waf/waf.vapi _build_/default/plugins/waf/waf.deps
 [ 78/168] copy: data/valide.desktop.in -
 _build_/default/data/valide.desktop
 [ 79/168] po: po/es.po - _build_/default/po/es.mo
 [ 80/168] po: po/fr.po - _build_/default/po/fr.mo
 [ 81/168] po: po/it.po - _build_/default/po/it.mo
 ../po/it.po:1:2: syntax error
 /usr/bin/msgfmt: found 1 fatal error
 Waf: Leaving directory `/home/arkadi/Projects/valide/_build_'
 Build failed
  - task failed (err #1):
    {task: po it.po - it.mo}

 Help


Syntax error fixed, update sources.

-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] bug in array construction?

2010-01-14 Thread Nicolas

Hi Denis,
use this:

row : array of string

Regards,
Nicolas.


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


[Vala] Vapi generation problem

2009-12-18 Thread Nicolas

Hello,

I try to use a non glib-library, and i have a problem generating the 
vapi file.


On my header i have:
typedef struct my_instance my_instance;

In my vapi file, i wrote:
public struct my_instance {}

When i use this structure (test_instance), vala generate this:
my_instance test_instance;

But i need this:
my_instance *test_instance;

There is a way to say to vala to generate the second one ?
Thanks in advance,
Nicolas.


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


[Vala] Vapi generation problem

2009-12-17 Thread Nicolas

Hello,

I try to use a non glib-library, and i have a problem generating the 
vapi file.


On my header i have:
typedef struct my_instance my_instance;

In my vapi file, i wrote:
public struct my_instance {}

When i use this structure (test_instance), vala generate this:
my_instance test_instance;

But i need this:
my_instance *test_instance;

There is a way to say to vala to generate the second one ?
Thanks in advance,
Nicolas.


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


[Vala] Simple question about gchar

2009-12-15 Thread Nicolas

Hello,

If someone can explain me if it's possible to create this on vala:

gchar *options[] = {somethings, NULL};

it could be great,

Thanks in advance,
Nicolas.


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


Re: [Vala] Simple question about gchar

2009-12-15 Thread Nicolas

Than you Julian,

In fact i already do this, but gcc say:

warning: passing argument 1 from incompatible pointer type.

so i had a doubt if i'm not mistaken even if my program work.

Regards,
Nicolas.


string?[] options = {somethings, null};



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


[Vala] [Genie] Bug in Genie ?

2009-12-13 Thread Nicolas

Hello,

When i build this piece of code, i have this message:

testbug.gs:9.65-9.65: error: syntax error, expected `)' but got `:' with 
previous identifier

   def test (mystring : string, files : SList of string, myint : int)

Is it a bug in the genie parser ?
I don't know if the problem appear with vala.

Code:

[indent=4]

class TestGenieBug : Object

   init
   print test if it's a bug

   /* NOT WORKING */
   def test (mystring : string, files : SList of string, myint : int)
   print hello

   /* WORKING */
   def test2 (mystring : string, myint : int, files : SList of string)
   print hello


init
   var bugtest = new TestGenieBug()


Regards,
Nicolas.


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


[Vala] Libgee problem

2009-12-09 Thread Nicolas

Hello,

I need to use libgee with double.

The problem is, :
var map = new HashMap double, double ();

Return this error:
error: `double' is not a supported generic type argument, use `?' to box 
value types


Why libgee does not support double with hashmap?

Best regards,
Nicolas.


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


Re: [Vala] Libgee problem

2009-12-09 Thread Nicolas

Hi Abderrahim,

Yes i tried with a ?, it build but i got a segmentation fault !
I'll try to find another solution.

Thanks,
Nicolas.

Because vala doesn't support double in generics (the error you got).
Not sure if it would help, but did you try its suggestion to use
'double?' instead?

This is an implementation detail but int is easier because of
G_[U]INT_{TO,FROM}_POINTER which can be used to convert from int to
pointer and back. (and no such thing exist for floats).

anyway, since double is a value type, double? it may work.

HTH,
Abderrahim



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


Re: [Vala] Libgee problem

2009-12-09 Thread Nicolas

Gdb:

Program received signal SIGSEGV, Segmentation fault.
0x08048b75 in _main (args=0xbfbfe978, args_length1=1) at testlist.vala:14
14stdout.printf (map[key].to_string());

Vala code:

using Gee;

static int main (string[] args) {

   var map = new HashMapdouble?, double? ();
   map.set (0.0, 0.0);
   map.set (1.0, 1.0);
   map.set (2.0, 2.0);
   map.set (9.0, 6.0);
   map.set (3.0, 3.0);
   map[4.0] = 4.0;
   map[5.0] = 5.0;
   foreach (double key in map.keys) {
   stdout.printf (map[key].to_string());
   }

   return 0;
}


Nicolas.


Could you post the code that segfaults? That's probably a bug in Vala.



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


Re: [Vala] Libgee problem

2009-12-09 Thread Nicolas

Alessandro,
I'm developping a chart library, i really need double for value.
But i found the solution, i'm using a simple array of double.

Jiří,
Thank you, i'm learning programming, so sorry for the crap ! ;-)

Nicolas.


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


Re: [Vala] Libgee problem

2009-12-09 Thread Nicolas

In fact, i'm using genie, because i love the syntax.
I making all the available examples in 
http://code.valaide.org/category/tags/genie


But the problem i encountering here, i can encounter it with other 
languages, because i don't know about the programming techniques.


Thanks again for your solution,
Nicolas.


In case you are just learning programming (generally speaking), you
should probably consider starting with some more mature language. There
is still a lot of rough edges you can run into with Vala. :)



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


[Vala] bug in new signal connect syntax

2009-12-07 Thread Nicolas

Hi Jörn,

Why not using this function:

private void on_row_activated(TreeView sender, TreePath treepath, 
TreeViewColumn column)


Regards,
Nicolas.


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


Re: [Vala] Vala Code Samples

2009-11-26 Thread Nicolas Joseph

Hello,

On Thu, 26 Nov 2009 15:40:12 +0300, Emad Al-Bloushi al3om...@live.com
wrote:
 Peace be upon you all ,
 
 Regarding to Vala Code Sample I would like to thank you for your great
 valuable job and I have a list of suggestions to facilitate testing and
 increase ease of development as described  below :
 
 Clean all available samples from deprecated syntax and deprecated GNOME
 libraries.Increase samples categories (Glib , GIO , Mysql ... etc) with
 their subcategories (GLib.Environment , GLib.Math , GLib.Shell ... etc).
 Allow developers in Vala list to post you their well tested samples.
 I think we can make testing and developing mechanism much better and
 easier to the current developers and newbie developers
 

Have you visited http://code.valaide.org/ ?

-- 
Nicolas Joseph

http://www.valaide.org
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Genie] Clutter sample problem

2009-11-12 Thread Nicolas

Hi,

I try to port the clutter sample from vala 
(http://mail.gnome.org/archives/vala-list/2009-November/msg00057.html) 
to genie and, of course, i have a problem:


When i load the program, i have this message:
(/usr/home/niko/Desktop/cluttertest:82339): Clutter-CRITICAL **: 
clutter_color_from_string: assertion `str != NULL' failed


And after the rectangles move, the program crash with:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 36301140 (LWP 100199)]
0x080498d5 in _lambda0_ (s=0x36352e80, _data1_=0x3634a9c0) at 
cluttertest.gs:44

44text.x = stage.width / 2

This is the code:

[indent=4]

uses
   Clutter

class ClutterDemo

   stage : Stage
   rectangles : array of Rectangle
   const colors : array of string = { blanched almond, OldLace, 
MistyRose, White, LavenderBlush, CornflowerBlue, chartreuse, 
chocolate, light coral, medium violet red, LemonChiffon2, 
RosyBrown3 }


   construct ()
   stage = Stage.get_default ()
   rectangles = new array of Rectangle[colors.length] /* probably 
the source of the first message */

   stage.hide.connect (Clutter.main_quit)
   create_rectangles ()
   stage.color = Clutter.Color () { alpha = 255 }
   stage.show_all ()

   def private create_rectangles ()
   i : int = 0
   while i  colors.length
   i++
   var r = new Rectangle
   r.width = r.height = stage.height / colors.length
   r.color = Color.from_string (colors[i])
   r.anchor_gravity = Gravity.CENTER
   r.y = i * r.height + r.height / 2
   stage.add_actor (r)
   rectangles[i] = r

   def start ()
   var animations = new array of Animation[rectangles.length]
   i : int = 0
   j : int = 0
   while i  rectangles.length
   i++
   animations[i] = rectangles[i].animate (AnimationMode.LINEAR, 
5000, x, stage.width / 2, rotation-angle-z, 500.0)

   animations[i].timeline.start ()

   animations[animations.length - 1].timeline.completed += def (s)
   var text = new Text.full (Bitstream Vera Sans 40, 
Congratulations!, Color.from_string (white))

   text.set_anchor_point_from_gravity (Gravity.CENTER)
   text.x = stage.width / 2 /* Crash here !! */
   text.y = -text.height
   stage.add_actor (text)
   text.show ()
   var text_anim = text.animate (AnimationMode.EASE_OUT_BOUNCE, 
3000, y, stage.height / 2)

   text_anim.timeline.start ()

   while j  rectangles.length
   j++
   animations[i] = rectangles[i].animate 
(AnimationMode.EASE_OUT_BOUNCE, 3000, x, Random.next_double () * 
stage.width, y, Random.next_double () * stage.height / 2 + 
stage.height / 2, rotation-angle-z, rectangles[i].rotation_angle_z, 
opacity, 0.0)

   animations[i].timeline.start ()

init
   Clutter.init (ref args)
   var demo = new ClutterDemo ()
   demo.start ()
   Clutter.main ()

Someone know what i have this problem ?
Thanks,
Nicolas.


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


Re: [Vala] [Genie] Clutter sample problem

2009-11-12 Thread Nicolas

Ok i found the solution, if someone interested :

[indent=4]

uses
   Clutter

class ClutterDemo

   animations : array of Animation
   stage : Stage
   rectangles : array of Rectangle
   const colors : array of string = { blanched almond, OldLace, 
MistyRose, White, LavenderBlush, CornflowerBlue, chartreuse, 
chocolate, light coral, medium violet red, LemonChiffon2, 
RosyBrown3 }


   construct ()
   stage = Stage.get_default ()
   rectangles = new array of Rectangle[colors.length]
   stage.hide.connect (Clutter.main_quit)
   create_rectangles ()
   stage.color = Clutter.Color () { alpha = 255 }
   stage.show_all ()

   def private create_rectangles ()
   i : int = 0
   while i  colors.length
   var r = new Rectangle
   r.width = r.height = stage.height / colors.length
   r.color = Color.from_string (colors[i])
   r.anchor_gravity = Gravity.CENTER
   r.y = i * r.height + r.height / 2
   stage.add_actor (r)
   rectangles[i] = r
   i++

   def start ()
   animations = new array of Animation[rectangles.length]
   i : int = 0
   while i  rectangles.length
   animations[i] = rectangles[i].animate (AnimationMode.LINEAR, 
5000, x, stage.width / 2, rotation-angle-z, 500.0)

   animations[i].timeline.start ()
   i++

   animations[animations.length - 
1].timeline.completed.connect(animate_with_text)


   def animate_with_text ()
   j : int = 0
   var mytext = new Text.full (Bitstream Vera Sans 25, Clutter 
say hello to Genie !, Color.from_string (white))

   mytext.set_anchor_point_from_gravity (Gravity.CENTER)
   mytext.x = stage.width / 2
   mytext.y = -mytext.height
   stage.add_actor (mytext)
   mytext.show ()
   var text_anim = mytext.animate (AnimationMode.EASE_OUT_BOUNCE, 
3000, y, stage.height / 2)

   text_anim.timeline.start ()

   while j  rectangles.length
   animations[j] = rectangles[j].animate 
(AnimationMode.EASE_OUT_BOUNCE, 3000, x, Random.next_double () * 
stage.width, y, Random.next_double () * stage.height / 2 + 
stage.height / 2, rotation-angle-z, rectangles[j].rotation_angle_z, 
opacity, 0.0)

   animations[j].timeline.start ()
   j++

init
   Clutter.init (ref args)
   var demo = new ClutterDemo ()
   demo.start ()
   Clutter.main ()

Nicolas.


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


Re: [Vala] Question about signal connection

2009-11-07 Thread Nicolas

Hi Joan,

Try this:

Signal.connect(monitor, changed, (GLib.Callback)handler2, monitor);

Nicolas.


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


Re: [Vala] [Genie] Using MarkupParser

2009-10-27 Thread Nicolas

Hi Patrick,

You can use the example from Caleb72:

[indent=3]
uses
  Xml

class JWMReader : Object
  path : string

  init
 Parser.init()

  final
 Parser.cleanup()

  def run()
 var doc = Parser.parse_file(path)
 var node = doc-get_root_element()
 parse_node(node)

  def set_source(pathname : string)
 path = pathname

  def private parse_node(node : Xml.Node*)
 if node is null
return
 case node-type
when ElementType.ELEMENT_NODE
   print NODE: %s, node-name
   if node-properties is not null
  get_attributes(node, node-properties)
   if node-children is null
  node = node-next
   else
  node = node-children
when ElementType.TEXT_NODE
   if not (node-content.strip() is )
  print TEXT: %s, node-content.strip()
   if node-next is null
  node = node-parent-next
   else
  node = node-next
when ElementType.COMMENT_NODE
   node = node-next
default
   print(DO NOT RECOGNISE NODE!)
   return   
 parse_node(node)


  def private get_attributes(node : Xml.Node*, properties : Xml.Attr*)
 if properties is null
return
 print ATTR: %s VALUE: %s, properties-name, 
node-get_prop(properties-name)

 properties = properties-next
 get_attributes(node, properties)

init
  var reader = new JWMReader()
  reader.set_source(/root/.jwmrc-tray)
  reader.run()

See you,
Nicolas.


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


Re: [Vala] [Genie] Using MarkupParser

2009-10-27 Thread Nicolas

Hey Patrick,

I'm not alone going on all interesting forums !

I can't really help you because i'm learning programmation like you.

I see on the libxml2 example page a function to clean the Xml.Doc:

xmlFreeDoc(yourdoc)

But vala has on its libxml2.vapi, this:

[CCode (cname = xmlDoc, free_function = xmlFreeDoc, cheader_filename 
= libxml/tree.h,libxml/parser.h)]
probably the free_function is for cleaning automatically the doc when 
vala generate c source file ?!?!


For the node, i don't know, for example this:
http://xmlsoft.org/examples/tree1.c
use a node, and i don't see a cleanup function.

Nicolas.


Thanks Nicholas - actually I am Caleb72.

That small piece of code was the result of about a day's work trying 
to understand that library - looking both at the Vala documentation 
and the original C library reference material. Then it was down to 
trial and error.


By the way - do you think the concerns I raised on the Puppy forum are 
correct regarding this code? I'm not actually doing anything to 
cleanup the Xml.Doc*, Xml.Node* and Xml.Attr* pointers I create and my 
reading of Parser.cleanup() was that everything is not necessarily 
destroyed. Genie has delete which I could use - not sure if I should 
be using something defined in the libxml library though.


My understanding of Genie thus far is that when you specifically 
define pointers as I have in this case, you take the responsibility 
for management of the memory, the reference counter isn't applicable.


Regards
Patrick




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


[Vala] [Genie] Convert string to uchar[]

2009-10-12 Thread Nicolas

Hi,

I need to convert string to array of uchar in genie.
I know under vala it's (uchar[]) testing where testing is the string, 
so how can i do this under genie ?


Thanks in advance for your response,
Nicolas.


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


Re: [Vala] [Genie] Convert string to uchar[]

2009-10-12 Thread Nicolas

Thanks, but already tested and this:

data_string : string
testing : array of uchar
testing = (array of uchar) data_string

Return:

error: syntax error, expected identifier
testing = (array of uchar) data_string
   ^

Another idea ?
Nicolas.


try 


(array of uchar) testing
  



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


Re: [Vala] [Genie] Convert string to uchar[]

2009-10-12 Thread Nicolas
Thanks Jürg, but if i've got my string as char[], i need to convert it 
to uchar[], so same problem no ?


Nicolas.


There is a string.to_utf8 method that returns a copy of the string as
char[].

Jürg



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


Re: [Vala] [Genie] Convert string to uchar[]

2009-10-12 Thread Nicolas

Thank you Jamie for your response.

I really need to use this , so i hope you find a solution quickly so 
that I can continue developing my program.


If I can help, please don't hesitate to ask,
Thank you again,
Nicolas.


looks like a bug - I will try and get a fix soon

jamie



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


Re: [Vala] [Genie] Convert string to uchar[]

2009-10-12 Thread Nicolas

Thank you so much Jamie, that build !

Nicolas.

I have just committed fix in master - if it does not work pls let me
know

jamie



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


Re: [Vala] Problem with Gee

2009-10-05 Thread Nicolas

Hi Didier,

Thanks for your response,
I'm learning programming, so don't hesitate to contact me in french, i 
must understand than english.


So, if i use Mapstring, int map = new TreeMapstring,int (); 
instead of var map = new HashMapstring, int (); the result is the same !


The only solution i found is using this (in genie):

list.add(value)
dict.set(value, something)

for o in list
   type = dict[o]
   print key is  + o
   print value is  + type

Nicolas.


Hi Nicolas,

HashMap do not maintain order for its keys. In contradiction to that, TreeMap is
a map that naturally maintains ordering of its entries, by using the supplied
comparison function, of the standard comparison function for the key type.

Thus you could do:
Mapstring, int map = new TreeMapstring,int ();

On that map, you can do insertion of the entries in any order, the resulting
entries will always be sorted by its keys.

I hope this is what you wanted.

Best regards, Didier.

  



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


[Vala] Problem with Gee

2009-10-04 Thread Nicolas

Hi,

I'm trying to use the Gee library, but i have a problem;
This is the code taken from the vala site:

using Gee;

static int main (string[] args) {

   var map = new HashMapstring, int ();
   map.set (one, 1);
   map.set (two, 2);
   map.set (three, 3);
   map[four] = 4;// same as map.set (four, 4)
   map[five] = 5;
   foreach (string key in map.keys) {
   stdout.printf (%d\n, map[key]);   // same as map.get (key)
   }

   return 0;
}

My question is, why when i execute this, the result is:
4
3
1
2
5

And not:
1
2
3
4
5

Thanks in advance for your response.
Nicolas.


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


Re: [Vala] Problem with Gee

2009-10-04 Thread Nicolas

thats typical for all hash tables. A good hash function will randomly
distribute the keys in the table and so will almost never be in the
order you add them
If you want order, use a list but not a dict or a hash

the hashmap is not sorted. I suggest you read the wikipedia article on
hashmaps and it should be obvious why.


Thanks everyone for your response, i'm using a list and get the value 
in order in the dict !

Nicolas.


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


Re: [Vala] Forum for Vala/Genie

2009-10-01 Thread Nicolas Joseph

Hi,

On Thu, 1 Oct 2009 09:57:12 +0200, Arkadi Viner arkash...@gmail.com
wrote:
 I agree with Xaviar,
 Vala's community will grow and the mailing list will become really
 annoying...
 I think we should have a forum too...
 

I'm also agree!

If you are interested, I can host the forum on my server[1].

[1] It's a personnal server, it already host the valaide.org domain.
If you have a better domain name, we can point a forum subdomain on my
server, by default I donate http://forum.valaide.org for the community:
free and without ads!

-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [PATCH] Vala binding for Graphviz library

2009-09-29 Thread Nicolas

Hi Martin,

I found on the 'valadoc' project the vapi for the graphviz library.
Download the project here:

git clone git://git.gnome.org/valadoc

See you,
Nicolas.


Here is a Vala binding for the graphviz library. Hopefully it can be included in
Vala GIT so that others can benefit from it as well. If anyone wants to try it 
out
there is small code sample included as a comment at the top of the .vapi file.





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


[Vala] Problem with switch statment

2009-09-27 Thread Nicolas

Hi,

I have a problem convert function from vala to genie, this is the code:

Vala code:
  
   switch (eb.button) {

   case 1:
   blah blah blah
   case 2:
   blah blah blah
   case 3:
   blah blah blah
}


My genie code:

   case eb.button
   when 1
   blah blah blah
   when 2
   blah blah blah
   when 3
   blah blah blah

The problem is, when i compile, i have this message:

treeview.gs:132.9-143.13: warning: unreachable code detected
treeview.gs:132.9-146.13: warning: unreachable code detected

And my real function (not blah blah blah) does not work, what's wrong ?
Does genie support the switch like vala ?

Thanks in advance,
Nicolas.


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


Re: [Vala] Problem with switch statment

2009-09-27 Thread Nicolas

Hi Jamie,
Thanks for your response.
My function work but i have this message when building:

treeview.gs:143.9-158.13: warning: unreachable code detected
Compilation succeeded - 1 warning(s)

This is the code:

   case eb.button
   when 1
   if(selection.count_selected_rows()=1)
   return false
   else
   if selection.path_is_selected(path)
   if (((eb.state  Gdk.ModifierType.SHIFT_MASK) == 
Gdk.ModifierType.SHIFT_MASK) and((eb.state  
Gdk.ModifierType.CONTROL_MASK) == Gdk.ModifierType.CONTROL_MASK))

   selection.unselect_path(path)
   else if(!(((eb.state  
Gdk.ModifierType.SHIFT_MASK) == Gdk.ModifierType.SHIFT_MASK) and 
((eb.state  Gdk.ModifierType.CONTROL_MASK) == 
Gdk.ModifierType.CONTROL_MASK)))

   return true
   return true
  return false
   when 2
   print(button 2 clicked\n)
   break
   when 3
   if (((eb.state  Gdk.ModifierType.SHIFT_MASK) == 
Gdk.ModifierType.SHIFT_MASK) and((eb.state  
Gdk.ModifierType.CONTROL_MASK) == Gdk.ModifierType.CONTROL_MASK))

   return false
   else
   selectioncount : int
   selectioncount = selection.count_selected_rows()
   if (selectioncount=1)
   selection.unselect_all()
   selection.select_path(path)
if use_popup_menu is true
show_treeview_popup(eb.time)
return true
   if(!(selection.count_selected_rows()0))
   selection.select_path(path)
   return false

The warning message come from the first line in when 3, but it work 
correctly.

Do you know if the problem come from my code or the genie parser ?
Because the same code in vala does not return any warnings.

Another question i need to use a GLib.List, i know under vala, it's:

GLib.ListTreePath mylist;

But how to use it with genie ?

Thanks in advance for your response,
Nicolas.

it works the same as vala except you dont need a break statement 

EG 


in vala :
switch (eb.button) {
case 1:
do_something ();
break;
case 2:
do_something ();
break;
case 3:
do_something ();
break;
}

is same as Genie

case eb.button
when 1
do_something ();
when 2
do_something ();
when 3
do_something ();



if you want to combine options just use comma

case eb.button
   when 1,2,3
do_something ();

this is same as vala

 switch (eb.button) { 
	case 1:

case 2:
case 3:
do_something ();
break;
}

please use latest vala master and send me code file if problem persists

jamie



  



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


Re: [Vala] ListStore and SQLite

2009-09-26 Thread Nicolas

You mean, like libgda[1]? I don't think there are vala bindings for it
already, but it shouldn't be too difficult to do since it's a gobject
based library.



Hi,

For libgda, take a look at: 
https://bugzilla.gnome.org/show_bug.cgi?id=570372


Nicolas.


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


[Vala] ListStore and SQLite

2009-09-21 Thread Nicolas

Hi,
I made a simple program to fill a liststore with a sqlite db (name, age, 
sex).
But, i have a problem, someone knows how to save in the db when user 
change a cell ?


Thanks in adavance,
Nicolas.

This is my code:

using Gtk;
using Sqlite;

   public TreeView treeview;
   public ListStore liststore;

   public TreeViewColumn column1;
   public TreeViewColumn column2;
   public TreeViewColumn column3;

 private enum Col
 {
   NAME,
   AGE,
   SEX,
   NB
 }


 private void on_column1_edit (string path, string new_text)
 {
   Gtk.TreeIter iter;
   liststore.get_iter_from_string (out iter, path);
   liststore.set (iter, 0, new_text);
 }

 private void on_column2_edit (string path, string new_text)
 {
   Gtk.TreeIter iter;
   liststore.get_iter_from_string (out iter, path);
   liststore.set (iter, 1, new_text);
 }

 private void on_column3_edit (string path, string new_text)
 {
   Gtk.TreeIter iter;
   liststore.get_iter_from_string (out iter, path);
   liststore.set (iter, 2, new_text);
 }


   protected void row_select (Gtk.TreeView sender, Gtk.TreePath path, 
Gtk.TreeViewColumn column)

   {
   Gtk.TreeIter iterDead;
  
   Gtk.TreeModel? treeModel = sender.get_model();

   treeModel.get_iter (out iterDead, path);
  
   liststore.remove (iterDead);

   }

   private static int populate_column (int n_columns, string[] values, 
string[] column_names)

   {
   TreeIter ti;
   liststore.append (out ti);
   liststore.set(ti, Col.NAME, values[0], Col.AGE, values[1], 
Col.SEX, values[2], -1);

   return 0;
   }


 public static int main (string[] args)
 {   
   Gtk.init (ref args);


   Database db;

   int loaddb;
   loaddb = Database.open (/home/niko/Desktop/test.db, out db);

   liststore = new Gtk.ListStore(Col.NB, typeof(string), 
typeof(string), typeof(string));   
   treeview = new Gtk.TreeView.with_model(liststore);



   var renderer = new CellRendererText();
   renderer.set_property(editable, true);
   renderer.edited.connect (on_column1_edit);
   renderer.set (width-chars, 25, null);
   renderer.set (height, 15, null);
   column1 = new Gtk.TreeViewColumn ();
   column1.pack_start (renderer, true);
   column1.set_title (Nom);
   column1.add_attribute (renderer, text, Col.NAME);
   column1.sizing = Gtk.TreeViewColumnSizing.GROW_ONLY;

   var renderer2 = new CellRendererText();
   renderer2.set_property(editable, true);
   renderer2.edited.connect (on_column2_edit);
   column2 = new Gtk.TreeViewColumn ();
   column2.pack_start (renderer2, true);
   column2.set_title (Age);
   column2.add_attribute (renderer2, text, Col.AGE);

   var renderer3 = new CellRendererText();
   renderer3.set_property(editable, true);
   renderer3.edited.connect (on_column3_edit);
   column3 = new Gtk.TreeViewColumn ();
   column3.pack_start (renderer3, true);
   column3.set_title (Sexe);
   column3.add_attribute (renderer3, text, Col.SEX);

   treeview.append_column (column1);
   treeview.append_column (column2);
   treeview.append_column (column3);

   treeview.set_search_column(0);
   treeview.set_reorderable(true);
   treeview.set_headers_clickable(true);
   treeview.set_rubber_banding(true);
   treeview.set_rules_hint(true);

   int rc;
   rc = db.exec (select * from personnes, populate_column, null);

   column1.add_attribute (renderer, text, 0);
   column2.add_attribute (renderer2, text, 1);
   column3.add_attribute (renderer3, text, 2);

   treeview.row_activated += row_select;

   var win = new Gtk.Window(Gtk.WindowType.TOPLEVEL);
   win.add(treeview);   
   win.show_all();  
   win.destroy.connect (Gtk.main_quit);

   Gtk.main();
  
   return 0;

 }
}


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


Re: [Vala] libgee on Windows

2009-09-11 Thread Nicolas Joseph
Hello,

I don't have problem for compile libgee on Windows:
libgee-0.3.0.ziphttp://code.google.com/p/valide/downloads/detail?name=libgee-0.3.0.zip

I use msys and several packages from
mingwhttp://sourceforge.net/projects/mingw/files/
.

2009/9/10 Mr. Maxwell . mr_maxw...@live.com


 The mailing list keeps destroying my pretty formating! Delete all the
 hyphens following the urls.

  From: mr_maxw...@live.com
  To: vala-list@gnome.org
  Date: Thu, 10 Sep 2009 16:20:53 -0500
  Subject: Re: [Vala] libgee on Windows
 
 
  config.loghttp://pastebin.com/f3a11a715--
  command line ouput
  http://pastebin.com/f2cd68b21--
 
   From: m...@jensge.org
   To: vala-list@gnome.org
   Date: Thu, 10 Sep 2009 11:20:45 +0200
   Subject: Re: [Vala] libgee on Windows
  
  
I tried running configure, make, make install from cygwin but it
 failed at configure. :( Appending --no-undefined on the gcc compile command
 also failed.
output.txt http://www.flyupload.com/?fid=155588output.png
 http://www.flyupload.com/?fid=7060892
config.log http://www.flyupload.com/?fid=8200585
  
   I cannot open those files. Could you use pastebin.com or a similar
   service? Forget about the -no-undefined for a now please.
  
  
   ___
   Vala-list mailing list
   Vala-list@gnome.org
   http://mail.gnome.org/mailman/listinfo/vala-list
 
  _
  With Windows Live, you can organize, edit, and share your photos.
  http://www.windowslive.com/Desktop/PhotoGallery

 _
 Get back to school stuff for them and cashback for you.

 http://www.bing.com/cashback?form=MSHYCBpubl=WLHMTAGcrea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1
 ___
 Vala-list mailing list
 Vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list




-- 
Nicolas Joseph
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Genie] Code Generator !

2009-09-04 Thread Nicolas

Hi,

I just created a new tiny program.
It can generate genie code !

Obviously, the program is still young and probably contains bugs, there 
will be some changes in the near future.


Thank you to test it and tell me what do you think about this kind of 
program.


Download it here: 
http://www.murga-linux.com/puppy/viewtopic.php?mode=attachid=21537


Nicolas.


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


Re: [Vala] Need help with string

2009-09-03 Thread Nicolas

Hi Abderrahim,

I use this:

using GLib;

public static void main(string[] args)
{
string contents;
try {
 FileUtils.get_contents(test.txt, out contents);
} catch (FileError err) {
 stdout.printf(error);
}

var info = contents.str([INFO]);
if (info != null) {
 var needed_text = info.substring([INFO].length);
   stdout.printf(%s, needed_text);
}

}

and it works perfectly.
Thank you so much !
Nicolas.

Hi,

2009/9/3 Nicolas c.r@wanadoo.fr:
  

That's the problem, I have a text file, but at a certain place there is, for
example, the code [INFO] and I need to read everything that comes after this
code, which in fact is just text !



Maybe you just want FileUtils.get_contents [1], it will return a
string that you can use as you like

string contents;
try {
  FileUtils.get_contents(filename, out contents);
} catch (FileError) {
  //handle appropriately
}

var info = contents.str('[INFO]');
if (info != null) {
  var needed_text = info.substring('[INFO]'.length);
  // do what you want with this
}

I haven't compiled this code, so there may be some problems with it,
but the idea is there.

HTH,
Abderrahim

[1] http://references.valadoc.org/glib-2.0/GLib.FileUtils.get_contents.html


  




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


[Vala] Need help with string

2009-09-02 Thread Nicolas

Hi,

I try to make a little program who read in a file and take only some 
informations (like an .ini file).

My text file is like this:

[INFO]
blah
blah blah
blah blah blah

Could someone tell me how to create this kind of function ?

Thank you so much in advance,
Nicolas.


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


  1   2   >