Re: [Vala] DBus horror

2009-12-18 Thread Kos
Solved it,
Everything fine with vala in this files, I just called the wrong functions:
getMetaData instead of getMetadata.

Nikos


On Tue, Dec 15, 2009 at 3:11 PM, Kos  wrote:

> Hey,
>
> I'm back with more DBus problems. Now I want to receive an 'a{sv}' output.
> I translated that into a HashTable, but I get errors.
> First I tried it the normal way, e.g. with return values. But it errors
> that there is no signature "" on the interface
> http://pastebin.org/65152 (example vala-file with comments and the errors)
>
> After that I tried with the an out variable. (Thinking of the struct
> solution...)
> http://pastebin.org/65154 (example vala-file with comments and the errors)
>
> Nikos
>
>
> On Tue, Dec 15, 2009 at 1:15 PM, Kos  wrote:
>
>> Thank you,
>>
>> That works. Even with the dynamic method.
>> Is there a time window when the fixes will emerge in a vala release? (Just
>> out of curiosity)
>>
>> @Jürg, sorry for the double mail. Forgot to send a copy to the mailinglist
>>
>>
>> Nikos
>>
>> On Tue, Dec 15, 2009 at 12:59 PM, Jürg Billeter  wrote:
>>
>>> On Tue, 2009-12-15 at 12:45 +0100, Kos wrote:
>>> > You can find the test-source here: http://pastebin.org/65108
>>> > I compile it with valac --pkg dbus-glib-1 vlc_test3.vala -g
>>>
>>> Use the static variant but with an out parameter instead of a return
>>> value as in the following lines:
>>>
>>> public abstract void GetStatus (out State state) throws DBus.Error;
>>>
>>>// Get info
>>>org_freedesktop_MediaPlayer.State state;
>>>dbus.GetStatus (out state);
>>>
>>> It should also work with return values, however, there was a change in
>>> how struct return values are processed a couple months back, and it's
>>> possible that the D-Bus code still needs a few fixes there.
>>>
>>> Jürg
>>>
>>>
>>>
>>
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] DBus horror

2009-12-15 Thread Kos
Hey,

I'm back with more DBus problems. Now I want to receive an 'a{sv}' output. I
translated that into a HashTable, but I get errors.
First I tried it the normal way, e.g. with return values. But it errors that
there is no signature "" on the interface
http://pastebin.org/65152 (example vala-file with comments and the errors)

After that I tried with the an out variable. (Thinking of the struct
solution...)
http://pastebin.org/65154 (example vala-file with comments and the errors)

Nikos

On Tue, Dec 15, 2009 at 1:15 PM, Kos  wrote:

> Thank you,
>
> That works. Even with the dynamic method.
> Is there a time window when the fixes will emerge in a vala release? (Just
> out of curiosity)
>
> @Jürg, sorry for the double mail. Forgot to send a copy to the mailinglist
>
>
> Nikos
>
> On Tue, Dec 15, 2009 at 12:59 PM, Jürg Billeter  wrote:
>
>> On Tue, 2009-12-15 at 12:45 +0100, Kos wrote:
>> > You can find the test-source here: http://pastebin.org/65108
>> > I compile it with valac --pkg dbus-glib-1 vlc_test3.vala -g
>>
>> Use the static variant but with an out parameter instead of a return
>> value as in the following lines:
>>
>> public abstract void GetStatus (out State state) throws DBus.Error;
>>
>>// Get info
>>org_freedesktop_MediaPlayer.State state;
>>dbus.GetStatus (out state);
>>
>> It should also work with return values, however, there was a change in
>> how struct return values are processed a couple months back, and it's
>> possible that the D-Bus code still needs a few fixes there.
>>
>> Jürg
>>
>>
>>
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] DBus horror

2009-12-15 Thread Kos
Thank you,

That works. Even with the dynamic method.
Is there a time window when the fixes will emerge in a vala release? (Just
out of curiosity)

@Jürg, sorry for the double mail. Forgot to send a copy to the mailinglist

Nikos

