Removed titlebar version property and allow disabling of titlebar display

This commit is contained in:
James Booth
2014-04-03 21:46:43 +01:00
parent 95c081666a
commit 561d96c711
6 changed files with 28 additions and 67 deletions

View File

@@ -1002,10 +1002,10 @@ _cons_statuses_setting(void)
static void
_cons_titlebar_setting(void)
{
if (prefs_get_boolean(PREF_TITLEBARVERSION)) {
cons_show("Titlebar display (/titlebar) : version");
if (prefs_get_boolean(PREF_TITLEBAR)) {
cons_show("Titlebar display (/titlebar) : ON");
} else {
cons_show("Titlebar display (/titlebar) : NONE");
cons_show("Titlebar display (/titlebar) : OFF");
}
}

View File

@@ -100,7 +100,9 @@ _ui_init(void)
static void
_ui_update_screen(void)
{
_ui_draw_win_title();
if (prefs_get_boolean(PREF_TITLEBAR)) {
_ui_draw_win_title();
}
title_bar_update_virtual();
status_bar_update_virtual();
inp_put_back();
@@ -1500,31 +1502,13 @@ _ui_chat_win_contact_offline(PContact contact, char *resource, char *status)
static void
_ui_clear_win_title(void)
{
printf("\033]0;\007");
printf("%c]0;%c", '\033', '\007');
}
static void
_ui_draw_win_title(void)
{
char new_win_title[100];
GString *version_str = g_string_new("");
if (prefs_get_boolean(PREF_TITLEBARVERSION)) {
g_string_append(version_str, " ");
g_string_append(version_str, PACKAGE_VERSION);
if (strcmp(PACKAGE_STATUS, "development") == 0) {
#ifdef HAVE_GIT_VERSION
g_string_append(version_str, "dev.");
g_string_append(version_str, PROF_GIT_BRANCH);
g_string_append(version_str, ".");
g_string_append(version_str, PROF_GIT_REVISION);
#else
g_string_append(version_str, "dev");
#endif
}
}
jabber_conn_status_t status = jabber_get_connection_status();
if (status == JABBER_CONNECTED) {
@@ -1533,20 +1517,18 @@ _ui_draw_win_title(void)
if (unread != 0) {
snprintf(new_win_title, sizeof(new_win_title),
"%c]0;%s%s (%d) - %s%c", '\033', "Profanity", version_str->str,
"%c]0;%s (%d) - %s%c", '\033', "Profanity",
unread, jid, '\007');
} else {
snprintf(new_win_title, sizeof(new_win_title),
"%c]0;%s%s - %s%c", '\033', "Profanity", version_str->str, jid,
"%c]0;%s - %s%c", '\033', "Profanity", jid,
'\007');
}
} else {
snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%s%c", '\033',
"Profanity", version_str->str, '\007');
snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%c", '\033',
"Profanity", '\007');
}
g_string_free(version_str, TRUE);
if (g_strcmp0(win_title, new_win_title) != 0) {
// print to x-window title bar
printf("%s", new_win_title);