mirror of
https://github.com/profanity-im/profanity.git
synced 2024-10-27 20:30:13 -04:00
Show name in statusbar tabs WIP
This commit is contained in:
parent
1215ec9bc8
commit
119c5650cf
@ -2095,7 +2095,7 @@ cmd_who(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window->type != WIN_CONSOLE && window->type != WIN_MUC) {
|
if (window->type != WIN_CONSOLE && window->type != WIN_MUC) {
|
||||||
status_bar_new(1);
|
status_bar_new(1, "console");
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -282,7 +282,7 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
|
|||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (wins_is_current(window)) {
|
if (wins_is_current(window)) {
|
||||||
is_current = TRUE;
|
is_current = TRUE;
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
|
|
||||||
if ((g_strcmp0(mynick, nick) != 0) && (prefs_get_boolean(PREF_BEEP))) {
|
if ((g_strcmp0(mynick, nick) != 0) && (prefs_get_boolean(PREF_BEEP))) {
|
||||||
beep();
|
beep();
|
||||||
@ -290,7 +290,7 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
|
|||||||
|
|
||||||
// not currently on groupchat window
|
// not currently on groupchat window
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
|
|
||||||
if ((g_strcmp0(mynick, nick) != 0) && (prefs_get_boolean(PREF_FLASH))) {
|
if ((g_strcmp0(mynick, nick) != 0) && (prefs_get_boolean(PREF_FLASH))) {
|
||||||
flash();
|
flash();
|
||||||
|
@ -333,7 +333,7 @@ api_win_create(
|
|||||||
// set status bar active
|
// set status bar active
|
||||||
ProfPluginWin *pluginwin = wins_get_plugin(tag);
|
ProfPluginWin *pluginwin = wins_get_plugin(tag);
|
||||||
int num = wins_get_num((ProfWin*)pluginwin);
|
int num = wins_get_num((ProfWin*)pluginwin);
|
||||||
status_bar_active(num);
|
status_bar_active(num, pluginwin->plugin_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -105,7 +105,7 @@ chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted)
|
|||||||
title_bar_switch();
|
title_bar_switch();
|
||||||
} else {
|
} else {
|
||||||
int num = wins_get_num(window);
|
int num = wins_get_num(window);
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
|
|
||||||
int ui_index = num;
|
int ui_index = num;
|
||||||
if (ui_index == 10) {
|
if (ui_index == 10) {
|
||||||
@ -249,11 +249,11 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
|
|||||||
if (wins_is_current(window)) {
|
if (wins_is_current(window)) {
|
||||||
win_print_incoming(window, timestamp, display_name, plugin_message, enc_mode);
|
win_print_incoming(window, timestamp, display_name, plugin_message, enc_mode);
|
||||||
title_bar_set_typing(FALSE);
|
title_bar_set_typing(FALSE);
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
|
|
||||||
// not currently viewing chat window with sender
|
// not currently viewing chat window with sender
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
cons_show_incoming_message(display_name, num, chatwin->unread);
|
cons_show_incoming_message(display_name, num, chatwin->unread);
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_FLASH)) {
|
if (prefs_get_boolean(PREF_FLASH)) {
|
||||||
@ -324,9 +324,11 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, const char *const message, prof_en
|
|||||||
enc_char = prefs_get_pgp_char();
|
enc_char = prefs_get_pgp_char();
|
||||||
}
|
}
|
||||||
|
|
||||||
win_print_outgoing((ProfWin*)chatwin, enc_char, "%s", message);
|
ProfWin *window = (ProfWin*)chatwin;
|
||||||
int num = wins_get_num((ProfWin*)chatwin);
|
|
||||||
status_bar_active(num);
|
win_print_outgoing(window, enc_char, "%s", message);
|
||||||
|
int num = wins_get_num(window);
|
||||||
|
status_bar_active(num, window->tab_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2161,7 +2161,7 @@ cons_alert(void)
|
|||||||
{
|
{
|
||||||
ProfWin *current = wins_get_current();
|
ProfWin *current = wins_get_current();
|
||||||
if (current->type != WIN_CONSOLE) {
|
if (current->type != WIN_CONSOLE) {
|
||||||
status_bar_new(1);
|
status_bar_new(1, "console");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ ui_init(void)
|
|||||||
refresh();
|
refresh();
|
||||||
create_title_bar();
|
create_title_bar();
|
||||||
status_bar_init();
|
status_bar_init();
|
||||||
status_bar_active(1);
|
status_bar_active(1, "console");
|
||||||
create_input_window();
|
create_input_window();
|
||||||
wins_init();
|
wins_init();
|
||||||
notifier_initialise();
|
notifier_initialise();
|
||||||
@ -287,7 +287,7 @@ ui_contact_typing(const char *const barejid, const char *const resource)
|
|||||||
title_bar_set_typing(TRUE);
|
title_bar_set_typing(TRUE);
|
||||||
|
|
||||||
int num = wins_get_num(window);
|
int num = wins_get_num(window);
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,7 +673,7 @@ ui_focus_win(ProfWin *window)
|
|||||||
title_bar_switch();
|
title_bar_switch();
|
||||||
}
|
}
|
||||||
status_bar_current(i);
|
status_bar_current(i);
|
||||||
status_bar_active(i);
|
status_bar_active(i, window->tab_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -690,7 +690,7 @@ ui_close_win(int index)
|
|||||||
wins_close_by_num(index);
|
wins_close_by_num(index);
|
||||||
title_bar_console();
|
title_bar_console();
|
||||||
status_bar_current(1);
|
status_bar_current(1);
|
||||||
status_bar_active(1);
|
status_bar_active(1, "console");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -738,17 +738,18 @@ ui_print_system_msg_from_recipient(const char *const barejid, const char *messag
|
|||||||
if (barejid == NULL || message == NULL)
|
if (barejid == NULL || message == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ProfWin *window = (ProfWin*)wins_get_chat(barejid);
|
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||||
|
ProfWin *window = (ProfWin*)chatwin;
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
window = wins_new_chat(barejid);
|
window = wins_new_chat(barejid);
|
||||||
if (window) {
|
if (window) {
|
||||||
num = wins_get_num(window);
|
num = wins_get_num(window);
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
} else {
|
} else {
|
||||||
num = 0;
|
num = 0;
|
||||||
window = wins_get_console();
|
window = wins_get_console();
|
||||||
status_bar_active(1);
|
status_bar_active(1, window->tab_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +759,8 @@ ui_print_system_msg_from_recipient(const char *const barejid, const char *messag
|
|||||||
void
|
void
|
||||||
ui_room_join(const char *const roomjid, gboolean focus)
|
ui_room_join(const char *const roomjid, gboolean focus)
|
||||||
{
|
{
|
||||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
ProfMucWin *mucwin = wins_get_muc(roomjid);
|
||||||
|
ProfWin *window = (ProfWin*)mucwin;
|
||||||
if (!window) {
|
if (!window) {
|
||||||
window = wins_new_muc(roomjid);
|
window = wins_new_muc(roomjid);
|
||||||
}
|
}
|
||||||
@ -781,7 +783,7 @@ ui_room_join(const char *const roomjid, gboolean focus)
|
|||||||
ui_focus_win(window);
|
ui_focus_win(window);
|
||||||
} else {
|
} else {
|
||||||
int num = wins_get_num(window);
|
int num = wins_get_num(window);
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
ProfWin *console = wins_get_console();
|
ProfWin *console = wins_get_console();
|
||||||
char *nick = muc_nick(roomjid);
|
char *nick = muc_nick(roomjid);
|
||||||
win_println(console, THEME_TYPING, '!', "-> Autojoined %s as %s (%d).", roomjid, nick, num);
|
win_println(console, THEME_TYPING, '!', "-> Autojoined %s as %s (%d).", roomjid, nick, num);
|
||||||
|
@ -519,11 +519,11 @@ mucwin_requires_config(ProfMucWin *mucwin)
|
|||||||
|
|
||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (wins_is_current(window)) {
|
if (wins_is_current(window)) {
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
|
|
||||||
// not currently on groupchat window
|
// not currently on groupchat window
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,11 +553,11 @@ mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const sub
|
|||||||
|
|
||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (wins_is_current(window)) {
|
if (wins_is_current(window)) {
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
|
|
||||||
// not currently on groupchat window
|
// not currently on groupchat window
|
||||||
} else {
|
} else {
|
||||||
status_bar_active(num);
|
status_bar_new(num, window->tab_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,11 +583,11 @@ mucwin_broadcast(ProfMucWin *mucwin, const char *const message)
|
|||||||
|
|
||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (wins_is_current(window)) {
|
if (wins_is_current(window)) {
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
|
|
||||||
// not currently on groupchat window
|
// not currently on groupchat window
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,11 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDat
|
|||||||
if (wins_is_current(window)) {
|
if (wins_is_current(window)) {
|
||||||
win_print_incoming(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
|
win_print_incoming(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
|
||||||
title_bar_set_typing(FALSE);
|
title_bar_set_typing(FALSE);
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
|
|
||||||
// not currently viewing chat window with sender
|
// not currently viewing chat window with sender
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread);
|
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread);
|
||||||
win_print_incoming(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
|
win_print_incoming(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
|
||||||
|
|
||||||
|
@ -51,33 +51,39 @@
|
|||||||
#include "ui/inputwin.h"
|
#include "ui/inputwin.h"
|
||||||
#include "ui/screen.h"
|
#include "ui/screen.h"
|
||||||
|
|
||||||
|
typedef struct _status_bar_tab_t {
|
||||||
|
char *display_name;
|
||||||
|
gboolean highlight;
|
||||||
|
} StatusBarTab;
|
||||||
|
|
||||||
typedef struct _status_bar_t {
|
typedef struct _status_bar_t {
|
||||||
gchar *time;
|
gchar *time;
|
||||||
char *message;
|
char *message;
|
||||||
GList *tabs;
|
GHashTable *tabs;
|
||||||
|
int current_tab;
|
||||||
} StatusBar;
|
} StatusBar;
|
||||||
|
|
||||||
|
#define MAX_TABS 5
|
||||||
|
#define SHOW_EMPTY_TABS FALSE
|
||||||
|
#define SHOW_NAME TRUE
|
||||||
|
|
||||||
static GTimeZone *tz;
|
static GTimeZone *tz;
|
||||||
static StatusBar *statusbar;
|
static StatusBar *statusbar;
|
||||||
static WINDOW *statusbar_win;
|
static WINDOW *statusbar_win;
|
||||||
//static char *message = NULL;
|
|
||||||
//// 1 2 3 4 5 6 7 8 9 0 >
|
|
||||||
//static char _active[34] = "[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]";
|
|
||||||
//static char *bracket = "- -";
|
|
||||||
//static int is_active[12];
|
|
||||||
//static GHashTable *remaining_active;
|
|
||||||
//static int is_new[12];
|
|
||||||
//static GHashTable *remaining_new;
|
|
||||||
//static GTimeZone *tz;
|
|
||||||
//static GDateTime *last_time;
|
|
||||||
//static int current;
|
|
||||||
|
|
||||||
//static void _update_win_statuses(void);
|
|
||||||
//static void _mark_new(int num);
|
|
||||||
//static void _mark_active(int num);
|
|
||||||
//static void _mark_inactive(int num);
|
|
||||||
static void _status_bar_draw(void);
|
static void _status_bar_draw(void);
|
||||||
|
|
||||||
|
void
|
||||||
|
_destroy_tab(StatusBarTab *tab)
|
||||||
|
{
|
||||||
|
if (tab) {
|
||||||
|
if (tab->display_name) {
|
||||||
|
free(tab->display_name);
|
||||||
|
}
|
||||||
|
free(tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_init(void)
|
status_bar_init(void)
|
||||||
{
|
{
|
||||||
@ -86,44 +92,17 @@ status_bar_init(void)
|
|||||||
statusbar = malloc(sizeof(StatusBar));
|
statusbar = malloc(sizeof(StatusBar));
|
||||||
statusbar->time = NULL;
|
statusbar->time = NULL;
|
||||||
statusbar->message = NULL;
|
statusbar->message = NULL;
|
||||||
|
statusbar->tabs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)_destroy_tab);
|
||||||
|
StatusBarTab *console = malloc(sizeof(StatusBarTab));
|
||||||
|
console->display_name = strdup("console");
|
||||||
|
g_hash_table_insert(statusbar->tabs, GINT_TO_POINTER(1), console);
|
||||||
|
statusbar->current_tab = 1;
|
||||||
|
|
||||||
int row = screen_statusbar_row();
|
int row = screen_statusbar_row();
|
||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
statusbar_win = newwin(1, cols, row, 0);
|
statusbar_win = newwin(1, cols, row, 0);
|
||||||
|
|
||||||
_status_bar_draw();
|
_status_bar_draw();
|
||||||
|
|
||||||
// int i;
|
|
||||||
// int cols = getmaxx(stdscr);
|
|
||||||
//
|
|
||||||
// is_active[1] = TRUE;
|
|
||||||
// is_new[1] = FALSE;
|
|
||||||
// for (i = 2; i < 12; i++) {
|
|
||||||
// is_active[i] = FALSE;
|
|
||||||
// is_new[i] = FALSE;
|
|
||||||
// }
|
|
||||||
// remaining_active = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
|
|
||||||
// remaining_new = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
|
|
||||||
// current = 1;
|
|
||||||
//
|
|
||||||
// int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
|
||||||
//
|
|
||||||
// int row = screen_statusbar_row();
|
|
||||||
// status_bar = newwin(1, cols, row, 0);
|
|
||||||
// wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34, _active);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
//
|
|
||||||
// tz = g_time_zone_new_local();
|
|
||||||
//
|
|
||||||
// if (last_time) {
|
|
||||||
// g_date_time_unref(last_time);
|
|
||||||
// }
|
|
||||||
// last_time = g_date_time_new_now(tz);
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -159,188 +138,69 @@ status_bar_resize(void)
|
|||||||
wresize(statusbar_win, 1, cols);
|
wresize(statusbar_win, 1, cols);
|
||||||
|
|
||||||
_status_bar_draw();
|
_status_bar_draw();
|
||||||
|
|
||||||
// int cols = getmaxx(stdscr);
|
|
||||||
//
|
|
||||||
// werase(status_bar);
|
|
||||||
//
|
|
||||||
// int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
|
||||||
//
|
|
||||||
// int row = screen_statusbar_row();
|
|
||||||
// mvwin(status_bar, row, 0);
|
|
||||||
// wresize(status_bar, 1, cols);
|
|
||||||
// wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34, _active);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
//
|
|
||||||
// if (message) {
|
|
||||||
// char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
|
|
||||||
//
|
|
||||||
// gchar *date_fmt = NULL;
|
|
||||||
// if (g_strcmp0(time_pref, "off") == 0) {
|
|
||||||
// date_fmt = g_strdup("");
|
|
||||||
// } else {
|
|
||||||
// date_fmt = g_date_time_format(last_time, time_pref);
|
|
||||||
// }
|
|
||||||
// assert(date_fmt != NULL);
|
|
||||||
// size_t len = strlen(date_fmt);
|
|
||||||
// g_free(date_fmt);
|
|
||||||
// if (g_strcmp0(time_pref, "off") != 0) {
|
|
||||||
// /* 01234567890123456
|
|
||||||
// * [HH:MM] message */
|
|
||||||
// mvwprintw(status_bar, 0, 5 + len, message);
|
|
||||||
// } else {
|
|
||||||
// mvwprintw(status_bar, 0, 1, message);
|
|
||||||
// }
|
|
||||||
// prefs_free_string(time_pref);
|
|
||||||
// }
|
|
||||||
// if (last_time) {
|
|
||||||
// g_date_time_unref(last_time);
|
|
||||||
// }
|
|
||||||
// last_time = g_date_time_new_now_local();
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_set_all_inactive(void)
|
status_bar_set_all_inactive(void)
|
||||||
{
|
{
|
||||||
// int i = 0;
|
g_hash_table_remove_all(statusbar->tabs);
|
||||||
// for (i = 0; i < 12; i++) {
|
|
||||||
// is_active[i] = FALSE;
|
|
||||||
// is_new[i] = FALSE;
|
|
||||||
// _mark_inactive(i);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// g_hash_table_remove_all(remaining_active);
|
|
||||||
// g_hash_table_remove_all(remaining_new);
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_current(int i)
|
status_bar_current(int i)
|
||||||
{
|
{
|
||||||
// if (i == 0) {
|
if (i == 0) {
|
||||||
// current = 10;
|
statusbar->current_tab = 10;
|
||||||
// } else if (i > 10) {
|
} else {
|
||||||
// current = 11;
|
statusbar->current_tab = i;
|
||||||
// } else {
|
}
|
||||||
// current = i;
|
|
||||||
// }
|
_status_bar_draw();
|
||||||
// int cols = getmaxx(stdscr);
|
|
||||||
// int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34, _active);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_inactive(const int win)
|
status_bar_inactive(const int win)
|
||||||
{
|
{
|
||||||
// int true_win = win;
|
int true_win = win;
|
||||||
// if (true_win == 0) {
|
if (true_win == 0) {
|
||||||
// true_win = 10;
|
true_win = 10;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // extra windows
|
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER(true_win));
|
||||||
// if (true_win > 10) {
|
|
||||||
// g_hash_table_remove(remaining_active, GINT_TO_POINTER(true_win));
|
_status_bar_draw();
|
||||||
// g_hash_table_remove(remaining_new, GINT_TO_POINTER(true_win));
|
|
||||||
//
|
|
||||||
// // still have new windows
|
|
||||||
// if (g_hash_table_size(remaining_new) != 0) {
|
|
||||||
// is_active[11] = TRUE;
|
|
||||||
// is_new[11] = TRUE;
|
|
||||||
// _mark_new(11);
|
|
||||||
//
|
|
||||||
// // still have active windows
|
|
||||||
// } else if (g_hash_table_size(remaining_active) != 0) {
|
|
||||||
// is_active[11] = TRUE;
|
|
||||||
// is_new[11] = FALSE;
|
|
||||||
// _mark_active(11);
|
|
||||||
//
|
|
||||||
// // no active or new windows
|
|
||||||
// } else {
|
|
||||||
// is_active[11] = FALSE;
|
|
||||||
// is_new[11] = FALSE;
|
|
||||||
// _mark_inactive(11);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // visible window indicators
|
|
||||||
// } else {
|
|
||||||
// is_active[true_win] = FALSE;
|
|
||||||
// is_new[true_win] = FALSE;
|
|
||||||
// _mark_inactive(true_win);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_active(const int win)
|
status_bar_active(const int win, char *name)
|
||||||
{
|
{
|
||||||
// int true_win = win;
|
int true_win = win;
|
||||||
// if (true_win == 0) {
|
if (true_win == 0) {
|
||||||
// true_win = 10;
|
true_win = 10;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // extra windows
|
StatusBarTab *tab = malloc(sizeof(StatusBarTab));
|
||||||
// if (true_win > 10) {
|
tab->display_name = strdup(name);
|
||||||
// g_hash_table_add(remaining_active, GINT_TO_POINTER(true_win));
|
tab->highlight = FALSE;
|
||||||
// g_hash_table_remove(remaining_new, GINT_TO_POINTER(true_win));
|
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
||||||
//
|
|
||||||
// // still have new windows
|
_status_bar_draw();
|
||||||
// if (g_hash_table_size(remaining_new) != 0) {
|
|
||||||
// is_active[11] = TRUE;
|
|
||||||
// is_new[11] = TRUE;
|
|
||||||
// _mark_new(11);
|
|
||||||
//
|
|
||||||
// // only active windows
|
|
||||||
// } else {
|
|
||||||
// is_active[11] = TRUE;
|
|
||||||
// is_new[11] = FALSE;
|
|
||||||
// _mark_active(11);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // visible window indicators
|
|
||||||
// } else {
|
|
||||||
// is_active[true_win] = TRUE;
|
|
||||||
// is_new[true_win] = FALSE;
|
|
||||||
// _mark_active(true_win);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_new(const int win)
|
status_bar_new(const int win, char* name)
|
||||||
{
|
{
|
||||||
// int true_win = win;
|
int true_win = win;
|
||||||
// if (true_win == 0) {
|
if (true_win == 0) {
|
||||||
// true_win = 10;
|
true_win = 10;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (true_win > 10) {
|
StatusBarTab *tab = malloc(sizeof(StatusBarTab));
|
||||||
// g_hash_table_add(remaining_active, GINT_TO_POINTER(true_win));
|
tab->display_name = strdup(name);
|
||||||
// g_hash_table_add(remaining_new, GINT_TO_POINTER(true_win));
|
tab->highlight = TRUE;
|
||||||
//
|
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
||||||
// is_active[11] = TRUE;
|
|
||||||
// is_new[11] = TRUE;
|
_status_bar_draw();
|
||||||
// _mark_new(11);
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// is_active[true_win] = TRUE;
|
|
||||||
// is_new[true_win] = TRUE;
|
|
||||||
// _mark_new(true_win);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -359,62 +219,19 @@ status_bar_print_message(const char *const msg)
|
|||||||
statusbar->message = strdup(msg);
|
statusbar->message = strdup(msg);
|
||||||
|
|
||||||
_status_bar_draw();
|
_status_bar_draw();
|
||||||
|
|
||||||
// werase(status_bar);
|
|
||||||
//
|
|
||||||
// if (message) {
|
|
||||||
// free(message);
|
|
||||||
// }
|
|
||||||
// message = strdup(msg);
|
|
||||||
//
|
|
||||||
// char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
|
|
||||||
// gchar *date_fmt = NULL;
|
|
||||||
// if (g_strcmp0(time_pref, "off") == 0) {
|
|
||||||
// date_fmt = g_strdup("");
|
|
||||||
// } else {
|
|
||||||
// date_fmt = g_date_time_format(last_time, time_pref);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// assert(date_fmt != NULL);
|
|
||||||
// size_t len = strlen(date_fmt);
|
|
||||||
// g_free(date_fmt);
|
|
||||||
// if (g_strcmp0(time_pref, "off") != 0) {
|
|
||||||
// mvwprintw(status_bar, 0, 5 + len, message);
|
|
||||||
// } else {
|
|
||||||
// mvwprintw(status_bar, 0, 1, message);
|
|
||||||
// }
|
|
||||||
// prefs_free_string(time_pref);
|
|
||||||
//
|
|
||||||
// int cols = getmaxx(stdscr);
|
|
||||||
// int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
|
||||||
//
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34, _active);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
status_bar_clear(void)
|
status_bar_clear(void)
|
||||||
{
|
{
|
||||||
// if (message) {
|
if (statusbar->message) {
|
||||||
// free(message);
|
free(statusbar->message);
|
||||||
// message = NULL;
|
statusbar->message = NULL;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// werase(status_bar);
|
werase(statusbar_win);
|
||||||
//
|
|
||||||
// int cols = getmaxx(stdscr);
|
_status_bar_draw();
|
||||||
// int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
|
||||||
//
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34, _active);
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
//
|
|
||||||
// _status_bar_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -428,66 +245,43 @@ status_bar_clear_message(void)
|
|||||||
_status_bar_draw();
|
_status_bar_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//static void
|
static int
|
||||||
//_update_win_statuses(void)
|
_tabs_width(void)
|
||||||
//{
|
{
|
||||||
// int i;
|
if (SHOW_NAME) {
|
||||||
// for(i = 1; i < 12; i++) {
|
if (SHOW_EMPTY_TABS) {
|
||||||
// if (is_new[i]) {
|
int width = 4;
|
||||||
// _mark_new(i);
|
int i = 0;
|
||||||
// }
|
for (i = 1; i <= MAX_TABS; i++) {
|
||||||
// else if (is_active[i]) {
|
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
|
||||||
// _mark_active(i);
|
if (tab) {
|
||||||
// }
|
width += strlen(tab->display_name);
|
||||||
// else {
|
width += 4;
|
||||||
// _mark_inactive(i);
|
} else {
|
||||||
// }
|
width += 3;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
return width;
|
||||||
//static void
|
} else {
|
||||||
//_mark_new(int num)
|
int width = 4;
|
||||||
//{
|
int i = 0;
|
||||||
// int active_pos = 1 + ((num-1) * 3);
|
for (i = 1; i <= MAX_TABS; i++) {
|
||||||
// int cols = getmaxx(stdscr);
|
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
|
||||||
// int status_attrs = theme_attrs(THEME_STATUS_NEW);
|
if (tab) {
|
||||||
// wattron(status_bar, status_attrs);
|
width += strlen(tab->display_name);
|
||||||
// wattron(status_bar, A_BLINK);
|
width += 4;
|
||||||
// if (num == 10) {
|
}
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + active_pos, "0");
|
}
|
||||||
// } else if (num > 10) {
|
return width;
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + active_pos, ">");
|
}
|
||||||
// } else {
|
} else {
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + active_pos, "%d", num);
|
if (SHOW_EMPTY_TABS) {
|
||||||
// }
|
return MAX_TABS * 3 + 4;
|
||||||
// wattroff(status_bar, status_attrs);
|
} else {
|
||||||
// wattroff(status_bar, A_BLINK);
|
return g_hash_table_size(statusbar->tabs) * 3 + 4;
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
//static void
|
}
|
||||||
//_mark_active(int num)
|
|
||||||
//{
|
|
||||||
// int active_pos = 1 + ((num-1) * 3);
|
|
||||||
// int cols = getmaxx(stdscr);
|
|
||||||
// int status_attrs = theme_attrs(THEME_STATUS_ACTIVE);
|
|
||||||
// wattron(status_bar, status_attrs);
|
|
||||||
// if (num == 10) {
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + active_pos, "0");
|
|
||||||
// } else if (num > 10) {
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + active_pos, ">");
|
|
||||||
// } else {
|
|
||||||
// mvwprintw(status_bar, 0, cols - 34 + active_pos, "%d", num);
|
|
||||||
// }
|
|
||||||
// wattroff(status_bar, status_attrs);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//static void
|
|
||||||
//_mark_inactive(int num)
|
|
||||||
//{
|
|
||||||
// int active_pos = 1 + ((num-1) * 3);
|
|
||||||
// int cols = getmaxx(stdscr);
|
|
||||||
// mvwaddch(status_bar, 0, cols - 34 + active_pos, ' ');
|
|
||||||
//}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_status_bar_draw(void)
|
_status_bar_draw(void)
|
||||||
@ -538,36 +332,77 @@ _status_bar_draw(void)
|
|||||||
}
|
}
|
||||||
prefs_free_string(time_pref);
|
prefs_free_string(time_pref);
|
||||||
|
|
||||||
|
// tabs
|
||||||
|
int cols = getmaxx(stdscr);
|
||||||
|
pos = cols - _tabs_width();
|
||||||
|
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
for (i = 1; i <= MAX_TABS; i++) {
|
||||||
|
int display_num = i == 10 ? 0 : i;
|
||||||
|
|
||||||
|
StatusBarTab *tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
|
||||||
|
if (tab || (tab == NULL && SHOW_EMPTY_TABS)) {
|
||||||
|
wattron(statusbar_win, bracket_attrs);
|
||||||
|
if (i == statusbar->current_tab) {
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "-");
|
||||||
|
} else {
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "[");
|
||||||
|
}
|
||||||
|
wattroff(statusbar_win, bracket_attrs);
|
||||||
|
pos++;
|
||||||
|
if (tab) {
|
||||||
|
if (tab->highlight) {
|
||||||
|
int status_attrs = theme_attrs(THEME_STATUS_NEW);
|
||||||
|
wattron(statusbar_win, status_attrs);
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "%d", display_num);
|
||||||
|
if (SHOW_NAME) {
|
||||||
|
pos++;
|
||||||
|
mvwprintw(statusbar_win, 0, pos, ":");
|
||||||
|
pos++;
|
||||||
|
mvwprintw(statusbar_win, 0, pos, tab->display_name);
|
||||||
|
pos += strlen(tab->display_name) -1 ;
|
||||||
|
}
|
||||||
|
wattroff(statusbar_win, status_attrs);
|
||||||
|
} else {
|
||||||
|
int status_attrs = theme_attrs(THEME_STATUS_ACTIVE);
|
||||||
|
wattron(statusbar_win, status_attrs);
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "%d", display_num);
|
||||||
|
if (SHOW_NAME) {
|
||||||
|
pos++;
|
||||||
|
mvwprintw(statusbar_win, 0, pos, ":");
|
||||||
|
pos++;
|
||||||
|
mvwprintw(statusbar_win, 0, pos, tab->display_name);
|
||||||
|
pos += strlen(tab->display_name) - 1;
|
||||||
|
}
|
||||||
|
wattroff(statusbar_win, status_attrs);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mvwprintw(statusbar_win, 0, pos, " ");
|
||||||
|
}
|
||||||
|
pos++;
|
||||||
|
wattron(statusbar_win, bracket_attrs);
|
||||||
|
if (i == statusbar->current_tab) {
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "-");
|
||||||
|
} else {
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "]");
|
||||||
|
}
|
||||||
|
pos++;
|
||||||
|
wattroff(statusbar_win, bracket_attrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wattron(statusbar_win, bracket_attrs);
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "[");
|
||||||
|
wattroff(statusbar_win, bracket_attrs);
|
||||||
|
pos++;
|
||||||
|
mvwprintw(statusbar_win, 0, pos, " ");
|
||||||
|
pos++;
|
||||||
|
wattron(statusbar_win, bracket_attrs);
|
||||||
|
mvwprintw(statusbar_win, 0, pos, "]");
|
||||||
|
wattroff(statusbar_win, bracket_attrs);
|
||||||
|
pos++;
|
||||||
|
|
||||||
wnoutrefresh(statusbar_win);
|
wnoutrefresh(statusbar_win);
|
||||||
inp_put_back();
|
inp_put_back();
|
||||||
|
|
||||||
// if (last_time) {
|
|
||||||
// g_date_time_unref(last_time);
|
|
||||||
// }
|
|
||||||
// last_time = g_date_time_new_now(tz);
|
|
||||||
//
|
|
||||||
// int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
|
||||||
// int time_attrs = theme_attrs(THEME_STATUS_TIME);
|
|
||||||
//
|
|
||||||
// char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
|
|
||||||
// if (g_strcmp0(time_pref, "off") != 0) {
|
|
||||||
// gchar *date_fmt = g_date_time_format(last_time, time_pref);
|
|
||||||
// assert(date_fmt != NULL);
|
|
||||||
// size_t len = strlen(date_fmt);
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwaddch(status_bar, 0, 1, '[');
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
// wattron(status_bar, time_attrs);
|
|
||||||
// mvwprintw(status_bar, 0, 2, date_fmt);
|
|
||||||
// wattroff(status_bar, time_attrs);
|
|
||||||
// wattron(status_bar, bracket_attrs);
|
|
||||||
// mvwaddch(status_bar, 0, 2 + len, ']');
|
|
||||||
// wattroff(status_bar, bracket_attrs);
|
|
||||||
// g_free(date_fmt);
|
|
||||||
// }
|
|
||||||
// prefs_free_string(time_pref);
|
|
||||||
//
|
|
||||||
// _update_win_statuses();
|
|
||||||
// wnoutrefresh(status_bar);
|
|
||||||
// inp_put_back();
|
|
||||||
}
|
}
|
||||||
|
@ -331,8 +331,8 @@ void title_bar_set_presence(contact_presence_t presence);
|
|||||||
|
|
||||||
// status bar
|
// status bar
|
||||||
void status_bar_inactive(const int win);
|
void status_bar_inactive(const int win);
|
||||||
void status_bar_active(const int win);
|
void status_bar_active(const int win, char *name);
|
||||||
void status_bar_new(const int win);
|
void status_bar_new(const int win, char *name);
|
||||||
void status_bar_set_all_inactive(void);
|
void status_bar_set_all_inactive(void);
|
||||||
|
|
||||||
// roster window
|
// roster window
|
||||||
|
@ -136,6 +136,7 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct prof_win_t {
|
typedef struct prof_win_t {
|
||||||
win_type_t type;
|
win_type_t type;
|
||||||
|
char *tab_name;
|
||||||
ProfLayout *layout;
|
ProfLayout *layout;
|
||||||
} ProfWin;
|
} ProfWin;
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ typedef struct prof_xml_win_t {
|
|||||||
} ProfXMLWin;
|
} ProfXMLWin;
|
||||||
|
|
||||||
typedef struct prof_plugin_win_t {
|
typedef struct prof_plugin_win_t {
|
||||||
ProfWin super;
|
ProfWin window;
|
||||||
char *tag;
|
char *tag;
|
||||||
char *plugin_name;
|
char *plugin_name;
|
||||||
unsigned long memcheck;
|
unsigned long memcheck;
|
||||||
|
@ -125,6 +125,7 @@ win_create_console(void)
|
|||||||
{
|
{
|
||||||
ProfConsoleWin *new_win = malloc(sizeof(ProfConsoleWin));
|
ProfConsoleWin *new_win = malloc(sizeof(ProfConsoleWin));
|
||||||
new_win->window.type = WIN_CONSOLE;
|
new_win->window.type = WIN_CONSOLE;
|
||||||
|
new_win->window.tab_name = strdup("console");
|
||||||
new_win->window.layout = _win_create_split_layout();
|
new_win->window.layout = _win_create_split_layout();
|
||||||
|
|
||||||
return &new_win->window;
|
return &new_win->window;
|
||||||
@ -135,6 +136,7 @@ win_create_chat(const char *const barejid)
|
|||||||
{
|
{
|
||||||
ProfChatWin *new_win = malloc(sizeof(ProfChatWin));
|
ProfChatWin *new_win = malloc(sizeof(ProfChatWin));
|
||||||
new_win->window.type = WIN_CHAT;
|
new_win->window.type = WIN_CHAT;
|
||||||
|
new_win->window.tab_name = strdup(barejid);
|
||||||
new_win->window.layout = _win_create_simple_layout();
|
new_win->window.layout = _win_create_simple_layout();
|
||||||
|
|
||||||
new_win->barejid = strdup(barejid);
|
new_win->barejid = strdup(barejid);
|
||||||
@ -162,6 +164,7 @@ win_create_muc(const char *const roomjid)
|
|||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
|
|
||||||
new_win->window.type = WIN_MUC;
|
new_win->window.type = WIN_MUC;
|
||||||
|
new_win->window.tab_name = strdup(roomjid);
|
||||||
|
|
||||||
ProfLayoutSplit *layout = malloc(sizeof(ProfLayoutSplit));
|
ProfLayoutSplit *layout = malloc(sizeof(ProfLayoutSplit));
|
||||||
layout->base.type = LAYOUT_SPLIT;
|
layout->base.type = LAYOUT_SPLIT;
|
||||||
@ -207,6 +210,7 @@ win_create_muc_config(const char *const roomjid, DataForm *form)
|
|||||||
{
|
{
|
||||||
ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin));
|
ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin));
|
||||||
new_win->window.type = WIN_MUC_CONFIG;
|
new_win->window.type = WIN_MUC_CONFIG;
|
||||||
|
new_win->window.tab_name = strdup(roomjid);
|
||||||
new_win->window.layout = _win_create_simple_layout();
|
new_win->window.layout = _win_create_simple_layout();
|
||||||
|
|
||||||
new_win->roomjid = strdup(roomjid);
|
new_win->roomjid = strdup(roomjid);
|
||||||
@ -222,6 +226,7 @@ win_create_private(const char *const fulljid)
|
|||||||
{
|
{
|
||||||
ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin));
|
ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin));
|
||||||
new_win->window.type = WIN_PRIVATE;
|
new_win->window.type = WIN_PRIVATE;
|
||||||
|
new_win->window.tab_name = strdup(fulljid);
|
||||||
new_win->window.layout = _win_create_simple_layout();
|
new_win->window.layout = _win_create_simple_layout();
|
||||||
|
|
||||||
new_win->fulljid = strdup(fulljid);
|
new_win->fulljid = strdup(fulljid);
|
||||||
@ -239,6 +244,7 @@ win_create_xmlconsole(void)
|
|||||||
{
|
{
|
||||||
ProfXMLWin *new_win = malloc(sizeof(ProfXMLWin));
|
ProfXMLWin *new_win = malloc(sizeof(ProfXMLWin));
|
||||||
new_win->window.type = WIN_XML;
|
new_win->window.type = WIN_XML;
|
||||||
|
new_win->window.tab_name = strdup("xmlconsole");
|
||||||
new_win->window.layout = _win_create_simple_layout();
|
new_win->window.layout = _win_create_simple_layout();
|
||||||
|
|
||||||
new_win->memcheck = PROFXMLWIN_MEMCHECK;
|
new_win->memcheck = PROFXMLWIN_MEMCHECK;
|
||||||
@ -250,15 +256,16 @@ ProfWin*
|
|||||||
win_create_plugin(const char *const plugin_name, const char *const tag)
|
win_create_plugin(const char *const plugin_name, const char *const tag)
|
||||||
{
|
{
|
||||||
ProfPluginWin *new_win = malloc(sizeof(ProfPluginWin));
|
ProfPluginWin *new_win = malloc(sizeof(ProfPluginWin));
|
||||||
new_win->super.type = WIN_PLUGIN;
|
new_win->window.type = WIN_PLUGIN;
|
||||||
new_win->super.layout = _win_create_simple_layout();
|
new_win->window.tab_name = strdup(plugin_name);
|
||||||
|
new_win->window.layout = _win_create_simple_layout();
|
||||||
|
|
||||||
new_win->tag = strdup(tag);
|
new_win->tag = strdup(tag);
|
||||||
new_win->plugin_name = strdup(plugin_name);
|
new_win->plugin_name = strdup(plugin_name);
|
||||||
|
|
||||||
new_win->memcheck = PROFPLUGINWIN_MEMCHECK;
|
new_win->memcheck = PROFPLUGINWIN_MEMCHECK;
|
||||||
|
|
||||||
return &new_win->super;
|
return &new_win->window;
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
@ -416,6 +423,7 @@ win_show_subwin(ProfWin *window)
|
|||||||
void
|
void
|
||||||
win_free(ProfWin* window)
|
win_free(ProfWin* window)
|
||||||
{
|
{
|
||||||
|
free(window->tab_name);
|
||||||
if (window->layout->type == LAYOUT_SPLIT) {
|
if (window->layout->type == LAYOUT_SPLIT) {
|
||||||
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
||||||
if (layout->subwin) {
|
if (layout->subwin) {
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include "config/theme.h"
|
#include "config/theme.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/statusbar.h"
|
|
||||||
#include "ui/window_list.h"
|
#include "ui/window_list.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "xmpp/roster_list.h"
|
#include "xmpp/roster_list.h"
|
||||||
@ -862,9 +861,9 @@ wins_swap(int source_win, int target_win)
|
|||||||
g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
|
g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
|
||||||
status_bar_inactive(source_win);
|
status_bar_inactive(source_win);
|
||||||
if (win_unread(source) > 0) {
|
if (win_unread(source) > 0) {
|
||||||
status_bar_new(target_win);
|
status_bar_new(target_win, source->tab_name);
|
||||||
} else {
|
} else {
|
||||||
status_bar_active(target_win);
|
status_bar_active(target_win, source->tab_name);
|
||||||
}
|
}
|
||||||
if (wins_get_current_num() == source_win) {
|
if (wins_get_current_num() == source_win) {
|
||||||
wins_set_current_by_num(target_win);
|
wins_set_current_by_num(target_win);
|
||||||
@ -879,14 +878,14 @@ wins_swap(int source_win, int target_win)
|
|||||||
g_hash_table_insert(windows, GINT_TO_POINTER(source_win), target);
|
g_hash_table_insert(windows, GINT_TO_POINTER(source_win), target);
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
|
g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
|
||||||
if (win_unread(source) > 0) {
|
if (win_unread(source) > 0) {
|
||||||
status_bar_new(target_win);
|
status_bar_new(target_win, source->tab_name);
|
||||||
} else {
|
} else {
|
||||||
status_bar_active(target_win);
|
status_bar_active(target_win, source->tab_name);
|
||||||
}
|
}
|
||||||
if (win_unread(target) > 0) {
|
if (win_unread(target) > 0) {
|
||||||
status_bar_new(source_win);
|
status_bar_new(source_win, target->tab_name);
|
||||||
} else {
|
} else {
|
||||||
status_bar_active(source_win);
|
status_bar_active(source_win, target->tab_name);
|
||||||
}
|
}
|
||||||
if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) {
|
if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) {
|
||||||
ui_focus_win(console);
|
ui_focus_win(console);
|
||||||
@ -1003,16 +1002,16 @@ wins_tidy(void)
|
|||||||
if (num == 10) {
|
if (num == 10) {
|
||||||
g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window);
|
g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window);
|
||||||
if (win_unread(window) > 0) {
|
if (win_unread(window) > 0) {
|
||||||
status_bar_new(0);
|
status_bar_new(0, window->tab_name);
|
||||||
} else {
|
} else {
|
||||||
status_bar_active(0);
|
status_bar_active(0, window->tab_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_hash_table_insert(new_windows, GINT_TO_POINTER(num), window);
|
g_hash_table_insert(new_windows, GINT_TO_POINTER(num), window);
|
||||||
if (win_unread(window) > 0) {
|
if (win_unread(window) > 0) {
|
||||||
status_bar_new(num);
|
status_bar_new(num, window->tab_name);
|
||||||
} else {
|
} else {
|
||||||
status_bar_active(num);
|
status_bar_active(num, window->tab_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
num++;
|
num++;
|
||||||
|
@ -466,8 +466,8 @@ void title_bar_set_presence(contact_presence_t presence) {}
|
|||||||
|
|
||||||
// status bar
|
// status bar
|
||||||
void status_bar_inactive(const int win) {}
|
void status_bar_inactive(const int win) {}
|
||||||
void status_bar_active(const int win) {}
|
void status_bar_active(const int win, char *name) {}
|
||||||
void status_bar_new(const int win) {}
|
void status_bar_new(const int win, char *name) {}
|
||||||
void status_bar_set_all_inactive(void) {}
|
void status_bar_set_all_inactive(void) {}
|
||||||
|
|
||||||
// roster window
|
// roster window
|
||||||
|
Loading…
Reference in New Issue
Block a user