workbenchdev / demos

Demos of GNOME technologies - GTK, libadwaita, CSS, portals, ...
Creative Commons Zero v1.0 Universal
10 stars 16 forks source link

Port 'Map' demo to Vala #174

Closed BharatAtbrat closed 3 months ago

BharatAtbrat commented 3 months ago

Added Vala code for Map demo

Let me know if conditional logic for checking valid coordinates is okay. If I've understood correctly try_parse returns true and false depending on whether the value can be parsed into float.

I would appreciate any other changes/ improvements :)

Diego-Ivan commented 3 months ago

Let me know if conditional logic for checking valid coordinates is okay. If I've understood correctly try_parse returns true and false depending on whether the value can be parsed into float.

That's right, but it also performs the parsing (if it is posible)! To do that, you need to pass a float variable as out parameter, which means that the method will assign that variable a value (the parsed value) after being called. Take a look at the parameter directions section of the Vala Tutorial for more information: https://wiki.gnome.org/Projects/Vala/Tutorial#Parameter_Directions