On Tue, Dec 15, 2009 at 12:59 PM, Jürg Billeter  wrote:

> On Tue, 2009-12-15 at 12:45 +0100, Kos wrote:
> > You can find the test-source here: http://pastebin.org/65108
> > I compile it with valac --pkg dbus-glib-1 vlc_test3.vala -g
>
> Use the static variant but with an out parameter instead of a return
> value as in the following lines:
>
> public abstract void GetStatus (out State state) throws DBus.Error;
>
>// Get info
>org_freedesktop_MediaPlayer.State state;
>dbus.GetStatus (out state);
>
> It should also work with return values, however, there was a change in
> how struct return values are processed a couple months back, and it's
> possible that the D-Bus code still needs a few fixes there.
>
> Jürg
>
>
>
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] DBus horror

2009-12-15 Thread Jürg Billeter
On Tue, 2009-12-15 at 12:45 +0100, Kos wrote:
> You can find the test-source here: http://pastebin.org/65108
> I compile it with valac --pkg dbus-glib-1 vlc_test3.vala -g

Use the static variant but with an out parameter instead of a return
value as in the following lines:

public abstract void GetStatus (out State state) throws DBus.Error;

// Get info
org_freedesktop_MediaPlayer.State state;
dbus.GetStatus (out state);

It should also work with return values, however, there was a change in
how struct return values are processed a couple months back, and it's
possible that the D-Bus code still needs a few fixes there.

Jürg

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


Re: [Vala] DBus horror

2009-12-15 Thread Kos
>
> () is definitely not ai, so the struct variant is supposed to work
> -- the array variant not.
>
> Am Montag, den 14.12.2009, 18:58 +0100 schrieb Kos:
> > I tried to set the return value to int[], so it doesn't had to guess the
> > return type. But then it segfaults.
> > vala file: http://pastebin.org/64817
>
> > generated c file: http://pastebin.org/64814
> > backtrace: see vala file
> >
> > I also tried to set the return value to a struct with 4 ints
> > (org_freedesktop_MediaPlayer.State), but then the c-compiler errors:
>
> > vlc_test2.vala.c: In function ‘_dynamic_GetStatus0’:
> > vlc_test2.vala.c:244: error: ‘result’ redeclared as different kind of symbol
> > vlc_test2.vala.c:243: note: previous definition of ‘result’ was here
>
> > vlc_test2.vala.c:249: warning: ‘return’ with a value, in function returning
>
> Can you post a self-contained sample for this, please? What do I need to
> install to test?
>
>
Of course I want to give you the source files.

You can find the test-source here: http://pastebin.org/65108
I compile it with valac --pkg dbus-glib-1 vlc_test3.vala -g

If you want to test it, you have to install VLC. After that you have to
enable the DBus support of VLC by going to tools->preferences. There you
will find a "show settings" radio button at the bottom left. Set it to All.
Than you go to interface->control interface and check the 'D-Bus control
interface' checkbox. Restart VLC. Now the GetStatus of org.mpris.vlc will
return (2 0 0 0) when the program is running, but not playing.

If you have amarok, it's a little bit easier. Just open amarok and make sure
it isn't playing or pauzed. Than you have to change the org.mpris.vlc to
org.mpris.amarok in my file and you should always get (2 0 0 0) when
accessing GetStatus over DBus.

Happy testing


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


Re: [Vala] DBus horror

2009-12-14 Thread Michael 'Mickey' Lauer
() is definitely not ai, so the struct variant is supposed to work
-- the array variant not.

Am Montag, den 14.12.2009, 18:58 +0100 schrieb Kos:
> I tried to set the return value to int[], so it doesn't had to guess the
> return type. But then it segfaults.
> vala file: http://pastebin.org/64817
> generated c file: http://pastebin.org/64814
> backtrace: see vala file
> 
> I also tried to set the return value to a struct with 4 ints
> (org_freedesktop_MediaPlayer.State), but then the c-compiler errors:
> vlc_test2.vala.c: In function ‘_dynamic_GetStatus0’:
> vlc_test2.vala.c:244: error: ‘result’ redeclared as different kind of symbol
> vlc_test2.vala.c:243: note: previous definition of ‘result’ was here
> vlc_test2.vala.c:249: warning: ‘return’ with a value, in function returning

