[network-manager-iodine: 5/10] Use nm_iodine_plugin_get_instance_private
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-iodine: 5/10] Use nm_iodine_plugin_get_instance_private
- Date: Thu, 7 Apr 2022 09:42:49 +0000 (UTC)
commit bbe47ea8c3de777b13a4c993118e2469014a6452
Author: Guido Günther <agx sigxcpu org>
Date: Thu Dec 23 23:29:04 2021 +0100
Use nm_iodine_plugin_get_instance_private
configure.ac | 5 +++++
src/nm-iodine-service.c | 19 +++++++++----------
2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 028df5a..a065db8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,11 @@ AM_GLIB_GNU_GETTEXT
if test x"$with_gnome" != xno; then
with_gnome=yes
+ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.4)
+ GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
+
+ PKG_CHECK_MODULES(LIBNMA, libnma >= 1.7.0)
+ PKG_CHECK_MODULES(LIBSECRET, libsecret-1 >= 0.18)
fi
PKG_CHECK_MODULES(LIBNM, libnm >= 1.1.0)
diff --git a/src/nm-iodine-service.c b/src/nm-iodine-service.c
index 5f60b09..c118a5f 100644
--- a/src/nm-iodine-service.c
+++ b/src/nm-iodine-service.c
@@ -50,15 +50,13 @@
#define NM_IODINE_USER "nm-iodine"
#define NM_IODINE_RUNDIR LOCALSTATEDIR "/run/" NM_IODINE_USER
-G_DEFINE_TYPE_WITH_PRIVATE (NMIodinePlugin, nm_iodine_plugin, NM_TYPE_VPN_SERVICE_PLUGIN)
-
typedef struct {
GPid pid;
NMVpnPluginFailure failure;
GVariantBuilder ip4config;
} NMIodinePluginPrivate;
-#define NM_IODINE_PLUGIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IODINE_PLUGIN,
NMIodinePluginPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (NMIodinePlugin, nm_iodine_plugin, NM_TYPE_VPN_SERVICE_PLUGIN)
static const char *iodine_binary_paths[] =
{
@@ -247,7 +245,7 @@ static gint
iodine_parse_stderr_line (NMVpnServicePlugin *plugin,
const char* line)
{
- NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
gchar **split = NULL;
GVariant *val;
long int mtu;
@@ -373,7 +371,7 @@ iodine_stderr_cb (GIOChannel *source, GIOCondition condition, gpointer plugin)
GError *err = NULL;
gchar *line;
gint ret, l;
- NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
status = g_io_channel_read_line (source, &line, NULL, NULL, &err);
switch (status) {
@@ -411,7 +409,7 @@ static void
iodine_watch_cb (GPid pid, gint status, gpointer user_data)
{
NMIodinePlugin *plugin = NM_IODINE_PLUGIN (user_data);
- NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
guint error = 0;
if (WIFEXITED (status)) {
@@ -482,6 +480,7 @@ nm_iodine_start_iodine_binary (NMIodinePlugin *plugin,
GIOChannel *stderr_channel;
gint stdin_fd, stderr_fd;
const char *props_topdomain, *props_fragsize, *props_nameserver;
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
/* Find iodine */
iodine_binary = iodine_binary_paths;
@@ -554,7 +553,7 @@ nm_iodine_start_iodine_binary (NMIodinePlugin *plugin,
iodine_stderr_cb,
plugin);
- NM_IODINE_PLUGIN_GET_PRIVATE (plugin)->pid = pid;
+ priv->pid = pid;
iodine_watch = g_child_watch_source_new (pid);
g_source_set_callback (iodine_watch,
(GSourceFunc) iodine_watch_cb,
@@ -572,7 +571,7 @@ real_connect (NMVpnServicePlugin *plugin,
GError **error)
{
NMSettingVpn *s_vpn;
- NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
gint ret = -1;
g_variant_builder_init(&priv->ip4config, G_VARIANT_TYPE_VARDICT);
@@ -638,7 +637,7 @@ ensure_killed (gpointer data)
static gboolean
real_disconnect (NMVpnServicePlugin *plugin, GError **err)
{
- NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
if (priv->pid) {
if (kill (priv->pid, SIGTERM) == 0)
@@ -656,7 +655,7 @@ real_disconnect (NMVpnServicePlugin *plugin, GError **err)
static void
nm_iodine_plugin_init (NMIodinePlugin *plugin)
{
- NMIodinePluginPrivate *priv = NM_IODINE_PLUGIN_GET_PRIVATE (plugin);
+ NMIodinePluginPrivate *priv = nm_iodine_plugin_get_instance_private (NM_IODINE_PLUGIN(plugin));
priv->failure = -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]