[Geany] Enabling save after no changes
Enrico Tröger
enrico.troeger at xxxxx
Wed Jan 28 16:01:40 UTC 2009
On Tue, 27 Jan 2009 21:13:30 -0500 (EST), Greg Smith
<gsmith at gregsmith.com> wrote:
>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:
Be patient, I'm going to implement this in Geany.
>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.
At this point you noticed that this way of changing it, is just a
hack :).
>-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.
The menu and toolbar items won't change when changing the 'changed'
flag but when document_set_text_changed() is called which itself sets
the 'changed' flag.
>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.
At least not as clean as it will be in the core.
>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
Thanks for the pointer, will fix this later.
Regards,
Enrico
--
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20090128/8c42ad8f/attachment.pgp>
More information about the Users
mailing list