release-1.10release-1.8release-1.9
Last change
on this file since 6a20996 was
d4927a7,
checked in by Anders Kaseorg <andersk@mit.edu>, 14 years ago
|
Replace owl_strdup with g_strdup.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Karl Ramm <kcr@mit.edu>
|
-
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 | { |
---|
[d4927a7] | 26 | owl_msgwin_set_text_nocopy(msgwin, g_strdup(msg)); |
---|
[d70f45f] | 27 | } |
---|
| 28 | |
---|
| 29 | void owl_msgwin_set_text_nocopy(owl_msgwin *msgwin, char *msg) |
---|
| 30 | { |
---|
[ddbbcffa] | 31 | g_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 | { |
---|
[ddbbcffa] | 38 | g_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.