ui/gtk/text.c

changeset 131
774b741984a2
parent 122
e82b01d17a78
child 140
c03c338a7dcf
equal deleted inserted replaced
130:212b63dd61be 131:774b741984a2
240 240
241 void ui_textarea_realize_event(GtkWidget *widget, gpointer data) { 241 void ui_textarea_realize_event(GtkWidget *widget, gpointer data) {
242 gtk_widget_grab_focus(widget); 242 gtk_widget_grab_focus(widget);
243 } 243 }
244 244
245 void ui_text_set(UiText *text, char *str) {
246 if(text->set) {
247 text->set(text, str);
248 } else {
249 if(text->value) {
250 g_free(text->value);
251 }
252 text->value = g_strdup(str);
253 }
254 }
255
256 char* ui_text_get(UiText *text) {
257 if(text->get) {
258 return text->get(text);
259 } else {
260 return text->value;
261 }
262 }
263
245 264
246 // undo manager functions 265 // undo manager functions
247 266
248 void ui_textbuf_insert( 267 void ui_textbuf_insert(
249 GtkTextBuffer *textbuffer, 268 GtkTextBuffer *textbuffer,

mercurial