Commit 6467345e authored by Christian Hergert's avatar Christian Hergert
Browse files

plugins/copyright: add tweaks and rename schema

parent 9f4dabb7
Pipeline #433898 passed with stages
in 72 minutes and 33 seconds
......@@ -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);
}
<?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>
......@@ -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
......
/* 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"));
}
/* 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
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
<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>
......
<?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>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment