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 352854 - modelines should revert to pref values when a modeline part is removed
modelines should revert to pref values when a modeline part is removed
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
2.15.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2006-08-25 14:38 UTC by Steve Frécinaux
Modified: 2019-03-23 20:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.99 KB, patch)
2006-08-26 15:27 UTC, Steve Frécinaux
none Details | Review
patch v2 (3.59 KB, patch)
2006-08-26 15:50 UTC, Steve Frécinaux
committed Details | Review

Description Steve Frécinaux 2006-08-25 14:38:54 UTC
Currently, if you remove a part from the modeline and save your document, the default value (the one you set in the prefs) is not applied back to the document. This is workaroundable by closing the document and reopening it, or by setting the modeline to the default value before deleting it, but it's an ugly workaround.
Comment 1 Paolo Maggi 2006-08-25 14:44:31 UTC
It should be quite easy to fix it... especially if you know the code ;)
Comment 2 Steve Frécinaux 2006-08-26 15:27:59 UTC
Created attachment 71655 [details] [review]
patch

This patch fixes the bug by reading the missing bits from modeline from gconf.
Comment 3 Steve Frécinaux 2006-08-26 15:50:21 UTC
Created attachment 71661 [details] [review]
patch v2

This patch only reads the modeline parts that have been removed.
Comment 4 Steve Frécinaux 2006-08-26 16:04:19 UTC
Fixed in the development version. The fix will be available in the next major release.
Comment 5 Paolo Maggi 2006-08-28 09:44:38 UTC
Why you didn't use the gedit-prefs-manager functions?
Comment 6 Steve Frécinaux 2006-08-28 10:38:23 UTC
Because they were said to be private to gedit, and thus aren't binded into python.
Comment 7 Paolo Maggi 2006-08-28 11:50:05 UTC
Who said that?
I don't think gedit_prefs_manager functions are private, they are the "official" way to get access to the gedit preferences.
I think we should bind it in python.
Comment 8 Paolo Borelli 2006-08-28 12:13:21 UTC
> Who said that?

I guess that would be me, even if I phrased the thing a bit differently: I know that prefs-manager functions are public and accessible from C plugins. Nonetheless until this one came up we had no real example of a py plugin needing to access the prefs: all similar issues were better resolved by directly querying the properties of the view/buffer etc. Beside prefs-manager is a functional interface and doesn't support notification, so we'll have a situation were plugins need GConf to manage their prefs, need GConf to get notification about prefs, yet they'd use the prefs-manager for reading some of the internal gedit prefs.

Substantially up until now my take on the issue was more a "wait and see", that is do not bind the api and set it in stone, until some compelling reason came up.

This was doubly true in 2.14 were our api plans were even less clear. For instance now we have gedit.commands and gedit.utils... I think it would be clearer to bind the prefs in a gedit.prefs module.
Comment 9 Paolo Maggi 2006-08-28 12:31:40 UTC
> Beside prefs-manager
> is a functional interface and doesn't support notification, 

This is true and we should probably fix it in the future. 

> so we'll have a
> situation were plugins need GConf to manage their prefs, need GConf to get
> notification about prefs, yet they'd use the prefs-manager for reading some of
> the internal gedit prefs.

Using gedit_prefs_manager let us abstract from the underlying way of managing preferences (this will help if gedit will ever be ported on Windows).

> I think it would be
> clearer to bind the prefs in a gedit.prefs module.

I agree.

My opinions about this problem are: 
- we should avoid to directly use gconf in plugins when possible (i.e. to access gedit core preferences)
- we should try to improve gedit_prefs_manager to support notification and to provide a simple API for accessing to plugins specific preferences
- if using gconf cannot be avoided we should use the GEDIT_PREFS defines instead of the names of the keys.