1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

add exit title preference to group and add command for setting the preference

This commit is contained in:
Will Song 2015-01-08 10:18:29 -06:00
parent 22a8d7a8a3
commit e57fa1633a
6 changed files with 34 additions and 2 deletions

View File

@ -726,6 +726,14 @@ static struct cmd_t command_defs[] =
"Show information in the window title bar.",
NULL } } },
{ "/exittitle",
cmd_exittitle, parse_args, 1, 1, &cons_exittitle_setting,
{ "/exittitle on|off", "Print a nice message upon exiting Profanity",
{ "/exittitle on|off",
"----------------",
"Print a nice message upon exiting Profanity",
NULL } } },
{ "/mouse",
cmd_mouse, parse_args, 1, 1, &cons_mouse_setting,
{ "/mouse on|off", "Use profanity mouse handling.",
@ -1074,6 +1082,7 @@ static Autocomplete autoaway_ac;
static Autocomplete autoaway_mode_ac;
static Autocomplete autoconnect_ac;
static Autocomplete titlebar_ac;
static Autocomplete exittitle_ac;
static Autocomplete theme_ac;
static Autocomplete theme_load_ac;
static Autocomplete account_ac;
@ -1206,6 +1215,9 @@ cmd_init(void)
titlebar_ac = autocomplete_new();
autocomplete_add(titlebar_ac, "version");
exittitle_ac = autocomplete_new();
autocomplete_add(exittitle_ac, "version");
log_ac = autocomplete_new();
autocomplete_add(log_ac, "maxsize");
autocomplete_add(log_ac, "rotate");
@ -1472,6 +1484,7 @@ cmd_uninit(void)
autocomplete_free(notify_typing_ac);
autocomplete_free(sub_ac);
autocomplete_free(titlebar_ac);
autocomplete_free(exittitle_ac);
autocomplete_free(log_ac);
autocomplete_free(prefs_ac);
autocomplete_free(autoaway_ac);
@ -1892,7 +1905,7 @@ _cmd_complete_parameters(char *input, int *size)
// autocomplete boolean settings
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
"/vercheck", "/privileges", "/presence", "/wrap" };
"/vercheck", "/privileges", "/presence", "/wrap", "/exittitle", };
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
result = autocomplete_param_with_func(input, size, boolean_choices[i],

View File

@ -3254,6 +3254,12 @@ cmd_titlebar(gchar **args, struct cmd_help_t help)
return _cmd_set_boolean_preference(args[0], help, "Titlebar", PREF_TITLEBAR);
}
gboolean
cmd_exittitle(gchar **args, struct cmd_help_t help)
{
return _cmd_set_boolean_preference(args[0], help, "Exit title", PREF_EXIT_TITLE);
}
gboolean
cmd_outtype(gchar **args, struct cmd_help_t help)
{

View File

@ -116,6 +116,7 @@ gboolean cmd_sub(gchar **args, struct cmd_help_t help);
gboolean cmd_theme(gchar **args, struct cmd_help_t help);
gboolean cmd_tiny(gchar **args, struct cmd_help_t help);
gboolean cmd_titlebar(gchar **args, struct cmd_help_t help);
gboolean cmd_exittitle(gchar **args, struct cmd_help_t help);
gboolean cmd_vercheck(gchar **args, struct cmd_help_t help);
gboolean cmd_who(gchar **args, struct cmd_help_t help);
gboolean cmd_win(gchar **args, struct cmd_help_t help);
@ -140,4 +141,4 @@ gboolean cmd_inpblock(gchar **args, struct cmd_help_t help);
gboolean cmd_form_field(char *tag, gchar **args);
#endif
#endif

View File

@ -497,6 +497,7 @@ _get_group(preference_t pref)
case PREF_THEME:
case PREF_VERCHECK:
case PREF_TITLEBAR:
case PREF_EXIT_TITLE:
case PREF_FLASH:
case PREF_INTYPE:
case PREF_HISTORY:

View File

@ -958,6 +958,16 @@ cons_titlebar_setting(void)
}
}
void
cons_exittitle_setting(void)
{
if (prefs_get_boolean(PREF_EXIT_TITLE)) {
cons_show("Exit title display (/exittitle) : ON");
} else {
cons_show("Exit title display (/exittitle) : OFF");
}
}
void
cons_roster_setting(void)
{

View File

@ -300,6 +300,7 @@ void cons_time_setting(void);
void cons_mouse_setting(void);
void cons_statuses_setting(void);
void cons_titlebar_setting(void);
void cons_exittitle_setting(void);
void cons_notify_setting(void);
void cons_show_desktop_prefs(void);
void cons_states_setting(void);