diff --git a/src/sview/common.c b/src/sview/common.c index 8f554fe5d7995af85e25d458ff272d7283ada4d7..86f4e269fbe65ffdc9344c1a47194b5a69009260 100644 --- a/src/sview/common.c +++ b/src/sview/common.c @@ -1911,8 +1911,7 @@ extern void remove_old(GtkTreeModel *model, int updated) gtk_tree_path_free(path); } -extern GtkWidget *create_pulldown_combo(display_data_t *display_data, - int count) +extern GtkWidget *create_pulldown_combo(display_data_t *display_data) { GtkListStore *store = NULL; GtkWidget *combo = NULL; @@ -1921,12 +1920,11 @@ extern GtkWidget *create_pulldown_combo(display_data_t *display_data, int i=0; store = gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING); - for(i=0; i<count; i++) { - if (display_data[i].id == -1) - break; + while (display_data[i].id != -1) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, display_data[i].id, 1, display_data[i].name, -1); + i++; } combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); diff --git a/src/sview/popups.c b/src/sview/popups.c index af335c703206dc000ef6d895d117e7ef0f1d690b..b5c0e258f6b0506a4dbedf5129e30e64773d3277 100644 --- a/src/sview/popups.c +++ b/src/sview/popups.c @@ -697,7 +697,7 @@ extern void create_search_popup(GtkAction *action, gpointer user_data) }; sview_search_info.search_type = SEARCH_JOB_STATE; - entry = create_pulldown_combo(pulldown_display_data, JOB_END); + entry = create_pulldown_combo(pulldown_display_data); label = gtk_label_new("Which state?"); } else if (!strcmp(name, "partition_name")) { sview_search_info.search_type = SEARCH_PARTITION_NAME; @@ -713,7 +713,7 @@ extern void create_search_popup(GtkAction *action, gpointer user_data) }; sview_search_info.search_type = SEARCH_PARTITION_STATE; - entry = create_pulldown_combo(pulldown_display_data, 5); + entry = create_pulldown_combo(pulldown_display_data); label = gtk_label_new("Which state?"); } else if (!strcmp(name, "node_name")) { sview_search_info.search_type = SEARCH_NODE_NAME; @@ -758,7 +758,7 @@ extern void create_search_popup(GtkAction *action, gpointer user_data) }; sview_search_info.search_type = SEARCH_NODE_STATE; - entry = create_pulldown_combo(pulldown_display_data, PAGE_CNT); + entry = create_pulldown_combo(pulldown_display_data); label = gtk_label_new("Which state?"); } else if ((cluster_flags & CLUSTER_FLAG_BG) && !strcmp(name, "bg_block_name")) { @@ -808,7 +808,7 @@ extern void create_search_popup(GtkAction *action, gpointer user_data) } } sview_search_info.search_type = SEARCH_BLOCK_STATE; - entry = create_pulldown_combo(pulldown_display_data, PAGE_CNT); + entry = create_pulldown_combo(pulldown_display_data); label = gtk_label_new("Which state?"); } else if (!strcmp(name, "reservation_name")) { sview_search_info.search_type = SEARCH_RESERVATION_NAME; diff --git a/src/sview/sview.h b/src/sview/sview.h index baf288810a39d7049fc0b3bb195816787e616aa9..483a0b8000b8caafdbd48ad87a72b533619a1c92 100644 --- a/src/sview/sview.h +++ b/src/sview/sview.h @@ -622,8 +622,7 @@ extern gboolean delete_popups(void); extern void *popup_thr(popup_info_t *popup_win); extern void set_for_update(GtkTreeModel *model, int updated); extern void remove_old(GtkTreeModel *model, int updated); -extern GtkWidget *create_pulldown_combo(display_data_t *display_data, - int count); +extern GtkWidget *create_pulldown_combo(display_data_t *display_data); extern char *str_tolower(char *upper_str); extern char *get_reason(void); extern void display_admin_edit(GtkTable *table, void *type_msg, int *row,