Can you post a self-contained sample for this, please? What do I need to
install to test?

Cheers,

:M:


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


Re: [Vala] DBus horror

2009-12-14 Thread Kos
On Mon, Dec 14, 2009 at 2:27 PM, John Carr  wrote:

> Hey,
>
> I noticed you used var foo = in the dynamic test. Doesn't Vala need to
> know what the return type will be at compile time? I think it is
> assuming it will be an object path when its actually an array of 4
> intergers.
>

I tried to set the return value to int[], so it doesn't had to guess the
return type. But then it segfaults.
vala file: http://pastebin.org/64817
generated c file: http://pastebin.org/64814
backtrace: see vala file

I also tried to set the return value to a struct with 4 ints
(org_freedesktop_MediaPlayer.State), but then the c-compiler errors:
vlc_test2.vala.c: In function ‘_dynamic_GetStatus0’:
vlc_test2.vala.c:244: error: ‘result’ redeclared as different kind of symbol
vlc_test2.vala.c:243: note: previous definition of ‘result’ was here
vlc_test2.vala.c:249: warning: ‘return’ with a value, in function returning
void


> In the static test, i wonder in vala can't yet map a return type of "4
> integers" to a struct - have you tried using int[4] as the return
> type?
>

I have tried setting it as int[]. That doesn't work either because vala will
expect a dbus signature of an array, instead of a struct.

** (process:4153): CRITICAL **: file
/home/karmic/progie/awn-applets/applets/maintained/media-indicator/vlc_test.vala.c:
line 383: uncaught error: Invalid signature, expected "ai", got "()"

Setting it as int[4] will generate an compile error.

 John
>

Sorry I have to keep bothering you.

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


Re: [Vala] DBus horror

2009-12-14 Thread John Carr
On Mon, Dec 14, 2009 at 11:37 AM, Kos  wrote:
> Hello,
>
> I'm using vala to make an applet for awn. It will be an applet that can
> manage all the media players. Therefor I'm using the dbus with the mpris
> interface. I've tried to get the state of vlc. That means you have the call
> the dbus function GetStatus and it will return a struct. I first tried with
> an dynamic dbus, but I've got an error on running. I've tried with a static
> dbus and I didn't get an error, hurray. After careful looking at the return
> value, It only returns zero's. Bye bye hurray. So it still didn't do what I
> want.
>
> For a stripped down version of my code, see http://pastebin.org/64684 (It
> has commentary)
>
> I really like coding in vala, but my project has a deadline. So either I
> need a way round the problem, or I'm forced to go to c. Do you see a way
> round the problem?
>
> thanks in advance,
> Kos
>
> ___
> Vala-list mailing list
> Vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
>

Hey,

I noticed you used var foo = in the dynamic test. Doesn't Vala need to
know what the return type will be at compile time? I think it is
assuming it will be an object path when its actually an array of 4
intergers.

In the static test, i wonder in vala can't yet map a return type of "4
integers" to a struct - have you tried using int[4] as the return
type?

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


[Vala] DBus horror

2009-12-14 Thread Kos
Hello,

I'm using vala to make an applet for awn. It will be an applet that can
manage all the media players. Therefor I'm using the dbus with the mpris
interface. I've tried to get the state of vlc. That means you have the call
the dbus function GetStatus and it will return a struct. I first tried with
an dynamic dbus, but I've got an error on running. I've tried with a static
dbus and I didn't get an error, hurray. After careful looking at the return
value, It only returns zero's. Bye bye hurray. So it still didn't do what I
want.

For a stripped down version of my code, see http://pastebin.org/64684 (It
has commentary)

I really like coding in vala, but my project has a deadline. So either I
need a way round the problem, or I'm forced to go to c. Do you see a way
round the problem?

thanks in advance,
Kos
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list