about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c23
-rw-r--r--src/ui/titlebar.c2
-rw-r--r--src/ui/window.c11
-rw-r--r--src/ui/window.h2
-rw-r--r--src/ui/windows.c2
5 files changed, 24 insertions, 16 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 14b4ce45..c6c1d01d 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -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);
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 521d5919..5ed974ce 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -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, " *");
         }
     }
diff --git a/src/ui/window.c b/src/ui/window.c
index 183b052d..3b189134 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -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);
 }
 
diff --git a/src/ui/window.h b/src/ui/window.h
index 3c74b8da..c0e5ddca 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -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
diff --git a/src/ui/windows.c b/src/ui/windows.c
index 020745f7..ca7bad36 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -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));
re>42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87