From 0bf9414532b36b65aae0aa11d0a5cf0edf1579ef Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 11 Sep 2008 15:06:14 +0000 Subject: [PATCH] Unsplit when the source document is closed. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/split-window-plugin@2937 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ plugins/splitwindow.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3911a737..2c0b9a95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ doc/plugins.dox: Add plugin signal "document-close", sent just before a document is closed. + * plugins/splitwindow.c: + Unsplit when the source document is closed. 2008-09-10 Nick Treleaven diff --git a/plugins/splitwindow.c b/plugins/splitwindow.c index 9a1429b2..2f1fd1bc 100644 --- a/plugins/splitwindow.c +++ b/plugins/splitwindow.c @@ -254,6 +254,20 @@ void plugin_init(GeanyData *data) } +static void on_document_close(GObject *obj, GeanyDocument *doc, gpointer user_data) +{ + /* remove the split window because the document won't exist anymore */ + if (our_editor && doc == our_editor->document) + on_unsplit(NULL, NULL); +} + +PluginCallback plugin_callbacks[] = +{ + { "document-close", (GCallback) &on_document_close, FALSE, NULL }, + { NULL, NULL, FALSE, NULL } +}; + + void plugin_cleanup() { if (plugin_state != STATE_UNSPLIT)