diff options
author | James Booth <boothj5@gmail.com> | 2013-12-23 00:23:22 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-12-23 00:23:22 +0000 |
commit | b83b262d47ea62330e1e1a21e3da12aef08e981d (patch) | |
tree | 6e459a2126cd797dda6299dc73b11d6336a401e4 | |
parent | 7fe8f61b9b43357c145ab28ab2f09bd9d870a16e (diff) | |
download | profani-tty-b83b262d47ea62330e1e1a21e3da12aef08e981d.tar.gz |
Bind remaining ui functions in main.c
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/ui/inputwin.c | 23 | ||||
-rw-r--r-- | src/ui/notifier.c | 24 | ||||
-rw-r--r-- | src/ui/statusbar.c | 29 | ||||
-rw-r--r-- | src/ui/titlebar.c | 23 | ||||
-rw-r--r-- | src/ui/ui.h | 4 |
6 files changed, 67 insertions, 40 deletions
diff --git a/src/main.c b/src/main.c index 9b3f54b6..233feb6a 100644 --- a/src/main.c +++ b/src/main.c @@ -50,6 +50,10 @@ _init_modules(void) ui_init_module(); console_init_module(); + inputwin_init_module(); + notifier_init_module(); + statusbar_init_module(); + titlebar_init_module(); } int diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 040e87b2..dd02ed70 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -73,7 +73,6 @@ _create_input_window(void) wmove(inp_win, 0, 0); _inp_win_refresh(); } -void (*create_input_window)(void) = _create_input_window; static void _inp_win_resize(const char * const input, const int size) @@ -92,21 +91,18 @@ _inp_win_resize(const char * const input, const int size) _inp_win_refresh(); } -void (*inp_win_resize)(const char * const, const int) = _inp_win_resize; static void _inp_non_block(void) { wtimeout(inp_win, 20); } -void (*inp_non_block)(void) = _inp_non_block; static void _inp_block(void) { wtimeout(inp_win, -1); } -void (*inp_block)(void) = _inp_block; static wint_t _inp_get_char(char *input, int *size) @@ -206,7 +202,6 @@ _inp_get_char(char *input, int *size) return ch; } -wint_t (*inp_get_char)(char*, int*) = _inp_get_char; static void _inp_get_password(char *passwd) @@ -219,14 +214,12 @@ _inp_get_password(char *passwd) echo(); status_bar_clear(); } -void (*inp_get_password)(char*) = _inp_get_password; static void _inp_put_back(void) { _inp_win_refresh(); } -void (*inp_put_back)(void) = _inp_put_back; static void _inp_replace_input(char *input, const char * const new_input, int *size) @@ -240,7 +233,6 @@ _inp_replace_input(char *input, const char * const new_input, int *size) waddstr(inp_win, input); _go_to_end(display_size); } -void (*inp_replace_input)(char*, const char * const, int*) = _inp_replace_input; static void _inp_win_reset(void) @@ -249,7 +241,6 @@ _inp_win_reset(void) pad_start = 0; _inp_win_refresh(); } -void (*inp_win_reset)(void) = _inp_win_reset; static void _clear_input(void) @@ -712,3 +703,17 @@ _printable(const wint_t ch) gunichar unichar = g_utf8_get_char(bytes); return g_unichar_isprint(unichar) && (ch != KEY_MOUSE); } + +void +inputwin_init_module(void) +{ + create_input_window = _create_input_window; + inp_win_resize = _inp_win_resize; + inp_non_block = _inp_non_block; + inp_block = _inp_block; + inp_get_char = _inp_get_char; + inp_get_password = _inp_get_password; + inp_put_back = _inp_put_back; + inp_replace_input = _inp_replace_input; + inp_win_reset = _inp_win_reset; +} diff --git a/src/ui/notifier.c b/src/ui/notifier.c index d0319cb9..ebc61e0d 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -46,7 +46,6 @@ _notifier_init(void) notify_init("Profanity"); #endif } -void (*notifier_init)(void) = _notifier_init; static void _notifier_uninit(void) @@ -57,7 +56,6 @@ _notifier_uninit(void) } #endif } -void (*notifier_uninit)(void) = _notifier_uninit; static void _notify_typing(const char * const handle) @@ -67,7 +65,6 @@ _notify_typing(const char * const handle) _notify(message, 10000, "Incoming message"); } -void (*notify_typing)(const char * const) = _notify_typing; static void _notify_invite(const char * const from, const char * const room, @@ -85,8 +82,6 @@ _notify_invite(const char * const from, const char * const room, g_string_free(message, TRUE); } -void (*notify_invite)(const char * const, const char * const, - const char * const) = _notify_invite; static void _notify_message(const char * const handle, int win) @@ -96,7 +91,6 @@ _notify_message(const char * const handle, int win) _notify(message, 10000, "incoming message"); } -void (*notify_message)(const char * const, int) = _notify_message; static void _notify_room_message(const char * const handle, const char * const room, int win) @@ -110,8 +104,6 @@ _notify_room_message(const char * const handle, const char * const room, int win g_string_free(text, TRUE); } -void (*notify_room_message)(const char * const, const char * const, - int) = _notify_room_message; static void _notify_subscription(const char * const from) @@ -121,7 +113,6 @@ _notify_subscription(const char * const from) _notify(message->str, 10000, "Incomming message"); g_string_free(message, TRUE); } -void (*notify_subscription)(const char * const) = _notify_subscription; static void _notify_remind(void) @@ -167,7 +158,6 @@ _notify_remind(void) g_string_free(text, TRUE); } -void (*notify_remind)(void) = _notify_remind; static void _notify(const char * const message, int timeout, @@ -216,3 +206,17 @@ _notify(const char * const message, int timeout, Shell_NotifyIcon(NIM_MODIFY, &nid); #endif } + +void +notifier_init_module(void) +{ + notifier_init = _notifier_init; + notifier_uninit = _notifier_uninit; + notify_typing = _notify_typing; + notify_invite = _notify_invite; + notify_message = _notify_message; + notify_room_message = _notify_room_message; + notify_subscription = _notify_subscription; + notify_remind = _notify_remind; +} + diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 8a578a56..4d0ab7ef 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -83,7 +83,6 @@ _create_status_bar(void) dirty = TRUE; } -void (*create_status_bar)(void) = _create_status_bar; static void _status_bar_refresh(void) @@ -108,7 +107,6 @@ _status_bar_refresh(void) g_date_time_unref(now_time); } -void (*status_bar_refresh)(void) = _status_bar_refresh; static void _status_bar_resize(void) @@ -135,7 +133,6 @@ _status_bar_resize(void) last_time = g_date_time_new_now_local(); dirty = TRUE; } -void (*status_bar_resize)(void) = _status_bar_resize; static void _status_bar_set_all_inactive(void) @@ -150,7 +147,6 @@ _status_bar_set_all_inactive(void) g_hash_table_remove_all(remaining_active); g_hash_table_remove_all(remaining_new); } -void (*status_bar_set_all_inactive)(void) = _status_bar_set_all_inactive; static void _status_bar_current(int i) @@ -168,7 +164,6 @@ _status_bar_current(int i) mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket); wattroff(status_bar, COLOUR_STATUS_BRACKET); } -void (*status_bar_current)(int) = _status_bar_current; static void _status_bar_inactive(const int win) @@ -209,7 +204,6 @@ _status_bar_inactive(const int win) _mark_inactive(true_win); } } -void (*status_bar_inactive)(const int) = _status_bar_inactive; static void _status_bar_active(const int win) @@ -244,7 +238,6 @@ _status_bar_active(const int win) _mark_active(true_win); } } -void (*status_bar_active)(const int) = _status_bar_active; static void _status_bar_new(const int win) @@ -268,7 +261,6 @@ _status_bar_new(const int win) _mark_new(true_win); } } -void (*status_bar_new)(const int) = _status_bar_new; static void _status_bar_get_password(void) @@ -276,7 +268,6 @@ _status_bar_get_password(void) status_bar_print_message("Enter password:"); dirty = TRUE; } -void (*status_bar_get_password)(void) = _status_bar_get_password; static void _status_bar_print_message(const char * const msg) @@ -300,7 +291,6 @@ _status_bar_print_message(const char * const msg) _update_win_statuses(); dirty = TRUE; } -void (*status_bar_print_message)(const char * const) = _status_bar_print_message; static void _status_bar_clear(void) @@ -329,7 +319,6 @@ _status_bar_clear(void) dirty = TRUE; } -void (*status_bar_clear)(void) = _status_bar_clear; static void _status_bar_clear_message(void) @@ -351,7 +340,6 @@ _status_bar_clear_message(void) _update_win_statuses(); dirty = TRUE; } -void (*status_bar_clear_message)(void) = _status_bar_clear_message; static void _status_bar_update_time(void) @@ -433,3 +421,20 @@ _mark_inactive(int num) mvwaddch(status_bar, 0, cols - 34 + active_pos, ' '); dirty = TRUE; } + +void +statusbar_init_module(void) +{ + create_status_bar = _create_status_bar; + status_bar_refresh = _status_bar_refresh; + status_bar_resize = _status_bar_resize; + status_bar_set_all_inactive = _status_bar_set_all_inactive; + status_bar_current = _status_bar_current; + status_bar_inactive = _status_bar_inactive; + status_bar_active = _status_bar_active; + status_bar_new = _status_bar_new; + status_bar_get_password = _status_bar_get_password; + status_bar_print_message = _status_bar_print_message; + status_bar_clear = _status_bar_clear; + status_bar_clear_message = _status_bar_clear_message; +} diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 79baae1d..04492b62 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -48,7 +48,6 @@ _create_title_bar(void) title_bar_set_status(CONTACT_OFFLINE); dirty = TRUE; } -void (*create_title_bar)(void) = _create_title_bar; static void _title_bar_title(void) @@ -60,7 +59,6 @@ _title_bar_title(void) _title_bar_draw_status(); dirty = TRUE; } -void (*title_bar_title)(void) = _title_bar_title; static void _title_bar_resize(void) @@ -74,7 +72,6 @@ _title_bar_resize(void) _title_bar_draw_status(); dirty = TRUE; } -void (*title_bar_resize)(void) = _title_bar_resize; static void _title_bar_refresh(void) @@ -109,7 +106,6 @@ _title_bar_refresh(void) dirty = FALSE; } } -void (*title_bar_refresh)(void) = _title_bar_refresh; static void _title_bar_show(const char * const title) @@ -121,7 +117,6 @@ _title_bar_show(const char * const title) strcpy(current_title, title); _title_bar_draw_title(); } -void (*title_bar_show)(const char * const) = _title_bar_show; static void _title_bar_set_status(contact_presence_t status) @@ -129,7 +124,6 @@ _title_bar_set_status(contact_presence_t status) current_status = status; _title_bar_draw_status(); } -void (*title_bar_set_status)(contact_presence_t) = _title_bar_set_status; static void _title_bar_set_recipient(const char * const from) @@ -149,7 +143,6 @@ _title_bar_set_recipient(const char * const from) dirty = TRUE; } -void (*title_bar_set_recipient)(const char * const) = _title_bar_set_recipient; static void _title_bar_set_typing(gboolean is_typing) @@ -176,7 +169,6 @@ _title_bar_set_typing(gboolean is_typing) dirty = TRUE; } -void (*title_bar_set_typing)(gboolean) = _title_bar_set_typing; static void _title_bar_draw(void) @@ -185,7 +177,6 @@ _title_bar_draw(void) _title_bar_draw_status(); _title_bar_draw_title(); } -void (*title_bar_draw)(void) = _title_bar_draw; static void _title_bar_draw_status(void) @@ -236,3 +227,17 @@ _title_bar_draw_title(void) dirty = TRUE; } + +void +titlebar_init_module(void) +{ + create_title_bar = _create_title_bar; + title_bar_title = _title_bar_title; + title_bar_resize = _title_bar_resize; + title_bar_refresh = _title_bar_refresh; + title_bar_show = _title_bar_show; + title_bar_set_status = _title_bar_set_status; + title_bar_set_recipient = _title_bar_set_recipient; + title_bar_set_typing = _title_bar_set_typing; + title_bar_draw = _title_bar_draw; +} diff --git a/src/ui/ui.h b/src/ui/ui.h index 9b5e5079..e5d4118d 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -43,6 +43,10 @@ void ui_init_module(void); 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); |