Skip to content

Instantly share code, notes, and snippets.

@dimitrov
Created March 1, 2011 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimitrov/849564 to your computer and use it in GitHub Desktop.
Save dimitrov/849564 to your computer and use it in GitHub Desktop.
// compile using valac app.vala -o app --pkg gtk+-2.0
using Gtk;
namespace MyApp
{
class MyApp: Gtk.Window
{
public MyApp()
{
this.set_default_size(100, 100);
var button = new Button.with_label("Click me!");
add(button);
button.clicked.connect(this.on_button_clicked);
}
private void on_button_clicked(Button button)
{
stdout.printf("Button clicked!\n");
}
public static int main(string[] args)
{
Gtk.init(ref args);
var app = new MyApp();
app.show_all();
app.destroy.connect(Gtk.main_quit);
Gtk.main();
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment