1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| #include <stdlib.h>
#include <gtk/gtk.h>
void hide_me(gpointer pWindow)
{
gtk_widget_hide(pWindow);
}
int main(int argc, char **argv)
{
GtkWidget *pWindow;
GtkWidget *pTable;
GtkWidget *pConnect[2];
gtk_init(&argc, &argv);
pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(pWindow), 640, 480);
g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);
pTable = gtk_table_new(9, 7, TRUE);
gtk_container_add(GTK_CONTAINER(pWindow), GTK_WIDGET(pTable));
pConnect[0]= gtk_button_new_with_mnemonic("_Connection");
pConnect[1]= gtk_button_new_with_mnemonic("Create an _account");
gtk_table_attach_defaults(GTK_TABLE(pTable), pConnect[0],
4, 6, 3, 4);
gtk_table_attach_defaults(GTK_TABLE(pTable), pConnect[1],
4, 6, 5, 6);
g_signal_connect(G_OBJECT(pConnect[0]), "clicked", G_CALLBACK(hide_me), pWindow);
gtk_widget_show_all(pWindow);
gtk_main();
return EXIT_SUCCESS;
} |
Partager