diff --git a/src/sview/block_info.c b/src/sview/block_info.c index ce8c3433489436b89ace55b463aaf568fba5f0dd..ec55a0e68382f922807d2edb292e3c1ce3c0dfb0 100644 --- a/src/sview/block_info.c +++ b/src/sview/block_info.c @@ -651,10 +651,12 @@ extern void refresh_block(GtkAction *action, gpointer user_data) xassert(popup_win != NULL); xassert(popup_win->spec_info != NULL); xassert(popup_win->spec_info->title != NULL); + popup_win->force_refresh = 1; specific_info_block(popup_win); } -extern int get_new_info_node_select(node_select_info_msg_t **node_select_ptr) +extern int get_new_info_node_select(node_select_info_msg_t **node_select_ptr, + int force) { static node_select_info_msg_t *bg_info_ptr = NULL; static node_select_info_msg_t *new_bg_ptr = NULL; @@ -662,7 +664,7 @@ extern int get_new_info_node_select(node_select_info_msg_t **node_select_ptr) time_t now = time(NULL); static time_t last; - if((now - last) < global_sleep_time) { + if(!force && ((now - last) < global_sleep_time)) { *node_select_ptr = bg_info_ptr; return error_code; } @@ -711,7 +713,7 @@ extern void get_info_block(GtkTable *table, display_data_t *display_data) goto display_it; } - if((part_error_code = get_new_info_part(&part_info_ptr)) + if((part_error_code = get_new_info_part(&part_info_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { goto get_node_select; } @@ -734,7 +736,8 @@ extern void get_info_block(GtkTable *table, display_data_t *display_data) } get_node_select: - if((block_error_code = get_new_info_node_select(&node_select_ptr)) + if((block_error_code = get_new_info_node_select(&node_select_ptr, + force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if((!display_widget || view == ERROR_VIEW) || (part_error_code != SLURM_NO_CHANGE_IN_DATA)) @@ -788,6 +791,7 @@ display_it: _update_info_block(block_list, GTK_TREE_VIEW(display_widget), NULL); end_it: toggled = FALSE; + force_refresh = FALSE; return; } @@ -814,7 +818,8 @@ extern void specific_info_block(popup_info_t *popup_win) goto display_it; } - if((part_error_code = get_new_info_part(&part_info_ptr)) + if((part_error_code = get_new_info_part(&part_info_ptr, + popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { goto get_node_select; } @@ -837,7 +842,8 @@ extern void specific_info_block(popup_info_t *popup_win) } get_node_select: - if((block_error_code = get_new_info_node_select(&node_select_ptr)) + if((block_error_code = get_new_info_node_select(&node_select_ptr, + popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if((!spec_info->display_widget || spec_info->view == ERROR_VIEW) @@ -897,6 +903,7 @@ display_it: end_it: popup_win->toggled = 0; + popup_win->force_refresh = 0; return; } diff --git a/src/sview/common.c b/src/sview/common.c index 3492e8955f81b83998fab2e01f7a295abaa5e8c3..0c3ddf7027099496abfc2fce33cde2abeaf1a418 100644 --- a/src/sview/common.c +++ b/src/sview/common.c @@ -115,12 +115,11 @@ static void _popup_state_changed(GtkCheckMenuItem *menuitem, display_data_t *display_data) { popup_info_t *popup_win = (popup_info_t *) display_data->user_data; - popup_win->toggled = 1; if(display_data->show) display_data->show = FALSE; else display_data->show = TRUE; - + popup_win->toggled = 1; (display_data->refresh)(NULL, display_data->user_data); } @@ -488,6 +487,7 @@ extern popup_info_t *create_popup_info(int type, int dest_type, char *title) popup_win->spec_info = xmalloc(sizeof(specific_info_t)); popup_win->popup = gtk_dialog_new(); popup_win->toggled = 0; + popup_win->force_refresh = 0; popup_win->type = dest_type; gtk_window_set_default_size(GTK_WINDOW(popup_win->popup), diff --git a/src/sview/job_info.c b/src/sview/job_info.c index 4be88d31a71d146ae42804feb3872f823de53962..33f1a12577f723489b902ccf0ff1b9d6f0fed573 100644 --- a/src/sview/job_info.c +++ b/src/sview/job_info.c @@ -142,8 +142,7 @@ static void _update_info_step(job_step_info_response_msg_t *step_info_ptr, int jobid, GtkTreeModel *model, GtkTreeIter *step_iter, - GtkTreeIter *iter, - int changed); + GtkTreeIter *iter); static int _nodes_in_list(char *node_list) @@ -171,8 +170,7 @@ static int _get_node_cnt(job_info_t * job) static void _update_job_record(job_info_t *job_ptr, job_step_info_response_msg_t *step_info_ptr, GtkTreeStore *treestore, - GtkTreeIter *iter, - int changed) + GtkTreeIter *iter) { char *nodes = NULL, time_buf[20]; char tmp_cnt[7]; @@ -184,6 +182,7 @@ static void _update_job_record(job_info_t *job_ptr, int childern = 0; uint32_t node_cnt = 0; + gtk_tree_store_set(treestore, iter, SORTID_UPDATED, 1, -1); if(!job_ptr->nodes || !strcasecmp(job_ptr->nodes,"waiting...")) { sprintf(time_buf,"0:00:00"); nodes = "waiting..."; @@ -194,9 +193,7 @@ static void _update_job_record(job_info_t *job_ptr, } gtk_tree_store_set(treestore, iter, SORTID_TIME, time_buf, -1); - if(!changed) - goto update_steps; - + gtk_tree_store_set(treestore, iter, SORTID_ALLOC, 1, -1); gtk_tree_store_set(treestore, iter, SORTID_JOBID, job_ptr->job_id, -1); @@ -249,26 +246,23 @@ static void _update_job_record(job_info_t *job_ptr, } else gtk_tree_store_set(treestore, iter, SORTID_NODELIST, nodes, -1); -update_steps: + childern = gtk_tree_model_iter_children(GTK_TREE_MODEL(treestore), &step_iter, iter); if(gtk_tree_model_iter_children(GTK_TREE_MODEL(treestore), &step_iter, iter)) _update_info_step(step_info_ptr, job_ptr->job_id, - GTK_TREE_MODEL(treestore), &step_iter, iter, - changed); + GTK_TREE_MODEL(treestore), &step_iter, iter); else _update_info_step(step_info_ptr, job_ptr->job_id, - GTK_TREE_MODEL(treestore), NULL, iter, - changed); + GTK_TREE_MODEL(treestore), NULL, iter); return; } static void _update_step_record(job_step_info_t *step_ptr, GtkTreeStore *treestore, - GtkTreeIter *iter, - int changed) + GtkTreeIter *iter) { char *nodes = NULL, time_buf[20]; char tmp_cnt[7]; @@ -278,6 +272,7 @@ static void _update_step_record(job_step_info_t *step_ptr, uint16_t nodecard = (uint16_t) NO_VAL; enum job_states state; + gtk_tree_store_set(treestore, iter, SORTID_UPDATED, 1, -1); if(!step_ptr->nodes || !strcasecmp(step_ptr->nodes,"waiting...")) { sprintf(time_buf,"0:00:00"); @@ -299,11 +294,6 @@ static void _update_step_record(job_step_info_t *step_ptr, gtk_tree_store_set(treestore, iter, SORTID_TIME, time_buf, -1); - gtk_tree_store_set(treestore, iter, SORTID_UPDATED, 1, -1); - - if(!changed) - return; - gtk_tree_store_set(treestore, iter, SORTID_ALLOC, 0, -1); gtk_tree_store_set(treestore, iter, @@ -354,7 +344,7 @@ static void _append_job_record(job_info_t *job_ptr, { gtk_tree_store_append(treestore, iter, NULL); gtk_tree_store_set(treestore, iter, SORTID_POS, line, -1); - _update_job_record(job_ptr, step_info_ptr, treestore, iter, 1); + _update_job_record(job_ptr, step_info_ptr, treestore, iter); } static void _append_step_record(job_step_info_t *step_ptr, @@ -365,15 +355,14 @@ static void _append_step_record(job_step_info_t *step_ptr, gtk_tree_store_append(treestore, &step_iter, iter); gtk_tree_store_set(treestore, &step_iter, SORTID_POS, jobid, -1); - _update_step_record(step_ptr, treestore, &step_iter, 1); + _update_step_record(step_ptr, treestore, &step_iter); } static void _update_info_step(job_step_info_response_msg_t *step_info_ptr, int jobid, GtkTreeModel *model, GtkTreeIter *step_iter, - GtkTreeIter *iter, - int changed) + GtkTreeIter *iter) { job_step_info_t step; int stepid = 0; @@ -409,8 +398,7 @@ static void _update_info_step(job_step_info_response_msg_t *step_info_ptr, /* update with new info */ _update_step_record(&step, GTK_TREE_STORE(model), - step_iter, - changed); + step_iter); goto found; } @@ -453,8 +441,7 @@ static void _update_info_step(job_step_info_response_msg_t *step_info_ptr, static void _update_info_job(job_info_msg_t *job_info_ptr, job_step_info_response_msg_t *step_info_ptr, GtkTreeView *tree_view, - specific_info_t *spec_info, - int changed) + specific_info_t *spec_info) { GtkTreePath *path = gtk_tree_path_new_first(); GtkTreeModel *model = gtk_tree_view_get_model(tree_view); @@ -483,7 +470,17 @@ static void _update_info_job(job_info_msg_t *job_info_ptr, break; } } - + /* make sure all the jobs are still here */ + if (gtk_tree_model_get_iter(model, &iter, path)) { + while(1) { + gtk_tree_store_set(GTK_TREE_STORE(model), &iter, + SORTID_UPDATED, 0, -1); + if(!gtk_tree_model_iter_next(model, &iter)) { + break; + } + } + } + for (i = 0; i < job_info_ptr->record_count; i++) { job = job_info_ptr->job_array[i]; /* get the iter, or find out the list is empty goto add */ @@ -513,8 +510,7 @@ static void _update_info_job(job_info_msg_t *job_info_ptr, /* update with new info */ _update_job_record(&job, step_info_ptr, GTK_TREE_STORE(model), - &iter, - changed); + &iter); goto found; } @@ -579,7 +575,9 @@ static void _update_info_job(job_info_msg_t *job_info_ptr, } if(host) free(host); - gtk_tree_path_free(path); + gtk_tree_path_free(path); + /* remove all old jobs */ + remove_old(model, SORTID_UPDATED); return; } @@ -647,7 +645,9 @@ void _display_info_job(job_info_msg_t *job_info_ptr, } if(!found) { - info = xstrdup("JOB ALREADY FINISHED OR NOT FOUND\n"); + char *temp = "JOB ALREADY FINISHED OR NOT FOUND\n"; + if(!not_found || strncmp(temp, not_found, strlen(temp))) + info = xstrdup(temp); xstrcat(info, not_found); } finished: @@ -673,10 +673,12 @@ extern void refresh_job(GtkAction *action, gpointer user_data) xassert(popup_win != NULL); xassert(popup_win->spec_info != NULL); xassert(popup_win->spec_info->title != NULL); + popup_win->force_refresh = 1; specific_info_job(popup_win); } -extern int get_new_info_job(job_info_msg_t **info_ptr) +extern int get_new_info_job(job_info_msg_t **info_ptr, + int force) { static job_info_msg_t *job_info_ptr = NULL, *new_job_ptr = NULL; uint16_t show_flags = 0; @@ -684,7 +686,7 @@ extern int get_new_info_job(job_info_msg_t **info_ptr) time_t now = time(NULL); static time_t last; - if((now - last) < global_sleep_time) { + if(!force && ((now - last) < global_sleep_time)) { error_code = SLURM_NO_CHANGE_IN_DATA; *info_ptr = job_info_ptr; return error_code; @@ -708,7 +710,8 @@ extern int get_new_info_job(job_info_msg_t **info_ptr) return error_code; } -extern int get_new_info_job_step(job_step_info_response_msg_t **info_ptr) +extern int get_new_info_job_step(job_step_info_response_msg_t **info_ptr, + int force) { static job_step_info_response_msg_t *old_step_ptr = NULL; static job_step_info_response_msg_t *new_step_ptr = NULL; @@ -717,7 +720,7 @@ extern int get_new_info_job_step(job_step_info_response_msg_t **info_ptr) time_t now = time(NULL); static time_t last; - if((now - last) < global_sleep_time) { + if(!force && ((now - last) < global_sleep_time)) { error_code = SLURM_NO_CHANGE_IN_DATA; *info_ptr = old_step_ptr; return error_code; @@ -767,7 +770,7 @@ extern void get_info_job(GtkTable *table, display_data_t *display_data) goto display_it; } - if((job_error_code = get_new_info_job(&job_info_ptr)) + if((job_error_code = get_new_info_job(&job_info_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA){ goto get_steps; } @@ -787,15 +790,14 @@ extern void get_info_job(GtkTable *table, display_data_t *display_data) goto end_it; } get_steps: - if((step_error_code = get_new_info_job_step(&step_info_ptr)) + if((step_error_code = get_new_info_job_step(&step_info_ptr, + force_refresh)) == SLURM_NO_CHANGE_IN_DATA){ if((!display_widget || view == ERROR_VIEW) || (job_error_code != SLURM_NO_CHANGE_IN_DATA)) goto display_it; - _update_info_job(job_info_ptr, step_info_ptr, - GTK_TREE_VIEW(display_widget), - NULL, 0); - goto end_it; + + goto update_it; } if (step_error_code != SLURM_SUCCESS) { @@ -833,11 +835,14 @@ display_it: the return value */ create_treestore(tree_view, display_data_job, SORTID_CNT); } + +update_it: view = INFO_VIEW; _update_info_job(job_info_ptr, step_info_ptr, - GTK_TREE_VIEW(display_widget), NULL, 1); + GTK_TREE_VIEW(display_widget), NULL); end_it: toggled = FALSE; + force_refresh = FALSE; return; } @@ -863,7 +868,8 @@ extern void specific_info_job(popup_info_t *popup_win) goto display_it; } - if((job_error_code = get_new_info_job(&job_info_ptr)) + if((job_error_code = + get_new_info_job(&job_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { goto get_steps; } @@ -886,21 +892,15 @@ extern void specific_info_job(popup_info_t *popup_win) goto end_it; } get_steps: - if((step_error_code = get_new_info_job_step(&step_info_ptr)) - == SLURM_NO_CHANGE_IN_DATA){ + if((step_error_code = + get_new_info_job_step(&step_info_ptr, popup_win->force_refresh)) + == SLURM_NO_CHANGE_IN_DATA) { if((!spec_info->display_widget || spec_info->view == ERROR_VIEW) - || (job_error_code != SLURM_NO_CHANGE_IN_DATA)) { + || (job_error_code != SLURM_NO_CHANGE_IN_DATA)) goto display_it; - } - if(spec_info->type != INFO_PAGE) { - _update_info_job(job_info_ptr, step_info_ptr, - GTK_TREE_VIEW( - spec_info->display_widget), - NULL, 0); - } - goto end_it; + goto update_it; } if (step_error_code != SLURM_SUCCESS) { @@ -924,11 +924,7 @@ display_it: spec_info->display_widget = NULL; } - spec_info->view = INFO_VIEW; - if(spec_info->type == INFO_PAGE) { - _display_info_job(job_info_ptr, step_info_ptr, popup_win); - goto end_it; - } else if(!spec_info->display_widget) { + if(spec_info->type != INFO_PAGE && !spec_info->display_widget) { job_and_step_info.job_info_ptr = job_info_ptr; job_and_step_info.step_info_ptr = step_info_ptr; tree_view = create_treeview(local_display_data, @@ -945,12 +941,19 @@ display_it: create_treestore(tree_view, popup_win->display_data, SORTID_CNT); } - _update_info_job(job_info_ptr, step_info_ptr, - GTK_TREE_VIEW(spec_info->display_widget), - spec_info, - 1); +update_it: + spec_info->view = INFO_VIEW; + if(spec_info->type == INFO_PAGE) { + _display_info_job(job_info_ptr, step_info_ptr, popup_win); + } else { + _update_info_job(job_info_ptr, step_info_ptr, + GTK_TREE_VIEW(spec_info->display_widget), + spec_info); + } + end_it: popup_win->toggled = 0; + popup_win->force_refresh = 0; return; } diff --git a/src/sview/node_info.c b/src/sview/node_info.c index 9c63bf8609140b0e2528930e82d35d5178b5bedf..072dcf1a2840360e9be43fcce84bc039c03e4a9f 100644 --- a/src/sview/node_info.c +++ b/src/sview/node_info.c @@ -212,10 +212,11 @@ extern void refresh_node(GtkAction *action, gpointer user_data) xassert(popup_win != NULL); xassert(popup_win->spec_info != NULL); xassert(popup_win->spec_info->title != NULL); + popup_win->force_refresh = 1; specific_info_node(popup_win); } -extern int get_new_info_node(node_info_msg_t **info_ptr) +extern int get_new_info_node(node_info_msg_t **info_ptr, int force) { static node_info_msg_t *node_info_ptr = NULL, *new_node_ptr = NULL; uint16_t show_flags = 0; @@ -223,7 +224,7 @@ extern int get_new_info_node(node_info_msg_t **info_ptr) time_t now = time(NULL); static time_t last; - if((now - last) < global_sleep_time) { + if(!force && ((now - last) < global_sleep_time)) { *info_ptr = node_info_ptr; return error_code; } @@ -269,7 +270,7 @@ extern void get_info_node(GtkTable *table, display_data_t *display_data) goto display_it; } - if((error_code = get_new_info_node(&node_info_ptr)) + if((error_code = get_new_info_node(&node_info_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if(!display_widget || view == ERROR_VIEW) goto display_it; @@ -314,6 +315,7 @@ display_it: _update_info_node(node_info_ptr, GTK_TREE_VIEW(display_widget), NULL); end_it: toggled = FALSE; + force_refresh = 1; return; } @@ -336,7 +338,8 @@ extern void specific_info_node(popup_info_t *popup_win) goto display_it; } - if((error_code = get_new_info_node(&node_info_ptr)) + if((error_code = get_new_info_node(&node_info_ptr, + popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if(!spec_info->display_widget || spec_info->view == ERROR_VIEW) goto display_it; @@ -385,6 +388,7 @@ display_it: GTK_TREE_VIEW(spec_info->display_widget), spec_info); end_it: popup_win->toggled = 0; + popup_win->force_refresh = 0; return; diff --git a/src/sview/part_info.c b/src/sview/part_info.c index c1b7dcd1c52e047e4479ffcda61fe795a05001cf..6c36e40c6d9033d8a762a2886f0d04f09c24c0f6 100644 --- a/src/sview/part_info.c +++ b/src/sview/part_info.c @@ -46,7 +46,6 @@ enum { SORTID_DISK, SORTID_NODELIST, SORTID_STATE, - SORTID_POINTER, SORTID_UPDATED, SORTID_CNT }; @@ -71,7 +70,6 @@ static display_data_t display_data_part[] = { #else {G_TYPE_STRING, SORTID_NODELIST, "NodeList", TRUE, -1, refresh_part}, #endif - {G_TYPE_POINTER, SORTID_POINTER, NULL, FALSE, -1, refresh_part}, {G_TYPE_INT, SORTID_UPDATED, NULL, FALSE, -1, refresh_part}, {G_TYPE_NONE, -1, NULL, FALSE, -1} @@ -120,9 +118,7 @@ static void _update_part_record(partition_info_t *part_ptr, { char time_buf[20]; char tmp_cnt[7]; - partition_info_t *ptr = xmalloc(sizeof(partition_info_t)); - memcpy(ptr, part_ptr, sizeof(partition_info_t)); - gtk_tree_store_set(treestore, iter, SORTID_POINTER, ptr, -1); + gtk_tree_store_set(treestore, iter, SORTID_NAME, part_ptr->name, -1); if(part_ptr->default_part) @@ -299,6 +295,59 @@ static void _update_info_part(partition_info_msg_t *part_info_ptr, remove_old(model, SORTID_UPDATED); } +void _display_info_part(partition_info_msg_t *part_info_ptr, + popup_info_t *popup_win) +{ + specific_info_t *spec_info = popup_win->spec_info; + char *name = (char *)spec_info->data; + int i, found = 0; + partition_info_t part; + char *info = NULL; + char *not_found = NULL; + GtkWidget *label = NULL; + + if(!spec_info->data) { + info = xstrdup("No pointer given!"); + goto finished; + } + + if(spec_info->display_widget) { + not_found = + xstrdup(GTK_LABEL(spec_info->display_widget)->text); + gtk_widget_destroy(spec_info->display_widget); + spec_info->display_widget = NULL; + } + for (i = 0; i < part_info_ptr->record_count; i++) { + part = part_info_ptr->partition_array[i]; + if (!part.nodes || (part.nodes[0] == '\0')) + continue; /* empty partition */ + if(!strcmp(part.name, name)) { + if(!(info = slurm_sprint_partition_info(&part, 0))) { + info = xmalloc(100); + sprintf(info, + "Problem getting partition " + "info for %s", + part.name); + } + found = 1; + break; + } + } + if(!found) { + info = xstrdup("PARTITION DOESN'T EXSIST\n"); + xstrcat(info, not_found); + } +finished: + label = gtk_label_new(info); + xfree(info); + xfree(not_found); + gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); + gtk_widget_show(label); + spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(label)); + + return; +} + void *_popup_thr_part(void *arg) { popup_thr(arg); @@ -311,10 +360,11 @@ extern void refresh_part(GtkAction *action, gpointer user_data) xassert(popup_win != NULL); xassert(popup_win->spec_info != NULL); xassert(popup_win->spec_info->title != NULL); + popup_win->force_refresh = 1; specific_info_part(popup_win); } -extern int get_new_info_part(partition_info_msg_t **part_ptr) +extern int get_new_info_part(partition_info_msg_t **part_ptr, int force) { static partition_info_msg_t *part_info_ptr = NULL; static partition_info_msg_t *new_part_ptr = NULL; @@ -322,7 +372,7 @@ extern int get_new_info_part(partition_info_msg_t **part_ptr) time_t now = time(NULL); static time_t last; - if((now - last) < global_sleep_time) { + if(!force && ((now - last) < global_sleep_time)) { *part_ptr = part_info_ptr; return error_code; } @@ -368,7 +418,7 @@ extern void get_info_part(GtkTable *table, display_data_t *display_data) goto display_it; } - if((error_code = get_new_info_part(&part_info_ptr)) + if((error_code = get_new_info_part(&part_info_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if(!display_widget || view == ERROR_VIEW) goto display_it; @@ -411,6 +461,7 @@ display_it: _update_info_part(part_info_ptr, GTK_TREE_VIEW(display_widget), NULL); end_it: toggled = FALSE; + force_refresh = 0; return; } @@ -433,14 +484,13 @@ extern void specific_info_part(popup_info_t *popup_win) goto display_it; } - if((error_code = get_new_info_part(&part_info_ptr)) + if((error_code = get_new_info_part(&part_info_ptr, + popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if(!spec_info->display_widget || spec_info->view == ERROR_VIEW) goto display_it; - _update_info_part(part_info_ptr, - GTK_TREE_VIEW(spec_info->display_widget), - spec_info); - return; + + goto update_it; } if (error_code != SLURM_SUCCESS) { @@ -468,7 +518,7 @@ display_it: spec_info->display_widget = NULL; } - if(!spec_info->display_widget) { + if(spec_info->type != INFO_PAGE && !spec_info->display_widget) { tree_view = create_treeview(local_display_data, part_info_ptr); spec_info->display_widget = @@ -483,11 +533,19 @@ display_it: create_treestore(tree_view, popup_win->display_data, SORTID_CNT); } +update_it: spec_info->view = INFO_VIEW; - _update_info_part(part_info_ptr, - GTK_TREE_VIEW(spec_info->display_widget), spec_info); + if(spec_info->type == INFO_PAGE) { + _display_info_part(part_info_ptr, popup_win); + } else { + _update_info_part(part_info_ptr, + GTK_TREE_VIEW(spec_info->display_widget), + spec_info); + } + end_it: popup_win->toggled = 0; + popup_win->force_refresh = 0; return; } @@ -555,12 +613,9 @@ extern void popup_all_part(GtkTreeModel *model, GtkTreeIter *iter, int id) ListIterator itr = NULL; popup_info_t *popup_win = NULL; GError *error = NULL; - partition_info_t *ptr = NULL; - + gtk_tree_model_get(model, iter, SORTID_NAME, &name, -1); - gtk_tree_model_get(model, iter, - SORTID_POINTER, &ptr, -1); - g_print("storing partition %s\n", ptr->name); + switch(id) { case JOB_PAGE: snprintf(title, 100, "Job(s) in partition %s", name); diff --git a/src/sview/sview.c b/src/sview/sview.c index ca2d504ef162117a7f4e4a21d5d6b22f24059998..3854a4ab03cf5860294a8f224a18a1895fb66212 100644 --- a/src/sview/sview.c +++ b/src/sview/sview.c @@ -38,6 +38,7 @@ sview_parameters_t params; int adding = 1; int fini = 0; bool toggled = FALSE; +bool force_refresh = FALSE; List popup_list; int page_running[PAGE_CNT]; int global_sleep_time = 5; @@ -114,7 +115,9 @@ static void _page_switched(GtkNotebook *notebook, GtkTable *table = GTK_TABLE(bin2->child); int i; static int running=-1; - + page_thr_t *page_thr = NULL; + GError *error = NULL; + /* make sure we aren't adding the page, and really asking for info */ if(adding) return; @@ -136,14 +139,18 @@ static void _page_switched(GtkNotebook *notebook, return; } if(main_display_data[i].get_info) { - page_thr_t *page = xmalloc(sizeof(page_thr_t)); - GError *error = NULL; running = i; page_running[i] = 1; + if(toggled || force_refresh) { + (main_display_data[i].get_info)( + table, &main_display_data[i]); + return; + } - page->page_num = i; - page->table = table; - if (!g_thread_create(_page_thr, page, FALSE, &error)) + page_thr = xmalloc(sizeof(page_thr_t)); + page_thr->page_num = i; + page_thr->table = table; + if (!g_thread_create(_page_thr, page_thr, FALSE, &error)) { g_printerr ("Failed to create YES thread: %s\n", error->message); @@ -357,6 +364,7 @@ extern void refresh_main(GtkAction *action, gpointer user_data) int page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_notebook)); if(page == -1) g_error("no pages in notebook for refresh\n"); + force_refresh = 1; _page_switched(GTK_NOTEBOOK(main_notebook), NULL, page, NULL); } diff --git a/src/sview/sview.h b/src/sview/sview.h index cd99a8af76a88adf3012f919e6f0ea40402e506e..9c41ceac8f7c0aaed1ad5c2a67e843d5795ac3c0 100644 --- a/src/sview/sview.h +++ b/src/sview/sview.h @@ -145,6 +145,7 @@ struct specific_info { struct popup_info { int type; /* window type */ int toggled; + int force_refresh; int *running; GtkWidget *popup; GtkWidget *event_box; @@ -162,6 +163,7 @@ extern void parse_command_line(int argc, char *argv[]); extern ba_system_t *ba_system_ptr; extern int quiet_flag; extern bool toggled; +extern bool force_refresh; extern List popup_list; extern int global_sleep_time; @@ -182,7 +184,7 @@ extern void tab_pressed(GtkWidget *widget, GdkEventButton *event, // part_info.c extern void refresh_part(GtkAction *action, gpointer user_data); -extern int get_new_info_part(partition_info_msg_t **part_ptr); +extern int get_new_info_part(partition_info_msg_t **part_ptr, int force); extern void get_info_part(GtkTable *table, display_data_t *display_data); extern void specific_info_part(popup_info_t *popup_win); extern void set_menus_part(void *arg, GtkTreePath *path, @@ -191,7 +193,8 @@ extern void popup_all_part(GtkTreeModel *model, GtkTreeIter *iter, int id); // block_info.c extern void refresh_block(GtkAction *action, gpointer user_data); -extern int get_new_info_node_select(node_select_info_msg_t **node_select_ptr); +extern int get_new_info_node_select(node_select_info_msg_t **node_select_ptr, + int force); extern void get_info_block(GtkTable *table, display_data_t *display_data); extern void specific_info_block(popup_info_t *popup_win); extern void set_menus_block(void *arg, GtkTreePath *path, @@ -200,8 +203,9 @@ extern void popup_all_block(GtkTreeModel *model, GtkTreeIter *iter, int id); // job_info.c extern void refresh_job(GtkAction *action, gpointer user_data); -extern int get_new_info_job(job_info_msg_t **info_ptr); -extern int get_new_info_job_step(job_step_info_response_msg_t **info_ptr); +extern int get_new_info_job(job_info_msg_t **info_ptr, int force); +extern int get_new_info_job_step(job_step_info_response_msg_t **info_ptr, + int force); extern void get_info_job(GtkTable *table, display_data_t *display_data); extern void specific_info_job(popup_info_t *popup_win); extern void set_menus_job(void *arg, GtkTreePath *path, @@ -214,7 +218,7 @@ extern void set_menus_admin(void *arg, GtkTreePath *path, GtkMenu *menu, int type); // node_info.c extern void refresh_node(GtkAction *action, gpointer user_data); -extern int get_new_info_node(node_info_msg_t **info_ptr); +extern int get_new_info_node(node_info_msg_t **info_ptr, int force); extern void get_info_node(GtkTable *table, display_data_t *display_data); extern void specific_info_node(popup_info_t *popup_win); extern void set_menus_node(void *arg, GtkTreePath *path,