summary refs log tree commit diff
path: root/src/settings/plugins/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/plugins/example')
-rw-r--r--src/settings/plugins/example/Makefile.am15
-rw-r--r--src/settings/plugins/example/Makefile.in30
-rw-r--r--src/settings/plugins/example/common.h11
-rw-r--r--src/settings/plugins/example/errors.c40
-rw-r--r--src/settings/plugins/example/nm-example-connection.c13
-rw-r--r--src/settings/plugins/example/nm-example-connection.h6
-rw-r--r--src/settings/plugins/example/plugin.c13
-rw-r--r--src/settings/plugins/example/reader.c5
-rw-r--r--src/settings/plugins/example/writer.c3
9 files changed, 31 insertions, 105 deletions
diff --git a/src/settings/plugins/example/Makefile.am b/src/settings/plugins/example/Makefile.am
index 8233a71f..b98f66ef 100644
--- a/src/settings/plugins/example/Makefile.am
+++ b/src/settings/plugins/example/Makefile.am
@@ -1,17 +1,14 @@
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src \
-	-I$(top_srcdir)/src/config \
-	-I$(top_srcdir)/src/logging \
 	-I$(top_srcdir)/src/settings \
 	-I$(top_srcdir)/include \
-	-I$(top_builddir)/include \
-	-I$(top_srcdir)/libnm-util \
-	-I$(top_builddir)/libnm-util \
+	-I$(top_srcdir)/libnm-core \
+	-I$(top_builddir)/libnm-core \
 	-DG_LOG_DOMAIN=\""NetworkManager-example"\" \
+	-DNETWORKMANAGER_COMPILATION \
 	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
 	$(GLIB_CFLAGS) \
 	$(DBUS_CFLAGS) \
-	$(POLKIT_CFLAGS) \
 	-DNMCONFDIR=\"$(nmconfdir)\"
 
 # 'noinst' here because this is an example plugin we don't want to install
@@ -27,15 +24,9 @@ libnm_settings_plugin_example_la_SOURCES = \
 	nm-example-connection.h \
 	plugin.c \
 	plugin.h \
-	errors.c \
 	common.h \
 	reader.c \
 	writer.c
 
-libnm_settings_plugin_example_la_LIBADD = \
-	$(top_builddir)/src/libNetworkManager.la \
-	$(top_builddir)/libnm-util/libnm-util.la \
-	$(GLIB_LIBS)
-
 libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version
 
diff --git a/src/settings/plugins/example/Makefile.in b/src/settings/plugins/example/Makefile.in
index 26aa0a60..baa5c698 100644
--- a/src/settings/plugins/example/Makefile.in
+++ b/src/settings/plugins/example/Makefile.in
@@ -102,13 +102,9 @@ CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
-am__DEPENDENCIES_1 =
-libnm_settings_plugin_example_la_DEPENDENCIES =  \
-	$(top_builddir)/src/libNetworkManager.la \
-	$(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1)
+libnm_settings_plugin_example_la_LIBADD =
 am_libnm_settings_plugin_example_la_OBJECTS =  \
