[gnome-builder/wip/gtk4-port: 548/1774] plugins/copyright: add preference toggle using new API
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 548/1774] plugins/copyright: add preference toggle using new API
- Date: Mon, 11 Jul 2022 22:31:16 +0000 (UTC)
commit e052503120ae1970d459f1fa5005acdc3fcba6c1
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 11 17:01:32 2022 -0700
plugins/copyright: add preference toggle using new API
src/plugins/copyright/copyright_plugin.py | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/copyright/copyright_plugin.py b/src/plugins/copyright/copyright_plugin.py
index 0d7578660..b68feb588 100644
--- a/src/plugins/copyright/copyright_plugin.py
+++ b/src/plugins/copyright/copyright_plugin.py
@@ -104,18 +104,18 @@ class CopyrightBufferAddin(Ide.Object, Ide.BufferAddin):
iter = match_end
class CopyrightPreferencesAddin(GObject.Object, Ide.PreferencesAddin):
- def do_load(self, prefs):
- self.update_on_save = prefs.add_switch(
- "editor", "general",
- "org.gnome.builder.plugins.copyright",
- "update-on-save",
- None,
- "false",
- _("Update Copyright"),
- _("When saving a file Builder will automatically update copyright information for you"),
- # translators: these are keywords used to search for preferences
- _("update copyright save"),
- 10)
-
- def do_unload(self, prefs):
- prefs.remove_id(self.update_on_save)
+ def do_load(self, window):
+ window.add_group('editor', 'formatting', 0, _('Formatting'))
+ Ide.add_preference_items(window, [
+ {
+ 'kind': 'toggle',
+ 'page': 'editor',
+ 'group': 'formatting',
+ 'name': 'update-copyright',
+ 'priority': 0,
+ 'title': _('Update Copyright'),
+ 'subtitle': _('Automatically update copyright headers when saving a file'),
+ 'schema_id': 'org.gnome.builder.plugins.copyright',
+ 'key': 'update-on-save',
+ },
+ ])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]