Moved /winstidy command to /wins autotidy
This commit is contained in:
@@ -105,6 +105,7 @@ static char * _inpblock_autocomplete(ProfWin *window, const char * const input);
|
|||||||
static char * _time_autocomplete(ProfWin *window, const char * const input);
|
static char * _time_autocomplete(ProfWin *window, const char * const input);
|
||||||
static char * _receipts_autocomplete(ProfWin *window, const char * const input);
|
static char * _receipts_autocomplete(ProfWin *window, const char * const input);
|
||||||
static char * _help_autocomplete(ProfWin *window, const char * const input);
|
static char * _help_autocomplete(ProfWin *window, const char * const input);
|
||||||
|
static char * _wins_autocomplete(ProfWin *window, const char * const input);
|
||||||
|
|
||||||
GHashTable *commands = NULL;
|
GHashTable *commands = NULL;
|
||||||
|
|
||||||
@@ -697,14 +698,16 @@ static struct cmd_t command_defs[] =
|
|||||||
CMD_TAG_UI)
|
CMD_TAG_UI)
|
||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/wins tidy",
|
"/wins tidy",
|
||||||
|
"/wins autotidy on|off",
|
||||||
"/wins prune",
|
"/wins prune",
|
||||||
"/wins swap <source> <target>")
|
"/wins swap <source> <target>")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Manage windows. "
|
"Manage windows. "
|
||||||
"Passing no argument will list all currently active windows and information about their usage.")
|
"Passing no argument will list all currently active windows and information about their usage.")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "tidy", "Move windows so there are no gaps." },
|
{ "tidy", "Move windows so there are no gaps." },
|
||||||
{ "prune", "Close all windows with no unread messages, and then tidy so there are no gaps." },
|
{ "autotidy on|off", "Automatically remove gaps when closing windows." },
|
||||||
|
{ "prune", "Close all windows with no unread messages, and then tidy so there are no gaps." },
|
||||||
{ "swap <source> <target>", "Swap windows, target may be an empty position." })
|
{ "swap <source> <target>", "Swap windows, target may be an empty position." })
|
||||||
CMD_NOEXAMPLES
|
CMD_NOEXAMPLES
|
||||||
},
|
},
|
||||||
@@ -893,19 +896,6 @@ static struct cmd_t command_defs[] =
|
|||||||
CMD_NOEXAMPLES
|
CMD_NOEXAMPLES
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "/winstidy",
|
|
||||||
cmd_winstidy, parse_args, 1, 1, &cons_winstidy_setting,
|
|
||||||
CMD_TAGS(
|
|
||||||
CMD_TAG_UI)
|
|
||||||
CMD_SYN(
|
|
||||||
"/winstidy on|off")
|
|
||||||
CMD_DESC(
|
|
||||||
"Auto tidy windows, when a window is closed, windows will be moved to fill the gap.")
|
|
||||||
CMD_ARGS(
|
|
||||||
{ "on|off", "Enable or disable auto window tidy." })
|
|
||||||
CMD_NOEXAMPLES
|
|
||||||
},
|
|
||||||
|
|
||||||
{ "/time",
|
{ "/time",
|
||||||
cmd_time, parse_args, 1, 3, &cons_time_setting,
|
cmd_time, parse_args, 1, 3, &cons_time_setting,
|
||||||
CMD_TAGS(
|
CMD_TAGS(
|
||||||
@@ -1872,6 +1862,7 @@ cmd_init(void)
|
|||||||
wins_ac = autocomplete_new();
|
wins_ac = autocomplete_new();
|
||||||
autocomplete_add(wins_ac, "prune");
|
autocomplete_add(wins_ac, "prune");
|
||||||
autocomplete_add(wins_ac, "tidy");
|
autocomplete_add(wins_ac, "tidy");
|
||||||
|
autocomplete_add(wins_ac, "autotidy");
|
||||||
autocomplete_add(wins_ac, "swap");
|
autocomplete_add(wins_ac, "swap");
|
||||||
|
|
||||||
roster_ac = autocomplete_new();
|
roster_ac = autocomplete_new();
|
||||||
@@ -2534,8 +2525,8 @@ _cmd_complete_parameters(ProfWin *window, const char * const input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *cmds[] = { "/prefs", "/disco", "/close", "/wins", "/subject", "/room" };
|
gchar *cmds[] = { "/prefs", "/disco", "/close", "/subject", "/room" };
|
||||||
Autocomplete completers[] = { prefs_ac, disco_ac, close_ac, wins_ac, subject_ac, room_ac };
|
Autocomplete completers[] = { prefs_ac, disco_ac, close_ac, subject_ac, room_ac };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||||
result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE);
|
result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE);
|
||||||
@@ -2574,6 +2565,7 @@ _cmd_complete_parameters(ProfWin *window, const char * const input)
|
|||||||
g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
|
g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
|
g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
|
g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
|
||||||
|
g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete);
|
||||||
|
|
||||||
int len = strlen(input);
|
int len = strlen(input);
|
||||||
char parsed[len+1];
|
char parsed[len+1];
|
||||||
@@ -3462,6 +3454,24 @@ _statuses_autocomplete(ProfWin *window, const char * const input)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_wins_autocomplete(ProfWin *window, const char * const input)
|
||||||
|
{
|
||||||
|
char *result = NULL;
|
||||||
|
|
||||||
|
result = autocomplete_param_with_func(input, "/wins autotidy", prefs_autocomplete_boolean_choice);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = autocomplete_param_with_ac(input, "/wins", wins_ac, TRUE);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_receipts_autocomplete(ProfWin *window, const char * const input)
|
_receipts_autocomplete(ProfWin *window, const char * const input)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -747,6 +747,17 @@ cmd_wins(ProfWin *window, const char * const command, gchar **args)
|
|||||||
cons_show("Same source and target window supplied.");
|
cons_show("Same source and target window supplied.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(args[0], "autotidy") == 0) {
|
||||||
|
if (g_strcmp0(args[1], "on") == 0) {
|
||||||
|
cons_show("Window autotidy enabled");
|
||||||
|
prefs_set_boolean(PREF_WINS_AUTO_TIDY, TRUE);
|
||||||
|
ui_tidy_wins();
|
||||||
|
} else if (g_strcmp0(args[1], "off") == 0) {
|
||||||
|
cons_show("Window autotidy disabled");
|
||||||
|
prefs_set_boolean(PREF_WINS_AUTO_TIDY, FALSE);
|
||||||
|
} else {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
}
|
}
|
||||||
@@ -754,18 +765,6 @@ cmd_wins(ProfWin *window, const char * const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
cmd_winstidy(ProfWin *window, const char * const command, gchar **args)
|
|
||||||
{
|
|
||||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Wins Auto Tidy", PREF_WINS_AUTO_TIDY);
|
|
||||||
|
|
||||||
if (result && g_strcmp0(args[0], "on") == 0) {
|
|
||||||
ui_tidy_wins();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_win(ProfWin *window, const char * const command, gchar **args)
|
cmd_win(ProfWin *window, const char * const command, gchar **args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ gboolean cmd_vercheck(ProfWin *window, const char * const command, gchar **args)
|
|||||||
gboolean cmd_who(ProfWin *window, const char * const command, gchar **args);
|
gboolean cmd_who(ProfWin *window, const char * const command, gchar **args);
|
||||||
gboolean cmd_win(ProfWin *window, const char * const command, gchar **args);
|
gboolean cmd_win(ProfWin *window, const char * const command, gchar **args);
|
||||||
gboolean cmd_wins(ProfWin *window, const char * const command, gchar **args);
|
gboolean cmd_wins(ProfWin *window, const char * const command, gchar **args);
|
||||||
gboolean cmd_winstidy(ProfWin *window, const char * const command, gchar **args);
|
|
||||||
gboolean cmd_xa(ProfWin *window, const char * const command, gchar **args);
|
gboolean cmd_xa(ProfWin *window, const char * const command, gchar **args);
|
||||||
gboolean cmd_alias(ProfWin *window, const char * const command, gchar **args);
|
gboolean cmd_alias(ProfWin *window, const char * const command, gchar **args);
|
||||||
gboolean cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args);
|
gboolean cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args);
|
||||||
|
|||||||
@@ -923,9 +923,9 @@ void
|
|||||||
cons_winstidy_setting(void)
|
cons_winstidy_setting(void)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_WINS_AUTO_TIDY))
|
if (prefs_get_boolean(PREF_WINS_AUTO_TIDY))
|
||||||
cons_show("Window Auto Tidy (/winstidy) : ON");
|
cons_show("Window Auto Tidy (/wins) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Window Auto Tidy (/winstidy) : OFF");
|
cons_show("Window Auto Tidy (/wins) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user