# HG changeset patch
# Node ID 8049cda8dd40
# Parent  c631d0391343
diff --git a/gplugin-gtk3/data/gplugin-gtk.gresource.xml b/gplugin-gtk4/data/gplugin-gtk.gresource.xml
copy from gplugin-gtk3/data/gplugin-gtk.gresource.xml
copy to gplugin-gtk4/data/gplugin-gtk.gresource.xml
--- a/gplugin-gtk3/data/gplugin-gtk.gresource.xml
+++ b/gplugin-gtk4/data/gplugin-gtk.gresource.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/imfreedom/keep/gplugin/gplugin-gtk/">
-    <file compressed="true">plugin-info.ui</file>
+  <gresource prefix="/org/imfreedom/keep/gplugin/gplugin-gtk4/">
   </gresource>
 </gresources>
diff --git a/gplugin-gtk3/gplugin-gtk.h.in b/gplugin-gtk4/gplugin-gtk.h.in
copy from gplugin-gtk3/gplugin-gtk.h.in
copy to gplugin-gtk4/gplugin-gtk.h.in
--- a/gplugin-gtk3/gplugin-gtk.h.in
+++ b/gplugin-gtk4/gplugin-gtk.h.in
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
+ * 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
diff --git a/gplugin-gtk3/meson.build b/gplugin-gtk4/meson.build
copy from gplugin-gtk3/meson.build
copy to gplugin-gtk4/meson.build
--- a/gplugin-gtk3/meson.build
+++ b/gplugin-gtk4/meson.build
@@ -1,71 +1,57 @@
-if get_option('gtk3')
+if get_option('gtk4')
 
 ###############################################################################
 # Build Info
 ###############################################################################
-GTK3 = dependency('gtk+-3.0', version : '>=3.0.0')
+GTK4 = dependency('gtk4', version : '>=4.0.0')
 
-GPLUGIN_GTK3_LIBRARY_VERSION = '0.1.0'
+GPLUGIN_GTK4_LIBRARY_VERSION = '0.1.0'
 
