summaryrefslogtreecommitdiff
path: root/src/gui/gui-buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui-buffer.c')
-rw-r--r--src/gui/gui-buffer.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 4c2df12a1..a5a4bbdc6 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -69,7 +69,10 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
char *input_data),
- void *input_callback_data)
+ void *input_callback_data,
+ int (*close_callback)(void *data,
+ struct t_gui_buffer *buffer),
+ void *close_callback_data)
{
struct t_gui_buffer *new_buffer;
struct t_gui_completion *new_completion;
@@ -99,6 +102,10 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
new_buffer->notify_level = GUI_BUFFER_NOTIFY_LEVEL_DEFAULT;
new_buffer->num_displayed = 0;
+ /* close callback */
+ new_buffer->close_callback = close_callback;
+ new_buffer->close_callback_data = close_callback_data;
+
/* title */
new_buffer->title = NULL;
new_buffer->title_refresh_needed = 1;
@@ -623,6 +630,11 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
hook_signal_send ("buffer_close",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
+ if (buffer->close_callback)
+ {
+ (void)(buffer->close_callback) (buffer->close_callback_data, buffer);
+ }
+
if (switch_to_another)
{
for (ptr_window = gui_windows; ptr_window;