diff --git a/src/filemanager/chattr.c b/src/filemanager/chattr.c index 3f6258709..b1f2a6c9c 100644 --- a/src/filemanager/chattr.c +++ b/src/filemanager/chattr.c @@ -880,17 +880,37 @@ chattrboxes_new (int y, int x, int height, int width) { WChattrBoxes *cb; Widget *w; + WGroup *cbg; + int i; if (height <= 0) height = 1; cb = g_new0 (WChattrBoxes, 1); w = WIDGET (cb); - group_init (GROUP (cb), y, x, height, width, chattrboxes_callback, chattrboxes_mouse_callback); + cbg = GROUP (cb); + group_init (cbg, y, x, height, width, chattrboxes_callback, chattrboxes_mouse_callback); w->options |= WOP_SELECTABLE | WOP_WANT_CURSOR; w->mouse_handler = chattrboxes_handle_mouse_event; w->keymap = chattr_map; + /* create checkboxes */ + for (i = 0; i < height; i++) + { + int m; + WCheck *check; + + m = check_attr_mod[i]; + + check = check_new (i, 0, check_attr[m].state, NULL); + group_add_widget (cbg, check); + } + + chattrboxes_rename (cb); + + /* select first checkbox */ + cbg->current = cbg->widgets; + return cb; } @@ -952,7 +972,7 @@ chattr_dlg_create (WPanel * panel, const char *fname, unsigned long attr) size_t i; int y; Widget *dw; - WGroup *dg, *cbg; + WGroup *dg; WChattrBoxes *cb; const int cb_scrollbar_width = 1; @@ -996,25 +1016,11 @@ chattr_dlg_create (WPanel * panel, const char *fname, unsigned long attr) widget_set_size (dw, dw->y, dw->x, lines, cols + wx * 2); } + checkboxes_lines = MIN (check_attr_mod_num, checkboxes_lines); cb = chattrboxes_new (y++, wx, checkboxes_lines, cols); - cbg = GROUP (cb); group_add_widget_autopos (dg, cb, WPOS_KEEP_TOP | WPOS_KEEP_HORZ, NULL); - /* create checkboxes */ - for (i = 0; i < (size_t) check_attr_mod_num && i < (size_t) checkboxes_lines; i++) - { - int m; - WCheck *check; - - m = check_attr_mod[i]; - - check = check_new (i, 0, check_attr[m].state, NULL); - group_add_widget (cbg, check); - } - - chattrboxes_rename (cb); - - y += i - 1; + y += checkboxes_lines - 1; cols = 0; for (i = single_set ? (BUTTONS - 2) : 0; i < BUTTONS; i++) @@ -1057,8 +1063,6 @@ chattr_dlg_create (WPanel * panel, const char *fname, unsigned long attr) } } - /* select first checkbox */ - cbg->current = cbg->widgets; widget_select (WIDGET (cb)); return ch_dlg;