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

Rename /titlebar -> /wintitle

This commit is contained in:
James Booth 2016-09-22 21:42:00 +01:00
parent f683a704ad
commit 3983ee1d6b
11 changed files with 55 additions and 42 deletions

View File

@ -83,7 +83,7 @@ static char* _ban_autocomplete(ProfWin *window, const char *const input);
static char* _affiliation_autocomplete(ProfWin *window, const char *const input);
static char* _role_autocomplete(ProfWin *window, const char *const input);
static char* _resource_autocomplete(ProfWin *window, const char *const input);
static char* _titlebar_autocomplete(ProfWin *window, const char *const input);
static char* _wintitle_autocomplete(ProfWin *window, const char *const input);
static char* _inpblock_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);
@ -123,7 +123,7 @@ static Autocomplete autoaway_ac;
static Autocomplete autoaway_mode_ac;
static Autocomplete autoaway_presence_ac;
static Autocomplete autoconnect_ac;
static Autocomplete titlebar_ac;
static Autocomplete wintitle_ac;
static Autocomplete theme_ac;
static Autocomplete theme_load_ac;
static Autocomplete account_ac;
@ -281,9 +281,9 @@ cmd_ac_init(void)
autocomplete_add(sub_ac, "sent");
autocomplete_add(sub_ac, "received");
titlebar_ac = autocomplete_new();
autocomplete_add(titlebar_ac, "show");
autocomplete_add(titlebar_ac, "goodbye");
wintitle_ac = autocomplete_new();
autocomplete_add(wintitle_ac, "show");
autocomplete_add(wintitle_ac, "goodbye");
log_ac = autocomplete_new();
autocomplete_add(log_ac, "maxsize");
@ -965,7 +965,7 @@ cmd_ac_reset(ProfWin *window)
autocomplete_reset(roster_remove_all_ac);
autocomplete_reset(roster_private_ac);
autocomplete_reset(group_ac);
autocomplete_reset(titlebar_ac);
autocomplete_reset(wintitle_ac);
autocomplete_reset(bookmark_ac);
autocomplete_reset(bookmark_property_ac);
autocomplete_reset(otr_ac);
@ -1049,7 +1049,7 @@ cmd_ac_uninit(void)
autocomplete_free(notify_mention_ac);
autocomplete_free(notify_trigger_ac);
autocomplete_free(sub_ac);
autocomplete_free(titlebar_ac);
autocomplete_free(wintitle_ac);
autocomplete_free(log_ac);
autocomplete_free(prefs_ac);
autocomplete_free(autoaway_ac);
@ -1242,7 +1242,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
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);
g_hash_table_insert(ac_funcs, "/wintitle", _wintitle_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, "/receipts", _receipts_autocomplete);
@ -2076,21 +2076,21 @@ _resource_autocomplete(ProfWin *window, const char *const input)
}
static char*
_titlebar_autocomplete(ProfWin *window, const char *const input)
_wintitle_autocomplete(ProfWin *window, const char *const input)
{
char *found = NULL;
found = autocomplete_param_with_func(input, "/titlebar show", prefs_autocomplete_boolean_choice);
found = autocomplete_param_with_func(input, "/wintitle show", prefs_autocomplete_boolean_choice);
if (found) {
return found;
}
found = autocomplete_param_with_func(input, "/titlebar goodbye", prefs_autocomplete_boolean_choice);
found = autocomplete_param_with_func(input, "/wintitle goodbye", prefs_autocomplete_boolean_choice);
if (found) {
return found;
}
found = autocomplete_param_with_ac(input, "/titlebar", titlebar_ac, FALSE);
found = autocomplete_param_with_ac(input, "/wintitle", wintitle_ac, FALSE);
if (found) {
return found;
}

View File

@ -1492,15 +1492,15 @@ static struct cmd_t command_defs[] =
CMD_NOEXAMPLES
},
{ "/titlebar",
parse_args, 2, 2, &cons_titlebar_setting,
{ "/wintitle",
parse_args, 2, 2, &cons_wintitle_setting,
CMD_NOSUBFUNCS
CMD_MAINFUNC(cmd_titlebar)
CMD_MAINFUNC(cmd_wintitle)
CMD_TAGS(
CMD_TAG_UI)
CMD_SYN(
"/titlebar show on|off",
"/titlebar goodbye on|off")
"/wintitle show on|off",
"/wintitle goodbye on|off")
CMD_DESC(
"Allow Profanity to modify the window title bar.")
CMD_ARGS(

View File

@ -5057,7 +5057,7 @@ cmd_states(ProfWin *window, const char *const command, gchar **args)
}
gboolean
cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
cmd_wintitle(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
cons_bad_cmd_usage(command);
@ -5067,9 +5067,9 @@ cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
ui_clear_win_title();
}
if (g_strcmp0(args[0], "show") == 0) {
_cmd_set_boolean_preference(args[1], command, "Titlebar show", PREF_TITLEBAR_SHOW);
_cmd_set_boolean_preference(args[1], command, "Window title show", PREF_WINTITLE_SHOW);
} else {
_cmd_set_boolean_preference(args[1], command, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
_cmd_set_boolean_preference(args[1], command, "Window title goodbye", PREF_WINTITLE_GOODBYE);
}
return TRUE;

View File

@ -128,7 +128,7 @@ gboolean cmd_status(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_sub(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_theme(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_tiny(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_wintitle(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_vercheck(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);

View File

@ -143,6 +143,19 @@ prefs_load(void)
prefs_free_string(value);
}
// move pre 0.5.0 titlebar settings to wintitle
if (g_key_file_has_key(prefs, PREF_GROUP_UI, "titlebar.show", NULL)) {
gboolean show = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "titlebar.show", NULL);
g_key_file_set_boolean(prefs, PREF_GROUP_UI, "wintitle.show", show);
g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar.show", NULL);
}
if (g_key_file_has_key(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL)) {
gboolean goodbye = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL);
g_key_file_set_boolean(prefs, PREF_GROUP_UI, "wintitle.goodbye", goodbye);
g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL);
}
_save_prefs();
boolean_choice_ac = autocomplete_new();
@ -1162,8 +1175,8 @@ _get_group(preference_t pref)
case PREF_BEEP:
case PREF_THEME:
case PREF_VERCHECK:
case PREF_TITLEBAR_SHOW:
case PREF_TITLEBAR_GOODBYE:
case PREF_WINTITLE_SHOW:
case PREF_WINTITLE_GOODBYE:
case PREF_FLASH:
case PREF_INTYPE:
case PREF_HISTORY:
@ -1282,10 +1295,10 @@ _get_key(preference_t pref)
return "theme";
case PREF_VERCHECK:
return "vercheck";
case PREF_TITLEBAR_SHOW:
return "titlebar.show";
case PREF_TITLEBAR_GOODBYE:
return "titlebar.goodbye";
case PREF_WINTITLE_SHOW:
return "wintitle.show";
case PREF_WINTITLE_GOODBYE:
return "wintitle.goodbye";
case PREF_FLASH:
return "flash";
case PREF_TRAY:

View File

@ -49,8 +49,8 @@ typedef enum {
PREF_BEEP,
PREF_VERCHECK,
PREF_THEME,
PREF_TITLEBAR_SHOW,
PREF_TITLEBAR_GOODBYE,
PREF_WINTITLE_SHOW,
PREF_WINTITLE_GOODBYE,
PREF_FLASH,
PREF_TRAY,
PREF_TRAY_READ,

View File

@ -208,8 +208,8 @@ _init(char *log_level)
static void
_shutdown(void)
{
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
if (prefs_get_boolean(PREF_WINTITLE_SHOW)) {
if (prefs_get_boolean(PREF_WINTITLE_GOODBYE)) {
ui_goodbye_title();
} else {
ui_clear_win_title();

View File

@ -1339,17 +1339,17 @@ cons_vercheck_setting(void)
}
void
cons_titlebar_setting(void)
cons_wintitle_setting(void)
{
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
cons_show("Titlebar show (/titlebar) : ON");
if (prefs_get_boolean(PREF_WINTITLE_SHOW)) {
cons_show("Window title show (/wintitle) : ON");
} else {
cons_show("Titlebar show (/titlebar) : OFF");
cons_show("Window title show (/wintitle) : OFF");
}
if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
cons_show("Titlebar goodbye (/titlebar) : ON");
if (prefs_get_boolean(PREF_WINTITLE_GOODBYE)) {
cons_show("Window title goodbye (/wintitle) : ON");
} else {
cons_show("Titlebar goodbye (/titlebar) : OFF");
cons_show("Window title goodbye (/wintitle) : OFF");
}
}
@ -1544,7 +1544,7 @@ cons_show_ui_prefs(void)
cons_occupants_setting();
cons_roster_setting();
cons_privileges_setting();
cons_titlebar_setting();
cons_wintitle_setting();
cons_encwarn_setting();
cons_presence_setting();
cons_inpblock_setting();

View File

@ -133,7 +133,7 @@ ui_update(void)
win_update_virtual(current);
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
if (prefs_get_boolean(PREF_WINTITLE_SHOW)) {
_ui_draw_term_title();
}
title_bar_update_virtual();

View File

@ -299,7 +299,7 @@ void cons_presence_setting(void);
void cons_wrap_setting(void);
void cons_winstidy_setting(void);
void cons_time_setting(void);
void cons_titlebar_setting(void);
void cons_wintitle_setting(void);
void cons_notify_setting(void);
void cons_show_desktop_prefs(void);
void cons_states_setting(void);

View File

@ -428,7 +428,7 @@ void cons_encwarn_setting(void) {}
void cons_time_setting(void) {}
void cons_mouse_setting(void) {}
void cons_statuses_setting(void) {}
void cons_titlebar_setting(void) {}
void cons_wintitle_setting(void) {}
void cons_notify_setting(void) {}
void cons_states_setting(void) {}
void cons_outtype_setting(void) {}