After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 761138 - GtkSourceFile: add API to set/get string metadata
GtkSourceFile: add API to set/get string metadata
Status: RESOLVED WONTFIX
Product: gtksourceview
Classification: Platform
Component: File loading and saving
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on: 761515
Blocks:
 
 
Reported: 2016-01-26 15:23 UTC by Sébastien Wilmet
Modified: 2016-06-12 11:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sébastien Wilmet 2016-01-26 15:23:07 UTC
Gvfs metadata is not supported on Windows. For that, gedit uses the gedit-metadata-manager. Since it is a useful feature for other text editors, it makes sense to have it in GtkSourceView.

So the gedit-metadata-manager would be moved to GtkSourceView, as internal functions. An API would be exposed in GtkSourceFile to set/get string metadata.

If gvfs metadata is supported, GtkSourceFile would use that, otherwise the metadata-manager is used.

GtkSourceFile can also handle location changes without loosing metadata. The metadata would be kept in memory in a GFileInfo, and when the location changes the in-memory metadata is saved to the new location.

GtkSourceView could even have standard metadata that is shared between all GtkSourceView applications, with the 'gtksourceview' namespace in the key. For example the cursor location, the GtkSourceLanguage used and the character encoding. But this can be done in a later iteration.
Comment 1 Sébastien Wilmet 2016-02-02 15:37:42 UTC
After looking at gedit-metadata-manager in more details, it is not really suitable for GtkSourceView, because it does sync I/O on the main thread, with potentially a big amount of data (e.g. after storing file metadata of every file opened with gedit during 10 years…).

Also, the GSV API should report GErrors when trying to save the metadata. It is currently not done with the GeditDocument API.

And it should be possible to save the metadata either sync or async. Saving synchronously is needed for example on application shutdown, when the main loop has already exited.

So, it's more complicated than I initially thought. If such a feature is included in GtkSourceView, it should be well done.
Comment 2 Sébastien Wilmet 2016-03-27 08:07:36 UTC
(In reply to Sébastien Wilmet from comment #1)
> After looking at gedit-metadata-manager in more details, it is not really
> suitable for GtkSourceView, because it does sync I/O on the main thread,
> with potentially a big amount of data (e.g. after storing file metadata of
> every file opened with gedit during 10 years…).

No, actually the gedit-metadata-manager keeps the metadata for only the last 50 opened files. But it isn't great either.

See bug #761515, to use for example SQLite.
Comment 3 Sébastien Wilmet 2016-06-12 11:02:47 UTC
Implemented in Gtef:
https://github.com/swilmet/gtef

It'll maybe be moved one day to GtkSourceView, but it is not worth keeping this bug open.