static GtkTreeStore *_local_create_treestore_2cols(GtkWidget *popup, int x, int y) { GtkScrolledWindow *window = create_scrolled_window(); GtkBin *bin = NULL; GtkViewport *view = NULL; GtkTable *table = NULL; GtkTreeView *treeview = NULL; GtkTreeStore *treestore = NULL; bin = GTK_BIN(&window->container); view = GTK_VIEWPORT(bin->child); bin = GTK_BIN(&view->bin); table = GTK_TABLE(bin->child); gtk_window_set_default_size(GTK_WINDOW(popup), x, y); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(popup)->vbox), GTK_WIDGET(window), TRUE, TRUE, 0); treeview = create_treeview_2cols_attach_to_table(table); treestore = GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); return treestore; }
static void _display_info_bb(List info_list, popup_info_t *popup_win) { specific_info_t *spec_info = popup_win->spec_info; char *name = (char *)spec_info->search_info->gchar_data; //int found = 0; burst_buffer_resv_t *bb_ptr = NULL; GtkTreeView *treeview = NULL; ListIterator itr = NULL; sview_bb_info_t *sview_bb_info = NULL; int update = 0; char bb_name_id[32]; if (!spec_info->search_info->gchar_data) { //info = xstrdup("No pointer given!"); goto finished; } if (!spec_info->display_widget) { treeview = create_treeview_2cols_attach_to_table( popup_win->table); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(treeview)); } else { treeview = GTK_TREE_VIEW(spec_info->display_widget); update = 1; } itr = list_iterator_create(info_list); while ((sview_bb_info = (sview_bb_info_t*) list_next(itr))) { bb_ptr = sview_bb_info->bb_ptr; if (bb_ptr->name) { strcpy(bb_name_id, bb_ptr->name); } else if (bb_ptr->array_task_id == NO_VAL) { convert_num_unit(bb_ptr->job_id, bb_name_id, sizeof(bb_name_id), UNIT_NONE, working_sview_config.convert_flags); } else { snprintf(bb_name_id, sizeof(bb_name_id), "%u_%u(%u)", bb_ptr->array_job_id, bb_ptr->array_task_id, bb_ptr->job_id); } if (!xstrcmp(bb_name_id, name)) { _layout_bb_record(treeview, sview_bb_info, update); break; } } list_iterator_destroy(itr); gtk_widget_show(spec_info->display_widget); finished: return; }
static void _display_info_resv(List info_list, popup_info_t *popup_win) { specific_info_t *spec_info = popup_win->spec_info; char *name = (char *)spec_info->search_info->gchar_data; int found = 0; reserve_info_t *resv_ptr = NULL; GtkTreeView *treeview = NULL; ListIterator itr = NULL; sview_resv_info_t *sview_resv_info = NULL; int update = 0; int j = 0; if (!spec_info->search_info->gchar_data) { //info = xstrdup("No pointer given!"); goto finished; } need_refresh: if (!spec_info->display_widget) { treeview = create_treeview_2cols_attach_to_table( popup_win->table); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(treeview)); } else { treeview = GTK_TREE_VIEW(spec_info->display_widget); update = 1; } itr = list_iterator_create(info_list); while ((sview_resv_info = (sview_resv_info_t*) list_next(itr))) { resv_ptr = sview_resv_info->resv_ptr; if (!strcmp(resv_ptr->name, name)) { j=0; while (resv_ptr->node_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, resv_ptr->node_inx[j], resv_ptr->node_inx[j+1], sview_resv_info->color_inx, true, 0); j += 2; } _layout_resv_record(treeview, sview_resv_info, update); found = 1; break; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); if (!found) { if (!popup_win->not_found) { char *temp = "RESERVATION DOESN'T EXSIST\n"; GtkTreeIter iter; GtkTreeModel *model = NULL; /* only time this will be run so no update */ model = gtk_tree_view_get_model(treeview); add_display_treestore_line(0, GTK_TREE_STORE(model), &iter, temp, ""); } popup_win->not_found = true; } else { if (popup_win->not_found) { popup_win->not_found = false; gtk_widget_destroy(spec_info->display_widget); goto need_refresh; } } gtk_widget_show(spec_info->display_widget); finished: return; }
void _display_info_block(List block_list, popup_info_t *popup_win) { specific_info_t *spec_info = popup_win->spec_info; char *name = (char *)spec_info->search_info->gchar_data; int j = 0, found = 0; sview_block_info_t *block_ptr = NULL; int update = 0; GtkTreeView *treeview = NULL; ListIterator itr = NULL; if (!spec_info->search_info->gchar_data) goto finished; need_refresh: if (!spec_info->display_widget) { treeview = create_treeview_2cols_attach_to_table( popup_win->table); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(treeview)); } else { treeview = GTK_TREE_VIEW(spec_info->display_widget); update = 1; } itr = list_iterator_create(block_list); while ((block_ptr = (sview_block_info_t*) list_next(itr))) { if (!xstrcmp(block_ptr->bg_block_name, name) || !xstrcmp(block_ptr->mp_str, name)) { /* we want to over ride any subgrp in error state */ enum node_states state = NODE_STATE_UNKNOWN; if (block_ptr->state & BG_BLOCK_ERROR_FLAG) state = NODE_STATE_ERROR; else if (list_count(block_ptr->job_list)) state = NODE_STATE_ALLOCATED; else state = NODE_STATE_IDLE; j = 0; while (block_ptr->mp_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, block_ptr->mp_inx[j], block_ptr->mp_inx[j+1], block_ptr->color_inx, true, state); j += 2; } _layout_block_record(treeview, block_ptr, update); found = 1; break; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); if (!found) { if (!popup_win->not_found) { char *temp = "BLOCK DOESN'T EXSIST\n"; GtkTreeIter iter; GtkTreeModel *model = NULL; /* only time this will be run so no update */ model = gtk_tree_view_get_model(treeview); add_display_treestore_line(0, GTK_TREE_STORE(model), &iter, temp, ""); } popup_win->not_found = true; } else { if (popup_win->not_found) { popup_win->not_found = false; gtk_widget_destroy(spec_info->display_widget); goto need_refresh; } } gtk_widget_show(spec_info->display_widget); finished: return; }