-	nm-example-connection.lo plugin.lo errors.lo reader.lo \
-	writer.lo
+	nm-example-connection.lo plugin.lo reader.lo writer.lo
 libnm_settings_plugin_example_la_OBJECTS =  \
 	$(am_libnm_settings_plugin_example_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
@@ -189,6 +185,8 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -312,6 +310,7 @@ NEWT_CFLAGS = @NEWT_CFLAGS@
 NEWT_LIBS = @NEWT_LIBS@
 NM = @NM@
 NMEDIT = @NMEDIT@
+NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@
 NM_MAJOR_VERSION = @NM_MAJOR_VERSION@
 NM_MICRO_VERSION = @NM_MICRO_VERSION@
 NM_MINOR_VERSION = @NM_MINOR_VERSION@
@@ -331,6 +330,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
@@ -357,7 +357,7 @@ SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@
 SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@
 SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@
 SYSTEM_CA_PATH = @SYSTEM_CA_PATH@
-UDEV_BASE_DIR = @UDEV_BASE_DIR@
+UDEV_DIR = @UDEV_DIR@
 USE_NLS = @USE_NLS@
 UUID_CFLAGS = @UUID_CFLAGS@
 UUID_LIBS = @UUID_LIBS@
@@ -438,18 +438,15 @@ with_resolvconf = @with_resolvconf@
 with_valgrind = @with_valgrind@
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src \
-	-I$(top_srcdir)/src/config \
-	-I$(top_srcdir)/src/logging \
 	-I$(top_srcdir)/src/settings \
 	-I$(top_srcdir)/include \
-	-I$(top_builddir)/include \
-	-I$(top_srcdir)/libnm-util \
-	-I$(top_builddir)/libnm-util \
+	-I$(top_srcdir)/libnm-core \
+	-I$(top_builddir)/libnm-core \
 	-DG_LOG_DOMAIN=\""NetworkManager-example"\" \
+	-DNETWORKMANAGER_COMPILATION \
 	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
 	$(GLIB_CFLAGS) \
 	$(DBUS_CFLAGS) \
-	$(POLKIT_CFLAGS) \
 	-DNMCONFDIR=\"$(nmconfdir)\"
 
 
@@ -465,16 +462,10 @@ libnm_settings_plugin_example_la_SOURCES = \
 	nm-example-connection.h \
 	plugin.c \
 	plugin.h \
-	errors.c \
 	common.h \
 	reader.c \
 	writer.c
 
-libnm_settings_plugin_example_la_LIBADD = \
-	$(top_builddir)/src/libNetworkManager.la \
-	$(top_builddir)/libnm-util/libnm-util.la \
-	$(GLIB_LIBS)
-
 libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version
 all: all-am
 
@@ -531,7 +522,6 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errors.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-example-connection.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader.Plo@am__quote@
diff --git a/src/settings/plugins/example/common.h b/src/settings/plugins/example/common.h
index ed0be9a7..cf209fe0 100644
--- a/src/settings/plugins/example/common.h
+++ b/src/settings/plugins/example/common.h
@@ -33,17 +33,6 @@
 
 #define EXAMPLE_DIR NMCONFDIR "/example-plugin"
 
-/* Boilerplate stuff for the plugin's error domain.  Bits of the code that
- * create new errors in the plugin's domain will create errors of
- * type EXAMPLE_PLUGIN_ERROR like so:
- *
- *  error = g_error_new_literal (EXAMPLE_PLUGIN_ERROR,
- *                               <specific error number>,
- *                               "This is a really bad error.");
- */
-#define EXAMPLE_PLUGIN_ERROR (example_plugin_error_quark ())
-GQuark example_plugin_error_quark (void);
-
 /* Prototypes for the reader/writer functions */
 NMConnection *connection_from_file (const char *filename, GError **error);
 
diff --git a/src/settings/plugins/example/errors.c b/src/settings/plugins/example/errors.c
deleted file mode 100644
index 8181f8a3..00000000
--- a/src/settings/plugins/example/errors.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* NetworkManager system settings service
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * (C) Copyright 2012 Red Hat, Inc.
- */
-
-#include <glib.h>
-#include "common.h"
-
-/* This is boilerplate code for defining the error domain that the plugin may
- * return to NetworkManager for various operations.  It just registers a
- * GObject "quark" (a UUID really) for the error which allows glib to keep
- * track of all the different error domains.
- */
-GQuark
-example_plugin_error_quark (void)
-{
-	static GQuark error_quark = 0;
-
-	if (G_UNLIKELY (error_quark == 0))
-		error_quark = g_quark_from_static_string ("example-plugin-error-quark");
-
-	return error_quark;
-}
-
-
diff --git a/src/settings/plugins/example/nm-example-connection.c b/src/settings/plugins/example/nm-example-connection.c
index e2226829..2f0b20a0 100644
--- a/src/settings/plugins/example/nm-example-connection.c
+++ b/src/settings/plugins/example/nm-example-connection.c
@@ -18,9 +18,11 @@
  * Copyright (C) 2012 Red Hat, Inc.
  */
 
+#include "config.h"
+
 #include <string.h>
 #include <glib/gstdio.h>
-#include <NetworkManager.h>
+#include <nm-dbus-interface.h>
 #include <nm-setting-connection.h>
 #include <nm-utils.h>
 
@@ -89,7 +91,7 @@ nm_example_connection_new (const char *full_path,
 	/* Make sure we have a UUID; just a sanity check */
 	uuid = nm_connection_get_uuid (NM_CONNECTION (object));
 	if (!uuid) {
-		g_set_error (error, EXAMPLE_PLUGIN_ERROR, 0,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 		             "Connection in file %s had no UUID", full_path);
 		g_object_unref (object);
 		object = NULL;
@@ -165,12 +167,7 @@ nm_example_connection_init (NMExampleConnection *connection)
 static void
 finalize (GObject *object)
 {
-	NMExampleConnectionPrivate *priv = NM_EXAMPLE_CONNECTION_GET_PRIVATE (object);
-
-	/* Zero out any secrets so we don't leave them in memory */
-	nm_connection_clear_secrets (NM_CONNECTION (object));
-
-	g_free (priv->path);
+	g_free (NM_EXAMPLE_CONNECTION_GET_PRIVATE (object)->path);
 
 	G_OBJECT_CLASS (nm_example_connection_parent_class)->finalize (object);
 }
diff --git a/src/settings/plugins/example/nm-example-connection.h b/src/settings/plugins/example/nm-example-connection.h
index 6d57a1ad..ddbd7ac2 100644
--- a/src/settings/plugins/example/nm-example-connection.h
+++ b/src/settings/plugins/example/nm-example-connection.h
@@ -18,8 +18,8 @@
  * Copyright (C) 2012 Red Hat, Inc.
  */
 
-#ifndef NM_EXAMPLE_CONNECTION_H
-#define NM_EXAMPLE_CONNECTION_H
+#ifndef __NETWORKMANAGER_EXAMPLE_CONNECTION_H__
+#define __NETWORKMANAGER_EXAMPLE_CONNECTION_H__
 
 #include <nm-settings-connection.h>
 
@@ -52,4 +52,4 @@ const char *nm_example_connection_get_path (NMExampleConnection *self);
 
 G_END_DECLS
 
-#endif /* NM_EXAMPLE_CONNECTION_H */
+#endif /* __NETWORKMANAGER_EXAMPLE_CONNECTION_H__ */
diff --git a/src/settings/plugins/example/plugin.c b/src/settings/plugins/example/plugin.c
index eea94946..9945e13b 100644
--- a/src/settings/plugins/example/plugin.c
+++ b/src/settings/plugins/example/plugin.c
@@ -18,11 +18,11 @@
  * Copyright (C) 2012 Red Hat, Inc.
  */
 
-#include <config.h>
+#include "config.h"
+
 #include <sys/stat.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <netinet/ether.h>
 #include <string.h>
 
 #include <gmodule.h>
@@ -198,11 +198,8 @@ update_connection_settings_commit_cb (NMSettingsConnection *orig, GError *error,
 	 * an error here.
 	 */
 	if (error) {
-		nm_log_warn (LOGD_SETTINGS, "%s: '%s' / '%s' invalid: %d",
-		             __func__,
-		             error ? g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)) : "(none)",
-		             (error && error->message) ? error->message : "(none)",
-		             error ? error->code : -1);
+		nm_log_warn (LOGD_SETTINGS, "%s: connection invalid: %s",
+		             __func__, error->message);
 		g_clear_error (&error);
 
 		nm_settings_connection_signal_remove (orig);
@@ -560,7 +557,7 @@ get_unmanaged_specs (NMSystemConfigInterface *config)
 	ids = g_strsplit (str, ";", -1);
 	for (i = 0; ids[i] != NULL; i++) {
 		/* Verify unmanaged specification and add it to the list */
-		if (!strncmp (ids[i], "mac:", 4) && nm_utils_hwaddr_valid (ids[i] + 4)) {
+		if (!strncmp (ids[i], "mac:", 4) && nm_utils_hwaddr_valid (ids[i] + 4, -1)) {
 			specs = g_slist_append (specs, ids[i]);
 		} else if (!strncmp (ids[i], "interface-name:", 15) && nm_utils_iface_valid_name (ids[i] + 15)) {
 			specs = g_slist_append (specs, ids[i]);
diff --git a/src/settings/plugins/example/reader.c b/src/settings/plugins/example/reader.c
index 9a4cecaa..ee45440a 100644
--- a/src/settings/plugins/example/reader.c
+++ b/src/settings/plugins/example/reader.c
@@ -18,11 +18,12 @@
  * Copyright (C) 2012 Red Hat, Inc.
  */
 
-#include <config.h>
+#include "config.h"
+
 #include <glib.h>
 
 #include <nm-connection.h>
-#include <NetworkManager.h>
+#include <nm-dbus-interface.h>
 
 #include "common.h"
 
diff --git a/src/settings/plugins/example/writer.c b/src/settings/plugins/example/writer.c
index f0a9ea21..41e5c498 100644
--- a/src/settings/plugins/example/writer.c
+++ b/src/settings/plugins/example/writer.c
@@ -18,7 +18,8 @@
  * Copyright (C) 2012 Red Hat, Inc.
  */
 
-#include <config.h>
+#include "config.h"
+
 #include <glib.h>
 
 #include <nm-connection.h>