static GtkWidget *create_dlg_chat(GtkWindow * parent) { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *chat_widget; /* * Create outer window. */ dialog = gtk_dialog_new_with_buttons(_("Player Chat"), parent, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); g_object_set_data(G_OBJECT(dialog), "dlg_players", dialog); /* * Get vertical box packing widget. */ vbox = GTK_DIALOG(dialog)->vbox; g_object_set_data(G_OBJECT(dialog), "vbox", vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); gtk_widget_show(vbox); chat_widget = create_chat_widget(); g_object_set_data_full(G_OBJECT(dialog), "chat_widget", chat_widget, (GtkDestroyNotify) gtk_widget_unref); gtk_box_pack_start(GTK_BOX(vbox), chat_widget, FALSE, FALSE, 0); /* * Set up callbacks */ g_signal_connect(dialog, "delete_event", GTK_SIGNAL_FUNC(gtk_widget_destroy), NULL); g_signal_connect(dialog, "response", GTK_SIGNAL_FUNC(gtk_widget_destroy), NULL); /* * Done! */ return dialog; }
static void setup_window (void) { GtkWidget *vbox; GtkWidget *packing; GtkWidget *menubar; GtkUIManager *ui_manager; GtkAccelGroup *accel_group; ClutterColor stage_color = {0x00,0x00,0x00,0xff}; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); clutter_widget = gtk_clutter_embed_new (); stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_widget)); clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color); clutter_actor_set_size (CLUTTER_ACTOR (stage), properties->tilesize * BOARDWIDTH, properties->tilesize * BOARDHEIGHT); clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), FALSE); board = gnibbles_board_new (); gtk_window_set_title (GTK_WINDOW (window), _("Nibbles")); gtk_window_set_default_size (GTK_WINDOW (window), DEFAULT_WIDTH, DEFAULT_HEIGHT); games_conf_add_window (GTK_WINDOW (window), KEY_PREFERENCES_GROUP); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_cb), NULL); g_signal_connect (G_OBJECT (window), "window_state_event", G_CALLBACK (window_state_cb), NULL); gtk_widget_realize (window); vbox = gtk_vbox_new (FALSE, 0); games_stock_init (); ui_manager = gtk_ui_manager_new (); create_menus (ui_manager); set_fullscreen_actions (FALSE); notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); accel_group = gtk_ui_manager_get_accel_group (ui_manager); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu"); gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0); packing = games_grid_frame_new (BOARDWIDTH, BOARDHEIGHT); gtk_widget_show (packing); gtk_container_add (GTK_CONTAINER (packing), clutter_widget); #ifdef GGZ_CLIENT chat = create_chat_widget (); gtk_box_pack_start (GTK_BOX (vbox), chat, FALSE, TRUE, 0); #endif g_signal_connect (G_OBJECT (clutter_widget), "configure_event", G_CALLBACK (configure_event_cb), NULL); g_signal_connect (G_OBJECT (window), "focus_out_event", G_CALLBACK (show_cursor_cb), NULL); gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), packing, NULL); gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE); statusbar = gtk_statusbar_new (); gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show_all (window); #ifdef GGZ_CLIENT gtk_widget_hide (chat); #endif scoreboard = gnibbles_scoreboard_new (statusbar); }