mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Removed titlebar version property and allow disabling of titlebar display
This commit is contained in:
parent
95c081666a
commit
561d96c711
@ -56,7 +56,6 @@ static void _cmd_complete_parameters(char *input, int *size);
|
|||||||
|
|
||||||
static char * _sub_autocomplete(char *input, int *size);
|
static char * _sub_autocomplete(char *input, int *size);
|
||||||
static char * _notify_autocomplete(char *input, int *size);
|
static char * _notify_autocomplete(char *input, int *size);
|
||||||
static char * _titlebar_autocomplete(char *input, int *size);
|
|
||||||
static char * _theme_autocomplete(char *input, int *size);
|
static char * _theme_autocomplete(char *input, int *size);
|
||||||
static char * _autoaway_autocomplete(char *input, int *size);
|
static char * _autoaway_autocomplete(char *input, int *size);
|
||||||
static char * _autoconnect_autocomplete(char *input, int *size);
|
static char * _autoconnect_autocomplete(char *input, int *size);
|
||||||
@ -528,12 +527,11 @@ static struct cmd_t command_defs[] =
|
|||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/titlebar",
|
{ "/titlebar",
|
||||||
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
|
cmd_titlebar, parse_args, 1, 1, &cons_titlebar_setting,
|
||||||
{ "/titlebar property on|off", "Show various properties in the window title bar.",
|
{ "/titlebar on|off", "Show information in the window title bar.",
|
||||||
{ "/titlebar property on|off",
|
{ "/titlebar on|off",
|
||||||
"-------------------------",
|
"----------------",
|
||||||
"Show various properties in the window title bar.",
|
"Show information in the window title bar.",
|
||||||
"Currently The only supported property is 'version'.",
|
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/mouse",
|
{ "/mouse",
|
||||||
@ -1406,7 +1404,7 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
|
|
||||||
// autocomplete boolean settings
|
// autocomplete boolean settings
|
||||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
||||||
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history",
|
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
|
||||||
"/vercheck" };
|
"/vercheck" };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||||
@ -1493,7 +1491,7 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
autocompleter acs[] = { _who_autocomplete, _sub_autocomplete, _notify_autocomplete,
|
autocompleter acs[] = { _who_autocomplete, _sub_autocomplete, _notify_autocomplete,
|
||||||
_autoaway_autocomplete, _titlebar_autocomplete, _theme_autocomplete,
|
_autoaway_autocomplete, _theme_autocomplete,
|
||||||
_account_autocomplete, _roster_autocomplete, _group_autocomplete,
|
_account_autocomplete, _roster_autocomplete, _group_autocomplete,
|
||||||
_bookmark_autocomplete, _autoconnect_autocomplete, _otr_autocomplete,
|
_bookmark_autocomplete, _autoconnect_autocomplete, _otr_autocomplete,
|
||||||
_connect_autocomplete, _statuses_autocomplete, _alias_autocomplete,
|
_connect_autocomplete, _statuses_autocomplete, _alias_autocomplete,
|
||||||
@ -1664,23 +1662,6 @@ _notify_autocomplete(char *input, int *size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
|
||||||
_titlebar_autocomplete(char *input, int *size)
|
|
||||||
{
|
|
||||||
char *result = NULL;
|
|
||||||
result = autocomplete_param_with_func(input, size, "/titlebar version",
|
|
||||||
prefs_autocomplete_boolean_choice);
|
|
||||||
if (result != NULL) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = autocomplete_param_with_ac(input, size, "/titlebar", titlebar_ac);
|
|
||||||
if (result != NULL) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_autoaway_autocomplete(char *input, int *size)
|
_autoaway_autocomplete(char *input, int *size)
|
||||||
{
|
{
|
||||||
|
@ -2162,13 +2162,10 @@ cmd_states(gchar **args, struct cmd_help_t help)
|
|||||||
gboolean
|
gboolean
|
||||||
cmd_titlebar(gchar **args, struct cmd_help_t help)
|
cmd_titlebar(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
if (strcmp(args[0], "version") != 0) {
|
if (g_strcmp0(args[0], "off") == 0) {
|
||||||
cons_show("Usage: %s", help.usage);
|
ui_clear_win_title();
|
||||||
return TRUE;
|
|
||||||
} else {
|
|
||||||
return _cmd_set_boolean_preference(args[1], help,
|
|
||||||
"Show version in window title", PREF_TITLEBARVERSION);
|
|
||||||
}
|
}
|
||||||
|
return _cmd_set_boolean_preference(args[0], help, "Titlebar", PREF_TITLEBAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -371,7 +371,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_BEEP:
|
case PREF_BEEP:
|
||||||
case PREF_THEME:
|
case PREF_THEME:
|
||||||
case PREF_VERCHECK:
|
case PREF_VERCHECK:
|
||||||
case PREF_TITLEBARVERSION:
|
case PREF_TITLEBAR:
|
||||||
case PREF_FLASH:
|
case PREF_FLASH:
|
||||||
case PREF_INTYPE:
|
case PREF_INTYPE:
|
||||||
case PREF_HISTORY:
|
case PREF_HISTORY:
|
||||||
@ -418,8 +418,8 @@ _get_key(preference_t pref)
|
|||||||
return "theme";
|
return "theme";
|
||||||
case PREF_VERCHECK:
|
case PREF_VERCHECK:
|
||||||
return "vercheck";
|
return "vercheck";
|
||||||
case PREF_TITLEBARVERSION:
|
case PREF_TITLEBAR:
|
||||||
return "titlebar.version";
|
return "titlebar";
|
||||||
case PREF_FLASH:
|
case PREF_FLASH:
|
||||||
return "flash";
|
return "flash";
|
||||||
case PREF_INTYPE:
|
case PREF_INTYPE:
|
||||||
@ -474,9 +474,10 @@ _get_default_boolean(preference_t pref)
|
|||||||
{
|
{
|
||||||
switch (pref)
|
switch (pref)
|
||||||
{
|
{
|
||||||
case PREF_STATUSES:
|
case PREF_TITLEBAR:
|
||||||
case PREF_AUTOAWAY_CHECK:
|
|
||||||
case PREF_OTR_WARN:
|
case PREF_OTR_WARN:
|
||||||
|
case PREF_AUTOAWAY_CHECK:
|
||||||
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ typedef enum {
|
|||||||
PREF_BEEP,
|
PREF_BEEP,
|
||||||
PREF_VERCHECK,
|
PREF_VERCHECK,
|
||||||
PREF_THEME,
|
PREF_THEME,
|
||||||
PREF_TITLEBARVERSION,
|
PREF_TITLEBAR,
|
||||||
PREF_FLASH,
|
PREF_FLASH,
|
||||||
PREF_INTYPE,
|
PREF_INTYPE,
|
||||||
PREF_HISTORY,
|
PREF_HISTORY,
|
||||||
|
@ -1002,10 +1002,10 @@ _cons_statuses_setting(void)
|
|||||||
static void
|
static void
|
||||||
_cons_titlebar_setting(void)
|
_cons_titlebar_setting(void)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_TITLEBARVERSION)) {
|
if (prefs_get_boolean(PREF_TITLEBAR)) {
|
||||||
cons_show("Titlebar display (/titlebar) : version");
|
cons_show("Titlebar display (/titlebar) : ON");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Titlebar display (/titlebar) : NONE");
|
cons_show("Titlebar display (/titlebar) : OFF");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,9 @@ _ui_init(void)
|
|||||||
static void
|
static void
|
||||||
_ui_update_screen(void)
|
_ui_update_screen(void)
|
||||||
{
|
{
|
||||||
|
if (prefs_get_boolean(PREF_TITLEBAR)) {
|
||||||
_ui_draw_win_title();
|
_ui_draw_win_title();
|
||||||
|
}
|
||||||
title_bar_update_virtual();
|
title_bar_update_virtual();
|
||||||
status_bar_update_virtual();
|
status_bar_update_virtual();
|
||||||
inp_put_back();
|
inp_put_back();
|
||||||
@ -1500,31 +1502,13 @@ _ui_chat_win_contact_offline(PContact contact, char *resource, char *status)
|
|||||||
static void
|
static void
|
||||||
_ui_clear_win_title(void)
|
_ui_clear_win_title(void)
|
||||||
{
|
{
|
||||||
printf("\033]0;\007");
|
printf("%c]0;%c", '\033', '\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ui_draw_win_title(void)
|
_ui_draw_win_title(void)
|
||||||
{
|
{
|
||||||
char new_win_title[100];
|
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();
|
jabber_conn_status_t status = jabber_get_connection_status();
|
||||||
|
|
||||||
if (status == JABBER_CONNECTED) {
|
if (status == JABBER_CONNECTED) {
|
||||||
@ -1533,20 +1517,18 @@ _ui_draw_win_title(void)
|
|||||||
|
|
||||||
if (unread != 0) {
|
if (unread != 0) {
|
||||||
snprintf(new_win_title, sizeof(new_win_title),
|
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');
|
unread, jid, '\007');
|
||||||
} else {
|
} else {
|
||||||
snprintf(new_win_title, sizeof(new_win_title),
|
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');
|
'\007');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%s%c", '\033',
|
snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%c", '\033',
|
||||||
"Profanity", version_str->str, '\007');
|
"Profanity", '\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
g_string_free(version_str, TRUE);
|
|
||||||
|
|
||||||
if (g_strcmp0(win_title, new_win_title) != 0) {
|
if (g_strcmp0(win_title, new_win_title) != 0) {
|
||||||
// print to x-window title bar
|
// print to x-window title bar
|
||||||
printf("%s", new_win_title);
|
printf("%s", new_win_title);
|
||||||
|
Loading…
Reference in New Issue
Block a user