Skip to content
Snippets Groups Projects
Commit 06c8f171 authored by Danny Auble's avatar Danny Auble
Browse files

better track of making the grid box

parent 92be2182
No related branches found
No related tags found
No related merge requests found
...@@ -200,8 +200,6 @@ extern int get_system_stats() ...@@ -200,8 +200,6 @@ extern int get_system_stats()
int x=0, table_x=0, table_y=0; int x=0, table_x=0, table_y=0;
int coord_x=0, coord_y=0, i=0; int coord_x=0, coord_y=0, i=0;
grid_button_t *grid_button = NULL; grid_button_t *grid_button = NULL;
/* GtkWidget *event_box = NULL; */
GdkColor color;
GError *error = NULL; GError *error = NULL;
#ifdef HAVE_BG #ifdef HAVE_BG
...@@ -223,18 +221,14 @@ update_it: ...@@ -223,18 +221,14 @@ update_it:
#ifndef HAVE_BG #ifndef HAVE_BG
if(DIM_SIZE[X] < 50) { if(DIM_SIZE[X] < 50) {
table_x = 1; table_x = 1;
table_y = DIM_SIZE[X];
} else if(DIM_SIZE[X] < 500) { } else if(DIM_SIZE[X] < 500) {
table_x = DIM_SIZE[X]; table_x = 10;
table_y = 1;
} else { } else {
table_x=20; table_x=20;
table_y = DIM_SIZE[X]/20;
if(table_y < 1)
table_y=1;
else
table_y++;
} }
table_y = DIM_SIZE[X]/table_x;
table_y++;
#else #else
if(DIM_SIZE[X] < 12) { if(DIM_SIZE[X] < 12) {
table_x = DIM_SIZE[X]; table_x = DIM_SIZE[X];
...@@ -249,7 +243,6 @@ update_it: ...@@ -249,7 +243,6 @@ update_it:
} }
#endif #endif
gtk_table_resize(main_grid_table, table_y, table_x); gtk_table_resize(main_grid_table, table_y, table_x);
gdk_color_parse("red", &color);
for (x=0; x<DIM_SIZE[X]; x++) { for (x=0; x<DIM_SIZE[X]; x++) {
#ifdef HAVE_BG #ifdef HAVE_BG
...@@ -273,8 +266,6 @@ update_it: ...@@ -273,8 +266,6 @@ update_it:
grid_button->indecies = i++; grid_button->indecies = i++;
grid_button->button = gtk_button_new(); grid_button->button = gtk_button_new();
gtk_widget_set_size_request(grid_button->button, 10, 10); gtk_widget_set_size_request(grid_button->button, 10, 10);
gtk_widget_modify_fg(grid_button->button,
GTK_STATE_NORMAL, &color);
g_signal_connect(G_OBJECT(grid_button->button), g_signal_connect(G_OBJECT(grid_button->button),
"button-press-event", "button-press-event",
G_CALLBACK(_open_node), G_CALLBACK(_open_node),
...@@ -286,12 +277,25 @@ update_it: ...@@ -286,12 +277,25 @@ update_it:
1, 1); 1, 1);
coord_x++; coord_x++;
if(coord_x == table_x) { if(coord_x == table_x) {
coord_x = 0; coord_x = 0;
coord_y++; coord_y++;
if(!(coord_y%10)) {
gtk_table_set_row_spacing(main_grid_table,
coord_y-1, 5);
}
} }
if(coord_y == table_y) if(coord_y == table_y)
break; break;
if(coord_x && !(coord_x%10)) {
gtk_table_set_col_spacing(main_grid_table,
coord_x-1, 5);
}
#endif #endif
} }
if (!g_thread_create(_blink_thr, NULL, FALSE, &error)) if (!g_thread_create(_blink_thr, NULL, FALSE, &error))
......
...@@ -437,21 +437,12 @@ int main(int argc, char *argv[]) ...@@ -437,21 +437,12 @@ int main(int argc, char *argv[])
gtk_table_set_homogeneous(main_grid_table, TRUE); gtk_table_set_homogeneous(main_grid_table, TRUE);
while(get_system_stats() != SLURM_SUCCESS) while(get_system_stats() != SLURM_SUCCESS)
sleep(10); sleep(10);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(grid_window),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
#ifdef HAVE_BG #ifdef HAVE_BG
gtk_widget_set_size_request(grid_window, 164, -1); gtk_widget_set_size_request(grid_window, 164, -1);
#else
if(DIM_SIZE[X] < 50) {
gtk_widget_set_size_request(grid_window, 54, -1);
gtk_table_set_row_spacing(main_grid_table, 9, 5);
} else if(DIM_SIZE[X] < 500) {
gtk_widget_set_size_request(grid_window, 162, -1);
gtk_table_set_row_spacing(main_grid_table, 9, 5);
} else {
gtk_widget_set_size_request(grid_window, 287, -1);
gtk_table_set_col_spacing(main_grid_table, 9, 5);
gtk_table_set_row_spacing(main_grid_table, 9, 5);
}
#endif #endif
/* fill in all static info for pages */ /* fill in all static info for pages */
/* Make a window */ /* Make a window */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment