diff -ruB mc-4.8.0/lib/widget/listbox.c mc-4.8.0-listbox_vk111116/lib/widget/listbox.c
old
|
new
|
|
156 | 156 | else |
157 | 157 | { |
158 | 158 | WLEntry *e = (WLEntry *) le->data; |
159 | | text = e->text; |
| 159 | if (l->num_type == LISTBOX_NUMBERED) |
| 160 | { /* for the numbered list: display entry numbers in 3 characters */ |
| 161 | text = g_strdup_printf ("%-3i%s", pos, e->text); |
| 162 | } |
| 163 | else if (l->num_type == LISTBOX_NUMBERED_HOTKEYS) |
| 164 | { /* display the numbers 0..9 */ |
| 165 | if (pos <= 9) |
| 166 | text = g_strdup_printf ("%-2i%s", pos, e->text); |
| 167 | else |
| 168 | text = g_strdup_printf (" %s", e->text); |
| 169 | } |
| 170 | else |
| 171 | text = e->text; |
160 | 172 | le = g_list_next (le); |
161 | 173 | pos++; |
162 | 174 | } |
diff -ruB mc-4.8.0/lib/widget/listbox.h mc-4.8.0-listbox_vk111116/lib/widget/listbox.h
old
|
new
|
|
39 | 39 | void *data; /* Client information */ |
40 | 40 | } WLEntry; |
41 | 41 | |
| 42 | typedef enum |
| 43 | { |
| 44 | LISTBOX_UNNUMBERED = 0, /* unnumbered (default) listbox */ |
| 45 | LISTBOX_NUMBERED, /* all items in the listbox are numbered */ |
| 46 | LISTBOX_NUMBERED_HOTKEYS /* only the first ten items are numbered 0-9 (to show the hotkeys) */ |
| 47 | } listbox_numbered_t; |
| 48 | |
42 | 49 | typedef struct WListbox |
43 | 50 | { |
44 | 51 | Widget widget; |
… |
… |
|
51 | 58 | gboolean deletable; /* Can list entries be deleted? */ |
52 | 59 | lcback_fn callback; /* The callback function */ |
53 | 60 | int cursor_x, cursor_y; /* Cache the values */ |
| 61 | listbox_numbered_t num_type; /* Numbered or unnumbered list */ |
54 | 62 | } WListbox; |
55 | 63 | |
56 | 64 | /*** global variables defined in .c file *********************************************************/ |
diff -ruB mc-4.8.0/src/filemanager/hotlist.c mc-4.8.0-listbox_vk111116/src/filemanager/hotlist.c
old
|
new
|
|
326 | 326 | break; |
327 | 327 | case HL_TYPE_DOTDOT: |
328 | 328 | case HL_TYPE_ENTRY: |
329 | | if (hotlist_state.moving) |
330 | | listbox_add_item (l_movelist, LISTBOX_APPEND_AT_END, 0, current->label, current); |
331 | | else |
332 | | listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, current->label, current); |
333 | | break; |
| 329 | { |
| 330 | char *lbl = g_strdup_printf (" %s", current->label); /* add a leading space to separate |
| 331 | ordinary entries from groups */ |
| 332 | if (hotlist_state.moving) |
| 333 | listbox_add_item (l_movelist, LISTBOX_APPEND_AT_END, 0, lbl, current); |
| 334 | else |
| 335 | listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, lbl, current); |
| 336 | g_free (lbl); |
| 337 | break; |
| 338 | } |
334 | 339 | default: |
335 | 340 | break; |
336 | 341 | } |
… |
… |
|
812 | 817 | } |
813 | 818 | /* get new listbox */ |
814 | 819 | l_hotlist = listbox_new (UY + 1, UX + 1, LINES - 14, COLS - 2 * UX - 8, FALSE, l_call); |
| 820 | /* display hotkey numbers 0..9 in the listbox */ |
| 821 | l_hotlist->num_type = LISTBOX_NUMBERED_HOTKEYS; |
815 | 822 | |
816 | 823 | /* Fill the hotlist with the active VFS or the hotlist */ |
817 | 824 | #ifdef ENABLE_VFS |
… |
… |
|
976 | 983 | g_free (lbl); |
977 | 984 | } |
978 | 985 | else |
979 | | listbox_add_item (l_hotlist, pos, 0, new->label, new); |
| 986 | { |
| 987 | /* add a leading space to separate ordinary entries from groups */ |
| 988 | char *lbl = g_strdup_printf(" %s", new->label); |
| 989 | listbox_add_item (l_hotlist, pos, 0, lbl, new); |
| 990 | } |
980 | 991 | listbox_select_entry (l_hotlist, l_hotlist->pos); |
981 | 992 | } |
982 | 993 | return new; |