Re: [Vala] using the notification area/systray



Hey,

Vala is a programming language designed to simplify Gtk and GLib programming by providing higher level abstractions on those APIs. Vala by itself cannot draw an icon to the system tray. This can be achieved using the Gtk toolkit. The Gtk.StatusIcon <http://www.valadoc.org/references/gtk+-3.0/0.11.5/Gtk.StatusIcon.html> can be used. I've included a small example of it's use below:


void main(string[] args) {
    Gtk.init(ref args);

    var trayicon = new Gtk.StatusIcon.from_stock("gtk-find");
    trayicon.button_press_event.connect((evt) => {
        switch (evt.button) {
         case 1:    // left-click
            print("clicked.\n"); break;
         default:   // middle & right click
            Gtk.main_quit(); break;
        }
        return true;
    });

    Gtk.main();
}


Hope this helps,

Chris

PS: I haven't tested this code, some tweaking may be required.


On 07/10/11 17:03, rastersoft wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all:

I'm working on a program in Vala and I need to paint an icon on the
notification area (or system tray). I've been searching for an specific
API in Vala, but haven't found it. Is there something that simplifies it?

Thanks.

- -- Nos leemos
                         RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4ZzW0ACgkQXEZvyfy1ha/gRwCeLsylgZ03cXLcxiu925pPgNa7
5r4AoJDVueokdj9zpb53jlIP2o18vvWU
=AKcy
-----END PGP SIGNATURE-----
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]