Preference to show/hide tab number

This commit is contained in:
James Booth
2018-03-09 23:44:28 +00:00
parent e96af8537c
commit 6f5c0eb525
7 changed files with 77 additions and 35 deletions

View File

@@ -797,6 +797,7 @@ cmd_ac_init(void)
statusbar_show_ac = autocomplete_new();
autocomplete_add(statusbar_show_ac, "name");
autocomplete_add(statusbar_show_ac, "number");
}
void

View File

@@ -1358,8 +1358,8 @@ static struct cmd_t command_defs[] =
CMD_TAGS(
CMD_TAG_UI)
CMD_SYN(
"/statusbar show name",
"/statusbar hide name",
"/statusbar show name|number",
"/statusbar hide name|number",
"/statusbar maxtabs <value>",
"/statusbar chat user|jid",
"/statusbar room room|jid",
@@ -1370,6 +1370,7 @@ static struct cmd_t command_defs[] =
CMD_ARGS(
{ "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
{ "show|hide name", "Show or hide names in tabs." },
{ "show|hide number", "Show or hide numbers in tabs." },
{ "chat user|jid", "Show only the users name, or the full jid if no nick is present for chat tabs." },
{ "room room|jid", "Show only the rooms name, or the full jid for room tabs." },
{ "up", "Move the status bar up the screen." },

View File

@@ -5776,17 +5776,39 @@ cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
ui_resize();
return TRUE;
}
if (g_strcmp0(args[1], "number") == 0) {
prefs_set_boolean(PREF_STATUSBAR_SHOW_NUMBER, TRUE);
cons_show("Enabled showing tab numbers.");
ui_resize();
return TRUE;
}
cons_bad_cmd_usage(command);
return TRUE;
}
if (g_strcmp0(args[0], "hide") == 0) {
if (g_strcmp0(args[1], "name") == 0) {
if (prefs_get_boolean(PREF_STATUSBAR_SHOW_NUMBER) == FALSE) {
cons_show("Cannot disable both names and numbers in statusbar.");
cons_show("Use '/statusbar maxtabs 0' to hide tabs.");
return TRUE;
}
prefs_set_boolean(PREF_STATUSBAR_SHOW_NAME, FALSE);
cons_show("Disabled showing tab names.");
ui_resize();
return TRUE;
}
if (g_strcmp0(args[1], "number") == 0) {
if (prefs_get_boolean(PREF_STATUSBAR_SHOW_NAME) == FALSE) {
cons_show("Cannot disable both names and numbers in statusbar.");
cons_show("Use '/statusbar maxtabs 0' to hide tabs.");
return TRUE;
}
prefs_set_boolean(PREF_STATUSBAR_SHOW_NUMBER, FALSE);
cons_show("Disabled showing tab numbers.");
ui_resize();
return TRUE;
}
cons_bad_cmd_usage(command);
return TRUE;
}