diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.c | 1 | ||||
-rw-r--r-- | src/ui/core.c | 19 | ||||
-rw-r--r-- | src/ui/inputwin.c | 1 | ||||
-rw-r--r-- | src/ui/statusbar.c | 68 | ||||
-rw-r--r-- | src/ui/statusbar.h | 33 | ||||
-rw-r--r-- | src/ui/ui.h | 17 | ||||
-rw-r--r-- | src/ui/windows.c | 1 |
7 files changed, 83 insertions, 57 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 7732a177..9d65df10 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -37,6 +37,7 @@ #include "ui/window.h" #include "ui/windows.h" #include "ui/ui.h" +#include "ui/statusbar.h" #include "xmpp/xmpp.h" #include "xmpp/bookmark.h" diff --git a/src/ui/core.c b/src/ui/core.c index bafd1987..c17b5394 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -51,6 +51,7 @@ #include "otr/otr.h" #include "ui/ui.h" #include "ui/titlebar.h" +#include "ui/statusbar.h" #include "ui/window.h" #include "ui/windows.h" #include "xmpp/xmpp.h" @@ -111,6 +112,16 @@ _ui_update_screen(void) doupdate(); } +static void +_ui_about(void) +{ + cons_show(""); + cons_about(); + if (ui_current_win_type() != WIN_CONSOLE) { + status_bar_new(1); + } +} + static unsigned long _ui_get_idle_time(void) { @@ -1579,6 +1590,12 @@ _ui_clear_win_title(void) } static void +_ui_statusbar_new(const int win) +{ + status_bar_new(win); +} + +static void _ui_draw_term_title(void) { char new_win_title[100]; @@ -1844,4 +1861,6 @@ ui_init_module(void) ui_titlebar_presence = _ui_titlebar_presence; ui_handle_login_account_success = _ui_handle_login_account_success; ui_update_presence =_ui_update_presence; + ui_about = _ui_about; + ui_statusbar_new = _ui_statusbar_new; } diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 365eed02..e9f377b1 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -42,6 +42,7 @@ #include "profanity.h" #include "roster_list.h" #include "ui/ui.h" +#include "ui/statusbar.h" #include "ui/windows.h" #include "xmpp/xmpp.h" diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 738242e0..673997bb 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -34,6 +34,7 @@ #include "config/theme.h" #include "ui/ui.h" +#include "ui/statusbar.h" #define TIME_CHECK 60000000 @@ -55,8 +56,8 @@ static void _mark_active(int num); static void _mark_inactive(int num); static void _status_bar_draw(void); -static void -_create_status_bar(void) +void +create_status_bar(void) { int rows, cols, i; getmaxyx(stdscr, rows, cols); @@ -86,8 +87,8 @@ _create_status_bar(void) _status_bar_draw(); } -static void -_status_bar_update_virtual(void) +void +status_bar_update_virtual(void) { GDateTime *now_time = g_date_time_new_now_local(); GTimeSpan elapsed = g_date_time_difference(now_time, last_time); @@ -99,8 +100,8 @@ _status_bar_update_virtual(void) g_date_time_unref(now_time); } -static void -_status_bar_resize(void) +void +status_bar_resize(void) { int rows, cols; getmaxyx(stdscr, rows, cols); @@ -125,8 +126,8 @@ _status_bar_resize(void) _status_bar_draw(); } -static void -_status_bar_set_all_inactive(void) +void +status_bar_set_all_inactive(void) { int i = 0; for (i = 0; i < 12; i++) { @@ -141,8 +142,8 @@ _status_bar_set_all_inactive(void) _status_bar_draw(); } -static void -_status_bar_current(int i) +void +status_bar_current(int i) { if (i == 0) { current = 10; @@ -160,8 +161,8 @@ _status_bar_current(int i) _status_bar_draw(); } -static void -_status_bar_inactive(const int win) +void +status_bar_inactive(const int win) { int true_win = win; if (true_win == 0) { @@ -202,8 +203,8 @@ _status_bar_inactive(const int win) _status_bar_draw(); } -static void -_status_bar_active(const int win) +void +status_bar_active(const int win) { int true_win = win; if (true_win == 0) { @@ -238,8 +239,8 @@ _status_bar_active(const int win) _status_bar_draw(); } -static void -_status_bar_new(const int win) +void +status_bar_new(const int win) { int true_win = win; if (true_win == 0) { @@ -263,16 +264,16 @@ _status_bar_new(const int win) _status_bar_draw(); } -static void -_status_bar_get_password(void) +void +status_bar_get_password(void) { status_bar_print_message("Enter password:"); _status_bar_draw(); } -static void -_status_bar_print_message(const char * const msg) +void +status_bar_print_message(const char * const msg) { werase(status_bar); @@ -292,8 +293,8 @@ _status_bar_print_message(const char * const msg) _status_bar_draw(); } -static void -_status_bar_clear(void) +void +status_bar_clear(void) { if (message != NULL) { free(message); @@ -320,8 +321,8 @@ _status_bar_clear(void) _status_bar_draw(); } -static void -_status_bar_clear_message(void) +void +status_bar_clear_message(void) { if (message != NULL) { free(message); @@ -421,21 +422,4 @@ _status_bar_draw(void) _update_win_statuses(); wnoutrefresh(status_bar); inp_put_back(); -} - -void -statusbar_init_module(void) -{ - create_status_bar = _create_status_bar; - status_bar_update_virtual = _status_bar_update_virtual; - 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; -} +} \ No newline at end of file diff --git a/src/ui/statusbar.h b/src/ui/statusbar.h new file mode 100644 index 00000000..74af3a68 --- /dev/null +++ b/src/ui/statusbar.h @@ -0,0 +1,33 @@ +/* + * statusbar.h + * + * Copyright (C) 2012 - 2014 James Booth <boothj5@gmail.com> + * + * This file is part of Profanity. + * + * Profanity is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Profanity is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Profanity. If not, see <http://www.gnu.org/licenses/>. + * + */ + void create_status_bar(void); + void status_bar_update_virtual(void); + void status_bar_resize(void); + void status_bar_clear(void); + void status_bar_clear_message(void); + void status_bar_get_password(void); + void status_bar_print_message(const char * const msg); + void status_bar_inactive(const int win); + void status_bar_active(const int win); + void status_bar_new(const int win); + void status_bar_set_all_inactive(void); + void status_bar_current(int i); \ No newline at end of file diff --git a/src/ui/ui.h b/src/ui/ui.h index 737cbc8c..1bc71546 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -45,7 +45,6 @@ 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); // ui startup and control void (*ui_init)(void); @@ -153,9 +152,10 @@ 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); +void (*ui_about)(void); +void (*ui_statusbar_new)(const int win); // create windows -void (*create_status_bar)(void); void (*create_input_window)(void); // console window actions @@ -230,19 +230,6 @@ void (*cons_autoconnect_setting)(void); void (*cons_show_contact_online)(PContact contact, Resource *resource, GDateTime *last_activity); void (*cons_show_contact_offline)(PContact contact, char *resource, char *status); -// status bar actions -void (*status_bar_update_virtual)(void); -void (*status_bar_resize)(void); -void (*status_bar_clear)(void); -void (*status_bar_clear_message)(void); -void (*status_bar_get_password)(void); -void (*status_bar_print_message)(const char * const msg); -void (*status_bar_inactive)(const int win); -void (*status_bar_active)(const int win); -void (*status_bar_new)(const int win); -void (*status_bar_set_all_inactive)(void); -void (*status_bar_current)(int i); - // input window actions wint_t (*inp_get_char)(char *input, int *size); void (*inp_win_reset)(void); diff --git a/src/ui/windows.c b/src/ui/windows.c index 83841837..75691f0d 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -36,6 +36,7 @@ #include "roster_list.h" #include "config/theme.h" #include "ui/ui.h" +#include "ui/statusbar.h" #include "ui/window.h" #include "ui/windows.h" |