Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Gtk4 #110

Merged
merged 17 commits into from Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
@@ -1,9 +1,11 @@
# Object files
*.o
*.lo

# Libraries
*.lib
*.a
*.la

# Shared objects (inc. Windows DLLs)
*.dll
Expand All @@ -17,6 +19,7 @@
*.app

autom4te.cache/
gtk4/
Makefile
Makefile.in

Expand All @@ -33,5 +36,6 @@ ltmain.sh
missing
nm-ssh-service.name
stamp-h1
properties/resources.c

/NetworkManager-ssh-*.tar*
179 changes: 170 additions & 9 deletions Makefile.am
@@ -1,17 +1,21 @@
AUTOMAKE_OPTIONS = foreign
AUTOMAKE_OPTIONS = foreign subdir-objects

SUBDIRS = src
SUBDIRS = . po

if WITH_GNOME
SUBDIRS += auth-dialog properties po
endif
CLEANFILES =

DISTCHECK_CONFIGURE_FLAGS = --with-tests=yes

dbusservicedir = $(sysconfdir)/dbus-1/system.d
dbusservice_DATA = nm-ssh-service.conf

nmvpnservicedir = $(NM_VPN_SERVICE_DIR)
nmvpnservice_DATA = nm-ssh-service.name

plugindir = $(libdir)/NetworkManager

libexec_PROGRAMS =

if WITH_LIBNM_GLIB
# Install a file with full path to plugins for an old gnome-shell
# https://bugzilla.gnome.org/show_bug.cgi?id=693590
Expand Down Expand Up @@ -51,19 +55,32 @@ nm-ssh-service.name: $(srcdir)/nm-ssh-service.name.in
-e 's|[@]PLUGINDIR[@]/|@NM_PLUGIN_DIR@|g' \
$< >$@

DISTCHECK_CONFIGURE_FLAGS = --with-tests=yes

EXTRA_DIST = nm-ssh-service.name.in \
$(dbusservice_DATA) \
$(desktopfile) \
$(iconfile) \
$(appdata_in_files) \
$(appdata_DATA) \
properties/nm-ssh-dialog.ui \
properties/gresource.xml \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
intltool-update.in \
\
shared/README \
shared/nm-service-defines.h \
shared/nm-default.h \
shared/nm-utils/nm-test-utils.h \
shared/nm-utils/nm-vpn-plugin-utils.c \
shared/nm-utils/gsystem-local-alloc.h \
shared/nm-utils/nm-shared-utils.h \
shared/nm-utils/nm-glib.h \
shared/nm-utils/nm-vpn-plugin-utils.h \
shared/nm-utils/nm-macros-internal.h \
shared/nm-utils/nm-vpn-plugin-macros.h \
shared/nm-utils/nm-shared-utils.c

CLEANFILES = $(nmvpnservice_DATA) \
CLEANFILES += $(nmvpnservice_DATA) \
$(desktop_DATA) \
$(appdata_DATA)

Expand Down Expand Up @@ -130,3 +147,147 @@ deb: changelog dist-xz
dpkg-buildpackage -B -nc

.PHONY: rpm deb changelog

AM_CPPFLAGS = \
$(LIBNM_CFLAGS) \
$(GIO_CFLAGS) \
-DNM_SSH_LOCALEDIR=\"$(datadir)/locale\" \
-I$(top_srcdir) \
-I$(top_srcdir)/shared/

libexec_PROGRAMS += nm-ssh-service

nm_ssh_service_SOURCES = \
src/nm-ssh-service.c \
src/nm-ssh-service.h \
shared/nm-service-defines.h

nm_ssh_service_LDADD = \
$(LIBNM_LIBS) $(GIO_LIBS)

properties/resources.c: properties/gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/properties --generate-dependencies $(srcdir)/properties/gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/properties --generate-source --internal

gtk4/resources.c: properties/gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/properties/gresource.xml |sed "s,^,$(builddir)/gtk4/,")
@mkdir -p $(builddir)/gtk4
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/gtk4 --sourcedir=$(builddir)/gtk4 --generate-source --internal

gtk4/%.ui: properties/%.ui
@mkdir -p $(builddir)/gtk4
gtk4-builder-tool simplify --3to4 $< |grep -v can-default >$@

