release-1.10release-1.7release-1.8release-1.9
Last change
on this file since 385cce2 was
23b6c11,
checked in by David Benjamin <davidben@mit.edu>, 14 years ago
|
Use owl_{strdup,free} instead of g_{strdup,free}
For consistency. Also, the strdup wrappers already handle NULL.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d70f45f] | 1 | #include "owl.h" |
---|
| 2 | |
---|
| 3 | static void owl_msgwin_redraw(owl_window *w, WINDOW *curswin, void *msgwin_); |
---|
| 4 | |
---|
| 5 | /* Maintains a small status window of text */ |
---|
| 6 | |
---|
| 7 | void owl_msgwin_init(owl_msgwin *msgwin, owl_window *window) |
---|
| 8 | { |
---|
| 9 | msgwin->msg = NULL; |
---|
| 10 | msgwin->window = g_object_ref(window); |
---|
| 11 | msgwin->redraw_id = g_signal_connect(window, "redraw", G_CALLBACK(owl_msgwin_redraw), msgwin); |
---|
[521e600] | 12 | owl_window_dirty(window); |
---|
[d70f45f] | 13 | } |
---|
| 14 | |
---|
| 15 | static void owl_msgwin_redraw(owl_window *w, WINDOW *curswin, void *msgwin_) |
---|
| 16 | { |
---|
| 17 | owl_msgwin *msgwin = msgwin_; |
---|
| 18 | |
---|
| 19 | werase(curswin); |
---|
| 20 | if (msgwin->msg) |
---|
| 21 | waddstr(curswin, msgwin->msg); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | void owl_msgwin_set_text(owl_msgwin *msgwin, const char *msg) |
---|
| 25 | { |
---|
[23b6c11] | 26 | owl_msgwin_set_text_nocopy(msgwin, owl_strdup(msg)); |
---|
[d70f45f] | 27 | } |
---|
| 28 | |
---|
| 29 | void owl_msgwin_set_text_nocopy(owl_msgwin *msgwin, char *msg) |
---|
| 30 | { |
---|
[23b6c11] | 31 | owl_free(msgwin->msg); |
---|
[d70f45f] | 32 | msgwin->msg = msg; |
---|
| 33 | owl_window_dirty(msgwin->window); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | void owl_msgwin_cleanup(owl_msgwin *msgwin) |
---|
| 37 | { |
---|
[23b6c11] | 38 | owl_free(msgwin->msg); |
---|
[d70f45f] | 39 | msgwin->msg = NULL; |
---|
| 40 | if (msgwin->window) { |
---|
| 41 | g_signal_handler_disconnect(msgwin->window, msgwin->redraw_id); |
---|
| 42 | g_object_unref(msgwin->window); |
---|
| 43 | msgwin->window = NULL; |
---|
| 44 | msgwin->redraw_id = 0; |
---|
| 45 | } |
---|
| 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.