mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 06:46:38 +02:00
core: move /input hotlist actions to new command /hotlist
Actions moved to command `/hotlist`: * `/input hotlist_clear` -> `/hotlist clear` * `/input hotlist_remove_buffer` -> `/hotlist remove` * `/input hotlist_restore_buffer` -> `/hotlist restore` * `/input hotlist_restore_all` -> `/hotlist restore -all`
This commit is contained in:
@@ -138,10 +138,10 @@ gui_key_default_bindings (int context)
|
||||
BIND(/* m-j,m-l */ "meta-jmeta-l", "/buffer +");
|
||||
BIND(/* m-j,m-r */ "meta-jmeta-r", "/server raw");
|
||||
BIND(/* m-j,m-s */ "meta-jmeta-s", "/server jump");
|
||||
BIND(/* m-h,m-c */ "meta-hmeta-c", "/input hotlist_clear");
|
||||
BIND(/* m-h,m-m */ "meta-hmeta-m", "/input hotlist_remove_buffer");
|
||||
BIND(/* m-h,m-r */ "meta-hmeta-r", "/input hotlist_restore_buffer");
|
||||
BIND(/* m-h,m-R */ "meta-hmeta-R", "/input hotlist_restore_all");
|
||||
BIND(/* m-h,m-c */ "meta-hmeta-c", "/hotlist clear");
|
||||
BIND(/* m-h,m-m */ "meta-hmeta-m", "/hotlist remove");
|
||||
BIND(/* m-h,m-r */ "meta-hmeta-r", "/hotlist restore");
|
||||
BIND(/* m-h,m-R */ "meta-hmeta-R", "/hotlist restore -all");
|
||||
BIND(/* m-k */ "meta-k", "/input grab_key_command");
|
||||
BIND(/* m-s */ "meta-s", "/mute spell toggle");
|
||||
BIND(/* m-u */ "meta-u", "/window scroll_unread");
|
||||
|
||||
+84
-1
@@ -484,6 +484,23 @@ gui_hotlist_restore_buffer (struct t_gui_buffer *buffer)
|
||||
gui_hotlist_changed_signal (buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restores latest hotlist removed in all buffers.
|
||||
*/
|
||||
|
||||
void
|
||||
gui_hotlist_restore_all_buffers ()
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
gui_hotlist_restore_buffer (ptr_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Resorts hotlist with new sort type.
|
||||
*/
|
||||
@@ -522,7 +539,7 @@ gui_hotlist_resort ()
|
||||
}
|
||||
|
||||
/*
|
||||
* Clears hotlist.
|
||||
* Clears hotlist with a level mask (integer).
|
||||
*
|
||||
* Argument "level_mask" is a combination of:
|
||||
* 1 = join/part
|
||||
@@ -560,6 +577,72 @@ gui_hotlist_clear (int level_mask)
|
||||
gui_hotlist_changed_signal (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clears hotlist with a level mask (string).
|
||||
*/
|
||||
|
||||
void
|
||||
gui_hotlist_clear_level_string (struct t_gui_buffer *buffer,
|
||||
const char *str_level_mask)
|
||||
{
|
||||
long level_mask;
|
||||
char *error;
|
||||
struct t_gui_hotlist *ptr_hotlist;
|
||||
int priority;
|
||||
|
||||
if (str_level_mask)
|
||||
{
|
||||
if (strcmp (str_level_mask, "lowest") == 0)
|
||||
{
|
||||
/* clear only lowest priority currently in hotlist */
|
||||
priority = GUI_HOTLIST_MAX + 1;
|
||||
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if ((int)ptr_hotlist->priority < priority)
|
||||
priority = ptr_hotlist->priority;
|
||||
}
|
||||
if (priority <= GUI_HOTLIST_MAX)
|
||||
{
|
||||
gui_hotlist_clear (1 << priority);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
else if (strcmp (str_level_mask, "highest") == 0)
|
||||
{
|
||||
/* clear only highest priority currently in hotlist */
|
||||
priority = GUI_HOTLIST_MIN - 1;
|
||||
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if ((int)ptr_hotlist->priority > priority)
|
||||
priority = ptr_hotlist->priority;
|
||||
}
|
||||
if (priority >= GUI_HOTLIST_MIN)
|
||||
{
|
||||
gui_hotlist_clear (1 << priority);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* clear hotlist using a mask of levels */
|
||||
error = NULL;
|
||||
level_mask = strtol (str_level_mask, &error, 10);
|
||||
if (error && !error[0] && (level_mask > 0))
|
||||
{
|
||||
gui_hotlist_clear ((int)level_mask);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_hotlist_clear (GUI_HOTLIST_MASK_MAX);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes a buffer from hotlist.
|
||||
*/
|
||||
|
||||
@@ -62,8 +62,11 @@ extern struct t_gui_hotlist *gui_hotlist_add (struct t_gui_buffer *buffer,
|
||||
enum t_gui_hotlist_priority priority,
|
||||
struct timeval *creation_time);
|
||||
extern void gui_hotlist_restore_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_hotlist_restore_all_buffers ();
|
||||
extern void gui_hotlist_resort ();
|
||||
extern void gui_hotlist_clear (int level_mask);
|
||||
extern void gui_hotlist_clear_level_string (struct t_gui_buffer *buffer,
|
||||
const char *str_level_mask);
|
||||
extern void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer,
|
||||
int force_remove_buffer);
|
||||
extern struct t_hdata *gui_hotlist_hdata_hotlist_cb (const void *pointer,
|
||||
|
||||
@@ -1460,108 +1460,6 @@ gui_input_history_global_next (struct t_gui_buffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clears hotlist (default key: alt-h, alt-c).
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_hotlist_clear (struct t_gui_buffer *buffer,
|
||||
const char *str_level_mask)
|
||||
{
|
||||
long level_mask;
|
||||
char *error;
|
||||
struct t_gui_hotlist *ptr_hotlist;
|
||||
int priority;
|
||||
|
||||
if (str_level_mask)
|
||||
{
|
||||
if (strcmp (str_level_mask, "lowest") == 0)
|
||||
{
|
||||
/* clear only lowest priority currently in hotlist */
|
||||
priority = GUI_HOTLIST_MAX + 1;
|
||||
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if ((int)ptr_hotlist->priority < priority)
|
||||
priority = ptr_hotlist->priority;
|
||||
}
|
||||
if (priority <= GUI_HOTLIST_MAX)
|
||||
{
|
||||
gui_hotlist_clear (1 << priority);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
else if (strcmp (str_level_mask, "highest") == 0)
|
||||
{
|
||||
/* clear only highest priority currently in hotlist */
|
||||
priority = GUI_HOTLIST_MIN - 1;
|
||||
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if ((int)ptr_hotlist->priority > priority)
|
||||
priority = ptr_hotlist->priority;
|
||||
}
|
||||
if (priority >= GUI_HOTLIST_MIN)
|
||||
{
|
||||
gui_hotlist_clear (1 << priority);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* clear hotlist using a mask of levels */
|
||||
error = NULL;
|
||||
level_mask = strtol (str_level_mask, &error, 10);
|
||||
if (error && !error[0] && (level_mask > 0))
|
||||
{
|
||||
gui_hotlist_clear ((int)level_mask);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_hotlist_clear (GUI_HOTLIST_MASK_MAX);
|
||||
gui_hotlist_initial_buffer = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes buffer from hotlist (default key: alt-h, alt-m).
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_hotlist_remove_buffer (struct t_gui_buffer *buffer)
|
||||
{
|
||||
gui_hotlist_remove_buffer (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restores latest hotlist removed in a buffer (default key: alt-h, alt-r).
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_hotlist_restore_buffer (struct t_gui_buffer *buffer)
|
||||
{
|
||||
gui_hotlist_restore_buffer (buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restores latest hotlist removed in all buffers (default key: alt-h, alt-R).
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_hotlist_restore_all ()
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
gui_hotlist_restore_buffer (ptr_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initializes "grab key mode" (next key will be inserted into input buffer)
|
||||
* (default key: alt-k).
|
||||
|
||||
@@ -72,11 +72,6 @@ extern void gui_input_history_local_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_local_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_global_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_global_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_hotlist_clear (struct t_gui_buffer *buffer,
|
||||
const char *level_mask);
|
||||
extern void gui_input_hotlist_remove_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_hotlist_restore_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_hotlist_restore_all ();
|
||||
extern void gui_input_grab_key (struct t_gui_buffer *buffer, int command,
|
||||
const char *delay);
|
||||
extern void gui_input_grab_mouse (struct t_gui_buffer *buffer, int area);
|
||||
|
||||
Reference in New Issue
Block a user