Added form to WIN_MUC_CONFIG type
This commit is contained in:
@@ -754,10 +754,11 @@ _ui_win_has_unsaved_form(int num)
|
||||
if (window->type != WIN_MUC_CONFIG) {
|
||||
return FALSE;
|
||||
}
|
||||
if (window->form == NULL) {
|
||||
if (window->wins.conf.form == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
return window->form->modified;
|
||||
|
||||
return window->wins.conf.form->modified;
|
||||
}
|
||||
|
||||
GString *
|
||||
@@ -784,12 +785,12 @@ _ui_switch_win(const int i)
|
||||
if (ui_win_exists(i)) {
|
||||
ProfWin *old_current = wins_get_current();
|
||||
if (old_current->type == WIN_MUC_CONFIG) {
|
||||
cmd_autocomplete_remove_form_fields(old_current->form);
|
||||
cmd_autocomplete_remove_form_fields(old_current->wins.conf.form);
|
||||
}
|
||||
|
||||
ProfWin *new_current = wins_get_by_num(i);
|
||||
if (new_current->type == WIN_MUC_CONFIG) {
|
||||
cmd_autocomplete_add_form_fields(new_current->form);
|
||||
cmd_autocomplete_add_form_fields(new_current->wins.conf.form);
|
||||
}
|
||||
|
||||
wins_set_current_by_num(i);
|
||||
@@ -818,12 +819,12 @@ _ui_previous_win(void)
|
||||
{
|
||||
ProfWin *old_current = wins_get_current();
|
||||
if (old_current->type == WIN_MUC_CONFIG) {
|
||||
cmd_autocomplete_remove_form_fields(old_current->form);
|
||||
cmd_autocomplete_remove_form_fields(old_current->wins.conf.form);
|
||||
}
|
||||
|
||||
ProfWin *new_current = wins_get_previous();
|
||||
if (new_current->type == WIN_MUC_CONFIG) {
|
||||
cmd_autocomplete_add_form_fields(new_current->form);
|
||||
cmd_autocomplete_add_form_fields(new_current->wins.conf.form);
|
||||
}
|
||||
|
||||
int i = wins_get_num(new_current);
|
||||
@@ -849,12 +850,12 @@ _ui_next_win(void)
|
||||
{
|
||||
ProfWin *old_current = wins_get_current();
|
||||
if (old_current->type == WIN_MUC_CONFIG) {
|
||||
cmd_autocomplete_remove_form_fields(old_current->form);
|
||||
cmd_autocomplete_remove_form_fields(old_current->wins.conf.form);
|
||||
}
|
||||
|
||||
ProfWin *new_current = wins_get_next();
|
||||
if (new_current->type == WIN_MUC_CONFIG) {
|
||||
cmd_autocomplete_add_form_fields(new_current->form);
|
||||
cmd_autocomplete_add_form_fields(new_current->wins.conf.form);
|
||||
}
|
||||
|
||||
int i = wins_get_num(new_current);
|
||||
@@ -1073,8 +1074,8 @@ _ui_close_win(int index)
|
||||
{
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
if (window) {
|
||||
if (window->type == WIN_MUC_CONFIG && window->form) {
|
||||
cmd_autocomplete_remove_form_fields(window->form);
|
||||
if (window->type == WIN_MUC_CONFIG && window->wins.conf.form) {
|
||||
cmd_autocomplete_remove_form_fields(window->wins.conf.form);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2652,7 +2653,7 @@ _ui_handle_room_configuration(const char * const room, DataForm *form)
|
||||
ProfWin *window = wins_new(title->str, WIN_MUC_CONFIG);
|
||||
g_string_free(title, TRUE);
|
||||
|
||||
window->form = form;
|
||||
window->wins.conf.form = form;
|
||||
|
||||
int num = wins_get_num(window);
|
||||
ui_switch_win(num);
|
||||
|
||||
@@ -189,7 +189,7 @@ _title_bar_draw(void)
|
||||
wprintw(win, " (typing...)");
|
||||
}
|
||||
} else if (current && current->type == WIN_MUC_CONFIG) {
|
||||
if (current->form && current->form->modified) {
|
||||
if (current->wins.conf.form && current->wins.conf.form->modified) {
|
||||
wprintw(win, " *");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,10 @@ win_create(const char * const title, win_type_t type)
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_win->type == WIN_MUC_CONFIG) {
|
||||
new_win->wins.conf.form = NULL;
|
||||
}
|
||||
|
||||
new_win->from = strdup(title);
|
||||
new_win->buffer = buffer_create();
|
||||
new_win->y_pos = 0;
|
||||
@@ -115,7 +119,6 @@ win_create(const char * const title, win_type_t type)
|
||||
new_win->type = type;
|
||||
new_win->is_otr = FALSE;
|
||||
new_win->is_trusted = FALSE;
|
||||
new_win->form = NULL;
|
||||
new_win->chat_resource = NULL;
|
||||
scrollok(new_win->win, TRUE);
|
||||
|
||||
@@ -198,7 +201,11 @@ win_free(ProfWin* window)
|
||||
|
||||
free(window->chat_resource);
|
||||
free(window->from);
|
||||
form_destroy(window->form);
|
||||
|
||||
if (window->type == WIN_MUC_CONFIG) {
|
||||
form_destroy(window->wins.conf.form);
|
||||
}
|
||||
|
||||
free(window);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ typedef struct prof_win_t {
|
||||
gboolean is_trusted;
|
||||
int unread;
|
||||
int history_shown;
|
||||
DataForm *form;
|
||||
|
||||
union {
|
||||
// WIN_CONSOLE
|
||||
@@ -100,6 +99,7 @@ typedef struct prof_win_t {
|
||||
|
||||
// WIN_MUC_CONFIG
|
||||
struct {
|
||||
DataForm *form;
|
||||
} conf;
|
||||
|
||||
// WIN_PRIVATE
|
||||
|
||||
@@ -656,7 +656,7 @@ wins_create_summary(void)
|
||||
case WIN_MUC_CONFIG:
|
||||
muc_config_string = g_string_new("");
|
||||
g_string_printf(muc_config_string, "%d: %s", ui_index, window->from);
|
||||
if ((window->form != NULL) && (window->form->modified)) {
|
||||
if ((window->wins.conf.form) && (window->wins.conf.form->modified)) {
|
||||
g_string_append(muc_config_string, " *");
|
||||
}
|
||||
result = g_slist_append(result, strdup(muc_config_string->str));
|
||||
|
||||
Reference in New Issue
Block a user