# Include <GTK/GTK. h>
Static gtkwidget * credits_window;
Gtkwidget * create_credits ()
{
Gtkwidget * window;
Gtkwidget * vbox, * hbox;
Gtkwidget * notebook, * button;
Gtkwidget * Page, * viewport;
Gtkwidget * label, * text;
Gtkwidget * entry, * image; // in personal information.
Gdkpixbuf * pixbuf;
Gtktextbuffer * text_buffer;
Window = gtk_window_new (gtk_window_toplevel );
Gtk_window_set_title (gtk_window (window), "Kai Fa Ren yuan ");
Vbox = gtk_vbox_new (false, 0 );
Gtk_container_add (gtk_container (window), vbox );
Notebook = gtk_notebook_new ();
Gtk_box_pack_start (gtk_box (vbox), notebook, true, true, 5 );
Page = gtk_vbox_new (false, 0 );
Viewport = gtk_viewport_new (null, null );
Gtk_box_pack_start (gtk_box (PAGE), viewport, true, true, 5 );
TEXT = gtk_text_view_new ();
Gtk_container_add (gtk_container (viewport), text );
Text_buffer = gtk_text_view_get_buffer (gtk_text_view (text ));
Hbox = gtk_hbox_new (false, 0 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 5 );
Label = gtk_label_new ("browser notification ");
Gtk_notebook_append_page (gtk_notebook (notebook), page, label );
// ================================================ ========================================================== ===
Page = gtk_vbox_new (false, 0 );
Viewport = gtk_viewport_new (null, null );
Gtk_box_pack_start (gtk_box (PAGE), viewport, true, true, 5 );
TEXT = gtk_text_view_new ();
Gtk_container_add (gtk_container (viewport), text );
Text_buffer = gtk_text_view_get_buffer (gtk_text_view (text ));
Hbox = gtk_hbox_new (false, 0 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 5 );
Button = gtk_button_new_with_label ("Confirm leave ");
G_signal_connect (g_object (button), "clicked ",
G_callback (gtk_main_quit), null );//
Gtk_box_pack_start (gtk_box (hbox), button, false, false, 5 );
Button = gtk_button_new_with_label ("cancel ");
G_signal_connect (g_object (button), "clicked ",
G_callback (gtk_main_quit), null );
Gtk_box_pack_start (gtk_box (hbox), button, false, false, 5 );
Label = gtk_label_new ("apply for leave ");
Gtk_notebook_append_page (gtk_notebook (notebook), page, label );
// ================================================ ========================================================== ========
Page = gtk_vbox_new (false, 0 );
// Label = gtk_label_new ("Yu 1123/nhello, nice to meet you/n gglad To see you again ");
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 0 );
Viewport = gtk_viewport_new (null, null );
Gtk_container_add (gtk_container (PAGE), viewport );
Pixbuf = gdk_pixbuf_new_from_file ("gnome-spider.png", null );
Image = gtk_image_new_from_pixbuf (pixbuf );
Gtk_container_add (gtk_container (viewport), image );
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 0 );
Label = gtk_label_new ("student ID :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Label = gtk_label_new ("name :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 0 );
Label = gtk_label_new ("Tel :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Label = gtk_label_new ("score :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 0 );
Label = gtk_label_new ("number of leave requests :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Label = gtk_label_new ("Times late :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 0 );
Label = gtk_label_new ("absenteeism :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Label = gtk_label_new ("number of early departures :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Entry = gtk_entry_new ();
Gtk_box_pack_start (gtk_box (hbox), entry, false, false, 0 );
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, true, 0 );
Label = gtk_label_new ("Awards :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Viewport = gtk_viewport_new (null, null );
Gtk_container_add (gtk_container (hbox), viewport );
TEXT = gtk_text_view_new ();
Gtk_container_add (gtk_container (viewport), text );
Text_buffer = gtk_text_view_get_buffer (gtk_text_view (text ));
Hbox = gtk_hbox_new (false, 5 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, true, 0 );
Label = gtk_label_new ("sanction :");
Gtk_box_pack_start (gtk_box (hbox), label, false, false, 0 );
Viewport = gtk_viewport_new (null, null );
Gtk_container_add (gtk_container (hbox), viewport );
TEXT = gtk_text_view_new ();
Gtk_container_add (gtk_container (viewport), text );
Text_buffer = gtk_text_view_get_buffer (gtk_text_view (text ));
// Gtk_box_pack_start (gtk_box (PAGE), viewport, false, false, 5 );
Label = gtk_label_new ("personal information ");
Gtk_notebook_append_page (gtk_notebook (notebook), page, label );
// ================================================ ======================================
Page = gtk_vbox_new (false, 0 );
Viewport = gtk_viewport_new (null, null );
Gtk_box_pack_start (gtk_box (PAGE), viewport, true, true, 5 );
TEXT = gtk_text_view_new ();
Gtk_container_add (gtk_container (viewport), text );
Text_buffer = gtk_text_view_get_buffer (gtk_text_view (text ));
Hbox = gtk_hbox_new (false, 0 );
Gtk_box_pack_start (gtk_box (PAGE), hbox, false, false, 5 );
// Gtk_box_pack_start (gtk_box (PAGE), label, false, false, 5 );
Label = gtk_label_new ("Message Board ");
Gtk_notebook_append_page (gtk_notebook (notebook), page, label );
// ================================================ ======================================
Gtk_widget_show_all (window );
Return window;
}
Void show_credits ()
{
Credits_window = create_credits ();
Gtk_widget_show (credits_window );
}
Int main (INT argc, char * argv [])
{
Gtkwidget * window;
Gtkwidget * bBox;
Gtkwidget * vbox;
Gtkwidget * label;
Gtkwidget * image;
Gtkwidget * Sep;
Gtkwidget * button;
Gtk_init (& argc, & argv );
Window = gtk_window_new (gtk_window_toplevel );
G_signal_connect (g_object (window), "delete_event", g_callback (gtk_main_quit), null );
Gtk_window_set_title (gtk_window (window), "about dialog ");
Gtk_window_set_position (gtk_window (window), gtk_win_pos_center );
Gtk_container_set_border_width (gtk_container (window), 10 );
Vbox = gtk_vbox_new (false, 0 );
Gtk_container_add (gtk_container (window), vbox );
Image = gtk_image_new_from_file ("gnome-spider.png ");
Gtk_box_pack_start (gtk_box (vbox), image, false, false, 5 );
Label = gtk_label_new (null );
Gtk_label_set_markup (gtk_label (Label), "<span> <big> GTK + 2.0 shi li Pian Cheng </big> </span> ");
Gtk_box_pack_start (gtk_box (vbox), label, false, false, 5 );
SEP = gtk_hseparator_new ();
Gtk_box_pack_start (gtk_box (vbox), SEP, false, false, 5 );
BBox = gtk_hbutton_box_new ();
Gtk_button_box_set_layout (gtk_button_box (bBox), gtk_buttonbox_edge );
Gtk_box_pack_start (gtk_box (vbox), bBox, false, false, 5 );
Button = gtk_button_new_with_label ("Kai Fa Ren yuan ");
// Gtk_box_pack_start (gtk_box (vbox), button, false, false, 5 );
G_signal_connect (g_object (button), "clicked", g_callback (show_credits), null );
Gtk_box_pack_start (gtk_box (bBox), button, false, false, 35 );
Gtk_widget_show_all (window );
Gtk_main ();
Return false;
}
File Name: App. c
I compiled with emacs22-gtk:
Gcc-g-wall-O app. c 'pkg-config -- cflags -- libs GTK +-2.0'