gplugin/gplugin

Add scaffolding for GTK4 widgets

2021-10-04, Elliott Sales de Andrade
b4b2c4d16058
Parents d404c2d1ddaa
Children 27b0c5e40a4b
Add scaffolding for GTK4 widgets

This just compiles new things, with no real implementation right now. I'm just posting because rbt won't accept multi-commit reviews from me.

Testing Done:
Compile only, really.

Reviewed at https://reviews.imfreedom.org/r/991/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/data/gplugin-gtk.gresource.xml Mon Oct 04 00:15:27 2021 -0500
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/imfreedom/keep/gplugin/gplugin-gtk4/">
+ </gresource>
+</gresources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk.h.in Mon Oct 04 00:15:27 2021 -0500
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef GPLUGIN_GTK_H
+#define GPLUGIN_GTK_H
+
+#ifndef __GI_SCANNER__
+# ifdef GPLUGIN_GTK_COMPILATION
+# error "gplugin-gtk source files should not include gplugin-gtk.h"
+# endif /* GPLUGIN_GTK_COMPILATION */
+#endif /* __GI_SCANNER__ */
+
+#ifndef GPLUGIN_GTK_GLOBAL_HEADER_INSIDE
+# define GPLUGIN_GTK_GLOBAL_HEADER_INSIDE
+#endif /* GPLUGIN_GTK_GLOBAL_HEADER_INSIDE */
+
+@GPLUGIN_GTK_H_INCLUDES@
+
+#undef GPLUGIN_GTK_GLOBAL_HEADER_INSIDE
+
+#endif /* GPLUGIN_GTK_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/meson.build Mon Oct 04 00:15:27 2021 -0500
@@ -0,0 +1,143 @@
+if get_option('gtk4')
+
+###############################################################################
+# Build Info
+###############################################################################
+GTK4 = dependency('gtk4', version : '>=4.0.0')
+
+GPLUGIN_GTK4_LIBRARY_VERSION = '0.1.0'
+
+GPLUGIN_GTK4_SOURCES = [
+]
+
+GPLUGIN_GTK4_HEADERS = [
+]
+
+GPLUGIN_GTK4_PRIVATE_SOURCES = [
+]
+
+GPLUGIN_GTK4_PRIVATE_HEADERS = [
+]
+
+GPLUGIN_GTK4_PUBLIC_BUILT_SOURCES = [
+]
+
+GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS = [
+]
+
+GPLUGIN_GTK4_GENERATED_TARGETS = [
+]
+
+###############################################################################
+# Configure Files
+###############################################################################
+GPLUGIN_GTK4_H_INCLUDES = ''
+foreach header : GPLUGIN_GTK4_HEADERS
+ GPLUGIN_GTK4_H_INCLUDES = '@0@\n#include <@1@>'.format(
+ GPLUGIN_GTK4_H_INCLUDES,
+ header)
+endforeach
+
+conf = configuration_data()
+conf.set('GPLUGIN_GTK_H_INCLUDES', GPLUGIN_GTK4_H_INCLUDES)
+gplugin_gtk4_h = configure_file(
+ input : 'gplugin-gtk.h.in',
+ output : 'gplugin-gtk.h',
+ configuration : conf,
+ install : true,
+ install_dir : get_option('includedir') / 'gplugin-gtk4-1.0')
+
+###############################################################################
+# Resource Target
+###############################################################################
+gplugin_gtk4_resources = gnome.compile_resources(
+ 'gplugin-gtk4-resources',
+ 'data/gplugin-gtk.gresource.xml',
+ c_name: 'gplugin_gtk',
+ source_dir: 'data')
+
+###############################################################################
+# Library Target
+###############################################################################
+gplugin_gtk4 = shared_library('gplugin-gtk4',
+ GPLUGIN_GTK4_SOURCES,
+ GPLUGIN_GTK4_HEADERS,
+ GPLUGIN_GTK4_PRIVATE_SOURCES,
+ GPLUGIN_GTK4_PRIVATE_HEADERS,
+ GPLUGIN_GTK4_PUBLIC_BUILT_SOURCES,
+ GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS,
+ gplugin_gtk4_resources,
+ c_args : ['-DGPLUGIN_GTK_COMPILATION', '-DG_LOG_DOMAIN="GPluginGtk"'],
+ include_directories : toplevel_inc,
+ dependencies : [gplugin_dep, GTK4],
+ version : GPLUGIN_GTK4_LIBRARY_VERSION,
+ install : true
+)
+
+gplugin_gtk4_inc = include_directories('.')
+
+pkgconfig.generate(
+ gplugin_gtk4,
+ name : 'gplugin-gtk4',
+ description : 'GTK4 widgets for GPlugin',
+ filebase : 'gplugin-gtk4',
+ subdirs : 'gplugin-gtk4-1.0',
+ libraries : [gplugin],
+ requires : [GLIB, GOBJECT, GMODULE, GTK4],
+)
+
+###############################################################################
+# GObject Introspection
+###############################################################################
+if get_option('introspection')
+ gplugin_gtk4_gir = gnome.generate_gir(
+ gplugin_gtk4,
+ sources : [
+ GPLUGIN_GTK4_SOURCES,
+ GPLUGIN_GTK4_HEADERS,
+ GPLUGIN_GTK4_PUBLIC_BUILT_SOURCES,
+ GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS,
+ ],
+ includes : [gplugin_gir[0], 'Gtk-4.0'],
+ namespace : 'GPluginGtk4',
+ nsversion : '1.0',
+ symbol_prefix : 'gplugin_gtk',
+ identifier_prefix : 'GPluginGtk',
+ install : true,
+ header : 'gplugin-gtk.h',
+ export_packages: ['gplugin-gtk4'],
+ dependencies : [gplugin_dep],
+ extra_args : ['--quiet', '-DGPLUGIN_GTK_COMPILATION'])
+ GPLUGIN_GTK4_GENERATED_TARGETS += gplugin_gtk4_gir
+endif
+
+###############################################################################
+# Library Dependency Object
+###############################################################################
+gplugin_gtk4_dep = declare_dependency(
+ include_directories: [toplevel_inc, gplugin_gtk4_inc],
+ link_with : [gplugin, gplugin_gtk4],
+ sources : [
+ GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS,
+ GPLUGIN_GTK4_GENERATED_TARGETS,
+ ],
+ dependencies : [GLIB, GOBJECT, GTK4],
+)
+
+meson.override_dependency('gplugin-gtk4', gplugin_gtk4_dep)
+
+###############################################################################
+# Install Stuff
+###############################################################################
+# install the normal includes into the gplugin-gtk subdirectory
+install_headers(
+ GPLUGIN_GTK4_HEADERS,
+ subdir : 'gplugin-gtk4-1.0/gplugin-gtk'
+)
+
+###############################################################################
+# subdirectories
+###############################################################################
+subdir('reference')
+
+endif # gtk4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/reference/gplugin-gtk4.toml.in Mon Oct 04 00:15:27 2021 -0500
@@ -0,0 +1,48 @@
+[library]
+version = "@GPLUGIN_VERSION@"
+browse_url = "https://keep.imfreedom.org/gplugin/gplugin/"
+repository_url = "https://keep.imfreedom.org/gplugin/gplugin/"
+website_url = "https://keep.imfreedom.org/gplugin/gplugin/"
+authors = "GPlugin Developers"
+logo_url = ""
+license = "LGPL-2.1-or-later"
+description = "GPlugin Gtk Library"
+dependencies = [ "GLib-2.0", "GObject-2.0", "GPlugin-1.0", "Gtk-4.0" ]
+devhelp = true
+search_index = true
+
+ [dependencies."GLib-2.0"]
+ name = "GLib"
+ description = "General-purpose, portable utility library."
+ docs_url = "https://docs.gtk.org/glib/"
+
+ [dependencies."GObject-2.0"]
+ name = "GObject"
+ description = "The base type system library"
+ docs_url = "https://docs.gtk.org/gobject/"
+
+ [dependencies."GPlugin-1.0"]
+ name = "GPlugin"
+ description = "Plugin library"
+ docs_url = "https://docs.imfreedom.org/gplugin/"
+
+ [dependencies."Gtk-4.0"]
+ name = "Gtk4"
+ description = "GTK Widget Toolkit"
+ docs_url = "https://docs.gtk.org/gtk4/"
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://keep.imfreedom.org/gplugin/gplugin/file/default/"
+
+[extra]
+# The same order will be used when generating the index
+content_files = [
+]
+content_images = [
+]
+urlmap_file = "urlmap.js"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/reference/meson.build Mon Oct 04 00:15:27 2021 -0500
@@ -0,0 +1,31 @@
+if get_option('doc')
+ gplugin_gtk4_toml = configure_file(
+ input : 'gplugin-gtk4.toml.in',
+ output : 'gplugin-gtk4.toml',
+ configuration : version_conf,
+ install : true,
+ install_dir : docs_dir / 'gplugin-gtk4',
+ )
+
+ gplugin_gtk4_doc = custom_target('gplugin-gtk4-doc',
+ input : [ gplugin_gtk4_toml, gplugin_gtk4_gir[0] ],
+ output : 'gplugin-gtk4',
+ command : [
+ gidocgen,
+ 'generate',
+ '--quiet',
+ '--fatal-warnings',
+ '--add-include-path=@0@'.format(meson.project_build_root() / 'gplugin'),
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--no-namespace-dir',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '@INPUT1@'
+ ],
+ depends : [ gplugin_gir[0] ],
+ build_by_default : true,
+ install : true,
+ install_dir : docs_dir,
+ )
+endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/reference/urlmap.js Mon Oct 04 00:15:27 2021 -0500
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 2021 GNOME Foundation
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+// A map between namespaces and base URLs for their online documentation
+baseURLs = [
+ [ 'GLib', 'https://docs.gtk.org/glib/' ],
+ [ 'GObject', 'https://docs.gtk.org/gobject/' ],
+ [ 'GPlugin', 'https://docs.imfreedom.org/gplugin/' ],
+ [ 'GModule', 'https://docs.gtk.org/gmodule/' ],
+ [ 'Gtk3', 'https://docs.gtk.org/gtk3/' ],
+]
--- a/meson.build Mon Oct 04 00:14:59 2021 -0500
+++ b/meson.build Mon Oct 04 00:15:27 2021 -0500
@@ -127,6 +127,7 @@
subdir('gplugin')
subdir('gplugin-gtk3')
subdir('gplugin-gtk3-viewer')
+subdir('gplugin-gtk4')
subdir('gplugin-query')
subdir('packaging')
subdir('po')
@@ -143,6 +144,9 @@
if get_option('gtk3')
doc_targets += gplugin_gtk3_doc
endif
+ if get_option('gtk4')
+ doc_targets += gplugin_gtk4_doc
+ endif
alias_target('doc', doc_targets)
endif
@@ -156,7 +160,8 @@
summary({
'api reference' : get_option('doc'),
- 'gtk3 widgets' : get_option('gtk3'),
+ 'GTK3 widgets' : get_option('gtk3'),
+ 'GTK4 widgets' : get_option('gtk4'),
'man pages' : get_option('help2man'),
}, bool_yn : true, section : 'Miscellaneous')
--- a/meson_options.txt Mon Oct 04 00:14:59 2021 -0500
+++ b/meson_options.txt Mon Oct 04 00:15:27 2021 -0500
@@ -19,7 +19,13 @@
option(
'gtk3',
type : 'boolean', value : true,
- description : 'Whether or not to build the gtk3 library'
+ description : 'Whether or not to build the GTK3 library'
+)
+
+option(
+ 'gtk4',
+ type : 'boolean', value : true,
+ description : 'Whether or not to build the GTK4 library'
)
option(