|
Packit |
1470ea |
/* A window in the application */
|
|
Packit |
1470ea |
public class Window : Gtk.ApplicationWindow {
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* The constructor */
|
|
Packit |
1470ea |
public Window (Application app) {
|
|
Packit |
1470ea |
Object (application: app, title: "AboutDialog Example");
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
var about_action = new SimpleAction ("about", null);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
about_action.activate.connect (this.about_cb);
|
|
Packit |
1470ea |
this.add_action (about_action);
|
|
Packit |
1470ea |
this.show_all ();
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* This is the callback function connected to the 'activate' signal
|
|
Packit |
1470ea |
* of the SimpleAction about_action.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
void about_cb (SimpleAction simple, Variant? parameter) {
|
|
Packit |
1470ea |
string[] authors = { "GNOME Documentation Team", null };
|
|
Packit |
1470ea |
string[] documenters = { "GNOME Documentation Team", null };
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Gtk.show_about_dialog (this,
|
|
Packit |
1470ea |
"program-name", ("GtkApplication Example"),
|
|
Packit |
1470ea |
"copyright", ("Copyright \xc2\xa9 2012 GNOME Documentation Team"),
|
|
Packit |
1470ea |
"authors", authors,
|
|
Packit |
1470ea |
"documenters", documenters,
|
|
Packit |
1470ea |
"website", "http://developer.gnome.org",
|
|
Packit |
1470ea |
"website-label", ("GNOME Developer Website"),
|
|
Packit |
1470ea |
null);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* This is the Application */
|
|
Packit |
1470ea |
public class Application : Gtk.Application {
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Here we override the activate signal of GLib.Application */
|
|
Packit |
1470ea |
protected override void activate () {
|
|
Packit |
1470ea |
new Window (this);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Here we override the startup signal of GLib.Application */
|
|
Packit |
1470ea |
protected override void startup () {
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
base.startup ();
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
var menu = new Menu ();
|
|
Packit |
1470ea |
menu.append ("About", "win.about");
|
|
Packit |
1470ea |
menu.append ("Quit", "app.quit");
|
|
Packit |
1470ea |
this.app_menu = menu;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
var quit_action = new SimpleAction ("quit", null);
|
|
Packit |
1470ea |
//quit_action.activate.connect (this.quit);
|
|
Packit |
1470ea |
this.add_action (quit_action);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* The constructor */
|
|
Packit |
1470ea |
public Application () {
|
|
Packit |
1470ea |
Object (application_id: "org.example.application");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* main function creates Application and runs it */
|
|
Packit |
1470ea |
int main (string[] args) {
|
|
Packit |
1470ea |
return new Application ().run (args);
|
|
Packit |
1470ea |
}
|