# Include a prebuilt file in tarball, to avoid hitting
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4415
EXTRA_DIST += \
gtk4/nm-ssh-dialog.ui

###################################################################################################

plugin_LTLIBRARIES = properties/libnm-vpn-plugin-ssh.la

properties_libnm_vpn_plugin_ssh_la_SOURCES = \
shared/nm-utils/nm-vpn-plugin-utils.c \
shared/nm-utils/nm-vpn-plugin-utils.h \
properties/nm-ssh-editor-plugin.c \
properties/nm-ssh-editor-plugin.h

properties_libnm_vpn_plugin_ssh_la_CFLAGS = \
$(LIBNM_CFLAGS)

properties_libnm_vpn_plugin_ssh_la_LIBADD = \
$(LIBNM_LIBS)

properties_libnm_vpn_plugin_ssh_la_LDFLAGS = \
-avoid-version

###################################################################################################

if WITH_GNOME
plugin_LTLIBRARIES += properties/libnm-gtk3-vpn-plugin-ssh-editor.la
endif

properties_libnm_gtk3_vpn_plugin_ssh_editor_la_SOURCES = \
properties/nm-ssh-editor.c \
properties/nm-ssh-editor.h \
properties/advanced-dialog.c \
properties/advanced-dialog.h

nodist_properties_libnm_gtk3_vpn_plugin_ssh_editor_la_SOURCES = \
properties/resources.c

properties_libnm_gtk3_vpn_plugin_ssh_editor_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBNM_CFLAGS)

properties_libnm_gtk3_vpn_plugin_ssh_editor_la_LIBADD = \
$(GTK_LIBS) \
$(LIBNM_LIBS)

properties_libnm_gtk3_vpn_plugin_ssh_editor_la_LDFLAGS = \
-avoid-version

###################################################################################################

if WITH_GTK4
plugin_LTLIBRARIES += properties/libnm-gtk4-vpn-plugin-ssh-editor.la
endif

properties_libnm_gtk4_vpn_plugin_ssh_editor_la_SOURCES = \
$(properties_libnm_gtk3_vpn_plugin_ssh_editor_la_SOURCES)

nodist_properties_libnm_gtk4_vpn_plugin_ssh_editor_la_SOURCES = \
gtk4/resources.c

properties_libnm_gtk4_vpn_plugin_ssh_editor_la_CFLAGS = \
$(GTK4_CFLAGS) \
$(LIBNM_CFLAGS)

properties_libnm_gtk4_vpn_plugin_ssh_editor_la_LIBADD = \
$(GTK4_LIBS) \
$(LIBNM_LIBS)

properties_libnm_gtk4_vpn_plugin_ssh_editor_la_LDFLAGS = \
$(properties_libnm_gtk3_vpn_plugin_ssh_editor_la_LDFLAGS)

###################################################################################################

if WITH_LIBNM_GLIB
plugin_LTLIBRARIES += properties/libnm-ssh-properties.la
endif

properties_libnm_ssh_properties_la_SOURCES = \
$(properties_libnm_gtk3_vpn_plugin_ssh_editor_la_SOURCES) \
$(libnm_vpn_plugin_ssh_la_SOURCES)

properties_libnm_ssh_properties_la_CFLAGS = \
-DNM_SSH_OLD \
$(LIBNM_GLIB_CFLAGS)

properties_libnm_ssh_properties_la_LIBADD = \
$(GTK_LIBS) \
$(LIBNM_GLIB_LIBS)

properties_libnm_ssh_properties_la_LDFLAGS = \
$(libnm_vpn_plugin_ssh_la_LDFLAGS)

###################################################################################################

libexec_PROGRAMS += auth_dialog/nm-ssh-auth-dialog

auth_dialog_nm_ssh_auth_dialog_CPPFLAGS = \
$(GTK_CFLAGS) \
$(LIBSECRET_CFLAGS) \
$(LIBNM_CFLAGS) \
$(LIBNMA_CFLAGS) \
-I$(top_srcdir)/ \
-I$(top_srcdir)/shared/

auth_dialog_nm_ssh_auth_dialog_SOURCES = \
properties/resources.c \
auth-dialog/main.c

