Exemplo n.º 1
0
Arquivo: grid.c Projeto: jtfrey/slurm
extern List copy_main_button_list(int initial_color)
{
	ListIterator itr = NULL;
	grid_button_t *grid_button = NULL;
	grid_button_t *send_grid_button = NULL;
	List button_list = list_create(destroy_grid_button);

	itr = list_iterator_create(grid_button_list);
	while ((grid_button = list_next(itr))) {
		send_grid_button = create_grid_button_from_another(
			grid_button, grid_button->node_name, initial_color);
		if (send_grid_button) {
			send_grid_button->button_list = button_list;
			_add_button_signals(send_grid_button);
			send_grid_button->used = false;
			list_append(button_list, send_grid_button);
		}
	}
	list_iterator_destroy(itr);
	return button_list;
}
Exemplo n.º 2
0
Arquivo: grid.c Projeto: jtfrey/slurm
extern void get_button_list_from_main(List *button_list, int start, int end,
				      int color_inx)
{
	ListIterator itr = NULL;
	ListIterator button_itr = NULL;
	grid_button_t *grid_button = NULL;
	grid_button_t *send_grid_button = NULL;

	if (!*button_list)
		*button_list = list_create(destroy_grid_button);

	color_inx %= sview_colors_cnt;
	itr = list_iterator_create(grid_button_list);
	while ((grid_button = list_next(itr))) {
		if ((grid_button->inx < start)
		    ||  (grid_button->inx > end))
			continue;
		button_itr = list_iterator_create(*button_list);
		while ((send_grid_button = list_next(button_itr))) {
			if (send_grid_button->inx == grid_button->inx)
				break;
		}
		list_iterator_destroy(button_itr);
		if (send_grid_button)
			continue;

		send_grid_button = create_grid_button_from_another(
			grid_button, grid_button->node_name, color_inx);
		if (send_grid_button) {
			send_grid_button->button_list = *button_list;
			_add_button_signals(send_grid_button);
			list_append(*button_list, send_grid_button);
		}
	}
	list_iterator_destroy(itr);
	return;
}
Exemplo n.º 3
0
extern void add_extra_bluegene_buttons(List *button_list, int inx,
				       int *color_inx)
{
	block_info_msg_t *block_ptr = NULL;
	block_info_t *bg_info_ptr = NULL;
	int rc = SLURM_SUCCESS;
	ListIterator itr = NULL;
	grid_button_t *grid_button = NULL;
	grid_button_t *send_grid_button = NULL;
	int i=0;
	char *mp_str = NULL;
	char tmp_nodes[256];
	int found = 0;
	int coord_y=0;
	uint16_t orig_state;

	rc = get_new_info_block(&block_ptr, 0);

	if ((rc != SLURM_SUCCESS) && (rc != SLURM_NO_CHANGE_IN_DATA)) {
		return;
	}

	if (!*button_list)
		*button_list = list_create(NULL);

	*color_inx %= sview_colors_cnt;

	itr = list_iterator_create(grid_button_list);
	while ((grid_button = list_next(itr))) {
		if (grid_button->inx == inx)
			break;
	}
	list_iterator_destroy(itr);

	if (!grid_button)
		return;
	orig_state = grid_button->state;
	/* remove all (if any) buttons pointing to this node since we
	   will be creating all of them */

	itr = list_iterator_create(*button_list);
	while ((send_grid_button = list_next(itr))) {
		if (send_grid_button->inx == grid_button->inx)
			list_remove(itr);
	}
	list_iterator_destroy(itr);

	for (i=0; i < block_ptr->record_count; i++) {
		bg_info_ptr = &block_ptr->block_array[i];
		if (!_block_in_node(bg_info_ptr->mp_inx, inx))
			continue;
		found = 1;
		mp_str = bg_info_ptr->mp_str;
		if (bg_info_ptr->ionode_str) {
			sprintf(tmp_nodes, "%s[%s]", mp_str,
				bg_info_ptr->ionode_str);
			mp_str = tmp_nodes;
		}
		if (bg_info_ptr->state & BG_BLOCK_ERROR_FLAG)
			grid_button->state = NODE_STATE_ERROR;
		else if (bg_info_ptr->job_running > NO_JOB_RUNNING)
			grid_button->state = NODE_STATE_ALLOCATED;
		else
			grid_button->state = NODE_STATE_IDLE;
		send_grid_button = create_grid_button_from_another(
			grid_button, mp_str, *color_inx);
		grid_button->state = orig_state;
		if (send_grid_button) {
			send_grid_button->button_list = *button_list;
			send_grid_button->table_x = 0;
			send_grid_button->table_y = coord_y++;
			//_add_button_signals(send_grid_button);
			/* this is a different signal than usual */
			g_signal_connect(
				G_OBJECT(send_grid_button->button),
				"button-press-event",
				G_CALLBACK(_open_block),
				send_grid_button);
			g_signal_connect(G_OBJECT(grid_button->button),
					 "enter-notify-event",
					 G_CALLBACK(_mouseover_node),
					 grid_button);
			g_signal_connect(G_OBJECT(grid_button->button),
					 "leave-notify-event",
					 G_CALLBACK(_mouseoff_node),
					 grid_button);
			list_append(*button_list, send_grid_button);
			(*color_inx)++;
		}
	}
	if (!found) {
		send_grid_button = create_grid_button_from_another(
			grid_button, grid_button->node_name, *color_inx);
		if (send_grid_button) {
			send_grid_button->button_list = *button_list;
			send_grid_button->table_x = 0;
			send_grid_button->table_y = coord_y++;
			_add_button_signals(send_grid_button);
			list_append(*button_list, send_grid_button);
			(*color_inx)++;
		}
	}

}