110 // add |
110 // add |
111 UI_APPLY_LAYOUT1(current, args); |
111 UI_APPLY_LAYOUT1(current, args); |
112 current->container->add(current->container, scroll_area, TRUE); |
112 current->container->add(current->container, scroll_area, TRUE); |
113 |
113 |
114 // bind value |
114 // bind value |
115 UiText *value = var->value; |
115 if(var) { |
116 if(value) { |
116 UiText *value = var->value; |
117 GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_area)); |
117 GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_area)); |
118 |
118 |
119 if(value->value.ptr) { |
119 if(value->value.ptr) { |
120 gtk_text_buffer_set_text(buf, value->value.ptr, -1); |
120 gtk_text_buffer_set_text(buf, value->value.ptr, -1); |
121 value->value.free(value->value.ptr); |
121 value->value.free(value->value.ptr); |
163 |
163 |
164 return scroll_area; |
164 return scroll_area; |
165 } |
165 } |
166 |
166 |
167 void ui_textarea_destroy(GtkWidget *object, UiTextArea *textarea) { |
167 void ui_textarea_destroy(GtkWidget *object, UiTextArea *textarea) { |
168 ui_destroy_boundvar(textarea->ctx, textarea->var); |
168 if(textarea->var) { |
|
169 ui_destroy_boundvar(textarea->ctx, textarea->var); |
|
170 } |
169 free(textarea); |
171 free(textarea); |
170 } |
172 } |
171 |
173 |
172 UIWIDGET ui_textarea_gettextwidget(UIWIDGET textarea) { |
174 UIWIDGET ui_textarea_gettextwidget(UIWIDGET textarea) { |
173 return SCROLLEDWINDOW_GET_CHILD(textarea); |
175 return SCROLLEDWINDOW_GET_CHILD(textarea); |