On Sun, 25 Jan 2009, Yura Siamashka wrote:
I think this behaviour can be implemented in plugin. Hook open/save and set changed flag for each document.
I just tried that:
static void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data) { if (doc != NULL) doc->changed=TRUE; }
Two problems:
-When you go to close the document afterwards, it always says "The file 'X' is not saved" which isn't quite true. At least that confirms the above is being called, so I know my plug-in is working.
-Even though I've got that evidence the changed flag is being toggled, the menu structure doesn't seem to change. Save and Save All are still disabled.
I'm not sure if those two discoveries mean that a plug-in based solution can't work for what I want here, or if I just need to make a much better one.
P.S. If someone feels like improving the "Plugin Signals" section of the documentation with a trivial edit, it would have made things easier if the sample on_document_open code snippet there included this addition:
#include "document.h"
That's not already included in demoplugin.c, I had to add that in order to access the GeanyDocument structure. The compiler error you get in that situation is a bit cryptic.
-- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD