[Vala] Detailed signals
Hi: How can I connect to a detailed signal, eg: 'changed::x' as you can see in the GSettings Devhelp code: -sample--- The "changed" signal void user_function (GSettings *settings, gchar *key, gpointer user_data) : Run Last / Has Details The "changed" signal is emitted when a key has potentially changed. You should call one of the g_settings_get() calls to check the new value. This signal supports detailed connections. You can connect to the detailed signal "changed::x" in order to only receive callbacks when key "x" changes. settings : the object on which the signal was emitted key : the name of the key that changed user_data : user data set when the signal handler was connected. -sample--- I tried the obvious object.changed::x.connect(...); and clearly didn't work. So help please... Thxs ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] GIO get_contens
Thanks these was exactly that I need. - Mensaje original - De: "Sébastien Wilmet" Para: vala-list@gnome.org Enviados: Jueves, 2 de Diciembre 2010 22:27:02 (GMT-0500) Auto-Detected Asunto: Re: [Vala] GIO get_contens Hello, On Thu, Dec 02, 2010 at 05:03:21PM -0500, Arley Consuegra Rosello wrote: > Hello, I was looking the basic gio sample there a file is read line by > line. > Exist some way to read the without using a while loop? > php have a funtion get_contens that is what I need. > In gio reference manual I found g_data_input_stream_read_upto_finish > that look like what I need, but don't found it in valadoc.org > > pd: Spanish user, sorry. > What you're searching is File.load_contents() I think. Best regards, Sébastien ___ 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
Re: [Vala] GIO get_contens
Hello, On Thu, Dec 02, 2010 at 05:03:21PM -0500, Arley Consuegra Rosello wrote: > Hello, I was looking the basic gio sample there a file is read line by > line. > Exist some way to read the without using a while loop? > php have a funtion get_contens that is what I need. > In gio reference manual I found g_data_input_stream_read_upto_finish > that look like what I need, but don't found it in valadoc.org > > pd: Spanish user, sorry. > What you're searching is File.load_contents() I think. Best regards, Sébastien pgpIhJ5TyVrVg.pgp Description: PGP signature ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] GIO get_contens
Hello, I was looking the basic gio sample there a file is read line by line. Exist some way to read the without using a while loop? php have a funtion get_contens that is what I need. In gio reference manual I found g_data_input_stream_read_upto_finish that look like what I need, but don't found it in valadoc.org pd: Spanish user, sorry. ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Dbus, connecting a signal to an async method...
Hello, I've a situation like the one in the example that I've attached here, where I need to make an asynchronous call to a method from a dbus signal callback function; to perform that I need to use the yield modifier, and so I need the callback function method should be async. Now, when I connect the async method to the dbus interface with somethink like: session_proxy = (FreeDesktopDBus) connection.get_object (FreeDesktopDBus.UNIQUE_NAME, FreeDesktopDBus.OBJECT_PATH, FreeDesktopDBus.INTERFACE_NAME); session_proxy.name_acquired.connect (this.name_acquired); Where name_acquired is defined as: private async void name_acquired(FreeDesktopDBus sender, string name) { } I get an error: Cannot convert from `Test.name_acquired' to `FreeDesktopDBus.name_acquired As a workaround I added two sync signal methods to the dbus interface, but not using async calls is not a good think here... Other ways? Thanks! Bye. PS: I'm using dbus-glib since the project I'm working on, uses it and I can't change that. using GLib; [DBus (name = "org.freedesktop.DBus")] public interface FreeDesktopDBus : GLib.Object { public const string UNIQUE_NAME = "org.freedesktop.DBus"; public const string OBJECT_PATH = "/org/freedesktop/DBus"; public const string INTERFACE_NAME = "org.freedesktop.DBus"; public abstract async string[] list_names () throws DBus.Error; public abstract async string[] list_activatable_names () throws DBus.Error; public abstract async string get_id () throws DBus.Error; public signal void name_lost (string name); public signal void name_acquired (string name); public signal void name_owner_changed (string name, string old_name, string new_name); } public class Test : GLib.Object { private List owned_names; private List activatable_names; FreeDesktopDBus session_proxy; public Test() { owned_names = new List(); activatable_names = new List(); session_proxy = null; } /* FIXME vala (at least 0.12) doesn't allow to call an async method! * until vala fixes it, add the new name to the activables one * error is : Cannot convert from `Test.name_acquired' to * `FreeDesktopDBus.name_acquired' */ private /*async*/ void name_acquired(FreeDesktopDBus sender, string name) { if (name.has_prefix (":")) return; //if (name in yield sender.list_names ()) owned_names.append (name); //else if (name in yield sender.list_activatable_names ()) activatable_names.append (name); printData(); } private void name_owner_changed (FreeDesktopDBus sender, string name, string old_owner, string new_owner) { if (name.has_prefix (":")) return; if (old_owner == "") { owned_names.append(name); } else if (new_owner == "") { owned_names.remove(name); } printData(); } public async void init() { DBus.Connection connection; string[] names; try { connection = DBus.Bus.get (DBus.BusType.SESSION); session_proxy = (FreeDesktopDBus) connection.get_object (FreeDesktopDBus.UNIQUE_NAME, FreeDesktopDBus.OBJECT_PATH, FreeDesktopDBus.INTERFACE_NAME); session_proxy.name_owner_changed.connect (this.name_owner_changed); session_proxy.name_acquired.connect (this.name_acquired); session_proxy.name_lost.connect ((p, name) => { activatable_names.remove(name); owned_names.remove(name); }); names = yield session_proxy.list_names (); foreach (unowned string name in names) { if (name.has_prefix (":")) continue; owned_names.append(name); } names = yield session_proxy.list_activatable_names (); foreach (unowned string session_act in names) { activatable_names.append(session_act); } this.printData(); } catch (Error err) { error ("%s", err.message); } } private void printData() { if (session_proxy == null) this.init.begin(); print("Session Names:\n"); foreach(string s in owned_names) print(" - "+s+"\n"); print("\n"); print("Session Activatable Names:\n"); foreach(string s in activatable_names) print(" - "+s+"\n"); print("\n"); } } int main(string[] args) { var t = new Test(); t.init.begin(); var loop = new GLib.MainLoop (null, false); loop.run(); } ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] char variables problem
It works fine in 0.10.0, shipped with ubuntu 10.10. On Thu, Dec 2, 2010 at 4:21 AM, Navdeep Singh Sidhu wrote: > What vala version are you using? > > It compiles and runs fine on my machine. > Valac 0.11.2 > Ubuntu 10.10 > GCC 4.4.5/ > > Navi > > - > > On 02/12/10 23:06, Sepehr Aryani wrote: >> Hi guys. >> what is the problem with this code? >> >> public void main(){ >> char ch1 = 'a'; >> char? ch2 = 'b'; >> >> >> stdout.printf("%c\n", ch1); >> stdout.printf("%c\n", ch2); >> stdout.printf("%s\n", ch1.to_string()); >> stdout.printf("%s\n", ch2.to_string()); >> } >> >> when I assign a value to ch1 and ch2, they remain empty and nothing is >> printed in output. >> Why... >> >> >> >> >> ___ >> vala-list mailing list >> vala-list@gnome.org >> http://mail.gnome.org/mailman/listinfo/vala-list > > > -- > Navdeep Singh Sidhu > [navdeepsinghsidhu gmail.com] > ___ > 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
Re: [Vala] char variables problem
What vala version are you using? It compiles and runs fine on my machine. Valac 0.11.2 Ubuntu 10.10 GCC 4.4.5/ Navi - On 02/12/10 23:06, Sepehr Aryani wrote: > Hi guys. > what is the problem with this code? > > public void main(){ > char ch1 = 'a'; > char? ch2 = 'b'; > > > stdout.printf("%c\n", ch1); > stdout.printf("%c\n", ch2); > stdout.printf("%s\n", ch1.to_string()); > stdout.printf("%s\n", ch2.to_string()); > } > > when I assign a value to ch1 and ch2, they remain empty and nothing is > printed in output. > Why... > > > > > ___ > vala-list mailing list > vala-list@gnome.org > http://mail.gnome.org/mailman/listinfo/vala-list -- Navdeep Singh Sidhu [navdeepsinghsidhu gmail.com] ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] char variables problem
Hi guys. what is the problem with this code? public void main(){ char ch1 = 'a'; char? ch2 = 'b'; stdout.printf("%c\n", ch1); stdout.printf("%c\n", ch2); stdout.printf("%s\n", ch1.to_string()); stdout.printf("%s\n", ch2.to_string()); } when I assign a value to ch1 and ch2, they remain empty and nothing is printed in output. Why... ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list