3 // Import and initialize GTK+
9 var window = new Gtk.Window({title: "Hello World"});
10 window.set_default_size(600, 500);
11 window.signal.hide.connect(Gtk.main_quit);
13 // Create the GtkStatusIcon from a file
14 var icon = new Gtk.StatusIcon({stock : Gtk.STOCK_MEDIA_PLAY});
17 var menu = new Gtk.Menu();
20 var item = new Gtk.MenuItem({label: "Hello"});
23 // Signal connecting the popup_menu event of the icon to the "activate" function
24 icon.signal.popup_menu.connect(active, menu);
26 function active(status_icon, button, time, data)
28 // GtkMenu.popup, calling the Gtk.StatusIcon.position_menu function
30 var area = new Gdk.Rectangle();
33 status_icon.get_geometry(ret);
35 print(ret.orientation);
36 print(ret.area.width);
37 print(ret.area.height);
40 menu.popup(null, null, Gtk.StatusIcon.position_menu, status_icon, button, time);