diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-command.c | 64 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 32 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 2 |
3 files changed, 72 insertions, 26 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 8872a824c..1aa79b784 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -770,25 +770,30 @@ COMMAND_CALLBACK(buffer) { if (argc > 2) { - for (i = 2; i < argc; i++) + if (string_strcasecmp (argv[2], "-all") == 0) + gui_buffer_hide_all (); + else { - ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); - if (ptr_buffer) + for (i = 2; i < argc; i++) { - number = strtol (argv[2], &error, 10); - if (error && !error[0]) + ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); + if (ptr_buffer) { - for (ptr_buffer2 = gui_buffers; ptr_buffer2; - ptr_buffer2 = ptr_buffer2->next_buffer) + number = strtol (argv[2], &error, 10); + if (error && !error[0]) { - if (ptr_buffer2->number == ptr_buffer->number) + for (ptr_buffer2 = gui_buffers; ptr_buffer2; + ptr_buffer2 = ptr_buffer2->next_buffer) { - gui_buffer_hide (ptr_buffer2); + if (ptr_buffer2->number == ptr_buffer->number) + { + gui_buffer_hide (ptr_buffer2); + } } } + else + gui_buffer_hide (ptr_buffer); } - else - gui_buffer_hide (ptr_buffer); } } } @@ -803,25 +808,30 @@ COMMAND_CALLBACK(buffer) { if (argc > 2) { - for (i = 2; i < argc; i++) + if (string_strcasecmp (argv[2], "-all") == 0) + gui_buffer_unhide_all (); + else { - ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); - if (ptr_buffer) + for (i = 2; i < argc; i++) { - number = strtol (argv[2], &error, 10); - if (error && !error[0]) + ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); + if (ptr_buffer) { - for (ptr_buffer2 = gui_buffers; ptr_buffer2; - ptr_buffer2 = ptr_buffer2->next_buffer) + number = strtol (argv[2], &error, 10); + if (error && !error[0]) { - if (ptr_buffer2->number == ptr_buffer->number) + for (ptr_buffer2 = gui_buffers; ptr_buffer2; + ptr_buffer2 = ptr_buffer2->next_buffer) { - gui_buffer_unhide (ptr_buffer2); + if (ptr_buffer2->number == ptr_buffer->number) + { + gui_buffer_unhide (ptr_buffer2); + } } } + else + gui_buffer_unhide (ptr_buffer); } - else - gui_buffer_unhide (ptr_buffer); } } } @@ -6747,8 +6757,8 @@ command_init () " || swap <number1>|<name1> [<number2>|<name2>]" " || merge <number>" " || unmerge [<number>|-all]" - " || hide [<number>|<name> [<number>|<name>...]]" - " || unhide [<number>|<name> [<number>|<name>...]]" + " || hide [<number>|<name>|-all [<number>|<name>...]]" + " || unhide [<number>|<name>|-all [<number>|<name>...]]" " || renumber [<number1> [<number2> [<start>]]]" " || close [<n1>[-<n2>]|<name>]" " || notify <level>" @@ -6821,8 +6831,10 @@ command_init () " || swap %(buffers_numbers)" " || merge %(buffers_numbers)" " || unmerge %(buffers_numbers)|-all" - " || hide %(buffers_numbers)|%(buffers_plugins_names)|%*" - " || unhide %(buffers_numbers)|%(buffers_plugins_names)|%*" + " || hide %(buffers_numbers)|%(buffers_plugins_names)|-all " + "%(buffers_numbers)|%(buffers_plugins_names)|%*" + " || unhide %(buffers_numbers)|%(buffers_plugins_names)|-all " + "%(buffers_numbers)|%(buffers_plugins_names)|%*" " || renumber %(buffers_numbers) %(buffers_numbers) %(buffers_numbers)" " || close %(buffers_plugins_names)" " || list" diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 5413e29a3..ae4a2a995 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -3467,6 +3467,22 @@ gui_buffer_hide (struct t_gui_buffer *buffer) } /* + * Hides all buffers. + */ + +void +gui_buffer_hide_all () +{ + struct t_gui_buffer *ptr_buffer; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + gui_buffer_hide (ptr_buffer); + } +} + +/* * Unhides a buffer. */ @@ -3483,6 +3499,22 @@ gui_buffer_unhide (struct t_gui_buffer *buffer) } /* + * Unhides all buffers. + */ + +void +gui_buffer_unhide_all () +{ + struct t_gui_buffer *ptr_buffer; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + gui_buffer_unhide (ptr_buffer); + } +} + +/* * Sorts buffers by layout number. */ diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index a9a55f295..fa0c6c8fa 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -316,7 +316,9 @@ extern void gui_buffer_merge (struct t_gui_buffer *buffer, extern void gui_buffer_unmerge (struct t_gui_buffer *buffer, int number); extern void gui_buffer_unmerge_all (); extern void gui_buffer_hide (struct t_gui_buffer *buffer); +extern void gui_buffer_hide_all (); extern void gui_buffer_unhide (struct t_gui_buffer *buffer); +extern void gui_buffer_unhide_all (); extern void gui_buffer_sort_by_layout_number (); extern void gui_buffer_undo_snap (struct t_gui_buffer *buffer); extern void gui_buffer_undo_snap_free (struct t_gui_buffer *buffer); |