diff options
Diffstat (limited to 'src/ui/titlebar.c')
-rw-r--r-- | src/ui/titlebar.c | 77 |
1 files changed, 33 insertions, 44 deletions
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index e9e2e457..bc8fc947 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -57,22 +57,28 @@ create_title_bar(void) inp_put_back(); } -static void -_title_bar_console(void) +void +title_bar_update_virtual(void) { - werase(win); - current_recipient = NULL; - typing = FALSE; - typing_elapsed = NULL; + if (current_recipient != NULL) { - free(current_title); - current_title = strdup(CONSOLE_TITLE); + if (typing_elapsed != NULL) { + gdouble seconds = g_timer_elapsed(typing_elapsed, NULL); - _title_bar_draw(); + if (seconds >= 10) { + typing = FALSE; + + g_timer_destroy(typing_elapsed); + typing_elapsed = NULL; + + _title_bar_draw(); + } + } + } } -static void -_title_bar_resize(void) +void +title_bar_resize(void) { int cols = getmaxx(stdscr); @@ -82,35 +88,29 @@ _title_bar_resize(void) _title_bar_draw(); } -static void -_title_bar_update_virtual(void) +void +title_bar_console(void) { - if (current_recipient != NULL) { - - if (typing_elapsed != NULL) { - gdouble seconds = g_timer_elapsed(typing_elapsed, NULL); - - if (seconds >= 10) { - typing = FALSE; + werase(win); + current_recipient = NULL; + typing = FALSE; + typing_elapsed = NULL; - g_timer_destroy(typing_elapsed); - typing_elapsed = NULL; + free(current_title); + current_title = strdup(CONSOLE_TITLE); - _title_bar_draw(); - } - } - } + _title_bar_draw(); } -static void -_title_bar_set_presence(contact_presence_t presence) +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; -} +} \ No newline at end of file |