GnomeAppBar with variable size components



In the game I am currently writing, I want to have part of the status
bar vary in size depending on data received after the status bar has
been built.

If you look at (go easy, I only have 28.8k):

	http://www.dccs.com.au/~dave/gnocatan/
	
look at the right-most part of the status bar - there is a little turn
indicator.  I want to resize that depending on how many players the
server says are in the game.

When the game starts up, I assume 4 players.  For my own testing, the
server says 2 players.  When I resize the drawing area, it does not
seem to cause the GnomeAppBar to shrink that area.  Just for kicks, I
decided to start with a default of 1 player, then see if it would grow
when the server message came in.  It seems that I cannot grow the
drawing area either.

Does anyone have any clues?

- Dave

Here is the code used to build the status bar:

	app_bar = gnome_appbar_new(FALSE, TRUE, FALSE);
	gnome_app_set_statusbar(GNOME_APP(app), app_bar);
	gnome_app_install_menu_hints(GNOME_APP(app), main_menu);

	net_status = gtk_label_new("Idle");
	gtk_widget_show(net_status);
	gtk_box_pack_start(GTK_BOX(app_bar), net_status, FALSE, TRUE, 0);

	vsep = gtk_vseparator_new();
	gtk_widget_show(vsep);
	gtk_box_pack_start(GTK_BOX(app_bar), vsep, FALSE, TRUE, 0);

	turn_area = gtk_drawing_area_new();
	gtk_signal_connect(GTK_OBJECT(turn_area), "expose_event",
			   GTK_SIGNAL_FUNC(expose_turn_area_event), NULL);
	gtk_widget_set_usize(turn_area, 30 * num_players, -1);
	gtk_widget_show(turn_area);
	gtk_box_pack_start(GTK_BOX(app_bar), turn_area, FALSE, TRUE, 0);

	gnome_appbar_set_status(GNOME_APPBAR(app_bar),
				_("Welcome to Gnocatan!"));

This is the code executed when the server tells me how many players
there are:

	gtk_widget_set_usize(turn_area, 30 * num_players, -1);
	gtk_container_resize_children(GTK_CONTAINER(turn_area->parent));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]