mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Renamed titlebar preference
This commit is contained in:
parent
e4d703f914
commit
c64484c6ed
@ -96,6 +96,7 @@ static char * _ban_autocomplete(char *input, int *size);
|
||||
static char * _affiliation_autocomplete(char *input, int *size);
|
||||
static char * _role_autocomplete(char *input, int *size);
|
||||
static char * _resource_autocomplete(char *input, int *size);
|
||||
static char * _titlebar_autocomplete(char *input, int *size);
|
||||
|
||||
GHashTable *commands = NULL;
|
||||
|
||||
@ -721,10 +722,10 @@ static struct cmd_t command_defs[] =
|
||||
NULL } } },
|
||||
|
||||
{ "/titlebar",
|
||||
cmd_titlebar, parse_args, 1, 1, &cons_titlebar_setting,
|
||||
{ "/titlebar on|off", "Show information in the window title bar.",
|
||||
{ "/titlebar on|off",
|
||||
"----------------",
|
||||
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
|
||||
{ "/titlebar show on|off", "Show information in the window title bar.",
|
||||
{ "/titlebar show on|off",
|
||||
"---------------------",
|
||||
"Show information in the window title bar.",
|
||||
NULL } } },
|
||||
|
||||
@ -1206,7 +1207,7 @@ cmd_init(void)
|
||||
autocomplete_add(sub_ac, "received");
|
||||
|
||||
titlebar_ac = autocomplete_new();
|
||||
autocomplete_add(titlebar_ac, "version");
|
||||
autocomplete_add(titlebar_ac, "show");
|
||||
|
||||
log_ac = autocomplete_new();
|
||||
autocomplete_add(log_ac, "maxsize");
|
||||
@ -1661,6 +1662,7 @@ cmd_reset_autocomplete()
|
||||
autocomplete_reset(roster_option_ac);
|
||||
autocomplete_reset(roster_by_ac);
|
||||
autocomplete_reset(group_ac);
|
||||
autocomplete_reset(titlebar_ac);
|
||||
autocomplete_reset(bookmark_ac);
|
||||
autocomplete_reset(bookmark_property_ac);
|
||||
autocomplete_reset(otr_ac);
|
||||
@ -1892,7 +1894,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",
|
||||
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history",
|
||||
"/vercheck", "/privileges", "/presence", "/wrap" };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||
@ -2002,6 +2004,7 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
g_hash_table_insert(ac_funcs, "/affiliation", _affiliation_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/role", _role_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/resource", _resource_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete);
|
||||
|
||||
char parsed[*size+1];
|
||||
i = 0;
|
||||
@ -2484,6 +2487,24 @@ _resource_autocomplete(char *input, int *size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_titlebar_autocomplete(char *input, int *size)
|
||||
{
|
||||
char *found = NULL;
|
||||
|
||||
found = autocomplete_param_with_func(input, size, "/titlebar show", 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;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_form_autocomplete(char *input, int *size)
|
||||
{
|
||||
|
@ -3252,10 +3252,14 @@ cmd_states(gchar **args, struct cmd_help_t help)
|
||||
gboolean
|
||||
cmd_titlebar(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
if (g_strcmp0(args[0], "off") == 0) {
|
||||
if (g_strcmp0(args[0], "show") != 0) {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(args[1], "off") == 0) {
|
||||
ui_clear_win_title();
|
||||
}
|
||||
return _cmd_set_boolean_preference(args[0], help, "Titlebar", PREF_TITLEBAR);
|
||||
return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -128,6 +128,16 @@ prefs_load(void)
|
||||
g_error_free(err);
|
||||
}
|
||||
|
||||
// move pre 0.4.6 titlebar preference
|
||||
err = NULL;
|
||||
gchar *old_titlebar = g_key_file_get_string(prefs, PREF_GROUP_UI, "titlebar", &err);
|
||||
if (err == NULL) {
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, _get_key(PREF_TITLEBAR_SHOW), old_titlebar);
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar", NULL);
|
||||
} else {
|
||||
g_error_free(err);
|
||||
}
|
||||
|
||||
_save_prefs();
|
||||
|
||||
boolean_choice_ac = autocomplete_new();
|
||||
@ -500,7 +510,7 @@ _get_group(preference_t pref)
|
||||
case PREF_BEEP:
|
||||
case PREF_THEME:
|
||||
case PREF_VERCHECK:
|
||||
case PREF_TITLEBAR:
|
||||
case PREF_TITLEBAR_SHOW:
|
||||
case PREF_FLASH:
|
||||
case PREF_INTYPE:
|
||||
case PREF_HISTORY:
|
||||
@ -571,8 +581,8 @@ _get_key(preference_t pref)
|
||||
return "theme";
|
||||
case PREF_VERCHECK:
|
||||
return "vercheck";
|
||||
case PREF_TITLEBAR:
|
||||
return "titlebar";
|
||||
case PREF_TITLEBAR_SHOW:
|
||||
return "titlebar.show";
|
||||
case PREF_FLASH:
|
||||
return "flash";
|
||||
case PREF_INTYPE:
|
||||
|
@ -54,7 +54,7 @@ typedef enum {
|
||||
PREF_BEEP,
|
||||
PREF_VERCHECK,
|
||||
PREF_THEME,
|
||||
PREF_TITLEBAR,
|
||||
PREF_TITLEBAR_SHOW,
|
||||
PREF_FLASH,
|
||||
PREF_INTYPE,
|
||||
PREF_HISTORY,
|
||||
|
@ -964,10 +964,10 @@ cons_statuses_setting(void)
|
||||
void
|
||||
cons_titlebar_setting(void)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_TITLEBAR)) {
|
||||
cons_show("Titlebar display (/titlebar) : ON");
|
||||
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
|
||||
cons_show("Titlebar show (/titlebar) : ON");
|
||||
} else {
|
||||
cons_show("Titlebar display (/titlebar) : OFF");
|
||||
cons_show("Titlebar show (/titlebar) : OFF");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ ui_update(void)
|
||||
|
||||
win_update_virtual(current);
|
||||
|
||||
if (prefs_get_boolean(PREF_TITLEBAR)) {
|
||||
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
|
||||
_ui_draw_term_title();
|
||||
}
|
||||
title_bar_update_virtual();
|
||||
|
Loading…
Reference in New Issue
Block a user