auth_dialog_nm_ssh_auth_dialog_LDADD = \
$(GTK_LIBS) \
$(LIBSECRET_LIBS) \
$(LIBNM_LIBS) \
$(LIBNMA_LIBS)
23 changes: 0 additions & 23 deletions auth-dialog/Makefile.am

This file was deleted.

2 changes: 1 addition & 1 deletion auth-dialog/main.c
Expand Up @@ -36,7 +36,7 @@
#include <nma-vpn-password-dialog.h>
#include <nm-vpn-service-plugin.h>

#include "src/nm-ssh-service-defines.h"
#include "nm-service-defines.h"

#define KEYRING_UUID_TAG "connection-uuid"
#define KEYRING_SN_TAG "setting-name"
Expand Down
23 changes: 17 additions & 6 deletions configure.ac
Expand Up @@ -8,13 +8,16 @@ AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h])

AC_USE_SYSTEM_EXTENSIONS

dnl
dnl Require programs
dnl
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)

dnl
dnl Required headers
Expand All @@ -28,6 +31,7 @@ dnl
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_HEADER_TIME
AC_GNU_SOURCE

dnl
dnl Checks for library functions.
Expand All @@ -49,6 +53,8 @@ dnl GNOME support
dnl
AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-ssh without GNOME support, e.g. vpn service only]))
AM_CONDITIONAL(WITH_GNOME, test x"$with_gnome" != xno)
AC_ARG_WITH(gtk4, AS_HELP_STRING([--with-gtk4], [Build NetworkManager-vpnc with libnma-gtk4 support]), [], [with_gtk4_specified=no])
AM_CONDITIONAL(WITH_GTK4, test x"$with_gtk4" == xyes)
AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--with-libnm-glib], [Build NetworkManager-ssh without libnm-glib comatibility]))
AM_CONDITIONAL(WITH_LIBNM_GLIB, test x"$with_libnm_glib" == xyes)
AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name files. Useful for development. (default is no)]))
Expand All @@ -60,13 +66,16 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
IT_PROG_INTLTOOL([0.35])
AM_GLIB_GNU_GETTEXT

PKG_CHECK_MODULES(GIO, gio-unix-2.0)
PKG_CHECK_MODULES(GIO, gio-unix-2.0 >= 2.32)
GIO_CFLAGS="$GIO_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
GIO_CFLAGS="$GIO_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)

if test x"$with_gnome" != xno; then
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.4)
GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MAN_REQUIRED=GDK_VERSION_3_4"

PKG_CHECK_MODULES(LIBNMA, libnma >= 1.1.0)
PKG_CHECK_MODULES(LIBSECRET, libsecret-1)
Expand All @@ -83,9 +92,14 @@ if test x"$with_gnome" != xno; then
fi
fi

if test x"$with_gtk4" == xyes; then
PKG_CHECK_MODULES(GTK4, gtk4 >= 4.0)
GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0"
GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_0"
PKG_CHECK_MODULES(LIBNMA_GTK4, libnma-gtk4 >= 1.8.33)
fi

PKG_CHECK_MODULES(LIBNM, libnm >= 1.1.0)
LIBNM_CFLAGS="$LIBNM_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_26"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
LIBNM_CFLAGS="$LIBNM_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"

Expand Down Expand Up @@ -118,9 +132,6 @@ fi

AC_CONFIG_FILES([
Makefile
src/Makefile
properties/Makefile
auth-dialog/Makefile
po/Makefile.in
])
AC_OUTPUT
5 changes: 4 additions & 1 deletion po/POTFILES.in
Expand Up @@ -4,6 +4,9 @@ appdata/network-manager-ssh.metainfo.xml.in
nm-ssh.desktop.in
auth-dialog/main.c
properties/advanced-dialog.c
properties/nm-ssh.c
properties/nm-ssh-editor-plugin.c
properties/nm-ssh-editor.c
[type: gettext/glade]properties/nm-ssh-dialog.ui
shared/nm-utils/nm-shared-utils.c
shared/nm-utils/nm-vpn-plugin-utils.c
src/nm-ssh-service.c
1 change: 1 addition & 0 deletions po/POTFILES.skip
@@ -0,0 +1 @@
gtk4/nm-ssh-dialog.ui