1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Removed statusbar functions from ui.h

This commit is contained in:
James Booth 2014-04-07 21:12:30 +01:00
parent fc40637789
commit f0f0dbfdac
10 changed files with 88 additions and 64 deletions

View File

@ -14,6 +14,7 @@ core_sources = \
src/server_events.c src/server_events.h \
src/ui/ui.h src/ui/window.c src/ui/window.h src/ui/core.c \
src/ui/titlebar.c src/ui/statusbar.c src/ui/inputwin.c \
src/ui/titlebar.h src/ui/statusbar.h \
src/ui/console.c src/ui/notifier.c \
src/ui/windows.c src/ui/windows.h \
src/command/command.h src/command/command.c src/command/history.c \
@ -50,6 +51,8 @@ tests_sources = \
src/config/theme.c src/config/theme.h \
src/ui/windows.c src/ui/windows.h \
src/ui/window.c src/ui/window.h \
src/ui/titlebar.c src/ui/statusbar.c \
src/ui/titlebar.h src/ui/statusbar.h \
src/server_events.c src/server_events.h \
tests/xmpp/mock_xmpp.h tests/xmpp/mock_xmpp.c \
tests/otr/mock_otr.h tests/otr/mock_otr.c \

View File

@ -647,11 +647,7 @@ cmd_help(gchar **args, struct cmd_help_t help)
gboolean
cmd_about(gchar **args, struct cmd_help_t help)
{
cons_show("");
cons_about();
if (ui_current_win_type() != WIN_CONSOLE) {
status_bar_new(1);
}
ui_about();
return TRUE;
}
@ -952,7 +948,7 @@ cmd_who(gchar **args, struct cmd_help_t help)
}
if (win_type != WIN_CONSOLE && win_type != WIN_MUC) {
status_bar_new(1);
ui_statusbar_new(1);
}
return TRUE;

View File

@ -56,7 +56,6 @@ _init_modules(void)
console_init_module();
inputwin_init_module();
notifier_init_module();
statusbar_init_module();
accounts_init_module();
#ifdef HAVE_LIBOTR

View File

@ -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"

View File

@ -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)
{
@ -1578,6 +1589,12 @@ _ui_clear_win_title(void)
printf("%c]0;%c", '\033', '\007');
}
static void
_ui_statusbar_new(const int win)
{
status_bar_new(win);
}
static void
_ui_draw_term_title(void)
{
@ -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;
}

View File

@ -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"

View File

@ -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;
}
}

33
src/ui/statusbar.h Normal file
View File

@ -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);

View File

@ -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);

View File

@ -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"