2013/9/20 Kuang Chen <kuangc...@ucla.edu>:
> Hi,
>
> I would like to write a gnome-shell extension, which involves some dbus
> calling in gjs.
>
> I have learned that Gio.DBus is the right module to use, but I failed to
> make it run correctly. To demonstrate what I mean, I prepared the following
> "incorrect" code, which attempts to call the ListNames method in
> org.freedesktop.DBus interface. I didn't see any output when I run this
> incorrect code.
>
>[...]
>
> So my guess is to make GDBus work, you need a Gio.Application to run? This
> could be a very stupid question, because I have zero experience programming
> for GNOME.

You don't need Gio.Application, but you do need a mainloop (and
Gio.Application provides one).
So alternatively you can do:

const Mainloop = imports.mainloop;

function main() {
   [ code to setup dbus and start the async call ]

   Mainloop.run('tag');
   return 0;
}
main();

And inside the async call, when you want to exit the script, you would
do "Mainloop.quit('tag')"

Giovanni
_______________________________________________
javascript-list mailing list
javascript-list@gnome.org
https://mail.gnome.org/mailman/listinfo/javascript-list

Reply via email to