Removed titlebar functions from ui.h
This commit is contained in:
@@ -351,6 +351,70 @@ _ui_group_removed(const char * const contact, const char * const group)
|
||||
cons_show("%s removed from group %s", contact, group);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_auto_away(void)
|
||||
{
|
||||
if (prefs_get_string(PREF_AUTOAWAY_MESSAGE) != NULL) {
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
||||
RESOURCE_AWAY);
|
||||
cons_show("Idle for %d minutes, status set to away (priority %d), \"%s\".",
|
||||
prefs_get_autoaway_time(), pri, prefs_get_string(PREF_AUTOAWAY_MESSAGE));
|
||||
title_bar_set_presence(CONTACT_AWAY);
|
||||
ui_current_page_off();
|
||||
} else {
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
||||
RESOURCE_AWAY);
|
||||
cons_show("Idle for %d minutes, status set to away (priority %d).",
|
||||
prefs_get_autoaway_time(), pri);
|
||||
title_bar_set_presence(CONTACT_AWAY);
|
||||
ui_current_page_off();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_end_auto_away(void)
|
||||
{
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(), RESOURCE_ONLINE);
|
||||
cons_show("No longer idle, status set to online (priority %d).", pri);
|
||||
title_bar_set_presence(CONTACT_ONLINE);
|
||||
ui_current_page_off();
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_titlebar_presence(contact_presence_t presence)
|
||||
{
|
||||
title_bar_set_presence(presence);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_handle_login_account_success(ProfAccount *account)
|
||||
{
|
||||
resource_presence_t resource_presence = accounts_get_login_presence(account->name);
|
||||
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
|
||||
cons_show_login_success(account);
|
||||
title_bar_set_presence(contact_presence);
|
||||
ui_current_page_off();
|
||||
status_bar_print_message(account->jid);
|
||||
status_bar_update_virtual();
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_update_presence(const resource_presence_t resource_presence,
|
||||
const char * const message, const char * const show)
|
||||
{
|
||||
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
|
||||
title_bar_set_presence(contact_presence);
|
||||
gint priority = accounts_get_priority_for_presence_type(jabber_get_account_name(), resource_presence);
|
||||
if (message != NULL) {
|
||||
cons_show("Status set to %s (priority %d), \"%s\".", show, priority, message);
|
||||
} else {
|
||||
cons_show("Status set to %s (priority %d).", show, priority);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg)
|
||||
{
|
||||
@@ -1775,4 +1839,9 @@ ui_init_module(void)
|
||||
ui_handle_error = _ui_handle_error;
|
||||
ui_current_update_virtual = _ui_current_update_virtual;
|
||||
ui_clear_win_title = _ui_clear_win_title;
|
||||
ui_auto_away = _ui_auto_away;
|
||||
ui_end_auto_away = _ui_end_auto_away;
|
||||
ui_titlebar_presence = _ui_titlebar_presence;
|
||||
ui_handle_login_account_success = _ui_handle_login_account_success;
|
||||
ui_update_presence =_ui_update_presence;
|
||||
}
|
||||
|
||||
@@ -57,33 +57,8 @@ create_title_bar(void)
|
||||
inp_put_back();
|
||||
}
|
||||
|
||||
static void
|
||||
_title_bar_console(void)
|
||||
{
|
||||
werase(win);
|
||||
current_recipient = NULL;
|
||||
typing = FALSE;
|
||||
typing_elapsed = NULL;
|
||||
|
||||
free(current_title);
|
||||
current_title = strdup(CONSOLE_TITLE);
|
||||
|
||||
_title_bar_draw();
|
||||
}
|
||||
|
||||
static void
|
||||
_title_bar_resize(void)
|
||||
{
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
wresize(win, 1, cols);
|
||||
wbkgd(win, COLOUR_TITLE_TEXT);
|
||||
|
||||
_title_bar_draw();
|
||||
}
|
||||
|
||||
static void
|
||||
_title_bar_update_virtual(void)
|
||||
void
|
||||
title_bar_update_virtual(void)
|
||||
{
|
||||
if (current_recipient != NULL) {
|
||||
|
||||
@@ -102,15 +77,40 @@ _title_bar_update_virtual(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_title_bar_set_presence(contact_presence_t presence)
|
||||
void
|
||||
title_bar_resize(void)
|
||||
{
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
wresize(win, 1, cols);
|
||||
wbkgd(win, COLOUR_TITLE_TEXT);
|
||||
|
||||
_title_bar_draw();
|
||||
}
|
||||
|
||||
void
|
||||
title_bar_console(void)
|
||||
{
|
||||
werase(win);
|
||||
current_recipient = NULL;
|
||||
typing = FALSE;
|
||||
typing_elapsed = NULL;
|
||||
|
||||
free(current_title);
|
||||
current_title = strdup(CONSOLE_TITLE);
|
||||
|
||||
_title_bar_draw();
|
||||
}
|
||||
|
||||
void
|
||||
title_bar_set_presence(contact_presence_t presence)
|
||||
{
|
||||
current_presence = presence;
|
||||
_title_bar_draw();
|
||||
}
|
||||
|
||||
static void
|
||||
_title_bar_set_recipient(const char * const recipient)
|
||||
void
|
||||
title_bar_set_recipient(const char * const recipient)
|
||||
{
|
||||
if (typing_elapsed != NULL) {
|
||||
g_timer_destroy(typing_elapsed);
|
||||
@@ -127,8 +127,8 @@ _title_bar_set_recipient(const char * const recipient)
|
||||
_title_bar_draw();
|
||||
}
|
||||
|
||||
static void
|
||||
_title_bar_set_typing(gboolean is_typing)
|
||||
void
|
||||
title_bar_set_typing(gboolean is_typing)
|
||||
{
|
||||
if (is_typing) {
|
||||
if (typing_elapsed != NULL) {
|
||||
@@ -257,15 +257,4 @@ _title_bar_draw(void)
|
||||
|
||||
wnoutrefresh(win);
|
||||
inp_put_back();
|
||||
}
|
||||
|
||||
void
|
||||
titlebar_init_module(void)
|
||||
{
|
||||
title_bar_console = _title_bar_console;
|
||||
title_bar_resize = _title_bar_resize;
|
||||
title_bar_update_virtual = _title_bar_update_virtual;
|
||||
title_bar_set_presence = _title_bar_set_presence;
|
||||
title_bar_set_recipient = _title_bar_set_recipient;
|
||||
title_bar_set_typing = _title_bar_set_typing;
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
void create_title_bar(void);
|
||||
void create_title_bar(void);
|
||||
void title_bar_update_virtual(void);
|
||||
void title_bar_resize(void);
|
||||
void title_bar_console(void);
|
||||
void title_bar_set_presence(contact_presence_t presence);
|
||||
void title_bar_set_recipient(const char * const from);
|
||||
void title_bar_set_typing(gboolean is_typing);
|
||||
16
src/ui/ui.h
16
src/ui/ui.h
@@ -46,7 +46,6 @@ void console_init_module(void);
|
||||
void inputwin_init_module(void);
|
||||
void notifier_init_module(void);
|
||||
void statusbar_init_module(void);
|
||||
void titlebar_init_module(void);
|
||||
|
||||
// ui startup and control
|
||||
void (*ui_init)(void);
|
||||
@@ -148,18 +147,17 @@ gboolean (*ui_duck_exists)(void);
|
||||
void (*ui_tidy_wins)(void);
|
||||
void (*ui_prune_wins)(void);
|
||||
|
||||
void (*ui_auto_away)(void);
|
||||
void (*ui_end_auto_away)(void);
|
||||
void (*ui_titlebar_presence)(contact_presence_t presence);
|
||||
void (*ui_handle_login_account_success)(ProfAccount *account);
|
||||
void (*ui_update_presence)(const resource_presence_t resource_presence,
|
||||
const char * const message, const char * const show);
|
||||
|
||||
// create windows
|
||||
void (*create_status_bar)(void);
|
||||
void (*create_input_window)(void);
|
||||
|
||||
// title bar actions
|
||||
void (*title_bar_update_virtual)(void);
|
||||
void (*title_bar_resize)(void);
|
||||
void (*title_bar_console)(void);
|
||||
void (*title_bar_set_presence)(contact_presence_t presence);
|
||||
void (*title_bar_set_recipient)(const char * const from);
|
||||
void (*title_bar_set_typing)(gboolean is_typing);
|
||||
|
||||
// console window actions
|
||||
void (*cons_show)(const char * const msg, ...);
|
||||
void (*cons_about)(void);
|
||||
|
||||
Reference in New Issue
Block a user