mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
WIP add self prefs for statusbar
This commit is contained in:
parent
b38f6ba512
commit
95b639a21f
@ -201,6 +201,7 @@ static Autocomplete presence_ac;
|
|||||||
static Autocomplete presence_setting_ac;
|
static Autocomplete presence_setting_ac;
|
||||||
static Autocomplete winpos_ac;
|
static Autocomplete winpos_ac;
|
||||||
static Autocomplete statusbar_ac;
|
static Autocomplete statusbar_ac;
|
||||||
|
static Autocomplete statusbar_self_ac;
|
||||||
static Autocomplete statusbar_chat_ac;
|
static Autocomplete statusbar_chat_ac;
|
||||||
static Autocomplete statusbar_room_ac;
|
static Autocomplete statusbar_room_ac;
|
||||||
static Autocomplete statusbar_show_ac;
|
static Autocomplete statusbar_show_ac;
|
||||||
@ -784,9 +785,16 @@ cmd_ac_init(void)
|
|||||||
autocomplete_add(statusbar_ac, "show");
|
autocomplete_add(statusbar_ac, "show");
|
||||||
autocomplete_add(statusbar_ac, "hide");
|
autocomplete_add(statusbar_ac, "hide");
|
||||||
autocomplete_add(statusbar_ac, "maxtabs");
|
autocomplete_add(statusbar_ac, "maxtabs");
|
||||||
|
autocomplete_add(statusbar_ac, "self");
|
||||||
autocomplete_add(statusbar_ac, "chat");
|
autocomplete_add(statusbar_ac, "chat");
|
||||||
autocomplete_add(statusbar_ac, "room");
|
autocomplete_add(statusbar_ac, "room");
|
||||||
|
|
||||||
|
statusbar_self_ac = autocomplete_new();
|
||||||
|
autocomplete_add(statusbar_self_ac, "user");
|
||||||
|
autocomplete_add(statusbar_self_ac, "barejid");
|
||||||
|
autocomplete_add(statusbar_self_ac, "fulljid");
|
||||||
|
autocomplete_add(statusbar_self_ac, "off");
|
||||||
|
|
||||||
statusbar_chat_ac = autocomplete_new();
|
statusbar_chat_ac = autocomplete_new();
|
||||||
autocomplete_add(statusbar_chat_ac, "user");
|
autocomplete_add(statusbar_chat_ac, "user");
|
||||||
autocomplete_add(statusbar_chat_ac, "jid");
|
autocomplete_add(statusbar_chat_ac, "jid");
|
||||||
@ -1080,6 +1088,7 @@ cmd_ac_reset(ProfWin *window)
|
|||||||
autocomplete_reset(presence_setting_ac);
|
autocomplete_reset(presence_setting_ac);
|
||||||
autocomplete_reset(winpos_ac);
|
autocomplete_reset(winpos_ac);
|
||||||
autocomplete_reset(statusbar_ac);
|
autocomplete_reset(statusbar_ac);
|
||||||
|
autocomplete_reset(statusbar_self_ac);
|
||||||
autocomplete_reset(statusbar_chat_ac);
|
autocomplete_reset(statusbar_chat_ac);
|
||||||
autocomplete_reset(statusbar_room_ac);
|
autocomplete_reset(statusbar_room_ac);
|
||||||
autocomplete_reset(statusbar_show_ac);
|
autocomplete_reset(statusbar_show_ac);
|
||||||
@ -1211,6 +1220,7 @@ cmd_ac_uninit(void)
|
|||||||
autocomplete_free(presence_setting_ac);
|
autocomplete_free(presence_setting_ac);
|
||||||
autocomplete_free(winpos_ac);
|
autocomplete_free(winpos_ac);
|
||||||
autocomplete_free(statusbar_ac);
|
autocomplete_free(statusbar_ac);
|
||||||
|
autocomplete_free(statusbar_self_ac);
|
||||||
autocomplete_free(statusbar_chat_ac);
|
autocomplete_free(statusbar_chat_ac);
|
||||||
autocomplete_free(statusbar_room_ac);
|
autocomplete_free(statusbar_room_ac);
|
||||||
autocomplete_free(statusbar_show_ac);
|
autocomplete_free(statusbar_show_ac);
|
||||||
@ -3230,6 +3240,11 @@ _statusbar_autocomplete(ProfWin *window, const char *const input, gboolean previ
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
found = autocomplete_param_with_ac(input, "/statusbar self", statusbar_self_ac, TRUE, previous);
|
||||||
|
if (found) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
found = autocomplete_param_with_ac(input, "/statusbar chat", statusbar_chat_ac, TRUE, previous);
|
found = autocomplete_param_with_ac(input, "/statusbar chat", statusbar_chat_ac, TRUE, previous);
|
||||||
if (found) {
|
if (found) {
|
||||||
return found;
|
return found;
|
||||||
|
@ -1361,6 +1361,7 @@ static struct cmd_t command_defs[] =
|
|||||||
"/statusbar show name|number",
|
"/statusbar show name|number",
|
||||||
"/statusbar hide name|number",
|
"/statusbar hide name|number",
|
||||||
"/statusbar maxtabs <value>",
|
"/statusbar maxtabs <value>",
|
||||||
|
"/statusbar self user|barejid|fulljid|off",
|
||||||
"/statusbar chat user|jid",
|
"/statusbar chat user|jid",
|
||||||
"/statusbar room room|jid",
|
"/statusbar room room|jid",
|
||||||
"/statusbar up",
|
"/statusbar up",
|
||||||
@ -1368,16 +1369,18 @@ static struct cmd_t command_defs[] =
|
|||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Manage statusbar display preferences.")
|
"Manage statusbar display preferences.")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
|
{ "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10" },
|
||||||
{ "show|hide name", "Show or hide names in tabs." },
|
{ "show|hide name", "Show or hide names in tabs." },
|
||||||
{ "show|hide number", "Show or hide numbers in tabs." },
|
{ "show|hide number", "Show or hide numbers in tabs." },
|
||||||
{ "chat user|jid", "Show only the users name, or the full jid if no nick is present for chat tabs." },
|
{ "self user|barejid|fulljid", "Show account user name, barejid, fulljid as status bar title." },
|
||||||
{ "room room|jid", "Show only the rooms name, or the full jid for room tabs." },
|
{ "self off", "Disable showing self as status bar title." },
|
||||||
{ "up", "Move the status bar up the screen." },
|
{ "chat user|jid", "Show users name, or the fulljid if no nick is present for chat tabs." },
|
||||||
{ "down", "Move the status bar down the screen." })
|
{ "room room|jid", "Show room name, or the fulljid for room tabs." },
|
||||||
|
{ "up", "Move the status bar up the screen." },
|
||||||
|
{ "down", "Move the status bar down the screen." })
|
||||||
CMD_EXAMPLES(
|
CMD_EXAMPLES(
|
||||||
"/statusbar maxtabs 5",
|
"/statusbar maxtabs 5",
|
||||||
"/statusbar hide name",
|
"/statusbar self user",
|
||||||
"/statusbar chat jid",
|
"/statusbar chat jid",
|
||||||
"/statusbar hide name")
|
"/statusbar hide name")
|
||||||
},
|
},
|
||||||
|
@ -5846,6 +5846,35 @@ cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(args[0], "self") == 0) {
|
||||||
|
if (g_strcmp0(args[1], "barejid") == 0) {
|
||||||
|
prefs_set_string(PREF_STATUSBAR_SELF, "barejid");
|
||||||
|
cons_show("Using barejid for statusbar title.");
|
||||||
|
ui_resize();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
if (g_strcmp0(args[1], "fulljid") == 0) {
|
||||||
|
prefs_set_string(PREF_STATUSBAR_SELF, "fulljid");
|
||||||
|
cons_show("Using fulljid for statusbar title.");
|
||||||
|
ui_resize();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
if (g_strcmp0(args[1], "user") == 0) {
|
||||||
|
prefs_set_string(PREF_STATUSBAR_SELF, "user");
|
||||||
|
cons_show("Using user for statusbar title.");
|
||||||
|
ui_resize();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
if (g_strcmp0(args[1], "off") == 0) {
|
||||||
|
prefs_set_string(PREF_STATUSBAR_SELF, "off");
|
||||||
|
cons_show("Disabling statusbar title.");
|
||||||
|
ui_resize();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_strcmp0(args[0], "chat") == 0) {
|
if (g_strcmp0(args[0], "chat") == 0) {
|
||||||
if (g_strcmp0(args[1], "jid") == 0) {
|
if (g_strcmp0(args[1], "jid") == 0) {
|
||||||
prefs_set_string(PREF_STATUSBAR_CHAT, "jid");
|
prefs_set_string(PREF_STATUSBAR_CHAT, "jid");
|
||||||
|
@ -1588,6 +1588,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_CONSOLE_CHAT:
|
case PREF_CONSOLE_CHAT:
|
||||||
case PREF_STATUSBAR_SHOW_NAME:
|
case PREF_STATUSBAR_SHOW_NAME:
|
||||||
case PREF_STATUSBAR_SHOW_NUMBER:
|
case PREF_STATUSBAR_SHOW_NUMBER:
|
||||||
|
case PREF_STATUSBAR_SELF:
|
||||||
case PREF_STATUSBAR_CHAT:
|
case PREF_STATUSBAR_CHAT:
|
||||||
case PREF_STATUSBAR_ROOM:
|
case PREF_STATUSBAR_ROOM:
|
||||||
return PREF_GROUP_UI;
|
return PREF_GROUP_UI;
|
||||||
@ -1847,6 +1848,8 @@ _get_key(preference_t pref)
|
|||||||
return "statusbar.show.name";
|
return "statusbar.show.name";
|
||||||
case PREF_STATUSBAR_SHOW_NUMBER:
|
case PREF_STATUSBAR_SHOW_NUMBER:
|
||||||
return "statusbar.show.number";
|
return "statusbar.show.number";
|
||||||
|
case PREF_STATUSBAR_SELF:
|
||||||
|
return "statusbar.self";
|
||||||
case PREF_STATUSBAR_CHAT:
|
case PREF_STATUSBAR_CHAT:
|
||||||
return "statusbar.chat";
|
return "statusbar.chat";
|
||||||
case PREF_STATUSBAR_ROOM:
|
case PREF_STATUSBAR_ROOM:
|
||||||
@ -1964,6 +1967,8 @@ _get_default_string(preference_t pref)
|
|||||||
case PREF_CONSOLE_PRIVATE:
|
case PREF_CONSOLE_PRIVATE:
|
||||||
case PREF_CONSOLE_CHAT:
|
case PREF_CONSOLE_CHAT:
|
||||||
return "all";
|
return "all";
|
||||||
|
case PREF_STATUSBAR_SELF:
|
||||||
|
return "fulljid";
|
||||||
case PREF_STATUSBAR_CHAT:
|
case PREF_STATUSBAR_CHAT:
|
||||||
return "user";
|
return "user";
|
||||||
case PREF_STATUSBAR_ROOM:
|
case PREF_STATUSBAR_ROOM:
|
||||||
|
@ -145,6 +145,7 @@ typedef enum {
|
|||||||
PREF_ROOM_LIST_CACHE,
|
PREF_ROOM_LIST_CACHE,
|
||||||
PREF_STATUSBAR_SHOW_NAME,
|
PREF_STATUSBAR_SHOW_NAME,
|
||||||
PREF_STATUSBAR_SHOW_NUMBER,
|
PREF_STATUSBAR_SHOW_NUMBER,
|
||||||
|
PREF_STATUSBAR_SELF,
|
||||||
PREF_STATUSBAR_CHAT,
|
PREF_STATUSBAR_CHAT,
|
||||||
PREF_STATUSBAR_ROOM,
|
PREF_STATUSBAR_ROOM,
|
||||||
} preference_t;
|
} preference_t;
|
||||||
|
@ -1754,6 +1754,14 @@ cons_statusbar_setting(void)
|
|||||||
|
|
||||||
cons_show("Max tabs (/statusbar) : %d", prefs_get_statusbartabs());
|
cons_show("Max tabs (/statusbar) : %d", prefs_get_statusbartabs());
|
||||||
|
|
||||||
|
char *pref_self = prefs_get_string(PREF_STATUSBAR_SELF);
|
||||||
|
if (g_strcmp0(pref_self, "off") == 0) {
|
||||||
|
cons_show("Self statusbar display (/statusbar) : OFF");
|
||||||
|
} else {
|
||||||
|
cons_show("Self statusbar display (/statusbar) : %s", pref_self);
|
||||||
|
}
|
||||||
|
prefs_free_string(pref_self);
|
||||||
|
|
||||||
char *pref_chat = prefs_get_string(PREF_STATUSBAR_CHAT);
|
char *pref_chat = prefs_get_string(PREF_STATUSBAR_CHAT);
|
||||||
cons_show("Chat tab display (/statusbar) : %s", pref_chat);
|
cons_show("Chat tab display (/statusbar) : %s", pref_chat);
|
||||||
prefs_free_string(pref_chat);
|
prefs_free_string(pref_chat);
|
||||||
|
@ -137,7 +137,7 @@ ui_update(void)
|
|||||||
_ui_draw_term_title();
|
_ui_draw_term_title();
|
||||||
}
|
}
|
||||||
title_bar_update_virtual();
|
title_bar_update_virtual();
|
||||||
status_bar_update_virtual();
|
status_bar_draw();
|
||||||
inp_put_back();
|
inp_put_back();
|
||||||
doupdate();
|
doupdate();
|
||||||
|
|
||||||
@ -388,8 +388,7 @@ ui_handle_login_account_success(ProfAccount *account, gboolean secured)
|
|||||||
title_bar_set_connected(TRUE);
|
title_bar_set_connected(TRUE);
|
||||||
title_bar_set_tls(secured);
|
title_bar_set_tls(secured);
|
||||||
|
|
||||||
status_bar_print_message(connection_get_fulljid());
|
status_bar_set_prompt(connection_get_fulljid());
|
||||||
status_bar_update_virtual();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -482,8 +481,7 @@ ui_disconnected(void)
|
|||||||
title_bar_set_connected(FALSE);
|
title_bar_set_connected(FALSE);
|
||||||
title_bar_set_tls(FALSE);
|
title_bar_set_tls(FALSE);
|
||||||
title_bar_set_presence(CONTACT_OFFLINE);
|
title_bar_set_presence(CONTACT_OFFLINE);
|
||||||
status_bar_clear_message();
|
status_bar_clear_prompt();
|
||||||
status_bar_update_virtual();
|
|
||||||
ui_hide_roster();
|
ui_hide_roster();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,15 +973,14 @@ ui_win_unread(int index)
|
|||||||
char*
|
char*
|
||||||
ui_ask_password(void)
|
ui_ask_password(void)
|
||||||
{
|
{
|
||||||
status_bar_get_password();
|
status_bar_set_prompt("Enter password:");
|
||||||
status_bar_update_virtual();
|
|
||||||
return inp_get_password();
|
return inp_get_password();
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
ui_get_line(void)
|
ui_get_line(void)
|
||||||
{
|
{
|
||||||
status_bar_update_virtual();
|
status_bar_draw();
|
||||||
return inp_get_line();
|
return inp_get_line();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,8 +1003,7 @@ ui_ask_pgp_passphrase(const char *hint, int prev_fail)
|
|||||||
|
|
||||||
ui_update();
|
ui_update();
|
||||||
|
|
||||||
status_bar_get_password();
|
status_bar_set_prompt("Enter password:");
|
||||||
status_bar_update_virtual();
|
|
||||||
return inp_get_password();
|
return inp_get_password();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ inp_get_line(void)
|
|||||||
line = inp_readline();
|
line = inp_readline();
|
||||||
ui_update();
|
ui_update();
|
||||||
}
|
}
|
||||||
status_bar_clear();
|
status_bar_clear_prompt();
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ inp_get_password(void)
|
|||||||
ui_update();
|
ui_update();
|
||||||
}
|
}
|
||||||
get_password = FALSE;
|
get_password = FALSE;
|
||||||
status_bar_clear();
|
status_bar_clear_prompt();
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ typedef struct _status_bar_tab_t {
|
|||||||
|
|
||||||
typedef struct _status_bar_t {
|
typedef struct _status_bar_t {
|
||||||
gchar *time;
|
gchar *time;
|
||||||
char *message;
|
char *prompt;
|
||||||
GHashTable *tabs;
|
GHashTable *tabs;
|
||||||
int current_tab;
|
int current_tab;
|
||||||
} StatusBar;
|
} StatusBar;
|
||||||
@ -70,9 +70,8 @@ static GTimeZone *tz;
|
|||||||
static StatusBar *statusbar;
|
static StatusBar *statusbar;
|
||||||
static WINDOW *statusbar_win;
|
static WINDOW *statusbar_win;
|
||||||
|
|
||||||
static void _status_bar_draw(void);
|
|
||||||
static int _status_bar_draw_time(int pos);
|
static int _status_bar_draw_time(int pos);
|
||||||
static void _status_bar_draw_message(int pos);
|
static void _status_bar_draw_prompt(int pos);
|
||||||
static int _status_bar_draw_bracket(gboolean current, int pos, char* ch);
|
static int _status_bar_draw_bracket(gboolean current, int pos, char* ch);
|
||||||
static int _status_bar_draw_extended_tabs(int pos);
|
static int _status_bar_draw_extended_tabs(int pos);
|
||||||
static int _status_bar_draw_tab(StatusBarTab *tab, int pos, int num);
|
static int _status_bar_draw_tab(StatusBarTab *tab, int pos, int num);
|
||||||
@ -88,7 +87,7 @@ status_bar_init(void)
|
|||||||
|
|
||||||
statusbar = malloc(sizeof(StatusBar));
|
statusbar = malloc(sizeof(StatusBar));
|
||||||
statusbar->time = NULL;
|
statusbar->time = NULL;
|
||||||
statusbar->message = NULL;
|
statusbar->prompt = NULL;
|
||||||
statusbar->tabs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)_destroy_tab);
|
statusbar->tabs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)_destroy_tab);
|
||||||
StatusBarTab *console = malloc(sizeof(StatusBarTab));
|
StatusBarTab *console = malloc(sizeof(StatusBarTab));
|
||||||
console->window_type = WIN_CONSOLE;
|
console->window_type = WIN_CONSOLE;
|
||||||
@ -100,7 +99,7 @@ status_bar_init(void)
|
|||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
statusbar_win = newwin(1, cols, row, 0);
|
statusbar_win = newwin(1, cols, row, 0);
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -113,19 +112,13 @@ status_bar_close(void)
|
|||||||
if (statusbar->time) {
|
if (statusbar->time) {
|
||||||
g_free(statusbar->time);
|
g_free(statusbar->time);
|
||||||
}
|
}
|
||||||
if (statusbar->message) {
|
if (statusbar->prompt) {
|
||||||
free(statusbar->message);
|
free(statusbar->prompt);
|
||||||
}
|
}
|
||||||
free(statusbar);
|
free(statusbar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
status_bar_update_virtual(void)
|
|
||||||
{
|
|
||||||
_status_bar_draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_resize(void)
|
status_bar_resize(void)
|
||||||
{
|
{
|
||||||
@ -135,7 +128,7 @@ status_bar_resize(void)
|
|||||||
mvwin(statusbar_win, row, 0);
|
mvwin(statusbar_win, row, 0);
|
||||||
wresize(statusbar_win, 1, cols);
|
wresize(statusbar_win, 1, cols);
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -153,7 +146,7 @@ status_bar_current(int i)
|
|||||||
statusbar->current_tab = i;
|
statusbar->current_tab = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -166,7 +159,7 @@ status_bar_inactive(const int win)
|
|||||||
|
|
||||||
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER(true_win));
|
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER(true_win));
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -183,7 +176,7 @@ status_bar_active(const int win, win_type_t wintype, char *identifier)
|
|||||||
tab->window_type = wintype;
|
tab->window_type = wintype;
|
||||||
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -200,51 +193,34 @@ status_bar_new(const int win, win_type_t wintype, char* identifier)
|
|||||||
tab->window_type = wintype;
|
tab->window_type = wintype;
|
||||||
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_get_password(void)
|
status_bar_set_prompt(const char *const prompt)
|
||||||
{
|
{
|
||||||
status_bar_print_message("Enter password:");
|
if (statusbar->prompt) {
|
||||||
}
|
free(statusbar->prompt);
|
||||||
|
statusbar->prompt = NULL;
|
||||||
void
|
|
||||||
status_bar_print_message(const char *const msg)
|
|
||||||
{
|
|
||||||
if (statusbar->message) {
|
|
||||||
free(statusbar->message);
|
|
||||||
statusbar->message = NULL;
|
|
||||||
}
|
}
|
||||||
statusbar->message = strdup(msg);
|
statusbar->prompt = strdup(prompt);
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_clear(void)
|
status_bar_clear_prompt(void)
|
||||||
{
|
{
|
||||||
if (statusbar->message) {
|
if (statusbar->prompt) {
|
||||||
free(statusbar->message);
|
free(statusbar->prompt);
|
||||||
statusbar->message = NULL;
|
statusbar->prompt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_status_bar_draw();
|
status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_clear_message(void)
|
status_bar_draw(void)
|
||||||
{
|
|
||||||
if (statusbar->message) {
|
|
||||||
free(statusbar->message);
|
|
||||||
statusbar->message = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
_status_bar_draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_status_bar_draw(void)
|
|
||||||
{
|
{
|
||||||
werase(statusbar_win);
|
werase(statusbar_win);
|
||||||
wbkgd(statusbar_win, theme_attrs(THEME_STATUS_TEXT));
|
wbkgd(statusbar_win, theme_attrs(THEME_STATUS_TEXT));
|
||||||
@ -253,7 +229,7 @@ _status_bar_draw(void)
|
|||||||
|
|
||||||
pos = _status_bar_draw_time(pos);
|
pos = _status_bar_draw_time(pos);
|
||||||
|
|
||||||
_status_bar_draw_message(pos);
|
_status_bar_draw_prompt(pos);
|
||||||
|
|
||||||
pos = getmaxx(stdscr) - _tabs_width();
|
pos = getmaxx(stdscr) - _tabs_width();
|
||||||
gint max_tabs = prefs_get_statusbartabs();
|
gint max_tabs = prefs_get_statusbartabs();
|
||||||
@ -413,10 +389,10 @@ _status_bar_draw_time(int pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_status_bar_draw_message(int pos)
|
_status_bar_draw_prompt(int pos)
|
||||||
{
|
{
|
||||||
if (statusbar->message) {
|
if (statusbar->prompt) {
|
||||||
mvwprintw(statusbar_win, 0, pos, statusbar->message);
|
mvwprintw(statusbar_win, 0, pos, statusbar->prompt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,13 +36,11 @@
|
|||||||
#define UI_STATUSBAR_H
|
#define UI_STATUSBAR_H
|
||||||
|
|
||||||
void status_bar_init(void);
|
void status_bar_init(void);
|
||||||
|
void status_bar_draw(void);
|
||||||
void status_bar_close(void);
|
void status_bar_close(void);
|
||||||
void status_bar_update_virtual(void);
|
|
||||||
void status_bar_resize(void);
|
void status_bar_resize(void);
|
||||||
void status_bar_clear(void);
|
void status_bar_clear_prompt(void);
|
||||||
void status_bar_clear_message(void);
|
void status_bar_set_prompt(const char *const prompt);
|
||||||
void status_bar_get_password(void);
|
|
||||||
void status_bar_print_message(const char *const msg);
|
|
||||||
void status_bar_current(int i);
|
void status_bar_current(int i);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user