Merge remote-tracking branch 'incertia/exit-title'

Conflicts:
	src/command/command.c
	src/config/preferences.c
	src/config/preferences.h
This commit is contained in:
James Booth
2015-01-12 01:12:42 +00:00
11 changed files with 45 additions and 8 deletions

View File

@@ -723,10 +723,12 @@ static struct cmd_t command_defs[] =
{ "/titlebar",
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
{ "/titlebar show on|off", "Show information in the window title bar.",
{ "/titlebar show on|off",
{ "/titlebar show|goodbye on|off", "Manage the terminal window title.",
{ "/titlebar show|goodbye on|off",
"---------------------",
"Show information in the window title bar.",
"Show or hide a title and exit message in the terminal window title.",
"show - Show current logged in user, and unread messages in the title.",
"goodbye - Show a message in the title when exiting profanity.",
NULL } } },
{ "/mouse",
@@ -1208,6 +1210,7 @@ cmd_init(void)
titlebar_ac = autocomplete_new();
autocomplete_add(titlebar_ac, "show");
autocomplete_add(titlebar_ac, "goodbye");
log_ac = autocomplete_new();
autocomplete_add(log_ac, "maxsize");
@@ -2497,6 +2500,11 @@ _titlebar_autocomplete(char *input, int *size)
return found;
}
found = autocomplete_param_with_func(input, size, "/titlebar goodbye", prefs_autocomplete_boolean_choice);
if (found != NULL) {
return found;
}
found = autocomplete_param_with_ac(input, size, "/titlebar", titlebar_ac, FALSE);
if (found != NULL) {
return found;

View File

@@ -3252,14 +3252,18 @@ cmd_states(gchar **args, struct cmd_help_t help)
gboolean
cmd_titlebar(gchar **args, struct cmd_help_t help)
{
if (g_strcmp0(args[0], "show") != 0) {
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
cons_show("Usage: %s", help.usage);
return TRUE;
}
if (g_strcmp0(args[1], "off") == 0) {
if (g_strcmp0(args[0], "show") == 0 && g_strcmp0(args[1], "off") == 0) {
ui_clear_win_title();
}
return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
if (g_strcmp0(args[0], "show") == 0) {
return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
} else {
return _cmd_set_boolean_preference(args[1], help, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
}
}
gboolean

View File

@@ -140,4 +140,4 @@ gboolean cmd_inpblock(gchar **args, struct cmd_help_t help);
gboolean cmd_form_field(char *tag, gchar **args);
#endif
#endif