summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-04-30 19:25:36 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-09-20 15:22:38 +0200
commit5615656384bb1b68db547af756ce3f53ebce6ee0 (patch)
tree53692fba4e25711cfdd4becd3e37b47e054183d9
parent2ded57d949db06816d9f8a59cf34bc91ff69c3d6 (diff)
downloadnetwork-manager-applet-5615656384bb1b68db547af756ce3f53ebce6ee0.tar.gz
build: allow building a GTK4 flavor of libnma
This is EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL. GTK4 is not released yet and things will change in incompatible ways. A new library called "libnma-gtk4" is added. The non-libnma parts (applet, editor) are not ported. There are few reasons for merging this early and none of them is shipping the library to the users at this point: * To allow bringup of GTK4-enabled VPN plugins * Do not block GTK4 enablement of GNOME Control Center * Help avoid using features that will be difficult to port from GTK3 All the test programs work, they emit a fair amount of warnings about properties that were removed in GTK4. To deal with those, we'd need to build different GResources for GTK3 and GTK4. The differencies seem small enough to the point the conversion could be automated. TODO, doesn't block testing. Tested to build with gtk+-4.0 = 3.94.0, but even the pkg-config name changed since in GTK4 git master. Did I say this is EXPERIMENTAL and there will be incompatible changes?
-rw-r--r--.gitignore9
-rw-r--r--Makefile.am260
-rw-r--r--NEWS8
-rw-r--r--config.h.meson3
-rw-r--r--configure.ac25
-rw-r--r--meson.build29
-rw-r--r--meson_options.txt1
-rw-r--r--src/libnma/libnma-gtk4.pc.in11
-rw-r--r--src/libnma/meson.build92
-rw-r--r--src/libnma/nma-cert-chooser.c2
-rw-r--r--src/libnma/nma-wifi-dialog.c4
-rw-r--r--src/libnma/tests/meson.build78
-rw-r--r--src/wireless-security/meson.build16
13 files changed, 452 insertions, 86 deletions
diff --git a/.gitignore b/.gitignore
index e92fd41b..6aff0319 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,17 +95,26 @@ src/connection-editor/nm-connection-editor-service-glue.h
src/connection-editor/ce-resources.c
src/connection-editor/ce-resources.h
src/libnma/libnma.pc
+src/libnma/libnma-gtk4.pc
src/libnma/NMA-1.0.gir
src/libnma/NMA-1.0.typelib
+src/libnma/NMA4-1.0.gir
+src/libnma/NMA4-1.0.typelib
src/libnma/nma-resources.c
src/libnma/nma-resources.h
src/libnma/nma-version.h
src/libnma/tests/cert-chooser
+src/libnma/tests/cert-chooser-gtk4
src/libnma/tests/mobile-wizard
+src/libnma/tests/mobile-wizard-gtk4
src/libnma/tests/run-vpn
+src/libnma/tests/run-vpn-gtk4
src/libnma/tests/vpn-password-dialog
+src/libnma/tests/vpn-password-dialog-gtk4
src/libnma/tests/wifi-dialog
+src/libnma/tests/wifi-dialog-gtk4
src/libnma/tests/wifi-dialog-secrets
+src/libnma/tests/wifi-dialog-secrets-gtk4
src/libnm-gtk/libnm-gtk.pc
src/libnm-gtk/NMGtk-1.0.gir
src/libnm-gtk/NMGtk-1.0.typelib
diff --git a/Makefile.am b/Makefile.am
index 863dbc69..1f969d74 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -216,6 +216,26 @@ src_utils_libutils_libnm_glib_la_LIBADD = \
endif
+if WITH_LIBNMA_GTK4
+
+noinst_LTLIBRARIES += src/utils/libutils-libnm-gtk4.la
+
+src_utils_libutils_libnm_gtk4_la_CPPFLAGS = \
+ "-I$(srcdir)/shared" \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS)
+
+src_utils_libutils_libnm_gtk4_la_SOURCES = \
+ $(shared_files) \
+ src/utils/utils.c \
+ src/utils/utils.h
+
+src_utils_libutils_libnm_gtk4_la_LIBADD = \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS)
+
+endif
+
check_programs += src/utils/tests/test-utils
src_utils_tests_test_utils_SOURCES = src/utils/tests/test-utils.c
@@ -336,6 +356,33 @@ $(src_wireless_security_libwireless_security_libnm_glib_la_OBJECTS): $(wireless_
endif
+if WITH_LIBNMA_GTK4
+
+noinst_LTLIBRARIES += src/wireless-security/libwireless-security-libnm-gtk4.la
+
+src_wireless_security_libwireless_security_libnm_gtk4_la_SOURCES = \
+ $(wireless_security_c_real)
+
+nodist_src_wireless_security_libwireless_security_libnm_gtk4_la_SOURCES = \
+ $(wireless_security_c_gen)
+
+src_wireless_security_libwireless_security_libnm_gtk4_la_CPPFLAGS = \
+ "-I$(srcdir)/shared" \
+ "-I$(srcdir)/src/utils" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS)
+
+src_wireless_security_libwireless_security_libnm_gtk4_la_LIBADD = \
+ src/utils/libutils-libnm-gtk4.la \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS)
+
+$(src_wireless_security_libwireless_security_libnm_gtk4_la_OBJECTS): $(wireless_security_h_gen)
+
+endif
+
EXTRA_DIST += \
src/wireless-security/eap-method-fast.ui \
src/wireless-security/eap-method-leap.ui \
@@ -743,9 +790,222 @@ src_libnma_tests_bar_code_LDADD = \
$(LIBNM_LIBS) \
src/libnma/libnma.la
+if WITH_LIBNMA_GTK4
+
+lib_LTLIBRARIES += src/libnma/libnma-gtk4.la
+
+src_libnma_libnma_gtk4_la_SOURCES = \
+ $(libnma_h_priv_real) \
+ $(libnma_c_real)
+
+if WITH_GCR_GTK4
+src_libnma_libnma_gtk4_la_SOURCES += \
+ $(libnma_h_priv_gcr) \
+ $(libnma_c_gcr)
+endif
+
+nodist_src_libnma_libnma_gtk4_la_SOURCES = \
+ $(libnma_h_priv_gen) \
+ $(libnma_c_gen)
+
+src_libnma_libnma_gtk4_la_CFLAGS = \
+ -DICONDIR=\""$(datadir)/icons"\" \
+ -DBINDIR=\""$(bindir)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DLIBEXECDIR=\""$(libexecdir)"\" \
+ -DDATADIR=\""$(datadir)"\" \
+ -DAUTOSTARTDIR=\""$(sysconfdir)/xdg/autostart"\" \
+ -DNMALOCALEDIR=\"$(datadir)/locale\" \
+ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
+ "-I$(srcdir)/shared" \
+ "-I$(srcdir)/src/utils" \
+ "-I$(srcdir)/src/wireless-security" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ $(GUDEV_CFLAGS) \
+ $(GCR_GCR4_CFLAGS)
+
+src_libnma_libnma_gtk4_la_LIBADD = \
+ src/wireless-security/libwireless-security-libnm-gtk4.la \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ $(GUDEV_LIBS) \
+ $(GCR_GCR4_LIBS)
+
+EXTRA_src_libnma_libnma_gtk4_la_DEPENDENCIES = src/libnma/libnma.ver
+
+src_libnma_libnma_gtk4_la_LDFLAGS = \
+ -Wl,-no-undefined \
+ -Wl,--version-script=$(srcdir)/src/libnma/libnma.ver
+
+
+pkgconfig_DATA += src/libnma/libnma-gtk4.pc
+
+if HAVE_INTROSPECTION
+src/libnma/NMA4-1.0.gir: src/libnma/libnma-gtk4.la
+src_libnma_NMA4_1_0_gir_INCLUDES = NM-1.0 Gtk-4.0
+src_libnma_NMA4_1_0_gir_EXPORT_PACKAGES = libnma-gtk4
+src_libnma_NMA4_1_0_gir_CFLAGS = $(src_libnma_libnma_gtk4_la_CFLAGS)
+src_libnma_NMA4_1_0_gir_LIBS = src/libnma/libnma-gtk4.la
+src_libnma_NMA4_1_0_gir_FILES = \
+ $(libnma_h_pub) \
+ $(libnma_c_real)
+if WITH_GCR_GTK4
+src_libnma_NMA4_1_0_gir_FILES += \
+ $(libnma_c_gcr)
+endif
+src_libnma_NMA4_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NMA --symbol-prefix=nma
+INTROSPECTION_GIRS += src/libnma/NMA4-1.0.gir
+endif
+
+check_PROGRAMS_norun += src/libnma/tests/mobile-wizard-gtk4
+
+src_libnma_tests_mobile_wizard_gtk4_SOURCES = \
+ src/libnma/tests/mobile-wizard.c
+
+src_libnma_tests_mobile_wizard_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_mobile_wizard_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+check_PROGRAMS_norun += src/libnma/tests/vpn-password-dialog-gtk4
+
+src_libnma_tests_vpn_password_dialog_gtk4_SOURCES = \
+ src/libnma/tests/vpn-password-dialog.c
+
+src_libnma_tests_vpn_password_dialog_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_vpn_password_dialog_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+check_PROGRAMS_norun += src/libnma/tests/wifi-dialog-gtk4
+
+src_libnma_tests_wifi_dialog_gtk4_SOURCES = \
+ src/libnma/tests/wifi-dialog.c
+
+src_libnma_tests_wifi_dialog_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_wifi_dialog_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+check_PROGRAMS_norun += src/libnma/tests/wifi-dialog-secrets-gtk4
+
+src_libnma_tests_wifi_dialog_secrets_gtk4_SOURCES = \
+ src/libnma/tests/wifi-dialog-secrets.c
+
+src_libnma_tests_wifi_dialog_secrets_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_wifi_dialog_secrets_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+check_PROGRAMS_norun += src/libnma/tests/run-vpn-gtk4
+
+src_libnma_tests_run_vpn_gtk4_SOURCES = \
+ src/libnma/tests/run-vpn.c
+
+src_libnma_tests_run_vpn_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_run_vpn_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+check_PROGRAMS_norun += src/libnma/tests/cert-chooser-gtk4
+
+src_libnma_tests_cert_chooser_gtk4_SOURCES = \
+ src/libnma/tests/cert-chooser.c
+
+src_libnma_tests_cert_chooser_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_cert_chooser_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+check_PROGRAMS_norun += src/libnma/tests/bar-code-gtk4
+
+src_libnma_tests_bar_code_gtk4_SOURCES = \
+ src/libnma/tests/bar-code.c
+
+src_libnma_tests_bar_code_gtk4_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_bar_code_gtk4_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK4_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma-gtk4.la
+
+endif
+
EXTRA_DIST += \
src/libnma/nma-version.h.in \
src/libnma/libnma.pc.in \
+ src/libnma/libnma-gtk4.pc.in \
src/libnma/libnma.ver \
src/libnma/wifi.ui \
src/libnma/nma-mobile-wizard.ui \
diff --git a/NEWS b/NEWS
index 6e91b146..43c76bb0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,12 @@
=======================================================
+network-manager-applet-1.8.24
+Overview of changes since network-manager-applet-1.8.22
+=======================================================
+
+* Add EXPERIMENTAL libnma-gtk4 library for use with GTK4.
+ Not recommended for production use.
+
+=======================================================
network-manager-applet-1.8.22
Overview of changes since network-manager-applet-1.8.20
=======================================================
diff --git a/config.h.meson b/config.h.meson
index c3ca560e..41246fc0 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -50,6 +50,9 @@
/* Define if Gcr is available */
#mesondefine WITH_GCR
+/* Define if GTK4 Gcr is available */
+#mesondefine WITH_GCR_GTK4
+
/* Define if Jansson is available */
#mesondefine WITH_JANSSON
diff --git a/configure.ac b/configure.ac
index 4c7fbf90..d5cc23fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,6 +165,20 @@ PKG_CHECK_MODULES(NOTIFY, [libnotify >= 0.4.3])
PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.10)
GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_10 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_10"
+AC_ARG_WITH(libnma-gtk4, AS_HELP_STRING([--with-libnma-gtk4], [build EXPERIMENTAL libnma-gtk4 library for use with GTK4]))
+if test "$with_libnma_gtk4" == yes; then
+ PKG_CHECK_MODULES(GTK4, gtk4 >= 3.94)
+ GTK4_CFLAGS="$GTK4_CFLAGS -DGTK_VERSION_MIN_REQUIRED=GTK_VERSION_3_96 -DGTK_VERSION_MAX_ALLOWED=GTK_VERSION_3_96"
+else
+ with_libnma_gtk4=no
+fi
+AM_CONDITIONAL(WITH_LIBNMA_GTK4, test "$with_libnma_gtk4" != "no")
+
+# No such thing yet, just same lame duck placeholders.
+# it may actually end up being called differently.
+AC_DEFINE(WITH_GCR_GTK4, 0, [Define if GTK4 Gcr is available])
+AM_CONDITIONAL(WITH_GCR_GTK4, false)
+
AC_ARG_WITH([appindicator],
AS_HELP_STRING([--with-appindicator=no|yes|auto|ayatana|ubuntu], [Build with lib(ayatana-)appindicator support in addition to xembed systray support.]),
[], [with_appindicator=no])
@@ -318,6 +332,15 @@ NM_COMPILER_WARNINGS(CFLAGS, [yes])
NM_LTO
NM_LD_GC
+# Disable extra compiler warning until GTK4 doesn't trigger it via graphene
+# https://github.com/ebassi/graphene/issues/134
+if test "$with_libnma_gtk4" == yes; then
+ _CFLAGS_SAVED="$CFLAGS"
+ CFLAGS="$CFLAGS $GTK4_CFLAGS"
+ NM_COMPILER_WARNING([_CFLAGS], [float-equal], [#include <gtk/gtk.h>])
+ CFLAGS="$_CFLAGS_SAVED $_CFLAGS"
+fi
+
AC_ARG_WITH(more-asserts,
AS_HELP_STRING([--with-more-asserts=level], [Enable more assertions for debugging (default: 0)]),
[more_asserts=${with_more_asserts}],
@@ -336,6 +359,7 @@ AC_CONFIG_FILES([
Makefile
src/libnm-gtk/libnm-gtk.pc
src/libnma/libnma.pc
+src/libnma/libnma-gtk4.pc
po/Makefile.in
man/nm-applet.1
man/nm-connection-editor.1
@@ -346,6 +370,7 @@ AC_OUTPUT
echo ""
echo " Build legacy library libnm-gtk: --with-libnm-gtk=${with_libnm_gtk}"
+echo " Build EXPERIMENTAL libnma-gtk4 library for use with GTK4: --with-libnma-gtk4=${with_libnma_gtk4}"
echo " GCR: --with-gcr=$have_gcr"
echo " LTO: --enable-lto=$enable_lto"
echo " Linker garbage collection: --enable-ld-gc=$enable_ld_gc"
diff --git a/meson.build b/meson.build
index 9c80c0b6..2157a4b0 100644
--- a/meson.build
+++ b/meson.build
@@ -20,7 +20,6 @@ nma_micro_version = version_array[2].to_int()
nma_gir_version = '1.0'
nma_gir_prefix = 'NMA'
-nma_gir_ns = 'NMA'
nma_gtk_gir_ns = 'NMGtk'
nma_prefix = get_option('prefix')
@@ -77,10 +76,21 @@ if enable_ld_gc
common_ldflags += test_ldflags
endif
+enable_libnma_gtk4 = get_option('libnma_gtk4')
+if enable_libnma_gtk4
+ gtk4_ext_dep = dependency('gtk4', version: '>= 3.96')
+ gtk4_dep = declare_dependency(
+ dependencies: gtk4_ext_dep,
+ compile_args: [
+ '-DGTK_VERSION_MIN_REQUIRED=GTK_VERSION_3_96',
+ '-DGTK_VERSION_MAX_ALLOWED=GTK_VERSION_3_96'
+ ]
+ )
+endif
+
if nma_debug
test_cflags = [
'-Wdeclaration-after-statement',
- '-Wfloat-equal',
'-Wformat=2',
'-Wimplicit-fallthrough',
'-Winit-self',
@@ -100,6 +110,12 @@ if nma_debug
'-Wvla',
]
+ # Disable extra compiler warning until GTK4 doesn't trigger it via graphene
+ # https://github.com/ebassi/graphene/issues/134
+ if not enable_libnma_gtk4 or cc.compiles('#include <gtk/gtk.h>', dependencies: gtk4_ext_dep, args: ['-Werror=float-equal'])
+ test_cflags += '-Wfloat-equal'
+ endif
+
common_flags += cc.get_supported_arguments(test_cflags)
endif
@@ -206,6 +222,10 @@ if enable_libnm_gtk
)
endif
+# No such thing yet, just same lame duck placeholders.
+# it may actually end up being called differently.
+config_h.set10('WITH_GCR_GTK4', false)
+
enable_appindicator = get_option('appindicator')
if enable_appindicator == 'auto' or enable_appindicator == 'yes'
appindicator_dep = dependency('ayatana-appindicator3-0.1', required: false)
@@ -448,8 +468,8 @@ if enable_gtk_doc
'nma-pkcs11-cert-chooser-dialog.h',
'nma-pkcs11-token-login-dialog.h',
'nma-resources.h',
- 'nma-private.h'
- 'nma-version.h'
+ 'nma-private.h',
+ 'nma-version.h',
]
private_sources = [
@@ -512,6 +532,7 @@ meson.add_install_script(
)
output = '\n Build legacy library libnm-gtk: ' + enable_libnm_gtk.to_string() + '\n'
+output += ' Build EXPERIMENTAL library libnm-gtk4 for use with GTK4: ' + enable_libnma_gtk4.to_string() + '\n'
output += ' GCR: ' + enable_gcr.to_string() + '\n'
output += ' LTO: ' + get_option('b_lto').to_string() + '\n'
output += ' Linker garbage collection: ' + enable_ld_gc.to_string() + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index 5a13c793..eadec332 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,5 @@
option('libnm_gtk', type: 'boolean', value: false, description: 'build legacy library libnm-gtk which depends on libnm-glib/libnm-util/dbus-glib')
+option('libnma_gtk4', type: 'boolean', value: false, description: 'build EXPERIMENTAL library libnma-gtk4 for use with GTK4')
option('appindicator', type: 'string', value: 'no', description: 'Build with lib(ayatana-)appindicator support in addition to xembed systray support (no|yes|auto|ayatana|ubuntu). Default is "no", "yes" is an alias for "auto".')
option('wwan', type: 'boolean', value: true, description: 'Enable WWAN support.')
option('selinux', type: 'boolean', value: true, description: 'Enable support for adjusting SELinux labels in configuration editor.')
diff --git a/src/libnma/libnma-gtk4.pc.in b/src/libnma/libnma-gtk4.pc.in
new file mode 100644
index 00000000..a2cf2b49
--- /dev/null
+++ b/src/libnma/libnma-gtk4.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+includedir=@includedir@
+libdir=@libdir@
+
+Name: libnma
+Description: NetworkManager UI utilities (gtk4 version)
+Version: @PACKAGE_VERSION@
+Requires: libnm
+Cflags: -I${includedir}/libnma
+Libs: -L${libdir} -lnma-gtk4
diff --git a/src/libnma/meson.build b/src/libnma/meson.build
index d959ec5f..04f4e65e 100644
--- a/src/libnma/meson.build
+++ b/src/libnma/meson.build
@@ -1,5 +1,3 @@
-lib_name = 'libnma'
-
cert_chooser_headers = files('nma-cert-chooser.h')
cert_chooser_sources = files(
@@ -27,11 +25,9 @@ gir_headers = cert_chooser_headers + files(
'nma-wifi-dialog.h'
)
-headers = gir_headers + files('nma-cert-chooser-private.h')
-
install_headers(
gir_headers,
- subdir: lib_name
+ subdir: 'libnma'
)
gir_sources = [version_header] + cert_chooser_sources + files(
@@ -54,7 +50,6 @@ incs = [
]
deps = [
- gtk_dep,
gudev_dep,
libnm_dep,
libutils_libnm_dep,
@@ -73,29 +68,24 @@ cflags = [
symbol_map = join_paths(meson.current_source_dir(), 'libnma.ver')
+nma_deps = [ deps, gtk_dep ]
+nma_sources = [ gir_sources, built_sources ]
if enable_gcr
- headers += files(
- 'nma-cert-chooser-button.h',
- 'nma-pkcs11-cert-chooser-dialog.h',
- 'nma-pkcs11-token-login-dialog.h'
- )
-
- gir_sources += files(
+ nma_sources += files(
'nma-cert-chooser-button.c',
'nma-pkcs11-cert-chooser.c',
'nma-pkcs11-cert-chooser-dialog.c',
'nma-pkcs11-token-login-dialog.c'
)
-
- deps += gcr_dep
+ nma_deps += gcr_dep
endif
libnma = shared_library(
'nma',
- sources: gir_sources + built_sources,
+ sources: nma_sources,
version: libversion,
include_directories: incs,
- dependencies: deps,
+ dependencies: nma_deps,
c_args: cflags,
link_args: '-Wl,--version-script,' + symbol_map,
link_depends: symbol_map,
@@ -109,26 +99,56 @@ libnma_dep = declare_dependency(
include_directories: libnma_inc
)
+if enable_libnma_gtk4
+ libnma_gtk4 = shared_library(
+ 'nma-gtk4',
+ sources: gir_sources + built_sources,
+ version: libversion,
+ include_directories: incs,
+ dependencies: [ deps, gtk4_dep ],
+ c_args: cflags,
+ link_args: '-Wl,--version-script,' + symbol_map,
+ link_depends: symbol_map,
+ link_whole: libwireless_security_libnma_gtk4,
+ install: true,
+ install_dir: nma_libdir
+ )
+
+ libnma_gtk4_dep = declare_dependency(
+ link_with: libnma_gtk4,
+ include_directories: libnma_inc
+ )
+endif
+
subdir('tests')
pkg.generate(
libraries: libnma,
version: nma_version,
- name: lib_name,
+ name: 'libnma',
description: 'NetworkManager UI utilities (libnm version)',
- filebase: lib_name,
- subdirs: lib_name,
+ filebase: 'libnma',
+ subdirs: 'libnma',
requires: 'libnm',
variables: 'exec_prefix=' + nma_prefix,
install_dir: join_paths(nma_libdir, 'pkgconfig')
)
-if enable_introspection
- gir_incs = [
- 'Gtk-3.0',
- 'NM-1.0'
- ]
+if enable_libnma_gtk4
+ pkg.generate(
+ libraries: libnma_gtk4,
+ version: nma_version,
+ name: 'libnma-gtk4',
+ description: 'NetworkManager UI utilities (gtk4 version)',
+ filebase: 'libnma-gtk4',
+ subdirs: 'libnma',
+ requires: 'libnm',
+ variables: 'exec_prefix=' + nma_prefix,
+ install_dir: join_paths(nma_libdir, 'pkgconfig')
+ )
+endif
+if enable_introspection
gir_dir = join_paths(nma_datadir, 'gir-' + nma_gir_version)
typelib_dir = join_paths(nma_libdir, 'girepository-' + nma_gir_version)
@@ -136,13 +156,29 @@ if enable_introspection
libnma,
sources: gir_sources + gir_headers,
nsversion: nma_gir_version,
- namespace: nma_gir_ns,
- includes: gir_incs,
+ namespace: 'NMA',
+ includes: [ 'Gtk-3.0', 'NM-1.0' ],
identifier_prefix: nma_gir_prefix,
symbol_prefix: nma_gir_prefix.to_lower(),
- export_packages: lib_name,
+ export_packages: 'libnma',
install: true,
install_dir_gir: gir_dir,
install_dir_typelib: typelib_dir
)
+
+ if enable_libnma_gtk4
+ gnome.generate_gir(
+ libnma,
+ sources: gir_sources + gir_headers,
+ nsversion: nma_gir_version,
+ namespace: 'NMA4',
+ includes: [ 'Gtk-4.0', 'NM-1.0' ],
+ identifier_prefix: nma_gir_prefix,
+ symbol_prefix: nma_gir_prefix.to_lower(),
+ export_packages: 'libnma',
+ install: true,
+ install_dir_gir: gir_dir,
+ install_dir_typelib: typelib_dir
+ )
+ endif
endif
diff --git a/src/libnma/nma-cert-chooser.c b/src/libnma/nma-cert-chooser.c
index 93d4a76a..82d0e00b 100644
--- a/src/libnma/nma-cert-chooser.c
+++ b/src/libnma/nma-cert-chooser.c
@@ -597,7 +597,7 @@ constructor (GType type, guint n_construct_properties, GObjectConstructParam *co
flags |= g_value_get_uint (construct_properties[i].value);
}
priv->vtable = &nma_cert_chooser_vtable_file;
-#if LIBNM_BUILD && WITH_GCR
+#if LIBNM_BUILD && (GTK_CHECK_VERSION(3,90,0) ? WITH_GCR_GTK4 : WITH_GCR)
if ((flags & NMA_CERT_CHOOSER_FLAG_PEM) == 0)
priv->vtable = &nma_cert_chooser_vtable_pkcs11;
#endif
diff --git a/src/libnma/nma-wifi-dialog.c b/src/libnma/nma-wifi-dialog.c
index b7f4ca49..12a16e85 100644
--- a/src/libnma/nma-wifi-dialog.c
+++ b/src/libnma/nma-wifi-dialog.c
@@ -1086,7 +1086,11 @@ internal_init (NMAWifiDialog *self,
gtk_window_set_icon_name (GTK_WINDOW (self), icon_name);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image1"));
+#if GTK_CHECK_VERSION(3,90,0)
+ gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon_name);
+#else
gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon_name, GTK_ICON_SIZE_DIALOG);
+#endif
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 2);
diff --git a/src/libnma/tests/meson.build b/src/libnma/tests/meson.build
index 2d682e86..253de9e7 100644
--- a/src/libnma/tests/meson.build
+++ b/src/libnma/tests/meson.build
@@ -1,59 +1,31 @@
-deps = [
- gtk_dep,
- libnm_dep,
- libnma_dep
-]
-
-executable(
+tests = [
+ 'bar-code',
'cert-chooser',
- 'cert-chooser.c',
- include_directories: incs,
- dependencies: deps,
- c_args: cflags,
- install: false
-)
-
-executable(
'mobile-wizard',
- 'mobile-wizard.c',
- include_directories: incs,
- dependencies: deps,
- c_args: cflags,
- install: false
-)
-
-executable(
'run-vpn',
- 'run-vpn.c',
- include_directories: incs,
- dependencies: deps,
- c_args: cflags,
- install: false
-)
-
-executable(
'vpn-password-dialog',
- 'vpn-password-dialog.c',
- include_directories: incs,
- dependencies: deps,
- c_args: cflags,
- install: false
-)
-
-executable(
'wifi-dialog',
- 'wifi-dialog.c',
- include_directories: incs,
- dependencies: deps,
- c_args: cflags,
- install: false
-)
-
-executable(
'wifi-dialog-secrets',
- 'wifi-dialog-secrets.c',
- include_directories: incs,
- dependencies: deps,
- c_args: cflags,
- install: false
-)
+]
+
+foreach tst : tests
+ executable(
+ tst,
+ tst + '.c',
+ include_directories: incs,
+ dependencies: [ gtk_dep, libnm_dep, libnma_dep ],
+ c_args: cflags,
+ install: false
+ )
+
+ if enable_libnma_gtk4
+ executable(
+ tst + '-gtk4',
+ tst + '.c',
+ include_directories: incs,
+ dependencies: [ gtk4_dep, libnm_dep, libnma_gtk4_dep ],
+ c_args: cflags,
+ install: false
+ )
+ endif
+endforeach
diff --git a/src/wireless-security/meson.build b/src/wireless-security/meson.build
index a4fbe97d..3a7cfc51 100644
--- a/src/wireless-security/meson.build
+++ b/src/wireless-security/meson.build
@@ -57,6 +57,22 @@ libwireless_security_libnm = static_library(
dependencies: deps
)
+if enable_libnma_gtk4
+ deps = [
+ gtk4_dep,
+ libnm_dep,
+ libutils_libnm_dep
+ ]
+
+ libwireless_security_libnma_gtk4 = static_library(
+ 'wireless-security-libnma-gtk4',
+ sources: sources,
+ include_directories: incs,
+ dependencies: deps,
+ c_args: cflags
+ )
+endif
+
if enable_libnm_gtk
deps = [
gtk_dep,