website rev 831
en: have a C/GTK example with a callback
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Apr 28 16:08:37 2011 +0200 (2011-04-28) |
parents | acf34ef74c4b |
children | 6a45b8e5343a |
files | en/devel/forge.php |
line diff
1.1 --- a/en/devel/forge.php Thu Apr 28 15:43:10 2011 +0200 1.2 +++ b/en/devel/forge.php Thu Apr 28 16:08:37 2011 +0200 1.3 @@ -208,20 +208,23 @@ 1.4 But keep in mind ther are not so popular than C and GTK and finaly not realy 1.5 easier to learn and use, at least for simple fronted you finally use SHell 1.6 scripts to perform tasks. Use can use Vala if you like but look at a pure 1.7 - GTK single window, it only 12 lines: 1.8 + GTK single window, it only 14 lines: 1.9 </p> 1.10 <pre> 1.11 #include >gtk/gtk.h< 1.12 1.13 int main(int argc, char *argv[]) 1.14 { 1.15 - GtkWidget *window; 1.16 - 1.17 - gtk_init(&argc, &argv); 1.18 - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 1.19 - gtk_widget_show(window); 1.20 - gtk_main(); 1.21 - return 0; 1.22 + GtkWidget *window; 1.23 + 1.24 + gtk_init(&argc, &argv); 1.25 + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 1.26 + g_signal_connect (G_OBJECT (window), "destroy", 1.27 + G_CALLBACK (gtk_main_quit), NULL); 1.28 + 1.29 + gtk_widget_show(window); 1.30 + gtk_main(); 1.31 + return 0; 1.32 } 1.33 </pre> 1.34 <p>