[gnome-builder] plugins/copyright: add tweaks and rename schema
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/copyright: add tweaks and rename schema
- Date: Sat, 20 Aug 2022 05:38:37 +0000 (UTC)
commit 6467345e75216c90bfeb56826f7d3fe931f13137
Author: Christian Hergert <chergert redhat com>
Date: Fri Aug 19 22:38:07 2022 -0700
plugins/copyright: add tweaks and rename schema
src/plugins/copyright/copyright-plugin.c | 8 +++-
src/plugins/copyright/copyright.gresource.xml | 7 ++++
src/plugins/copyright/copyright.plugin | 1 +
src/plugins/copyright/gbp-copyright-tweaks-addin.c | 44 ++++++++++++++++++++++
src/plugins/copyright/gbp-copyright-tweaks-addin.h | 31 +++++++++++++++
src/plugins/copyright/meson.build | 32 ++++++++++------
...xml => org.gnome.builder.copyright.gschema.xml} | 2 +-
src/plugins/copyright/tweaks.ui | 38 +++++++++++++++++++
8 files changed, 148 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/copyright/copyright-plugin.c b/src/plugins/copyright/copyright-plugin.c
index 3bb6ac1ac..09a682e78 100644
--- a/src/plugins/copyright/copyright-plugin.c
+++ b/src/plugins/copyright/copyright-plugin.c
@@ -26,14 +26,18 @@
#include "gbp-copyright-buffer-addin.h"
#include "gbp-copyright-preferences-addin.h"
+#include "gbp-copyright-tweaks-addin.h"
_IDE_EXTERN void
_gbp_copyright_register_types (PeasObjectModule *module)
{
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_BUFFER_ADDIN,
+ GBP_TYPE_COPYRIGHT_BUFFER_ADDIN);
peas_object_module_register_extension_type (module,
IDE_TYPE_PREFERENCES_ADDIN,
GBP_TYPE_COPYRIGHT_PREFERENCES_ADDIN);
peas_object_module_register_extension_type (module,
- IDE_TYPE_BUFFER_ADDIN,
- GBP_TYPE_COPYRIGHT_BUFFER_ADDIN);
+ IDE_TYPE_TWEAKS_ADDIN,
+ GBP_TYPE_COPYRIGHT_TWEAKS_ADDIN);
}
diff --git a/src/plugins/copyright/copyright.gresource.xml b/src/plugins/copyright/copyright.gresource.xml
new file mode 100644
index 000000000..3cff596d0
--- /dev/null
+++ b/src/plugins/copyright/copyright.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/plugins/copyright">
+ <file>copyright.plugin</file>
+ <file preprocess="xml-stripblanks">tweaks.ui</file>
+ </gresource>
+</gresources>
diff --git a/src/plugins/copyright/copyright.plugin b/src/plugins/copyright/copyright.plugin
index f389cb6a4..5b16e1983 100644
--- a/src/plugins/copyright/copyright.plugin
+++ b/src/plugins/copyright/copyright.plugin
@@ -2,6 +2,7 @@
Authors=Christian Hergert <chergert redhat com>
Builtin=true
Copyright=Copyright © 2020 Christian Hergert
+Depends=editorui;
Description=Update copyright when files are saved
Embedded=_gbp_copyright_register_types
Module=copyright_plugin
diff --git a/src/plugins/copyright/gbp-copyright-tweaks-addin.c
b/src/plugins/copyright/gbp-copyright-tweaks-addin.c
new file mode 100644
index 000000000..99db81bd4
--- /dev/null
+++ b/src/plugins/copyright/gbp-copyright-tweaks-addin.c
@@ -0,0 +1,44 @@
+/* gbp-copyright-tweaks-addin.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-copyright-tweaks-addin"
+
+#include "config.h"
+
+#include "gbp-copyright-tweaks-addin.h"
+
+struct _GbpCopyrightTweaksAddin
+{
+ IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpCopyrightTweaksAddin, gbp_copyright_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_copyright_tweaks_addin_class_init (GbpCopyrightTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_copyright_tweaks_addin_init (GbpCopyrightTweaksAddin *self)
+{
+ ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+ IDE_STRV_INIT ("/plugins/copyright/tweaks.ui"));
+}
diff --git a/src/plugins/copyright/gbp-copyright-tweaks-addin.h
b/src/plugins/copyright/gbp-copyright-tweaks-addin.h
new file mode 100644
index 000000000..f022199a4
--- /dev/null
+++ b/src/plugins/copyright/gbp-copyright-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-copyright-tweaks-addin.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <libide-tweaks.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_COPYRIGHT_TWEAKS_ADDIN (gbp_copyright_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpCopyrightTweaksAddin, gbp_copyright_tweaks_addin, GBP, COPYRIGHT_TWEAKS_ADDIN,
IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/copyright/meson.build b/src/plugins/copyright/meson.build
index 5ba17ab71..1d8a9d10d 100644
--- a/src/plugins/copyright/meson.build
+++ b/src/plugins/copyright/meson.build
@@ -1,16 +1,24 @@
if get_option('plugin_copyright')
- plugins_sources += files(
- 'copyright-plugin.c',
- 'gbp-copyright-buffer-addin.c',
- 'gbp-copyright-preferences-addin.c',
- 'gbp-copyright-util.c',
- )
- install_data('org.gnome.builder.plugins.copyright.gschema.xml', install_dir: schema_dir)
+plugins_sources += files(
+ 'copyright-plugin.c',
+ 'gbp-copyright-buffer-addin.c',
+ 'gbp-copyright-preferences-addin.c',
+ 'gbp-copyright-tweaks-addin.c',
+ 'gbp-copyright-util.c',
+)
+
+plugins_sources += gnome.compile_resources(
+ 'copyright-resources',
+ 'copyright.gresource.xml',
+ c_name: 'gbp_copyright',
+)
+
+install_data('org.gnome.builder.copyright.gschema.xml', install_dir: schema_dir)
+
+test_copyright = executable('test-copyright', ['test-copyright.c', 'gbp-copyright-util.c'],
+ dependencies: [ libglib_dep ],
+)
+test('test-copyright', test_copyright)
- test_copyright = executable('test-copyright',
- ['test-copyright.c', 'gbp-copyright-util.c'],
- dependencies: [ libglib_dep ],
- )
- test('test-copyright', test_copyright)
endif
diff --git a/src/plugins/copyright/org.gnome.builder.plugins.copyright.gschema.xml
b/src/plugins/copyright/org.gnome.builder.copyright.gschema.xml
similarity index 67%
rename from src/plugins/copyright/org.gnome.builder.plugins.copyright.gschema.xml
rename to src/plugins/copyright/org.gnome.builder.copyright.gschema.xml
index 4db11f45a..a7aed359c 100644
--- a/src/plugins/copyright/org.gnome.builder.plugins.copyright.gschema.xml
+++ b/src/plugins/copyright/org.gnome.builder.copyright.gschema.xml
@@ -1,5 +1,5 @@
<schemalist>
- <schema id="org.gnome.builder.plugins.copyright" path="/org/gnome/builder/plugins/copyright/"
gettext-domain="gnome-builder">
+ <schema id="org.gnome.builder.copyright" path="/org/gnome/builder/copyright/"
gettext-domain="gnome-builder">
<key name="update-on-save" type="b">
<default>false</default>
<summary>Update Copyright before Saving</summary>
diff --git a/src/plugins/copyright/tweaks.ui b/src/plugins/copyright/tweaks.ui
new file mode 100644
index 000000000..34078c9cc
--- /dev/null
+++ b/src/plugins/copyright/tweaks.ui
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="IdeTweaks">
+ <child internal-child="visual_section">
+ <object class="IdeTweaksSection">
+ <child internal-child="editor_page">
+ <object class="IdeTweaksPage">
+ <child internal-child="editor_page_internal_section">
+ <object class="IdeTweaksSection">
+ <child internal-child="editor_session_page">
+ <object class="IdeTweaksPage">
+ <child>
+ <object class="IdeTweaksSettings" id="settings_org_gnome_builder_copyright">
+ <property name="schema-id">org.gnome.builder.copyright</property>
+ <property name="application-only">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="IdeTweaksGroup">
+ <child>
+ <object class="IdeTweaksSwitch">
+ <property name="title" translatable="yes">Update Copyright</property>
+ <property name="subtitle" translatable="yes">Update copyright headers when
saving documents</property>
+ <property
name="action-name">settings.org.gnome.builder.copyright.update-on-save</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]