-GPLUGIN_GTK3_SOURCES = [
-	'gplugin-gtk-plugin-info.c',
-	'gplugin-gtk-store.c',
-	'gplugin-gtk-view.c',
+GPLUGIN_GTK4_SOURCES = [
+]
+
+GPLUGIN_GTK4_HEADERS = [
 ]
 
-GPLUGIN_GTK3_HEADERS = [
-	'gplugin-gtk-plugin-info.h',
-	'gplugin-gtk-store.h',
-	'gplugin-gtk-view.h',
+GPLUGIN_GTK4_PRIVATE_SOURCES = [
 ]
 
-GPLUGIN_GTK3_PRIVATE_SOURCES = [
+GPLUGIN_GTK4_PRIVATE_HEADERS = [
 ]
 
-GPLUGIN_GTK3_PRIVATE_HEADERS = [
+GPLUGIN_GTK4_PUBLIC_BUILT_SOURCES = [
 ]
 
-GPLUGIN_GTK3_PUBLIC_BUILT_SOURCES = [
+GPLUGIN_GTK4_PUBLIC_BUILT_HEADERS = [
 ]
 
-GPLUGIN_GTK3_PUBLIC_BUILT_HEADERS = [
-]
-
-GPLUGIN_GTK3_GENERATED_TARGETS = [
+GPLUGIN_GTK4_GENERATED_TARGETS = [
 ]
 
 ###############################################################################
 # Configure Files
 ###############################################################################
-GPLUGIN_GTK3_H_INCLUDES = ''
-foreach header : GPLUGIN_GTK3_HEADERS
-	GPLUGIN_GTK3_H_INCLUDES = '@0@\n#include <@1@>'.format(
-		GPLUGIN_GTK3_H_INCLUDES,
+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_GTK3_H_INCLUDES)
-gplugin_gtk3_h = configure_file(
+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-gtk3-1.0')
-
-gplugin_gtk3_xml = configure_file(
-	input : 'gplugin-gtk3.xml.in',
-	output: 'gplugin-gtk3.xml',
-	configuration : version_conf,
-	install: true,
-	install_dir : get_option('datadir') / 'glade' / 'catalogs',
-)
+	install_dir : get_option('includedir') / 'gplugin-gtk4-1.0')
 
 ###############################################################################
 # Resource Target
 ###############################################################################
-gplugin_gtk3_resources = gnome.compile_resources(
-	'gplugin-gtk3-resources',
+gplugin_gtk4_resources = gnome.compile_resources(
+	'gplugin-gtk4-resources',
 	'data/gplugin-gtk.gresource.xml',
 	c_name: 'gplugin_gtk',
 	source_dir: 'data')
@@ -73,74 +59,80 @@ gplugin_gtk3_resources = gnome.compile_r
 ###############################################################################
 # Library Target
 ###############################################################################
-gplugin_gtk3 = shared_library('gplugin-gtk3',
-	GPLUGIN_GTK3_SOURCES,
-	GPLUGIN_GTK3_HEADERS,
-	GPLUGIN_GTK3_PRIVATE_SOURCES,
-	GPLUGIN_GTK3_PRIVATE_HEADERS,
-	GPLUGIN_GTK3_PUBLIC_BUILT_SOURCES,
-	GPLUGIN_GTK3_PUBLIC_BUILT_HEADERS,
-	gplugin_gtk3_resources,
+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, GTK3],
-	version : GPLUGIN_GTK3_LIBRARY_VERSION,
+	dependencies : [gplugin_dep, GTK4],
+	version : GPLUGIN_GTK4_LIBRARY_VERSION,
 	install : true
 )
 
-gplugin_gtk3_inc = include_directories('.')
+gplugin_gtk4_inc = include_directories('.')
 
 pkgconfig.generate(
-	gplugin_gtk3,
-	name : 'gplugin-gtk3',
-	description : 'Gtk3 widgets for GPlugin',
-	filebase : 'gplugin-gtk3',
-	subdirs : 'gplugin-gtk3-1.0',
+	gplugin_gtk4,
+	name : 'gplugin-gtk4',
+	description : 'GTK4 widgets for GPlugin',
+	filebase : 'gplugin-gtk4',
+	subdirs : 'gplugin-gtk4-1.0',
 	libraries : [gplugin],
-	requires : [GLIB, GOBJECT, GMODULE, GTK3],
+	requires : [GLIB, GOBJECT, GMODULE, GTK4],
 )
 
 ###############################################################################
 # GObject Introspection
 ###############################################################################
 if get_option('introspection')
-	gplugin_gtk3_gir = gnome.generate_gir(
-		gplugin_gtk3,
-		sources : GPLUGIN_GTK3_SOURCES + GPLUGIN_GTK3_HEADERS +
-		          GPLUGIN_GTK3_PUBLIC_BUILT_SOURCES +
-		          GPLUGIN_GTK3_PUBLIC_BUILT_HEADERS,
-		includes : [gplugin_gir[0], 'Gtk-3.0'],
-		namespace : 'GPluginGtk3',
+	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-gtk3'],
+		export_packages: ['gplugin-gtk4'],
 		dependencies : [gplugin_dep],
 		extra_args : ['--quiet', '-DGPLUGIN_GTK_COMPILATION'])
-	GPLUGIN_GTK3_GENERATED_TARGETS += gplugin_gtk3_gir
+	GPLUGIN_GTK4_GENERATED_TARGETS += gplugin_gtk4_gir
 endif
 
 ###############################################################################
 # Library Dependency Object
 ###############################################################################
-gplugin_gtk3_dep = declare_dependency(
-	include_directories: [toplevel_inc, gplugin_gtk3_inc],
-	link_with : [gplugin, gplugin_gtk3],
-	sources : GPLUGIN_GTK3_PUBLIC_BUILT_HEADERS + GPLUGIN_GTK3_GENERATED_TARGETS,
-	dependencies : [GLIB, GOBJECT, GTK3],
+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-gtk3', gplugin_gtk3_dep)
+meson.override_dependency('gplugin-gtk4', gplugin_gtk4_dep)
 
 ###############################################################################
 # Install Stuff
 ###############################################################################
 # install the normal includes into the gplugin-gtk subdirectory
 install_headers(
-	GPLUGIN_GTK3_HEADERS,
-	subdir : 'gplugin-gtk3-1.0/gplugin-gtk'
+	GPLUGIN_GTK4_HEADERS,
+	subdir : 'gplugin-gtk4-1.0/gplugin-gtk'
 )
 
 ###############################################################################
@@ -148,4 +140,4 @@ install_headers(
 ###############################################################################
 subdir('reference')
 
-endif  # gtk3
+endif  # gtk4
diff --git a/gplugin-gtk3/reference/gplugin-gtk3.toml.in b/gplugin-gtk4/reference/gplugin-gtk4.toml.in
copy from gplugin-gtk3/reference/gplugin-gtk3.toml.in
copy to gplugin-gtk4/reference/gplugin-gtk4.toml.in
--- a/gplugin-gtk3/reference/gplugin-gtk3.toml.in
+++ b/gplugin-gtk4/reference/gplugin-gtk4.toml.in
@@ -7,7 +7,7 @@ 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-3.0" ]
+dependencies = [ "GLib-2.0", "GObject-2.0", "GPlugin-1.0", "Gtk-4.0" ]
 devhelp = true
 search_index = true
 
@@ -26,10 +26,10 @@ search_index = true
   description = "Plugin library"
   docs_url = "https://docs.imfreedom.org/gplugin/"
 
-  [dependencies."Gtk-3.0"]
-  name = "Gtk3"
-  description = "Gtk Widget Toolkit"
-  docs_url = "https://docs.gtk.org/gtk3/"
+  [dependencies."Gtk-4.0"]
+  name = "Gtk4"
+  description = "GTK Widget Toolkit"
+  docs_url = "https://docs.gtk.org/gtk4/"
 
 [theme]
 name = "basic"
diff --git a/gplugin-gtk3/reference/meson.build b/gplugin-gtk4/reference/meson.build
copy from gplugin-gtk3/reference/meson.build
copy to gplugin-gtk4/reference/meson.build
--- a/gplugin-gtk3/reference/meson.build
+++ b/gplugin-gtk4/reference/meson.build
@@ -1,15 +1,15 @@
 if get_option('doc')
-	gplugin_gtk3_toml = configure_file(
-		input : 'gplugin-gtk3.toml.in',
-		output : 'gplugin-gtk3.toml',
+	gplugin_gtk4_toml = configure_file(
+		input : 'gplugin-gtk4.toml.in',
+		output : 'gplugin-gtk4.toml',
 		configuration : version_conf,
 		install : true,
-		install_dir : docs_dir / 'gplugin-gtk3',
+		install_dir : docs_dir / 'gplugin-gtk4',
 	)
 
-	gplugin_gtk3_doc = custom_target('gplugin-gtk3-doc',
-		input : [ gplugin_gtk3_toml, gplugin_gtk3_gir[0] ],
-		output : 'gplugin-gtk3',
+	gplugin_gtk4_doc = custom_target('gplugin-gtk4-doc',
+		input : [ gplugin_gtk4_toml, gplugin_gtk4_gir[0] ],
+		output : 'gplugin-gtk4',
 		command : [
 			gidocgen,
 			'generate',
diff --git a/gplugin-gtk3/reference/urlmap.js b/gplugin-gtk4/reference/urlmap.js
copy from gplugin-gtk3/reference/urlmap.js
copy to gplugin-gtk4/reference/urlmap.js
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -127,6 +127,7 @@ docs_dir = get_option('prefix') / get_op
 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('doc')
 	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 @@ install_data('ChangeLog', 'INSTALL.md', 
 
 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')
 
diff --git a/meson_options.txt b/meson_options.txt
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -19,7 +19,13 @@ option(
 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(
