1/* A window in the application */ 2public class Window : Gtk.ApplicationWindow { 3 4 /* The constructor */ 5 public Window (Application app) { 6 Object (application: app, title: "AboutDialog Example"); 7 8 var about_action = new SimpleAction ("about", null); 9 10 about_action.activate.connect (this.about_cb); 11 this.add_action (about_action); 12 this.show_all (); 13 } 14 15 /* This is the callback function connected to the 'activate' signal 16 * of the SimpleAction about_action. 17 */ 18 void about_cb (SimpleAction simple, Variant? parameter) { 19 string[] authors = { "GNOME Documentation Team", null }; 20 string[] documenters = { "GNOME Documentation Team", null }; 21 22 Gtk.show_about_dialog (this, 23 "program-name", ("GtkApplication Example"), 24 "copyright", ("Copyright \xc2\xa9 2012 GNOME Documentation Team"), 25 "authors", authors, 26 "documenters", documenters, 27 "website", "http://developer.gnome.org", 28 "website-label", ("GNOME Developer Website"), 29 null); 30 } 31} 32 33/* This is the Application */ 34public class Application : Gtk.Application { 35 36 /* Here we override the activate signal of GLib.Application */ 37 protected override void activate () { 38 new Window (this); 39 } 40 41 /* Here we override the startup signal of GLib.Application */ 42 protected override void startup () { 43 44 base.startup (); 45 46 var menu = new Menu (); 47 menu.append ("About", "win.about"); 48 menu.append ("Quit", "app.quit"); 49 this.app_menu = menu; 50 51 var quit_action = new SimpleAction ("quit", null); 52 //quit_action.activate.connect (this.quit); 53 this.add_action (quit_action); 54 } 55 56 /* The constructor */ 57 public Application () { 58 Object (application_id: "org.example.application"); 59 } 60} 61 62/* main function creates Application and runs it */ 63int main (string[] args) { 64 return new Application ().run (args); 65} 66