mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Option to show version in title bar with /titlebarversion
This commit is contained in:
parent
ed6c6b36c0
commit
1780148f59
@ -118,6 +118,7 @@ static gboolean _cmd_set_history(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_states(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_outtype(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_autoping(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_titlebarversion(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_vercheck(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_away(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_online(gchar **args, struct cmd_help_t help);
|
||||
@ -429,6 +430,14 @@ static struct cmd_t setting_commands[] =
|
||||
"and each time the /about command is run.",
|
||||
NULL } } },
|
||||
|
||||
{ "/titlebarversion",
|
||||
_cmd_set_titlebarversion, parse_args, 1, 1,
|
||||
{ "/titlebarversion on|off", "Check for a new release.",
|
||||
{ "/titlebarversion on|off",
|
||||
"------------------",
|
||||
"Show the version in the title bar of the window.",
|
||||
NULL } } },
|
||||
|
||||
{ "/chlog",
|
||||
_cmd_set_chlog, parse_args, 1, 1,
|
||||
{ "/chlog on|off", "Chat logging to file",
|
||||
@ -911,6 +920,8 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
prefs_autocomplete_boolean_choice);
|
||||
_parameter_autocomplete(input, size, "/vercheck",
|
||||
prefs_autocomplete_boolean_choice);
|
||||
_parameter_autocomplete(input, size, "/titlebarversion",
|
||||
prefs_autocomplete_boolean_choice);
|
||||
|
||||
_parameter_autocomplete(input, size, "/msg",
|
||||
contact_list_find_contact);
|
||||
@ -1505,6 +1516,13 @@ _cmd_set_states(gchar **args, struct cmd_help_t help)
|
||||
"Sending chat states", prefs_set_states);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_set_titlebarversion(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args, help, "/titlebarversion",
|
||||
"Show version in window title", prefs_set_titlebarversion);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_set_outtype(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
|
@ -278,6 +278,19 @@ prefs_set_vercheck(gboolean value)
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_get_titlebarversion(void)
|
||||
{
|
||||
return g_key_file_get_boolean(prefs, "ui", "titlebarversion", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_titlebarversion(gboolean value)
|
||||
{
|
||||
g_key_file_set_boolean(prefs, "ui", "titlebarversion", value);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_get_flash(void)
|
||||
{
|
||||
|
@ -57,6 +57,8 @@ gboolean prefs_get_showsplash(void);
|
||||
void prefs_set_showsplash(gboolean value);
|
||||
gboolean prefs_get_vercheck(void);
|
||||
void prefs_set_vercheck(gboolean value);
|
||||
gboolean prefs_get_titlebarversion(void);
|
||||
void prefs_set_titlebarversion(gboolean value);
|
||||
gboolean prefs_get_intype(void);
|
||||
void prefs_set_intype(gboolean value);
|
||||
gboolean prefs_get_states(void);
|
||||
|
@ -123,6 +123,16 @@ ui_init(void)
|
||||
void
|
||||
ui_refresh(void)
|
||||
{
|
||||
GString *version_str = g_string_new("");
|
||||
|
||||
if (prefs_get_titlebarversion()) {
|
||||
g_string_append(version_str, " ");
|
||||
g_string_append(version_str, PACKAGE_VERSION);
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
g_string_append(version_str, "dev");
|
||||
}
|
||||
}
|
||||
|
||||
jabber_conn_status_t status = jabber_get_connection_status();
|
||||
|
||||
if (status == JABBER_CONNECTED) {
|
||||
@ -130,14 +140,16 @@ ui_refresh(void)
|
||||
gint unread = _win_get_unread();
|
||||
|
||||
if (unread != 0) {
|
||||
printf("%c]0;*%s - %s (%d unread)%c", '\033', "Profanity", jid, unread, '\007');
|
||||
printf("%c]0;*%s%s - %s (%d unread)%c", '\033', "Profanity", version_str->str, jid, unread, '\007');
|
||||
} else {
|
||||
printf("%c]0;%s - %s%c", '\033', "Profanity", jid, '\007');
|
||||
printf("%c]0;%s%s - %s%c", '\033', "Profanity", version_str->str, jid, '\007');
|
||||
}
|
||||
} else {
|
||||
printf("%c]0;%s%c", '\033', "Profanity", '\007');
|
||||
printf("%c]0;%s%s%c", '\033', "Profanity", version_str->str, '\007');
|
||||
}
|
||||
|
||||
g_string_free(version_str, TRUE);
|
||||
|
||||
title_bar_refresh();
|
||||
status_bar_refresh();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user