From d040fd18ab37a270f83e8dd4ff974f0360a7da38 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 14 Apr 2015 09:40:49 -0400 Subject: [PATCH 01/13] introspection: trivial fixes Add some missing files to libnmdbus.la. Add missing name-fixing annotations to the XML to make all generated NMDBus types match the names of their corresponding NM types. --- introspection/Makefile.am | 8 ++++++++ introspection/nm-active-connection.xml | 1 + introspection/nm-dhcp4-config.xml | 1 + introspection/nm-dhcp6-config.xml | 1 + 4 files changed, 11 insertions(+) diff --git a/introspection/Makefile.am b/introspection/Makefile.am index 3cf0873396..c8a70cffc7 100644 --- a/introspection/Makefile.am +++ b/introspection/Makefile.am @@ -17,6 +17,8 @@ nodist_libnmdbus_la_SOURCES = \ nmdbus-active-connection.h \ nmdbus-agent-manager.c \ nmdbus-agent-manager.h \ + nmdbus-device-adsl.c \ + nmdbus-device-adsl.h \ nmdbus-device-bond.c \ nmdbus-device-bond.h \ nmdbus-device-bridge.c \ @@ -35,6 +37,12 @@ nodist_libnmdbus_la_SOURCES = \ nmdbus-device-infiniband.h \ nmdbus-device-macvlan.c \ nmdbus-device-macvlan.h \ + nmdbus-device-modem.c \ + nmdbus-device-modem.h \ + nmdbus-device-olpc-mesh.c \ + nmdbus-device-olpc-mesh.h \ + nmdbus-device-team.c \ + nmdbus-device-team.h \ nmdbus-device-tun.c \ nmdbus-device-tun.h \ nmdbus-device-veth.c \ diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml index cbecdfcefe..4d5d15a1e5 100644 --- a/introspection/nm-active-connection.xml +++ b/introspection/nm-active-connection.xml @@ -2,6 +2,7 @@ + Objects that implement the Connection.Active interface represent an attempt to connect to a network using the details provided by a Connection object. diff --git a/introspection/nm-dhcp4-config.xml b/introspection/nm-dhcp4-config.xml index c0821ada97..379c50f9b0 100644 --- a/introspection/nm-dhcp4-config.xml +++ b/introspection/nm-dhcp4-config.xml @@ -2,6 +2,7 @@ + Options and configuration returned by the IPv4 DHCP server. diff --git a/introspection/nm-dhcp6-config.xml b/introspection/nm-dhcp6-config.xml index 93b0f1c8f0..df75660a70 100644 --- a/introspection/nm-dhcp6-config.xml +++ b/introspection/nm-dhcp6-config.xml @@ -2,6 +2,7 @@ + Options and configuration returned by the IPv6 DHCP server. From f2174b623f814115207331f4ad0d3e944d1f323b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 14 Apr 2015 11:18:33 -0400 Subject: [PATCH 02/13] ppp-manager: trivial: move class_init function --- src/ppp-manager/nm-ppp-manager.c | 124 +++++++++++++++---------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index c13672976f..48c9ff23de 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -191,68 +191,6 @@ get_property (GObject *object, guint prop_id, } } -static void -nm_ppp_manager_class_init (NMPPPManagerClass *manager_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (manager_class); - - g_type_class_add_private (manager_class, sizeof (NMPPPManagerPrivate)); - - object_class->constructed = constructed; - object_class->dispose = dispose; - object_class->finalize = finalize; - object_class->get_property = get_property; - object_class->set_property = set_property; - - /* Properties */ - g_object_class_install_property - (object_class, PROP_PARENT_IFACE, - g_param_spec_string (NM_PPP_MANAGER_PARENT_IFACE, "", "", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - /* signals */ - signals[STATE_CHANGED] = - g_signal_new ("state-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, state_changed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_UINT); - - signals[IP4_CONFIG] = - g_signal_new ("ip4-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, ip4_config), - NULL, NULL, NULL, - G_TYPE_NONE, 2, - G_TYPE_STRING, - G_TYPE_OBJECT); - - signals[IP6_CONFIG] = - g_signal_new ("ip6-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, ip6_config), - NULL, NULL, NULL, - G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_OBJECT); - - signals[STATS] = - g_signal_new ("stats", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, stats), - NULL, NULL, NULL, - G_TYPE_NONE, 2, - G_TYPE_UINT, G_TYPE_UINT); - - dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class), - &dbus_glib_nm_ppp_manager_object_info); -} - NMPPPManager * nm_ppp_manager_new (const char *iface) { @@ -676,6 +614,68 @@ impl_ppp_manager_set_ip6_config (NMPPPManager *manager, return TRUE; } +static void +nm_ppp_manager_class_init (NMPPPManagerClass *manager_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (manager_class); + + g_type_class_add_private (manager_class, sizeof (NMPPPManagerPrivate)); + + object_class->constructed = constructed; + object_class->dispose = dispose; + object_class->finalize = finalize; + object_class->get_property = get_property; + object_class->set_property = set_property; + + /* Properties */ + g_object_class_install_property + (object_class, PROP_PARENT_IFACE, + g_param_spec_string (NM_PPP_MANAGER_PARENT_IFACE, "", "", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + /* signals */ + signals[STATE_CHANGED] = + g_signal_new ("state-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMPPPManagerClass, state_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_UINT); + + signals[IP4_CONFIG] = + g_signal_new ("ip4-config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMPPPManagerClass, ip4_config), + NULL, NULL, NULL, + G_TYPE_NONE, 2, + G_TYPE_STRING, + G_TYPE_OBJECT); + + signals[IP6_CONFIG] = + g_signal_new ("ip6-config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMPPPManagerClass, ip6_config), + NULL, NULL, NULL, + G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_OBJECT); + + signals[STATS] = + g_signal_new ("stats", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMPPPManagerClass, stats), + NULL, NULL, NULL, + G_TYPE_NONE, 2, + G_TYPE_UINT, G_TYPE_UINT); + + dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class), + &dbus_glib_nm_ppp_manager_object_info); +} + /*******************************************/ From dd0e19895532504e6de615d18a761457ec685b58 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 13 Apr 2015 10:28:17 -0400 Subject: [PATCH 03/13] include: add nm-dbus-compat.h Add a file containing the defines like DBUS_INTERFACE_DBUS from dbus-shared.h, and use it from the gdbus-using files. Also, convert a bunch of other places that were previously hardcoding the string values to use the defines instead, and fix the ifcfg-rh plugin to properly namespace its own D-Bus-related defines. --- include/Makefile.am | 1 + include/nm-dbus-compat.h | 74 +++++++++++++++++++ libnm-glib/nm-active-connection.c | 4 +- libnm-glib/nm-device.c | 4 +- libnm-glib/nm-object.c | 2 +- libnm-glib/nm-remote-settings.c | 2 +- libnm-glib/nm-vpn-plugin.c | 6 +- libnm/nm-dbus-helpers.h | 11 +-- libnm/tests/common.c | 7 +- src/devices/team/nm-device-team.c | 6 +- src/devices/wwan/nm-modem-manager.c | 2 +- src/nm-dbus-manager.c | 6 +- src/settings/plugins/ifcfg-rh/plugin.c | 17 ++--- .../nm-supplicant-interface.c | 5 +- 14 files changed, 107 insertions(+), 40 deletions(-) create mode 100644 include/nm-dbus-compat.h diff --git a/include/Makefile.am b/include/Makefile.am index ff7eac8c27..2cd66c9fff 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,6 @@ EXTRA_DIST = \ gsystem-local-alloc.h \ + nm-dbus-compat.h \ nm-dbus-glib-types.h \ nm-glib-compat.h \ nm-gvaluearray-compat.h \ diff --git a/include/nm-dbus-compat.h b/include/nm-dbus-compat.h new file mode 100644 index 0000000000..dd97b5fd62 --- /dev/null +++ b/include/nm-dbus-compat.h @@ -0,0 +1,74 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * 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. + * + * Copyright 2015 Red Hat, Inc. + */ + +#ifndef __NM_DBUS_COMPAT_H__ +#define __NM_DBUS_COMPAT_H__ + +/* Copied from */ + +/* Bus names */ + +/** The bus name used to talk to the bus itself. */ +#define DBUS_SERVICE_DBUS "org.freedesktop.DBus" + +/* Paths */ +/** The object path used to talk to the bus itself. */ +#define DBUS_PATH_DBUS "/org/freedesktop/DBus" +/** The object path used in local/in-process-generated messages. */ +#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local" + +/* Interfaces, these #define don't do much other than + * catch typos at compile time + */ +/** The interface exported by the object with #DBUS_SERVICE_DBUS and #DBUS_PATH_DBUS */ +#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus" +/** The interface supported by introspectable objects */ +#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable" +/** The interface supported by objects with properties */ +#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties" +/** The interface supported by most dbus peers */ +#define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer" + +/** This is a special interface whose methods can only be invoked + * by the local implementation (messages from remote apps aren't + * allowed to specify this interface). + */ +#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local" + +/* Owner flags */ +#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */ +#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */ +#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */ + +/* Replies to request for a name */ +#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */ +#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */ +#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */ +#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */ + +/* Replies to releasing a name */ +#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */ +#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */ +#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */ + +/* Replies to service starts */ +#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */ +#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */ + +#endif /* __NM_DBUS_COMPAT_H__ */ diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c index 7067a1100d..e5f474f7eb 100644 --- a/libnm-glib/nm-active-connection.c +++ b/libnm-glib/nm-active-connection.c @@ -120,7 +120,7 @@ _nm_active_connection_type_for_path (DBusGConnection *connection, GValue value = G_VALUE_INIT; GType type; - proxy = _nm_dbus_new_proxy_for_connection (connection, path, "org.freedesktop.DBus.Properties"); + proxy = _nm_dbus_new_proxy_for_connection (connection, path, DBUS_INTERFACE_PROPERTIES); if (!proxy) { g_warning ("%s: couldn't create D-Bus object proxy.", __func__); return G_TYPE_INVALID; @@ -197,7 +197,7 @@ _nm_active_connection_type_for_path_async (DBusGConnection *connection, async_data->callback = callback; async_data->user_data = user_data; - proxy = _nm_dbus_new_proxy_for_connection (connection, path, "org.freedesktop.DBus.Properties"); + proxy = _nm_dbus_new_proxy_for_connection (connection, path, DBUS_INTERFACE_PROPERTIES); dbus_g_proxy_begin_call (proxy, "Get", async_got_type, async_data, NULL, G_TYPE_STRING, NM_DBUS_INTERFACE_ACTIVE_CONNECTION, diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index bd5d16374e..731edb6927 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -887,7 +887,7 @@ _nm_device_type_for_path (DBusGConnection *connection, GValue value = G_VALUE_INIT; NMDeviceType nm_dtype; - proxy = _nm_dbus_new_proxy_for_connection (connection, path, "org.freedesktop.DBus.Properties"); + proxy = _nm_dbus_new_proxy_for_connection (connection, path, DBUS_INTERFACE_PROPERTIES); if (!proxy) { g_warning ("%s: couldn't create D-Bus object proxy.", __func__); return G_TYPE_INVALID; @@ -987,7 +987,7 @@ _nm_device_type_for_path_async (DBusGConnection *connection, async_data->callback = callback; async_data->user_data = user_data; - proxy = _nm_dbus_new_proxy_for_connection (connection, path, "org.freedesktop.DBus.Properties"); + proxy = _nm_dbus_new_proxy_for_connection (connection, path, DBUS_INTERFACE_PROPERTIES); dbus_g_proxy_begin_call (proxy, "Get", async_got_type, async_data, NULL, G_TYPE_STRING, NM_DBUS_INTERFACE_DEVICE, diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index fb25c1ac40..2cf7119e0d 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -173,7 +173,7 @@ constructed (GObject *object) if (G_OBJECT_CLASS (nm_object_parent_class)->constructed) G_OBJECT_CLASS (nm_object_parent_class)->constructed (object); - priv->properties_proxy = _nm_object_new_proxy (self, NULL, "org.freedesktop.DBus.Properties"); + priv->properties_proxy = _nm_object_new_proxy (self, NULL, DBUS_INTERFACE_PROPERTIES); if (_nm_object_is_connection_private (self)) priv->nm_running = TRUE; diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 80a274f5e3..20b4638007 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -1215,7 +1215,7 @@ constructed (GObject *object) /* D-Bus properties proxy */ priv->props_proxy = _nm_dbus_new_proxy_for_connection (priv->bus, NM_DBUS_PATH_SETTINGS, - "org.freedesktop.DBus.Properties"); + DBUS_INTERFACE_PROPERTIES); g_assert (priv->props_proxy); /* Monitor properties */ diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index f40ea800f2..3acf26ead1 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -768,9 +768,9 @@ constructor (GType type, goto err; proxy = dbus_g_proxy_new_for_name (connection, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus"); + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); if (!dbus_g_proxy_call (proxy, "RequestName", &err, G_TYPE_STRING, priv->dbus_service_name, diff --git a/libnm/nm-dbus-helpers.h b/libnm/nm-dbus-helpers.h index ca779d3a39..1b2f28e2d9 100644 --- a/libnm/nm-dbus-helpers.h +++ b/libnm/nm-dbus-helpers.h @@ -23,16 +23,7 @@ #include -/* Copied from dbus/dbus-shared.h */ -#define DBUS_SERVICE_DBUS "org.freedesktop.DBus" -#define DBUS_PATH_DBUS "/org/freedesktop/DBus" -#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local" - -#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus" -#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable" -#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties" -#define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer" - +#include "nm-dbus-compat.h" GBusType _nm_dbus_bus_type (void); diff --git a/libnm/tests/common.c b/libnm/tests/common.c index a28e5112b3..a90266c5e8 100644 --- a/libnm/tests/common.c +++ b/libnm/tests/common.c @@ -24,6 +24,7 @@ #include #include "NetworkManager.h" +#include "nm-dbus-compat.h" #include "common.h" @@ -34,9 +35,9 @@ name_exists (GDBusConnection *c, const char *name) gboolean exists = FALSE; reply = g_dbus_connection_call_sync (c, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetNameOwner", g_variant_new ("(s)", name), NULL, diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 23750f3579..ccfab0f3b0 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -332,9 +332,9 @@ teamd_dbus_appeared (GDBusConnection *connection, guint32 pid; ret = g_dbus_connection_call_sync (connection, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetConnectionUnixProcessID", g_variant_new ("(s)", name_owner), NULL, diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c index f0e5692651..92ac0a189c 100644 --- a/src/devices/wwan/nm-modem-manager.c +++ b/src/devices/wwan/nm-modem-manager.c @@ -265,7 +265,7 @@ modem_manager_poke (NMModemManager *self) g_dbus_connection_call (self->priv->dbus_connection, "org.freedesktop.ModemManager1", "/org/freedesktop/ModemManager1", - "org.freedesktop.DBus.Peer", + DBUS_INTERFACE_PEER, "Ping", NULL, /* inputs */ NULL, /* outputs */ diff --git a/src/nm-dbus-manager.c b/src/nm-dbus-manager.c index b8b5325671..4f3ea07223 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-dbus-manager.c @@ -769,9 +769,9 @@ nm_dbus_manager_init_bus (NMDBusManager *self) dbus_connection_set_exit_on_disconnect (priv->connection, FALSE); priv->proxy = dbus_g_proxy_new_for_name (priv->g_connection, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus"); + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); priv->proxy_destroy_id = g_signal_connect (priv->proxy, "destroy", G_CALLBACK (destroy_cb), self); diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index 8febfe6a01..d33b41cd0c 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -59,9 +59,8 @@ #include "utils.h" #include "gsystem-local-alloc.h" -#define DBUS_SERVICE_NAME "com.redhat.ifcfgrh1" -#define DBUS_OBJECT_PATH "/com/redhat/ifcfgrh1" - +#define IFCFGRH1_DBUS_SERVICE_NAME "com.redhat.ifcfgrh1" +#define IFCFGRH1_DBUS_OBJECT_PATH "/com/redhat/ifcfgrh1" #define _LOG_DEFAULT_DOMAIN LOGD_SETTINGS @@ -792,12 +791,12 @@ sc_plugin_ifcfg_init (SCPluginIfcfg *plugin) dbus_connection_set_exit_on_disconnect (tmp, FALSE); proxy = dbus_g_proxy_new_for_name (priv->bus, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus"); + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); if (!dbus_g_proxy_call (proxy, "RequestName", &error, - G_TYPE_STRING, DBUS_SERVICE_NAME, + G_TYPE_STRING, IFCFGRH1_DBUS_SERVICE_NAME, G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE, G_TYPE_INVALID, G_TYPE_UINT, &result, @@ -927,9 +926,9 @@ nm_system_config_factory (void) priv = SC_PLUGIN_IFCFG_GET_PRIVATE (singleton); if (priv->bus) dbus_g_connection_register_g_object (priv->bus, - DBUS_OBJECT_PATH, + IFCFGRH1_DBUS_OBJECT_PATH, G_OBJECT (singleton)); - _LOGD ("Acquired D-Bus service %s", DBUS_SERVICE_NAME); + _LOGD ("Acquired D-Bus service %s", IFCFGRH1_DBUS_SERVICE_NAME); } else g_object_ref (singleton); diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index 19795bf3b9..d2361f51e6 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -32,6 +32,7 @@ #include "nm-glib-compat.h" #include "gsystem-local-alloc.h" #include "nm-core-internal.h" +#include "nm-dbus-compat.h" #define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface" #define WPAS_DBUS_IFACE_BSS WPAS_DBUS_INTERFACE ".BSS" @@ -691,7 +692,7 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_ */ priv->ready_count++; g_dbus_proxy_call (priv->iface_proxy, - "org.freedesktop.DBus.Introspectable.Introspect", + DBUS_INTERFACE_INTROSPECTABLE ".Introspect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, @@ -1133,7 +1134,7 @@ nm_supplicant_interface_set_config (NMSupplicantInterface *self, if (cfg) { priv->cfg = g_object_ref (cfg); g_dbus_proxy_call (priv->iface_proxy, - "org.freedesktop.DBus.Properties.Set", + DBUS_INTERFACE_PROPERTIES ".Set", g_variant_new ("(ssv)", WPAS_DBUS_IFACE_INTERFACE, "ApScan", From 3452ee2a0e3d04a324e7b9cd153323a353d5c182 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 6 Apr 2015 16:42:31 -0400 Subject: [PATCH 04/13] all: rename nm-glib-compat.h to nm-glib.h, use everywhere Rather than randomly including one or more of , , and everywhere (and forgetting to include "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to nm-glib.h, include from there, and then change all .c files in NM to include "nm-glib.h" rather than including the glib headers directly. (Public headers files still have to include the real glib headers, since nm-glib.h isn't installed...) Also, remove glib includes from header files that are already including a base object header file (which must itself already include the glib headers). --- callouts/nm-dispatcher-utils.c | 2 +- callouts/nm-dispatcher-utils.h | 2 +- callouts/nm-dispatcher.c | 4 +--- callouts/tests/test-dispatcher-envp.c | 3 +-- clients/cli/agent.c | 2 +- clients/cli/common.c | 4 +--- clients/cli/connections.c | 2 +- clients/cli/devices.c | 2 +- clients/cli/general.c | 3 +-- clients/cli/nmcli.c | 3 +-- clients/cli/polkit-agent.c | 4 ++-- clients/cli/settings.c | 3 +-- clients/cli/utils.c | 2 +- clients/common/nm-polkit-listener.c | 3 +-- clients/common/nm-polkit-listener.h | 4 ++-- clients/nm-online.c | 3 ++- clients/tui/newt/nmt-newt-types.h | 4 ++-- clients/tui/newt/nmt-newt-utils.c | 2 +- clients/tui/newt/nmt-newt-utils.h | 3 ++- clients/tui/nm-editor-bindings.c | 1 - clients/tui/nmt-editor.c | 2 +- clients/tui/nmt-mac-entry.h | 1 + clients/tui/nmt-page-bond.c | 2 +- clients/tui/nmt-page-bridge-port.c | 2 +- clients/tui/nmt-page-bridge.c | 2 +- clients/tui/nmt-page-dsl.c | 2 +- clients/tui/nmt-page-dsl.h | 1 + clients/tui/nmt-page-ethernet.c | 2 +- clients/tui/nmt-page-infiniband.c | 2 +- clients/tui/nmt-page-ip4.c | 2 +- clients/tui/nmt-page-ip6.c | 2 +- clients/tui/nmt-page-ppp.c | 2 +- clients/tui/nmt-page-team-port.c | 2 +- clients/tui/nmt-page-team.c | 2 +- clients/tui/nmt-page-team.h | 1 + clients/tui/nmt-page-vlan.c | 2 +- clients/tui/nmt-page-wifi.c | 2 +- clients/tui/nmt-route-editor.c | 2 +- clients/tui/nmt-utils.h | 2 +- clients/tui/nmtui.c | 2 +- clients/tui/vpn-helpers.c | 2 +- clients/tui/vpn-helpers.h | 3 ++- configure.ac | 2 +- include/Makefile.am | 2 +- include/{nm-glib-compat.h => nm-glib.h} | 11 ++++------- include/nm-gvaluearray-compat.h | 4 ---- include/nm-macros-internal.h | 3 +-- include/nm-test-utils.h | 4 +--- libnm-core/crypto.c | 2 +- libnm-core/crypto.h | 2 +- libnm-core/crypto_gnutls.c | 2 +- libnm-core/crypto_nss.c | 2 +- libnm-core/nm-connection.c | 2 +- libnm-core/nm-core-internal.h | 2 +- libnm-core/nm-dbus-utils.c | 3 +-- libnm-core/nm-errors.c | 3 +-- libnm-core/nm-keyfile-internal.h | 3 +-- libnm-core/nm-keyfile-reader.c | 3 +-- libnm-core/nm-keyfile-utils.c | 3 +-- libnm-core/nm-keyfile-writer.c | 2 +- libnm-core/nm-property-compare.c | 7 +++---- libnm-core/nm-property-compare.h | 2 +- libnm-core/nm-setting-ip-config.c | 2 +- libnm-core/nm-setting-private.h | 2 +- libnm-core/nm-setting-serial.c | 2 +- libnm-core/nm-setting.c | 2 +- libnm-core/nm-utils.c | 2 +- libnm-core/tests/test-compare.c | 3 +-- libnm-core/tests/test-crypto.c | 2 +- libnm-core/tests/test-general.c | 3 +-- libnm-core/tests/test-secrets.c | 2 +- libnm-core/tests/test-setting-8021x.c | 2 +- libnm-core/tests/test-setting-dcb.c | 2 +- libnm-core/tests/test-settings-defaults.c | 2 +- libnm-glib/libnm-glib-test.c | 3 ++- libnm-glib/libnm_glib.c | 4 +--- libnm-glib/nm-access-point.c | 3 +-- libnm-glib/nm-active-connection.c | 2 +- libnm-glib/nm-client.c | 2 +- libnm-glib/nm-dbus-helpers-private.h | 3 ++- libnm-glib/nm-dbus-helpers.c | 2 +- libnm-glib/nm-device-bond.c | 3 +-- libnm-glib/nm-device-bridge.c | 3 +-- libnm-glib/nm-device-bt.c | 3 +-- libnm-glib/nm-device-ethernet.c | 3 +-- libnm-glib/nm-device-infiniband.c | 3 +-- libnm-glib/nm-device-modem.c | 3 +-- libnm-glib/nm-device-olpc-mesh.c | 3 +-- libnm-glib/nm-device-team.c | 3 +-- libnm-glib/nm-device-vlan.c | 3 +-- libnm-glib/nm-device-wifi.c | 3 +-- libnm-glib/nm-device-wimax.c | 3 +-- libnm-glib/nm-device.c | 2 +- libnm-glib/nm-object-cache.c | 2 +- libnm-glib/nm-object-cache.h | 3 +-- libnm-glib/nm-object-private.h | 2 +- libnm-glib/nm-object.c | 3 +-- libnm-glib/nm-remote-connection.c | 3 +-- libnm-glib/nm-remote-settings.c | 2 +- libnm-glib/nm-secret-agent.c | 2 +- libnm-glib/nm-types.c | 2 +- libnm-glib/nm-vpn-plugin.c | 2 +- libnm-glib/nm-wimax-nsp.c | 3 +-- libnm-glib/tests/common.c | 2 +- libnm-glib/tests/common.h | 2 +- libnm-glib/tests/test-nm-client.c | 2 +- libnm-glib/tests/test-remote-settings-client.c | 2 +- libnm-util/crypto.c | 2 +- libnm-util/crypto.h | 2 +- libnm-util/crypto_gnutls.c | 2 +- libnm-util/crypto_nss.c | 2 +- libnm-util/nm-connection.c | 2 +- libnm-util/nm-param-spec-specialized.c | 2 +- libnm-util/nm-param-spec-specialized.h | 2 +- libnm-util/nm-setting-ip4-config.c | 3 +-- libnm-util/nm-setting-ip6-config.c | 2 +- libnm-util/nm-setting-private.h | 2 +- libnm-util/nm-setting-serial.c | 2 +- libnm-util/nm-utils.c | 3 +-- libnm-util/nm-value-transforms.c | 2 +- libnm-util/tests/test-crypto.c | 2 +- libnm-util/tests/test-general.c | 2 +- libnm-util/tests/test-libnm-linking.c | 3 +-- libnm-util/tests/test-secrets.c | 2 +- libnm-util/tests/test-setting-8021x.c | 2 +- libnm-util/tests/test-setting-dcb.c | 3 +-- libnm-util/tests/test-settings-defaults.c | 2 +- libnm/nm-access-point.c | 3 +-- libnm/nm-active-connection.c | 2 +- libnm/nm-client.c | 2 +- libnm/nm-dbus-helpers.c | 3 +-- libnm/nm-dbus-helpers.h | 2 +- libnm/nm-device-bond.c | 3 +-- libnm/nm-device-bridge.c | 3 +-- libnm/nm-device-bt.c | 3 +-- libnm/nm-device-ethernet.c | 3 +-- libnm/nm-device-infiniband.c | 3 +-- libnm/nm-device-modem.c | 3 +-- libnm/nm-device-olpc-mesh.c | 3 +-- libnm/nm-device-team.c | 3 +-- libnm/nm-device-vlan.c | 3 +-- libnm/nm-device-wifi.c | 3 +-- libnm/nm-device-wimax.c | 3 +-- libnm/nm-device.c | 2 +- libnm/nm-manager.c | 2 +- libnm/nm-object-cache.c | 2 +- libnm/nm-object-cache.h | 3 +-- libnm/nm-object-private.h | 2 +- libnm/nm-object.c | 3 +-- libnm/nm-remote-connection.c | 3 +-- libnm/nm-remote-settings.c | 2 +- libnm/nm-secret-agent-old.c | 2 +- libnm/nm-vpn-plugin-old.c | 3 +-- libnm/nm-wimax-nsp.c | 3 +-- libnm/tests/common.c | 2 +- libnm/tests/common.h | 3 ++- libnm/tests/test-nm-client.c | 3 +-- libnm/tests/test-remote-settings-client.c | 2 +- libnm/tests/test-secret-agent.c | 2 +- src/NetworkManagerUtils.c | 3 +-- src/NetworkManagerUtils.h | 2 +- src/devices/adsl/nm-atm-manager.c | 2 +- src/devices/adsl/nm-atm-manager.h | 3 +-- src/devices/adsl/nm-device-adsl.c | 2 +- src/devices/adsl/nm-device-adsl.h | 3 +-- src/devices/bluetooth/nm-bluez-device.c | 3 +-- src/devices/bluetooth/nm-bluez-device.h | 4 +--- src/devices/bluetooth/nm-bluez-manager.c | 2 +- src/devices/bluetooth/nm-bluez-manager.h | 3 +-- src/devices/bluetooth/nm-bluez4-adapter.c | 2 +- src/devices/bluetooth/nm-bluez4-adapter.h | 3 +-- src/devices/bluetooth/nm-bluez4-manager.h | 7 ++----- src/devices/bluetooth/nm-bluez5-dun.h | 3 +-- src/devices/bluetooth/nm-bluez5-manager.c | 2 +- src/devices/bluetooth/nm-bluez5-manager.h | 7 ++----- src/devices/bluetooth/nm-bt-error.c | 2 +- src/devices/bluetooth/nm-device-bt.c | 3 +-- src/devices/nm-device-bond.c | 2 +- src/devices/nm-device-bond.h | 2 -- src/devices/nm-device-bridge.c | 2 +- src/devices/nm-device-bridge.h | 3 +-- src/devices/nm-device-ethernet-utils.c | 2 +- src/devices/nm-device-ethernet-utils.h | 2 +- src/devices/nm-device-ethernet.c | 3 +-- src/devices/nm-device-ethernet.h | 2 -- src/devices/nm-device-factory.h | 3 --- src/devices/nm-device-generic.c | 1 - src/devices/nm-device-generic.h | 2 -- src/devices/nm-device-gre.h | 2 -- src/devices/nm-device-infiniband.c | 3 +-- src/devices/nm-device-infiniband.h | 2 -- src/devices/nm-device-macvlan.h | 2 -- src/devices/nm-device-tun.h | 2 -- src/devices/nm-device-veth.h | 2 -- src/devices/nm-device-vlan.c | 2 +- src/devices/nm-device-vlan.h | 2 -- src/devices/nm-device-vxlan.h | 2 -- src/devices/nm-device.c | 3 +-- src/devices/nm-device.h | 3 +-- src/devices/team/nm-device-team.c | 3 +-- src/devices/team/nm-device-team.h | 2 -- src/devices/team/nm-team-factory.h | 2 +- src/devices/wifi/nm-device-olpc-mesh.c | 3 +-- src/devices/wifi/nm-device-olpc-mesh.h | 2 -- src/devices/wifi/nm-device-wifi.c | 4 +--- src/devices/wifi/nm-device-wifi.h | 2 -- src/devices/wifi/nm-wifi-ap.c | 2 +- src/devices/wifi/nm-wifi-ap.h | 3 +-- src/devices/wifi/tests/test-wifi-ap-utils.c | 2 +- src/devices/wwan/nm-device-modem.c | 2 +- src/devices/wwan/nm-device-modem.h | 3 --- src/devices/wwan/nm-modem-broadband.h | 1 - src/devices/wwan/nm-modem-manager.h | 1 - src/devices/wwan/nm-modem.h | 2 +- src/devices/wwan/nm-wwan-factory.h | 2 +- src/dhcp-manager/Makefile.am | 1 + src/dhcp-manager/nm-dhcp-client.c | 2 +- src/dhcp-manager/nm-dhcp-client.h | 5 ++--- src/dhcp-manager/nm-dhcp-dhclient-utils.c | 2 +- src/dhcp-manager/nm-dhcp-dhclient-utils.h | 5 ++--- src/dhcp-manager/nm-dhcp-dhclient.c | 4 +--- src/dhcp-manager/nm-dhcp-dhclient.h | 4 +--- src/dhcp-manager/nm-dhcp-dhcpcd.c | 3 +-- src/dhcp-manager/nm-dhcp-dhcpcd.h | 3 --- src/dhcp-manager/nm-dhcp-helper.c | 2 +- src/dhcp-manager/nm-dhcp-listener.c | 3 +-- src/dhcp-manager/nm-dhcp-listener.h | 3 +-- src/dhcp-manager/nm-dhcp-manager.c | 3 +-- src/dhcp-manager/nm-dhcp-manager.h | 3 +-- src/dhcp-manager/nm-dhcp-systemd.c | 3 +-- src/dhcp-manager/nm-dhcp-systemd.h | 3 --- src/dhcp-manager/nm-dhcp-utils.c | 2 +- src/dhcp-manager/nm-dhcp-utils.h | 4 +++- src/dhcp-manager/tests/test-dhcp-dhclient.c | 2 +- src/dhcp-manager/tests/test-dhcp-utils.c | 2 +- src/dns-manager/nm-dns-dnsmasq.c | 2 +- src/dns-manager/nm-dns-dnsmasq.h | 3 --- src/dns-manager/nm-dns-manager.c | 3 +-- src/dns-manager/nm-dns-manager.h | 2 +- src/dns-manager/nm-dns-plugin.c | 2 +- src/dns-manager/nm-dns-plugin.h | 3 +-- src/dns-manager/nm-dns-unbound.h | 2 -- src/dnsmasq-manager/nm-dnsmasq-manager.c | 2 +- src/dnsmasq-manager/nm-dnsmasq-manager.h | 3 +-- src/dnsmasq-manager/nm-dnsmasq-utils.h | 2 +- src/dnsmasq-manager/tests/test-dnsmasq-utils.c | 2 +- src/main-utils.c | 4 +--- src/main-utils.h | 2 +- src/main.c | 2 +- src/nm-activation-request.h | 3 +-- src/nm-active-connection.c | 3 +-- src/nm-active-connection.h | 2 +- src/nm-auth-manager.h | 2 +- src/nm-auth-subject.c | 3 +-- src/nm-auth-subject.h | 3 +-- src/nm-auth-utils.c | 2 +- src/nm-auth-utils.h | 2 +- src/nm-config-data.h | 3 +-- src/nm-config.c | 7 +++---- src/nm-config.h | 3 +-- src/nm-connection-provider.h | 2 +- src/nm-connectivity.c | 2 +- src/nm-connectivity.h | 4 +--- src/nm-dbus-manager.c | 2 +- src/nm-dbus-manager.h | 2 +- src/nm-dcb.c | 2 +- src/nm-dcb.h | 2 +- src/nm-default-route-manager.h | 2 +- src/nm-dhcp4-config.c | 3 +-- src/nm-dhcp4-config.h | 3 +-- src/nm-dhcp6-config.c | 3 +-- src/nm-dhcp6-config.h | 3 +-- src/nm-dispatcher.c | 4 +--- src/nm-dispatcher.h | 2 +- src/nm-firewall-manager.c | 3 +-- src/nm-firewall-manager.h | 2 +- src/nm-iface-helper.c | 2 +- src/nm-ip4-config.h | 2 +- src/nm-ip6-config.c | 2 +- src/nm-ip6-config.h | 2 +- src/nm-logging.c | 2 +- src/nm-logging.h | 3 +-- src/nm-manager.c | 3 +-- src/nm-manager.h | 3 +-- src/nm-multi-index.c | 3 +-- src/nm-multi-index.h | 2 +- src/nm-policy.c | 3 +-- src/nm-properties-changed-signal.h | 2 +- src/nm-rfkill-manager.h | 2 +- src/nm-route-manager.h | 2 +- src/nm-session-monitor.c | 3 +-- src/nm-session-monitor.h | 2 +- src/nm-sleep-monitor-systemd.c | 2 +- src/nm-sleep-monitor-upower.c | 2 +- src/nm-sleep-monitor.h | 2 +- src/platform/nm-platform.h | 3 +-- src/platform/tests/monitor.c | 2 +- src/platform/wifi/wifi-utils-nl80211.c | 2 +- src/platform/wifi/wifi-utils-private.h | 2 +- src/platform/wifi/wifi-utils-wext.c | 3 +-- src/platform/wifi/wifi-utils.c | 2 +- src/platform/wifi/wifi-utils.h | 2 +- src/ppp-manager/nm-ppp-manager.c | 2 +- src/ppp-manager/nm-ppp-manager.h | 4 +--- src/ppp-manager/nm-pppd-plugin.c | 3 +-- src/rdisc/nm-rdisc.h | 2 +- src/settings/nm-agent-manager.c | 2 +- src/settings/nm-agent-manager.h | 3 +-- src/settings/nm-inotify-helper.c | 2 +- src/settings/nm-inotify-helper.h | 4 ++-- src/settings/nm-secret-agent.c | 3 +-- src/settings/nm-secret-agent.h | 3 +-- src/settings/nm-settings-connection.c | 2 +- src/settings/nm-settings.h | 1 + src/settings/nm-system-config-interface.h | 4 ++-- src/settings/plugins/ibft/plugin.c | 3 +-- src/settings/plugins/ibft/plugin.h | 2 +- src/settings/plugins/ibft/reader.c | 2 +- src/settings/plugins/ibft/reader.h | 3 ++- src/settings/plugins/ifcfg-rh/common.h | 2 +- src/settings/plugins/ifcfg-rh/plugin.c | 3 +-- src/settings/plugins/ifcfg-rh/plugin.h | 2 +- src/settings/plugins/ifcfg-rh/reader.c | 2 +- src/settings/plugins/ifcfg-rh/reader.h | 2 +- src/settings/plugins/ifcfg-rh/shvar.h | 2 +- src/settings/plugins/ifcfg-rh/utils.c | 2 +- src/settings/plugins/ifcfg-rh/utils.h | 2 +- src/settings/plugins/ifcfg-rh/writer.h | 4 +++- src/settings/plugins/ifnet/net_parser.h | 2 +- src/settings/plugins/ifnet/net_utils.c | 2 +- src/settings/plugins/ifnet/net_utils.h | 2 +- src/settings/plugins/ifnet/plugin.c | 3 +-- src/settings/plugins/ifnet/plugin.h | 2 +- src/settings/plugins/ifnet/tests/test-ifnet.c | 2 +- src/settings/plugins/ifnet/wpa_parser.h | 2 +- src/settings/plugins/ifupdown/interface_parser.h | 2 +- .../plugins/ifupdown/nm-ifupdown-connection.h | 1 + src/settings/plugins/ifupdown/plugin.c | 3 +-- src/settings/plugins/ifupdown/plugin.h | 2 +- src/settings/plugins/ifupdown/tests/test-ifupdown.c | 2 +- src/settings/plugins/keyfile/common.h | 2 +- src/settings/plugins/keyfile/plugin.c | 3 +-- src/settings/plugins/keyfile/plugin.h | 2 +- src/settings/plugins/keyfile/reader.h | 3 ++- src/settings/plugins/keyfile/utils.c | 3 +-- src/settings/plugins/keyfile/utils.h | 2 +- src/settings/plugins/keyfile/writer.c | 4 +--- src/settings/plugins/keyfile/writer.h | 3 ++- src/supplicant-manager/nm-supplicant-config.c | 2 +- src/supplicant-manager/nm-supplicant-config.h | 2 +- src/supplicant-manager/nm-supplicant-interface.c | 3 +-- src/supplicant-manager/nm-supplicant-interface.h | 3 +-- src/supplicant-manager/nm-supplicant-manager.c | 4 +--- src/supplicant-manager/nm-supplicant-manager.h | 2 +- .../nm-supplicant-settings-verify.c | 2 +- src/tests/config/test-config.c | 2 +- src/tests/test-dcb.c | 2 +- src/tests/test-general-with-expect.c | 2 +- src/tests/test-general.c | 2 +- src/tests/test-ip4-config.c | 2 +- src/tests/test-ip6-config.c | 2 +- src/tests/test-resolvconf-capture.c | 2 +- src/tests/test-route-manager.c | 2 +- src/tests/test-wired-defname.c | 3 +-- src/vpn-manager/nm-vpn-connection.c | 3 +-- src/vpn-manager/nm-vpn-connection.h | 2 -- src/vpn-manager/nm-vpn-manager.c | 2 +- src/vpn-manager/nm-vpn-manager.h | 3 +-- src/vpn-manager/nm-vpn-service.c | 3 +-- src/vpn-manager/nm-vpn-service.h | 3 +-- 370 files changed, 374 insertions(+), 562 deletions(-) rename include/{nm-glib-compat.h => nm-glib.h} (98%) diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c index 085d43dbc8..b930e269f2 100644 --- a/callouts/nm-dispatcher-utils.c +++ b/callouts/nm-dispatcher-utils.c @@ -22,7 +22,6 @@ #include -#include #include #include @@ -30,6 +29,7 @@ #include #include +#include "nm-glib.h" #include "nm-dispatcher-api.h" #include "nm-utils.h" diff --git a/callouts/nm-dispatcher-utils.h b/callouts/nm-dispatcher-utils.h index 665a0d4eaf..be67787d6f 100644 --- a/callouts/nm-dispatcher-utils.h +++ b/callouts/nm-dispatcher-utils.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_DISPATCHER_UTILS_H__ #define __NETWORKMANAGER_DISPATCHER_UTILS_H__ -#include +#include "nm-glib.h" char ** nm_dispatcher_utils_construct_envp (const char *action, diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index d9fe147f4d..ef6f2a96bd 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -32,13 +32,11 @@ #include #include -#include #include - +#include "nm-glib.h" #include "nm-dispatcher-api.h" #include "nm-dispatcher-utils.h" -#include "nm-glib-compat.h" #include "nmdbus-dispatcher.h" diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index 023c77a82d..c6516b308e 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -23,9 +23,8 @@ #include #include #include -#include -#include +#include "nm-glib.h" #include "nm-core-internal.h" #include "nm-dispatcher-utils.h" #include "nm-dispatcher-api.h" diff --git a/clients/cli/agent.c b/clients/cli/agent.c index 1695ed5961..896e76152a 100644 --- a/clients/cli/agent.c +++ b/clients/cli/agent.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -30,6 +29,7 @@ #include #include +#include "nm-glib.h" #include "common.h" #include "utils.h" #include "nm-secret-agent-simple.h" diff --git a/clients/cli/common.c b/clients/cli/common.c index d92aeaf263..db20372aeb 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -30,8 +29,7 @@ #include #include -#include "nm-glib-compat.h" - +#include "nm-glib.h" #include "common.h" #include "utils.h" diff --git a/clients/cli/connections.c b/clients/cli/connections.c index c09eff9120..36780577ea 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include #include #include @@ -31,6 +30,7 @@ #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "utils.h" #include "common.h" diff --git a/clients/cli/devices.c b/clients/cli/devices.c index fd2f7b6167..70135e1780 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -25,9 +25,9 @@ #include #include -#include #include +#include "nm-glib.h" #include "nm-secret-agent-simple.h" #include "polkit-agent.h" #include "utils.h" diff --git a/clients/cli/general.c b/clients/cli/general.c index fdf22c71f3..b5fd5e1f66 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -22,14 +22,13 @@ #include #include -#include #include +#include "nm-glib.h" #include "polkit-agent.h" #include "utils.h" #include "general.h" - /* Available fields for 'general status' */ static NmcOutputField nmc_fields_nm_status[] = { {"RUNNING", N_("RUNNING"), 15}, /* 0 */ diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index c27798c237..2c19e4897b 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -33,12 +33,11 @@ #include #include -#include #include +#include "nm-glib.h" #include "polkit-agent.h" #include "nmcli.h" -#include "nm-glib-compat.h" #include "utils.h" #include "common.h" #include "connections.h" diff --git a/clients/cli/polkit-agent.c b/clients/cli/polkit-agent.c index a163b824fa..269fa6df9e 100644 --- a/clients/cli/polkit-agent.c +++ b/clients/cli/polkit-agent.c @@ -27,9 +27,9 @@ #include #include -#include #include +#include "nm-glib.h" #include "polkit-agent.h" #include "nm-polkit-listener.h" #include "common.h" @@ -142,7 +142,7 @@ nmc_start_polkit_agent_start_try (NmCli *nmc) #else /* polkit agent is not avalable; implement stub functions. */ -#include +#include "nm-glib.h" #include "nmcli.h" #include "polkit-agent.h" diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 2f931b7854..42d88322e9 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -22,13 +22,12 @@ #include #include -#include #include +#include "nm-glib.h" #include "utils.h" #include "common.h" #include "settings.h" -#include "nm-glib-compat.h" #include "nm-macros-internal.h" #include "gsystem-local-alloc.h" diff --git a/clients/cli/utils.c b/clients/cli/utils.c index 690ec9bbc2..6552e15f63 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -29,9 +29,9 @@ #include #include -#include #include +#include "nm-glib.h" #include "utils.h" int diff --git a/clients/common/nm-polkit-listener.c b/clients/common/nm-polkit-listener.c index 82df1b2de2..bad5f432dc 100644 --- a/clients/common/nm-polkit-listener.c +++ b/clients/common/nm-polkit-listener.c @@ -36,10 +36,9 @@ #include #include #include -#include #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-polkit-listener.h" G_DEFINE_TYPE (NMPolkitListener, nm_polkit_listener, POLKIT_AGENT_TYPE_LISTENER) diff --git a/clients/common/nm-polkit-listener.h b/clients/common/nm-polkit-listener.h index 3cd7501924..ffdc91acf8 100644 --- a/clients/common/nm-polkit-listener.h +++ b/clients/common/nm-polkit-listener.h @@ -19,11 +19,11 @@ #ifndef __NM_POLKIT_LISTENER_H__ #define __NM_POLKIT_LISTENER_H__ -#include - #define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE #include +#include "nm-glib.h" + G_BEGIN_DECLS #define NM_TYPE_POLKIT_LISTENER (nm_polkit_listener_get_type ()) diff --git a/clients/nm-online.c b/clients/nm-online.c index cd97e6cc16..fc4e86474c 100644 --- a/clients/nm-online.c +++ b/clients/nm-online.c @@ -41,7 +41,8 @@ #include #include -#include "nm-glib-compat.h" + +#include "nm-glib.h" #define PROGRESS_STEPS 15 #define WAIT_STARTUP_TAG "wait-startup" diff --git a/clients/tui/newt/nmt-newt-types.h b/clients/tui/newt/nmt-newt-types.h index 608f7ff6fa..775c3bc8ec 100644 --- a/clients/tui/newt/nmt-newt-types.h +++ b/clients/tui/newt/nmt-newt-types.h @@ -19,9 +19,9 @@ #ifndef NMT_NEWT_TYPES_H #define NMT_NEWT_TYPES_H -#include #include -#include "nm-glib-compat.h" + +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/clients/tui/newt/nmt-newt-utils.c b/clients/tui/newt/nmt-newt-utils.c index 70a65a8489..b405c9dbf9 100644 --- a/clients/tui/newt/nmt-newt-utils.c +++ b/clients/tui/newt/nmt-newt-utils.c @@ -30,7 +30,7 @@ #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nmt-newt-utils.h" static void diff --git a/clients/tui/newt/nmt-newt-utils.h b/clients/tui/newt/nmt-newt-utils.h index 3b37868a0d..7a3b677f51 100644 --- a/clients/tui/newt/nmt-newt-utils.h +++ b/clients/tui/newt/nmt-newt-utils.h @@ -20,7 +20,8 @@ #define NMT_NEWT_UTILS_H #include -#include + +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/clients/tui/nm-editor-bindings.c b/clients/tui/nm-editor-bindings.c index 9218c31f52..a21ed66672 100644 --- a/clients/tui/nm-editor-bindings.c +++ b/clients/tui/nm-editor-bindings.c @@ -33,7 +33,6 @@ #include #include "nm-editor-bindings.h" -#include "nm-gvaluearray-compat.h" static void value_transform_string_int (const GValue *src_value, diff --git a/clients/tui/nmt-editor.c b/clients/tui/nmt-editor.c index abc9286637..a0c15343f3 100644 --- a/clients/tui/nmt-editor.c +++ b/clients/tui/nmt-editor.c @@ -27,10 +27,10 @@ #include "nmt-editor.h" -#include #include #include +#include "nm-glib.h" #include "nmtui.h" #include "nm-editor-utils.h" diff --git a/clients/tui/nmt-mac-entry.h b/clients/tui/nmt-mac-entry.h index 2e3e6cd1f7..2852de8de1 100644 --- a/clients/tui/nmt-mac-entry.h +++ b/clients/tui/nmt-mac-entry.h @@ -19,6 +19,7 @@ #ifndef NMT_MAC_ENTRY_H #define NMT_MAC_ENTRY_H +#include "nm-glib.h" #include "nm-utils.h" #include "nmt-newt.h" diff --git a/clients/tui/nmt-page-bond.c b/clients/tui/nmt-page-bond.c index b043b513de..89e10cf539 100644 --- a/clients/tui/nmt-page-bond.c +++ b/clients/tui/nmt-page-bond.c @@ -27,9 +27,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-bond.h" #include "nmt-address-list.h" diff --git a/clients/tui/nmt-page-bridge-port.c b/clients/tui/nmt-page-bridge-port.c index c9ef14ed86..ee18ba5fdd 100644 --- a/clients/tui/nmt-page-bridge-port.c +++ b/clients/tui/nmt-page-bridge-port.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-bridge-port.h" G_DEFINE_TYPE (NmtPageBridgePort, nmt_page_bridge_port, NMT_TYPE_EDITOR_PAGE) diff --git a/clients/tui/nmt-page-bridge.c b/clients/tui/nmt-page-bridge.c index ee42d78339..84491b6a5f 100644 --- a/clients/tui/nmt-page-bridge.c +++ b/clients/tui/nmt-page-bridge.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-bridge.h" #include "nmt-address-list.h" diff --git a/clients/tui/nmt-page-dsl.c b/clients/tui/nmt-page-dsl.c index 1d476aa01b..0b0f1b93e6 100644 --- a/clients/tui/nmt-page-dsl.c +++ b/clients/tui/nmt-page-dsl.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-dsl.h" #include "nmt-page-ethernet.h" #include "nmt-page-ppp.h" diff --git a/clients/tui/nmt-page-dsl.h b/clients/tui/nmt-page-dsl.h index b938ead238..8da0e05e91 100644 --- a/clients/tui/nmt-page-dsl.h +++ b/clients/tui/nmt-page-dsl.h @@ -19,6 +19,7 @@ #ifndef NMT_PAGE_DSL_H #define NMT_PAGE_DSL_H +#include "nm-glib.h" #include "nmt-editor-page-device.h" G_BEGIN_DECLS diff --git a/clients/tui/nmt-page-ethernet.c b/clients/tui/nmt-page-ethernet.c index cf4ef2c458..cec0491a6d 100644 --- a/clients/tui/nmt-page-ethernet.c +++ b/clients/tui/nmt-page-ethernet.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-ethernet.h" #include "nmt-mac-entry.h" #include "nmt-mtu-entry.h" diff --git a/clients/tui/nmt-page-infiniband.c b/clients/tui/nmt-page-infiniband.c index f39b0b84fd..ecc5dc311a 100644 --- a/clients/tui/nmt-page-infiniband.c +++ b/clients/tui/nmt-page-infiniband.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-infiniband.h" #include "nmt-mtu-entry.h" diff --git a/clients/tui/nmt-page-ip4.c b/clients/tui/nmt-page-ip4.c index df3f0b6474..366a391973 100644 --- a/clients/tui/nmt-page-ip4.c +++ b/clients/tui/nmt-page-ip4.c @@ -25,9 +25,9 @@ #include -#include #include +#include "nm-glib.h" #include "nmt-page-ip4.h" #include "nmt-ip-entry.h" #include "nmt-address-list.h" diff --git a/clients/tui/nmt-page-ip6.c b/clients/tui/nmt-page-ip6.c index 1513dbfa08..ea8314d7f2 100644 --- a/clients/tui/nmt-page-ip6.c +++ b/clients/tui/nmt-page-ip6.c @@ -25,9 +25,9 @@ #include -#include #include +#include "nm-glib.h" #include "nmt-page-ip6.h" #include "nmt-ip-entry.h" #include "nmt-address-list.h" diff --git a/clients/tui/nmt-page-ppp.c b/clients/tui/nmt-page-ppp.c index cec36549dc..85690e4e67 100644 --- a/clients/tui/nmt-page-ppp.c +++ b/clients/tui/nmt-page-ppp.c @@ -25,9 +25,9 @@ #include -#include #include +#include "nm-glib.h" #include "nmt-page-ppp.h" #include "nmt-newt-section.h" #include "nmt-newt-separator.h" diff --git a/clients/tui/nmt-page-team-port.c b/clients/tui/nmt-page-team-port.c index 645dc9d37d..a571924ae1 100644 --- a/clients/tui/nmt-page-team-port.c +++ b/clients/tui/nmt-page-team-port.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-team-port.h" G_DEFINE_TYPE (NmtPageTeamPort, nmt_page_team_port, NMT_TYPE_EDITOR_PAGE) diff --git a/clients/tui/nmt-page-team.c b/clients/tui/nmt-page-team.c index e520b02a3c..b7664943fd 100644 --- a/clients/tui/nmt-page-team.c +++ b/clients/tui/nmt-page-team.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-page-team.h" #include "nmt-slave-list.h" diff --git a/clients/tui/nmt-page-team.h b/clients/tui/nmt-page-team.h index 2d8bf07ad7..95a0e454d3 100644 --- a/clients/tui/nmt-page-team.h +++ b/clients/tui/nmt-page-team.h @@ -19,6 +19,7 @@ #ifndef NMT_PAGE_TEAM_H #define NMT_PAGE_TEAM_H +#include "nm-glib.h" #include "nmt-editor-page-device.h" G_BEGIN_DECLS diff --git a/clients/tui/nmt-page-vlan.c b/clients/tui/nmt-page-vlan.c index 9b9c8f52af..fefb244b15 100644 --- a/clients/tui/nmt-page-vlan.c +++ b/clients/tui/nmt-page-vlan.c @@ -23,9 +23,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-editor-bindings.h" #include "nmt-page-vlan.h" diff --git a/clients/tui/nmt-page-wifi.c b/clients/tui/nmt-page-wifi.c index 9cd20abf32..cf593f0108 100644 --- a/clients/tui/nmt-page-wifi.c +++ b/clients/tui/nmt-page-wifi.c @@ -29,9 +29,9 @@ #include -#include #include +#include "nm-glib.h" #include "nmt-page-wifi.h" #include "nmt-mac-entry.h" #include "nmt-mtu-entry.h" diff --git a/clients/tui/nmt-route-editor.c b/clients/tui/nmt-route-editor.c index 77bbec76de..156f7ad085 100644 --- a/clients/tui/nmt-route-editor.c +++ b/clients/tui/nmt-route-editor.c @@ -27,9 +27,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nmt-route-editor.h" #include "nmt-route-table.h" diff --git a/clients/tui/nmt-utils.h b/clients/tui/nmt-utils.h index 7e24fcab19..cb7e632aae 100644 --- a/clients/tui/nmt-utils.h +++ b/clients/tui/nmt-utils.h @@ -19,7 +19,7 @@ #ifndef NMT_UTILS_H #define NMT_UTILS_H -#include +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c index 0fac98ebc4..3519d5b9e0 100644 --- a/clients/tui/nmtui.c +++ b/clients/tui/nmtui.c @@ -30,11 +30,11 @@ #include #include -#include #include #include +#include "nm-glib.h" #include "nmt-newt.h" #include "nm-editor-bindings.h" diff --git a/clients/tui/vpn-helpers.c b/clients/tui/vpn-helpers.c index ab6469183c..be8f538463 100644 --- a/clients/tui/vpn-helpers.c +++ b/clients/tui/vpn-helpers.c @@ -31,7 +31,6 @@ #include "config.h" #include -#include #include #include @@ -39,6 +38,7 @@ #include #include +#include "nm-glib.h" #include "vpn-helpers.h" #define NM_VPN_API_SUBJECT_TO_CHANGE diff --git a/clients/tui/vpn-helpers.h b/clients/tui/vpn-helpers.h index 28019ca9c8..3bb26c6d76 100644 --- a/clients/tui/vpn-helpers.h +++ b/clients/tui/vpn-helpers.h @@ -19,12 +19,13 @@ #ifndef _VPN_HELPERS_H_ #define _VPN_HELPERS_H_ -#include #include #define NM_VPN_API_SUBJECT_TO_CHANGE #include +#include "nm-glib.h" + GHashTable *vpn_get_plugins (GError **error); NMVpnPluginUiInterface *vpn_get_plugin_by_service (const char *service); diff --git a/configure.ac b/configure.ac index b0c2277633..c0df38ee56 100644 --- a/configure.ac +++ b/configure.ac @@ -297,7 +297,7 @@ PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0], dnl GLIB_VERSION_MIN_REQUIRED should match the version above. dnl GLIB_VERSION_MAX_ALLOWED should be set to the same version; -dnl nm-glib-compat.h will cause it to be overridden for the functions +dnl nm-glib.h will cause it to be overridden for the functions dnl we have compat versions of. GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32" diff --git a/include/Makefile.am b/include/Makefile.am index 2cd66c9fff..66b0bec801 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,7 +2,7 @@ EXTRA_DIST = \ gsystem-local-alloc.h \ nm-dbus-compat.h \ nm-dbus-glib-types.h \ - nm-glib-compat.h \ + nm-glib.h \ nm-gvaluearray-compat.h \ nm-test-utils.h \ nm-macros-internal.h diff --git a/include/nm-glib-compat.h b/include/nm-glib.h similarity index 98% rename from include/nm-glib-compat.h rename to include/nm-glib.h index 5e36516f6e..b46feb7666 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib.h @@ -17,15 +17,13 @@ * Copyright 2008 - 2011 Red Hat, Inc. */ -#ifndef __NM_GLIB_COMPAT_H__ -#define __NM_GLIB_COMPAT_H__ +#ifndef __NM_GLIB_H__ +#define __NM_GLIB_H__ -#include -#include +#include #include - #ifdef __clang__ #undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -43,7 +41,6 @@ #include "nm-gvaluearray-compat.h" - static inline void __g_type_ensure (GType type) { @@ -261,4 +258,4 @@ _g_key_file_save_to_file (GKeyFile *key_file, #endif -#endif /* __NM_GLIB_COMPAT_H__ */ +#endif /* __NM_GLIB_H__ */ diff --git a/include/nm-gvaluearray-compat.h b/include/nm-gvaluearray-compat.h index f0b4a6cdcc..424e6be78d 100644 --- a/include/nm-gvaluearray-compat.h +++ b/include/nm-gvaluearray-compat.h @@ -20,10 +20,6 @@ #ifndef __NM_GVALUEARRAY_COMPAT_H__ #define __NM_GVALUEARRAY_COMPAT_H__ -#include - -#include "nm-glib-compat.h" - #define g_value_array_get_type() \ G_GNUC_EXTENSION ({ \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ diff --git a/include/nm-macros-internal.h b/include/nm-macros-internal.h index da6eacaf25..9d1beabb56 100644 --- a/include/nm-macros-internal.h +++ b/include/nm-macros-internal.h @@ -22,8 +22,7 @@ #ifndef __NM_MACROS_INTERNAL_H__ #define __NM_MACROS_INTERNAL_H__ - -#include +#include "nm-glib.h" /********************************************************/ diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 3007674e13..2c60e98f4b 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -86,14 +86,12 @@ #include #include #include -#include -#include #include #include +#include "nm-glib.h" #include "nm-utils.h" #include "nm-macros-internal.h" -#include "nm-glib-compat.h" #include "gsystem-local-alloc.h" #ifdef __NETWORKMANAGER_LOGGING_H__ diff --git a/libnm-core/crypto.c b/libnm-core/crypto.c index 205d22c613..c6b6653f92 100644 --- a/libnm-core/crypto.c +++ b/libnm-core/crypto.c @@ -23,13 +23,13 @@ #include "config.h" -#include #include #include #include #include #include +#include "nm-glib.h" #include "crypto.h" #include "nm-errors.h" diff --git a/libnm-core/crypto.h b/libnm-core/crypto.h index 434f108d0a..d4784102e6 100644 --- a/libnm-core/crypto.h +++ b/libnm-core/crypto.h @@ -24,7 +24,7 @@ #ifndef __CRYPTO_H__ #define __CRYPTO_H__ -#include +#include "nm-glib.h" #define MD5_HASH_LEN 20 #define CIPHER_DES_EDE3_CBC "DES-EDE3-CBC" diff --git a/libnm-core/crypto_gnutls.c b/libnm-core/crypto_gnutls.c index 01291f048a..32692fde9e 100644 --- a/libnm-core/crypto_gnutls.c +++ b/libnm-core/crypto_gnutls.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include @@ -31,6 +30,7 @@ #include #include +#include "nm-glib.h" #include "crypto.h" #include "nm-errors.h" diff --git a/libnm-core/crypto_nss.c b/libnm-core/crypto_nss.c index d0c3506b88..0c5905c18c 100644 --- a/libnm-core/crypto_nss.c +++ b/libnm-core/crypto_nss.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include @@ -36,6 +35,7 @@ #include #include +#include "nm-glib.h" #include "crypto.h" #include "nm-errors.h" diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index 8f226582cd..353421a70d 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -22,9 +22,9 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-connection-private.h" #include "nm-utils.h" diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index f05528b3e4..2ff9e5348e 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -33,8 +33,8 @@ * and some test programs. **/ -#include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-core-enum-types.h" #include "nm-dbus-interface.h" diff --git a/libnm-core/nm-dbus-utils.c b/libnm-core/nm-dbus-utils.c index 4bdbdd0942..e2e3265c52 100644 --- a/libnm-core/nm-dbus-utils.c +++ b/libnm-core/nm-dbus-utils.c @@ -21,10 +21,9 @@ #include "config.h" #include -#include #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-core-internal.h" typedef struct { diff --git a/libnm-core/nm-errors.c b/libnm-core/nm-errors.c index 3b1b1bc97e..b2e95066d6 100644 --- a/libnm-core/nm-errors.c +++ b/libnm-core/nm-errors.c @@ -21,10 +21,9 @@ #include "config.h" #include -#include +#include "nm-glib.h" #include "nm-errors.h" -#include "nm-glib-compat.h" #include "nm-dbus-interface.h" #include "nm-vpn-dbus-interface.h" #include "nm-core-internal.h" diff --git a/libnm-core/nm-keyfile-internal.h b/libnm-core/nm-keyfile-internal.h index f4bb079637..5f4c927f29 100644 --- a/libnm-core/nm-keyfile-internal.h +++ b/libnm-core/nm-keyfile-internal.h @@ -22,13 +22,12 @@ #ifndef __NM_KEYFILE_INTERNAL_H__ #define __NM_KEYFILE_INTERNAL_H__ -#include #include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-setting-8021x.h" - /*********************************************************/ #define NM_KEYFILE_CERT_SCHEME_PREFIX_BLOB "data:;base64," diff --git a/libnm-core/nm-keyfile-reader.c b/libnm-core/nm-keyfile-reader.c index 9f2dbc15d6..dfc3944ccb 100644 --- a/libnm-core/nm-keyfile-reader.c +++ b/libnm-core/nm-keyfile-reader.c @@ -30,14 +30,13 @@ #include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include "nm-macros-internal.h" #include "gsystem-local-alloc.h" -#include "nm-glib-compat.h" #include "nm-keyfile-internal.h" #include "nm-keyfile-utils.h" - typedef struct { NMConnection *connection; GKeyFile *keyfile; diff --git a/libnm-core/nm-keyfile-utils.c b/libnm-core/nm-keyfile-utils.c index d04a3d1bef..2540afebb1 100644 --- a/libnm-core/nm-keyfile-utils.c +++ b/libnm-core/nm-keyfile-utils.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-keyfile-utils.h" #include "nm-keyfile-internal.h" @@ -31,7 +31,6 @@ #include "nm-setting-wireless.h" #include "nm-setting-wireless-security.h" - typedef struct { const char *setting; const char *alias; diff --git a/libnm-core/nm-keyfile-writer.c b/libnm-core/nm-keyfile-writer.c index ff433b264a..9dc9b387ed 100644 --- a/libnm-core/nm-keyfile-writer.c +++ b/libnm-core/nm-keyfile-writer.c @@ -30,6 +30,7 @@ #include #include +#include "nm-glib.h" #include "nm-setting.h" #include "nm-setting-connection.h" #include "nm-setting-ip4-config.h" @@ -43,7 +44,6 @@ #include "nm-utils.h" #include "gsystem-local-alloc.h" -#include "nm-glib-compat.h" #include "nm-keyfile-internal.h" #include "nm-keyfile-utils.h" diff --git a/libnm-core/nm-property-compare.c b/libnm-core/nm-property-compare.c index 5d270706e8..a52c3ccee1 100644 --- a/libnm-core/nm-property-compare.c +++ b/libnm-core/nm-property-compare.c @@ -22,13 +22,12 @@ #include "config.h" -#include "nm-property-compare.h" -#include "nm-glib-compat.h" - #include #include #include -#include + +#include "nm-property-compare.h" +#include "nm-glib.h" static gint _nm_property_compare_collection (GVariant *value1, GVariant *value2) diff --git a/libnm-core/nm-property-compare.h b/libnm-core/nm-property-compare.h index 33016787ff..c03d147952 100644 --- a/libnm-core/nm-property-compare.h +++ b/libnm-core/nm-property-compare.h @@ -23,7 +23,7 @@ #ifndef __NM_PROPERTY_COMPARE_H__ #define __NM_PROPERTY_COMPARE_H__ -#include +#include "nm-glib.h" int nm_property_compare (GVariant *value1, GVariant *value2); diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c index e2e3450a26..b4cd213817 100644 --- a/libnm-core/nm-setting-ip-config.c +++ b/libnm-core/nm-setting-ip-config.c @@ -26,11 +26,11 @@ #include #include +#include "nm-glib.h" #include "nm-setting-ip-config.h" #include "nm-setting-ip4-config.h" #include "nm-setting-ip6-config.h" #include "nm-utils.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" #include "nm-utils-private.h" diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h index dc8d7fac20..ea8194860a 100644 --- a/libnm-core/nm-setting-private.h +++ b/libnm-core/nm-setting-private.h @@ -21,10 +21,10 @@ #ifndef __NM_SETTING_PRIVATE_H__ #define __NM_SETTING_PRIVATE_H__ +#include "nm-glib.h" #include "nm-setting.h" #include "nm-connection.h" #include "nm-core-enum-types.h" -#include "nm-glib-compat.h" #include "nm-core-internal.h" diff --git a/libnm-core/nm-setting-serial.c b/libnm-core/nm-setting-serial.c index 3fd780c838..668565f35c 100644 --- a/libnm-core/nm-setting-serial.c +++ b/libnm-core/nm-setting-serial.c @@ -24,8 +24,8 @@ #include +#include "nm-glib.h" #include "nm-setting-serial.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" /** diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index b6af31a4c1..07daeacecb 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -24,8 +24,8 @@ #include #include -#include +#include "nm-glib.h" #include "nm-setting.h" #include "nm-setting-private.h" #include "nm-utils.h" diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 2519d32ce6..f6a9e5a05a 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -31,9 +31,9 @@ #include #include +#include "nm-glib.h" #include "nm-utils.h" #include "nm-utils-private.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" #include "crypto.h" #include "gsystem-local-alloc.h" diff --git a/libnm-core/tests/test-compare.c b/libnm-core/tests/test-compare.c index 12db9c23b3..6e861ffdb7 100644 --- a/libnm-core/tests/test-compare.c +++ b/libnm-core/tests/test-compare.c @@ -24,8 +24,7 @@ #include #include -#include "nm-glib-compat.h" - +#include "nm-glib.h" #include "nm-property-compare.h" #include "nm-test-utils.h" diff --git a/libnm-core/tests/test-crypto.c b/libnm-core/tests/test-crypto.c index e4ca808659..282939f6e9 100644 --- a/libnm-core/tests/test-crypto.c +++ b/libnm-core/tests/test-crypto.c @@ -23,13 +23,13 @@ #include "config.h" -#include #include #include #include #include #include +#include "nm-glib.h" #include "crypto.h" #include "nm-utils.h" #include "nm-errors.h" diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index dd897ddcdd..e8e96bb756 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -23,10 +23,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-setting-private.h" @@ -62,7 +62,6 @@ #include "nm-setting-wireless-security.h" #include "nm-simple-connection.h" #include "nm-keyfile-internal.h" -#include "nm-glib-compat.h" #include "nm-test-utils.h" #include "test-general-enums.h" diff --git a/libnm-core/tests/test-secrets.c b/libnm-core/tests/test-secrets.c index 178fddd526..6995522f79 100644 --- a/libnm-core/tests/test-secrets.c +++ b/libnm-core/tests/test-secrets.c @@ -21,9 +21,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-setting-8021x.h" #include "nm-setting-cdma.h" #include "nm-setting-connection.h" diff --git a/libnm-core/tests/test-setting-8021x.c b/libnm-core/tests/test-setting-8021x.c index 16f6016e23..255448b8bb 100644 --- a/libnm-core/tests/test-setting-8021x.c +++ b/libnm-core/tests/test-setting-8021x.c @@ -21,11 +21,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-setting-connection.h" #include "nm-setting-8021x.h" diff --git a/libnm-core/tests/test-setting-dcb.c b/libnm-core/tests/test-setting-dcb.c index 0369ca55f2..2e9fa1a74d 100644 --- a/libnm-core/tests/test-setting-dcb.c +++ b/libnm-core/tests/test-setting-dcb.c @@ -21,9 +21,9 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-setting-dcb.h" #include "nm-connection.h" #include "nm-errors.h" diff --git a/libnm-core/tests/test-settings-defaults.c b/libnm-core/tests/test-settings-defaults.c index 7d7715cbb3..81d754223d 100644 --- a/libnm-core/tests/test-settings-defaults.c +++ b/libnm-core/tests/test-settings-defaults.c @@ -21,11 +21,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-setting-8021x.h" #include "nm-setting-cdma.h" #include "nm-setting-connection.h" diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index da3bc5f6d9..c8ea9863a8 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -30,6 +30,8 @@ #include #include + +#include "nm-glib.h" #include "nm-client.h" #include "nm-device.h" #include "nm-device-ethernet.h" @@ -38,7 +40,6 @@ #include "nm-active-connection.h" #include "nm-vpn-connection.h" #include "nm-setting-ip4-config.h" -#include "nm-glib-compat.h" static gboolean test_wireless_enabled (NMClient *client) diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c index 7acfcc95a3..7e99db1c1c 100644 --- a/libnm-glib/libnm_glib.c +++ b/libnm-glib/libnm_glib.c @@ -26,14 +26,12 @@ #include #include #include -#include #include #include +#include "nm-glib.h" #include "NetworkManager.h" #include "libnm_glib.h" -#include "nm-glib-compat.h" - #define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist" diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c index c6b7c9ce74..5c6ba006a7 100644 --- a/libnm-glib/nm-access-point.c +++ b/libnm-glib/nm-access-point.c @@ -24,14 +24,13 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include #include #include +#include "nm-glib.h" #include "nm-access-point.h" #include "NetworkManager.h" #include "nm-types-private.h" diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c index e5f474f7eb..613c3577f1 100644 --- a/libnm-glib/nm-active-connection.c +++ b/libnm-glib/nm-active-connection.c @@ -23,6 +23,7 @@ #include +#include "nm-glib.h" #include "NetworkManager.h" #include "nm-active-connection.h" #include "nm-object-private.h" @@ -31,7 +32,6 @@ #include "nm-device-private.h" #include "nm-connection.h" #include "nm-vpn-connection.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers-private.h" static GType _nm_active_connection_type_for_path (DBusGConnection *connection, diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 40add09c76..0322449a44 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -25,6 +25,7 @@ #include #include +#include "nm-glib.h" #include "nm-client.h" #include "nm-device-ethernet.h" #include "nm-device-wifi.h" @@ -35,7 +36,6 @@ #include "nm-vpn-connection.h" #include "nm-object-cache.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled); diff --git a/libnm-glib/nm-dbus-helpers-private.h b/libnm-glib/nm-dbus-helpers-private.h index 8a350e783d..417faf3bd4 100644 --- a/libnm-glib/nm-dbus-helpers-private.h +++ b/libnm-glib/nm-dbus-helpers-private.h @@ -21,10 +21,11 @@ #ifndef NM_DBUS_HELPERS_PRIVATE_H #define NM_DBUS_HELPERS_PRIVATE_H -#include #include #include +#include "nm-glib.h" + DBusGConnection *_nm_dbus_new_connection (GError **error); gboolean _nm_dbus_is_connection_private (DBusGConnection *connection); diff --git a/libnm-glib/nm-dbus-helpers.c b/libnm-glib/nm-dbus-helpers.c index 00e04ab435..076f19863e 100644 --- a/libnm-glib/nm-dbus-helpers.c +++ b/libnm-glib/nm-dbus-helpers.c @@ -21,9 +21,9 @@ #include "config.h" #include -#include #include #include +#include "nm-glib.h" #include "nm-dbus-helpers-private.h" #include "NetworkManager.h" diff --git a/libnm-glib/nm-device-bond.c b/libnm-glib/nm-device-bond.c index 786d4f1680..b8a253cdf9 100644 --- a/libnm-glib/nm-device-bond.c +++ b/libnm-glib/nm-device-bond.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-bond.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-bridge.c b/libnm-glib/nm-device-bridge.c index ef69fb2647..f80835a85f 100644 --- a/libnm-glib/nm-device-bridge.c +++ b/libnm-glib/nm-device-bridge.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-bridge.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-bt.c b/libnm-glib/nm-device-bt.c index 58d483443a..5b09399953 100644 --- a/libnm-glib/nm-device-bt.c +++ b/libnm-glib/nm-device-bt.c @@ -24,11 +24,10 @@ #include #include -#include "nm-glib-compat.h" - #include #include +#include "nm-glib.h" #include "nm-device-bt.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-ethernet.c b/libnm-glib/nm-device-ethernet.c index d27a980fe9..24e3f36908 100644 --- a/libnm-glib/nm-device-ethernet.c +++ b/libnm-glib/nm-device-ethernet.c @@ -24,12 +24,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-ethernet.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-infiniband.c b/libnm-glib/nm-device-infiniband.c index 663b36516d..10b65aac79 100644 --- a/libnm-glib/nm-device-infiniband.c +++ b/libnm-glib/nm-device-infiniband.c @@ -24,12 +24,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-infiniband.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-modem.c b/libnm-glib/nm-device-modem.c index 524d86cea0..7ef2926b21 100644 --- a/libnm-glib/nm-device-modem.c +++ b/libnm-glib/nm-device-modem.c @@ -23,12 +23,11 @@ #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-modem.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-olpc-mesh.c b/libnm-glib/nm-device-olpc-mesh.c index e68fda6261..f33c68e7fc 100644 --- a/libnm-glib/nm-device-olpc-mesh.c +++ b/libnm-glib/nm-device-olpc-mesh.c @@ -22,11 +22,10 @@ #include -#include "nm-glib-compat.h" - #include #include +#include "nm-glib.h" #include "nm-device-olpc-mesh.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-team.c b/libnm-glib/nm-device-team.c index d9a5fce088..6a16846bad 100644 --- a/libnm-glib/nm-device-team.c +++ b/libnm-glib/nm-device-team.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-team.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-vlan.c b/libnm-glib/nm-device-vlan.c index 26c234bdd5..475be6be68 100644 --- a/libnm-glib/nm-device-vlan.c +++ b/libnm-glib/nm-device-vlan.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-vlan.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c index 28609c79df..788e66954e 100644 --- a/libnm-glib/nm-device-wifi.c +++ b/libnm-glib/nm-device-wifi.c @@ -24,12 +24,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-wifi.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-device-wimax.c b/libnm-glib/nm-device-wimax.c index 5211e04087..e94142031f 100644 --- a/libnm-glib/nm-device-wimax.c +++ b/libnm-glib/nm-device-wimax.c @@ -24,11 +24,10 @@ #include #include -#include "nm-glib-compat.h" - #include #include +#include "nm-glib.h" #include "nm-device-wimax.h" #include "nm-object-private.h" #include "nm-object-cache.h" diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 731edb6927..b511254150 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -26,6 +26,7 @@ #include #include +#include "nm-glib.h" #include "NetworkManager.h" #include "nm-device-ethernet.h" #include "nm-device-adsl.h" @@ -47,7 +48,6 @@ #include "nm-remote-connection.h" #include "nm-types.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-utils.h" #include "nm-dbus-helpers-private.h" diff --git a/libnm-glib/nm-object-cache.c b/libnm-glib/nm-object-cache.c index 752c606a93..09bf720cec 100644 --- a/libnm-glib/nm-object-cache.c +++ b/libnm-glib/nm-object-cache.c @@ -21,7 +21,7 @@ #include "config.h" #include -#include +#include "nm-glib.h" #include "nm-object-cache.h" #include "nm-object.h" diff --git a/libnm-glib/nm-object-cache.h b/libnm-glib/nm-object-cache.h index 7aca3b4fba..5fcd2ef574 100644 --- a/libnm-glib/nm-object-cache.h +++ b/libnm-glib/nm-object-cache.h @@ -21,8 +21,7 @@ #ifndef NM_OBJECT_CACHE_H #define NM_OBJECT_CACHE_H -#include -#include +#include "nm-glib.h" #include "nm-object.h" G_BEGIN_DECLS diff --git a/libnm-glib/nm-object-private.h b/libnm-glib/nm-object-private.h index 75e63b2e7e..1b18918c8e 100644 --- a/libnm-glib/nm-object-private.h +++ b/libnm-glib/nm-object-private.h @@ -21,7 +21,7 @@ #ifndef NM_OBJECT_PRIVATE_H #define NM_OBJECT_PRIVATE_H -#include +#include "nm-glib.h" #include "nm-object.h" void _nm_object_ensure_inited (NMObject *object); diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 2cf7119e0d..206b3f5b4d 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -22,16 +22,15 @@ #include "config.h" #include -#include #include #include #include +#include "nm-glib.h" #include "NetworkManager.h" #include "nm-object.h" #include "nm-object-cache.h" #include "nm-object-private.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-types.h" #include "nm-dbus-helpers-private.h" diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index 3a70e81ed4..1dce200e96 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -22,17 +22,16 @@ #include "config.h" #include -#include #include #include #include #include +#include "nm-glib.h" #include "nm-remote-connection.h" #include "nm-remote-connection-private.h" #include "nm-object-private.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers-private.h" #define NM_REMOTE_CONNECTION_BUS "bus" diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 20b4638007..37a4622d87 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -25,12 +25,12 @@ #include #include +#include "nm-glib.h" #include "nm-dbus-glib-types.h" #include "nm-remote-settings.h" #include "nm-remote-connection-private.h" #include "nm-object-private.h" #include "nm-dbus-helpers-private.h" -#include "nm-glib-compat.h" #include "nm-object-private.h" /** diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index 04f8dd8b1f..3da765857c 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -23,7 +23,7 @@ #include #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "NetworkManager.h" #include "nm-secret-agent.h" #include "nm-glib-enum-types.h" diff --git a/libnm-glib/nm-types.c b/libnm-glib/nm-types.c index 5b434aa97b..daafc2bc25 100644 --- a/libnm-glib/nm-types.c +++ b/libnm-glib/nm-types.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-types.h" #include "nm-types-private.h" #include "nm-object-private.h" diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index 3acf26ead1..290ecb4738 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -22,7 +22,7 @@ #include "config.h" #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-vpn-plugin.h" #include "nm-vpn-enum-types.h" #include "nm-utils.h" diff --git a/libnm-glib/nm-wimax-nsp.c b/libnm-glib/nm-wimax-nsp.c index 1735ab3eec..e85fb4e370 100644 --- a/libnm-glib/nm-wimax-nsp.c +++ b/libnm-glib/nm-wimax-nsp.c @@ -22,12 +22,11 @@ #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-wimax-nsp.h" #include "NetworkManager.h" #include "nm-types-private.h" diff --git a/libnm-glib/tests/common.c b/libnm-glib/tests/common.c index 540d43afa6..3989f756f1 100644 --- a/libnm-glib/tests/common.c +++ b/libnm-glib/tests/common.c @@ -21,9 +21,9 @@ #include "config.h" #include -#include #include +#include "nm-glib.h" #include "NetworkManager.h" #include "common.h" diff --git a/libnm-glib/tests/common.h b/libnm-glib/tests/common.h index 7c49d2532b..63dbe4d24f 100644 --- a/libnm-glib/tests/common.h +++ b/libnm-glib/tests/common.h @@ -18,7 +18,7 @@ * Copyright 2014 Red Hat, Inc. */ -#include +#include "nm-glib.h" typedef struct { GDBusConnection *bus; diff --git a/libnm-glib/tests/test-nm-client.c b/libnm-glib/tests/test-nm-client.c index 0ec3924d99..067d460c91 100644 --- a/libnm-glib/tests/test-nm-client.c +++ b/libnm-glib/tests/test-nm-client.c @@ -23,12 +23,12 @@ #include #include #include -#include #include #include #include #include +#include "nm-glib.h" #include "nm-client.h" #include "nm-device-wifi.h" #include "nm-device-ethernet.h" diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c index afaa6fe117..b40a0facd9 100644 --- a/libnm-glib/tests/test-remote-settings-client.c +++ b/libnm-glib/tests/test-remote-settings-client.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -34,6 +33,7 @@ #include #include +#include "nm-glib.h" #include "nm-remote-settings.h" #include "common.h" diff --git a/libnm-util/crypto.c b/libnm-util/crypto.c index 8a10af9453..8b6198c93b 100644 --- a/libnm-util/crypto.c +++ b/libnm-util/crypto.c @@ -23,13 +23,13 @@ #include "config.h" -#include #include #include #include #include #include +#include "nm-glib.h" #include "crypto.h" GQuark diff --git a/libnm-util/crypto.h b/libnm-util/crypto.h index 315d8fec83..36041584cf 100644 --- a/libnm-util/crypto.h +++ b/libnm-util/crypto.h @@ -24,7 +24,7 @@ #ifndef __CRYPTO_H__ #define __CRYPTO_H__ -#include +#include "nm-glib.h" #define MD5_HASH_LEN 20 #define CIPHER_DES_EDE3_CBC "DES-EDE3-CBC" diff --git a/libnm-util/crypto_gnutls.c b/libnm-util/crypto_gnutls.c index f61ad8693d..8b0c9f78cc 100644 --- a/libnm-util/crypto_gnutls.c +++ b/libnm-util/crypto_gnutls.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include @@ -31,6 +30,7 @@ #include #include +#include "nm-glib.h" #include "crypto.h" #define SALT_LEN 8 diff --git a/libnm-util/crypto_nss.c b/libnm-util/crypto_nss.c index edd19b54fe..9f60f5cc28 100644 --- a/libnm-util/crypto_nss.c +++ b/libnm-util/crypto_nss.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include @@ -36,6 +35,7 @@ #include #include +#include "nm-glib.h" #include "crypto.h" static gboolean initialized = FALSE; diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index 3a929b045f..2671ce3c78 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -22,10 +22,10 @@ #include "config.h" -#include #include #include #include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-utils.h" #include "nm-dbus-glib-types.h" diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c index 11f957499e..456c341773 100644 --- a/libnm-util/nm-param-spec-specialized.c +++ b/libnm-util/nm-param-spec-specialized.c @@ -22,8 +22,8 @@ #include "config.h" +#include "nm-glib.h" #include "nm-param-spec-specialized.h" -#include "nm-glib-compat.h" struct _NMParamSpecSpecialized { GParamSpec parent; diff --git a/libnm-util/nm-param-spec-specialized.h b/libnm-util/nm-param-spec-specialized.h index 7803e919ae..226c301758 100644 --- a/libnm-util/nm-param-spec-specialized.h +++ b/libnm-util/nm-param-spec-specialized.h @@ -23,7 +23,7 @@ #ifndef NM_PARAM_SPEC_SPECIALIZED_H #define NM_PARAM_SPEC_SPECIALIZED_H -#include +#include "nm-glib.h" typedef struct _NMParamSpecSpecialized NMParamSpecSpecialized; diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c index 4db43cbca8..838a88e0d0 100644 --- a/libnm-util/nm-setting-ip4-config.c +++ b/libnm-util/nm-setting-ip4-config.c @@ -26,14 +26,13 @@ #include #include +#include "nm-glib.h" #include "nm-setting-ip4-config.h" #include "nm-param-spec-specialized.h" #include "nm-utils.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" - /** * SECTION:nm-setting-ip4-config * @short_description: Describes IPv4 addressing, routing, and name service properties diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c index 4e69a0727c..8c8055c80f 100644 --- a/libnm-util/nm-setting-ip6-config.c +++ b/libnm-util/nm-setting-ip6-config.c @@ -25,11 +25,11 @@ #include #include +#include "nm-glib.h" #include "nm-setting-ip6-config.h" #include "nm-param-spec-specialized.h" #include "nm-utils.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" /** diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h index 5e1122e810..1b6c0377f3 100644 --- a/libnm-util/nm-setting-private.h +++ b/libnm-util/nm-setting-private.h @@ -21,7 +21,7 @@ #ifndef NM_SETTING_PRIVATE_H #define NM_SETTING_PRIVATE_H -#include "nm-glib-compat.h" +#include "nm-glib.h" #define NM_SETTING_SECRET_FLAGS_ALL \ (NM_SETTING_SECRET_FLAG_NONE | \ diff --git a/libnm-util/nm-setting-serial.c b/libnm-util/nm-setting-serial.c index 24f2c89807..9524881b01 100644 --- a/libnm-util/nm-setting-serial.c +++ b/libnm-util/nm-setting-serial.c @@ -24,8 +24,8 @@ #include +#include "nm-glib.h" #include "nm-setting-serial.h" -#include "nm-glib-compat.h" #include "nm-setting-private.h" /** diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 143063e7f5..23c2cbf446 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -28,12 +28,11 @@ #include #include #include -#include #include +#include "nm-glib.h" #include "nm-utils.h" #include "nm-utils-private.h" -#include "nm-glib-compat.h" #include "nm-dbus-glib-types.h" #include "nm-setting-private.h" #include "crypto.h" diff --git a/libnm-util/nm-value-transforms.c b/libnm-util/nm-value-transforms.c index 00e7e77579..6a6f5bfc0d 100644 --- a/libnm-util/nm-value-transforms.c +++ b/libnm-util/nm-value-transforms.c @@ -23,10 +23,10 @@ #include +#include "nm-glib.h" #include "nm-utils.h" #include "nm-utils-private.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" static void _nm_utils_convert_op_to_string (const GValue *src_value, GValue *dest_value) diff --git a/libnm-util/tests/test-crypto.c b/libnm-util/tests/test-crypto.c index 8055facf0e..290a722452 100644 --- a/libnm-util/tests/test-crypto.c +++ b/libnm-util/tests/test-crypto.c @@ -23,13 +23,13 @@ #include "config.h" -#include #include #include #include #include #include +#include "nm-glib.h" #include "crypto.h" #include "nm-utils.h" diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index f365dc0438..598914d9f7 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -30,6 +29,7 @@ #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-setting-private.h" diff --git a/libnm-util/tests/test-libnm-linking.c b/libnm-util/tests/test-libnm-linking.c index 9738d44d7f..66a4831410 100644 --- a/libnm-util/tests/test-libnm-linking.c +++ b/libnm-util/tests/test-libnm-linking.c @@ -21,10 +21,9 @@ #include "config.h" -#include #include -#include "nm-glib-compat.h" +#include "nm-glib.h" extern GType nm_state_get_type (void); diff --git a/libnm-util/tests/test-secrets.c b/libnm-util/tests/test-secrets.c index adf3a94a34..cc23813119 100644 --- a/libnm-util/tests/test-secrets.c +++ b/libnm-util/tests/test-secrets.c @@ -21,11 +21,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-setting-connection.h" #include "nm-setting-wired.h" #include "nm-setting-8021x.h" diff --git a/libnm-util/tests/test-setting-8021x.c b/libnm-util/tests/test-setting-8021x.c index dfc07a8055..9790669869 100644 --- a/libnm-util/tests/test-setting-8021x.c +++ b/libnm-util/tests/test-setting-8021x.c @@ -21,11 +21,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-setting-connection.h" #include "nm-setting-8021x.h" diff --git a/libnm-util/tests/test-setting-dcb.c b/libnm-util/tests/test-setting-dcb.c index 8f0af2e6c1..20a02250bf 100644 --- a/libnm-util/tests/test-setting-dcb.c +++ b/libnm-util/tests/test-setting-dcb.c @@ -21,10 +21,9 @@ #include "config.h" -#include #include #include -#include +#include "nm-glib.h" #include "nm-setting-dcb.h" #include "gsystem-local-alloc.h" diff --git a/libnm-util/tests/test-settings-defaults.c b/libnm-util/tests/test-settings-defaults.c index 70a743cb00..1f0ba1c294 100644 --- a/libnm-util/tests/test-settings-defaults.c +++ b/libnm-util/tests/test-settings-defaults.c @@ -21,11 +21,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-setting-8021x.h" #include "nm-setting-cdma.h" #include "nm-setting-connection.h" diff --git a/libnm/nm-access-point.c b/libnm/nm-access-point.c index e8ab6ef538..95c2cf5f5d 100644 --- a/libnm/nm-access-point.c +++ b/libnm/nm-access-point.c @@ -23,14 +23,13 @@ #include -#include "nm-glib-compat.h" - #include #include #include #include #include +#include "nm-glib.h" #include "nm-access-point.h" #include "nm-dbus-interface.h" #include "nm-object-private.h" diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index 31f513280d..f2951fbef2 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -23,6 +23,7 @@ #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-active-connection.h" #include "nm-object-private.h" @@ -31,7 +32,6 @@ #include "nm-device-private.h" #include "nm-connection.h" #include "nm-vpn-connection.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 3d683a1c67..5ddb70bea4 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -24,6 +24,7 @@ #include #include +#include "nm-glib.h" #include "nm-client.h" #include "nm-manager.h" #include "nm-remote-settings.h" @@ -35,7 +36,6 @@ #include "nm-vpn-connection.h" #include "nm-remote-connection.h" #include "nm-object-cache.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers.h" void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled); diff --git a/libnm/nm-dbus-helpers.c b/libnm/nm-dbus-helpers.c index 45e09442e9..717f7f4602 100644 --- a/libnm/nm-dbus-helpers.c +++ b/libnm/nm-dbus-helpers.c @@ -21,9 +21,8 @@ #include "config.h" #include -#include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-dbus-helpers.h" #include "nm-dbus-interface.h" diff --git a/libnm/nm-dbus-helpers.h b/libnm/nm-dbus-helpers.h index 1b2f28e2d9..2b0809f81b 100644 --- a/libnm/nm-dbus-helpers.h +++ b/libnm/nm-dbus-helpers.h @@ -21,8 +21,8 @@ #ifndef __NM_DBUS_HELPERS_PRIVATE_H__ #define __NM_DBUS_HELPERS_PRIVATE_H__ -#include +#include "nm-glib.h" #include "nm-dbus-compat.h" GBusType _nm_dbus_bus_type (void); diff --git a/libnm/nm-device-bond.c b/libnm/nm-device-bond.c index 6bb673233d..8959f1e0e2 100644 --- a/libnm/nm-device-bond.c +++ b/libnm/nm-device-bond.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-bond.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-bridge.c b/libnm/nm-device-bridge.c index ce28f2c2f4..2b9efbd0d2 100644 --- a/libnm/nm-device-bridge.c +++ b/libnm/nm-device-bridge.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-bridge.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-bt.c b/libnm/nm-device-bt.c index 7752646457..01566312f9 100644 --- a/libnm/nm-device-bt.c +++ b/libnm/nm-device-bt.c @@ -24,12 +24,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-bt.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c index be2cb4dc40..21bb52be5a 100644 --- a/libnm/nm-device-ethernet.c +++ b/libnm/nm-device-ethernet.c @@ -24,13 +24,12 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include #include +#include "nm-glib.h" #include "nm-device-ethernet.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-infiniband.c b/libnm/nm-device-infiniband.c index bce8a87aa2..e8436a9294 100644 --- a/libnm/nm-device-infiniband.c +++ b/libnm/nm-device-infiniband.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-infiniband.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-modem.c b/libnm/nm-device-modem.c index dcbb447a2f..81d7570e2b 100644 --- a/libnm/nm-device-modem.c +++ b/libnm/nm-device-modem.c @@ -24,12 +24,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-modem.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-olpc-mesh.c b/libnm/nm-device-olpc-mesh.c index 108e533982..32b40eb01c 100644 --- a/libnm/nm-device-olpc-mesh.c +++ b/libnm/nm-device-olpc-mesh.c @@ -23,11 +23,10 @@ #include #include -#include "nm-glib-compat.h" - #include #include +#include "nm-glib.h" #include "nm-device-olpc-mesh.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-team.c b/libnm/nm-device-team.c index cff1d71849..5fc09cdc05 100644 --- a/libnm/nm-device-team.c +++ b/libnm/nm-device-team.c @@ -23,12 +23,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-team.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-vlan.c b/libnm/nm-device-vlan.c index fb6e3bd7b2..d4992426a4 100644 --- a/libnm/nm-device-vlan.c +++ b/libnm/nm-device-vlan.c @@ -23,13 +23,12 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include #include +#include "nm-glib.h" #include "nm-device-vlan.h" #include "nm-device-private.h" #include "nm-object-private.h" diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index 4a19f2e5a5..94bb5d31ef 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -24,13 +24,12 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include #include +#include "nm-glib.h" #include "nm-device-wifi.h" #include "nm-access-point.h" #include "nm-device-private.h" diff --git a/libnm/nm-device-wimax.c b/libnm/nm-device-wimax.c index 67c66827bb..61406ff3c1 100644 --- a/libnm/nm-device-wimax.c +++ b/libnm/nm-device-wimax.c @@ -24,12 +24,11 @@ #include #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-device-wimax.h" #include "nm-wimax-nsp.h" #include "nm-object-private.h" diff --git a/libnm/nm-device.c b/libnm/nm-device.c index 19268a4306..ba9234de81 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -26,6 +26,7 @@ #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-active-connection.h" #include "nm-device-ethernet.h" @@ -51,7 +52,6 @@ #include "nm-object-cache.h" #include "nm-remote-connection.h" #include "nm-core-internal.h" -#include "nm-glib-compat.h" #include "nm-utils.h" #include "nm-dbus-helpers.h" #include "nm-setting-connection.h" diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index 2fd40273a3..48e1d83d2b 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -25,6 +25,7 @@ #include #include +#include "nm-glib.h" #include "nm-manager.h" #include "nm-device-ethernet.h" #include "nm-device-wifi.h" @@ -34,7 +35,6 @@ #include "nm-active-connection.h" #include "nm-vpn-connection.h" #include "nm-object-cache.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers.h" #include "nmdbus-manager.h" diff --git a/libnm/nm-object-cache.c b/libnm/nm-object-cache.c index 752c606a93..09bf720cec 100644 --- a/libnm/nm-object-cache.c +++ b/libnm/nm-object-cache.c @@ -21,7 +21,7 @@ #include "config.h" #include -#include +#include "nm-glib.h" #include "nm-object-cache.h" #include "nm-object.h" diff --git a/libnm/nm-object-cache.h b/libnm/nm-object-cache.h index ebadbaa8dd..5e5eead0ac 100644 --- a/libnm/nm-object-cache.h +++ b/libnm/nm-object-cache.h @@ -21,8 +21,7 @@ #ifndef __NM_OBJECT_CACHE_H__ #define __NM_OBJECT_CACHE_H__ -#include -#include +#include "nm-glib.h" #include "nm-object.h" G_BEGIN_DECLS diff --git a/libnm/nm-object-private.h b/libnm/nm-object-private.h index 0b13cbb6e7..f8fcee9986 100644 --- a/libnm/nm-object-private.h +++ b/libnm/nm-object-private.h @@ -21,7 +21,7 @@ #ifndef __NM_OBJECT_PRIVATE_H__ #define __NM_OBJECT_PRIVATE_H__ -#include +#include "nm-glib.h" #include "nm-object.h" typedef gboolean (*PropertyMarshalFunc) (NMObject *, GParamSpec *, GVariant *, gpointer); diff --git a/libnm/nm-object.c b/libnm/nm-object.c index bf25000bc9..b86dc7d1ba 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -22,16 +22,15 @@ #include "config.h" #include -#include #include #include #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-object.h" #include "nm-object-cache.h" #include "nm-object-private.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers.h" #include "nm-client.h" #include "nm-core-internal.h" diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c index 98924973d7..a27c0404f0 100644 --- a/libnm/nm-remote-connection.c +++ b/libnm/nm-remote-connection.c @@ -22,16 +22,15 @@ #include "config.h" #include -#include #include #include #include #include +#include "nm-glib.h" #include "nm-remote-connection.h" #include "nm-remote-connection-private.h" #include "nm-object-private.h" -#include "nm-glib-compat.h" #include "nm-dbus-helpers.h" #include "nmdbus-settings-connection.h" diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c index d37e366617..d6a786a6ac 100644 --- a/libnm/nm-remote-settings.c +++ b/libnm/nm-remote-settings.c @@ -26,13 +26,13 @@ #include #include +#include "nm-glib.h" #include "nm-remote-settings.h" #include "nm-client.h" #include "nm-remote-connection.h" #include "nm-remote-connection-private.h" #include "nm-object-private.h" #include "nm-dbus-helpers.h" -#include "nm-glib-compat.h" #include "nm-object-private.h" #include "nm-core-internal.h" diff --git a/libnm/nm-secret-agent-old.c b/libnm/nm-secret-agent-old.c index 6df54d433d..97f3bc8d59 100644 --- a/libnm/nm-secret-agent-old.c +++ b/libnm/nm-secret-agent-old.c @@ -22,7 +22,7 @@ #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-secret-agent-old.h" #include "nm-enum-types.h" diff --git a/libnm/nm-vpn-plugin-old.c b/libnm/nm-vpn-plugin-old.c index 3f3c7c7351..5748060ff0 100644 --- a/libnm/nm-vpn-plugin-old.c +++ b/libnm/nm-vpn-plugin-old.c @@ -30,9 +30,8 @@ #include #include -#include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-vpn-plugin-old.h" #include "nm-enum-types.h" #include "nm-utils.h" diff --git a/libnm/nm-wimax-nsp.c b/libnm/nm-wimax-nsp.c index 0fed1c6e4c..3fa4ddf019 100644 --- a/libnm/nm-wimax-nsp.c +++ b/libnm/nm-wimax-nsp.c @@ -22,12 +22,11 @@ #include -#include "nm-glib-compat.h" - #include #include #include +#include "nm-glib.h" #include "nm-wimax-nsp.h" #include "nm-dbus-interface.h" #include "nm-object-private.h" diff --git a/libnm/tests/common.c b/libnm/tests/common.c index a90266c5e8..833d7fd004 100644 --- a/libnm/tests/common.c +++ b/libnm/tests/common.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "NetworkManager.h" #include "nm-dbus-compat.h" diff --git a/libnm/tests/common.h b/libnm/tests/common.h index aa15167b85..1fd3f464c6 100644 --- a/libnm/tests/common.h +++ b/libnm/tests/common.h @@ -18,9 +18,10 @@ * Copyright 2014 Red Hat, Inc. */ -#include #include +#include "nm-glib.h" + typedef struct { GDBusConnection *bus; GDBusProxy *proxy; diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c index 1c9bc853a6..55b005066e 100644 --- a/libnm/tests/test-nm-client.c +++ b/libnm/tests/test-nm-client.c @@ -20,14 +20,13 @@ #include "config.h" -#include #include #include #include #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "common.h" #include "nm-test-utils.h" diff --git a/libnm/tests/test-remote-settings-client.c b/libnm/tests/test-remote-settings-client.c index d723f6ce7d..2f47b53267 100644 --- a/libnm/tests/test-remote-settings-client.c +++ b/libnm/tests/test-remote-settings-client.c @@ -20,13 +20,13 @@ #include "config.h" -#include #include #include #include #include +#include "nm-glib.h" #include "common.h" #include "nm-test-utils.h" diff --git a/libnm/tests/test-secret-agent.c b/libnm/tests/test-secret-agent.c index 3f0095abc0..28a6c9920d 100644 --- a/libnm/tests/test-secret-agent.c +++ b/libnm/tests/test-secret-agent.c @@ -20,7 +20,6 @@ #include "config.h" -#include #include #include #include @@ -28,6 +27,7 @@ #include #include +#include "nm-glib.h" #include "common.h" #include "nm-test-utils.h" diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 6292e80c76..d91a4e61b8 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -21,8 +21,6 @@ #include "config.h" -#include -#include #include #include #include @@ -35,6 +33,7 @@ #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-platform.h" #include "nm-utils.h" diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 2ad132b8ec..47593fb87b 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -22,10 +22,10 @@ #ifndef __NETWORKMANAGER_UTILS_H__ #define __NETWORKMANAGER_UTILS_H__ -#include #include #include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-types.h" diff --git a/src/devices/adsl/nm-atm-manager.c b/src/devices/adsl/nm-atm-manager.c index 0830f85d15..1718cdd8dc 100644 --- a/src/devices/adsl/nm-atm-manager.c +++ b/src/devices/adsl/nm-atm-manager.c @@ -24,12 +24,12 @@ #include #include +#include "nm-glib.h" #include "nm-atm-manager.h" #include "nm-setting-adsl.h" #include "nm-device-adsl.h" #include "nm-device-factory.h" #include "nm-logging.h" -#include "nm-glib-compat.h" typedef struct { GUdevClient *client; diff --git a/src/devices/adsl/nm-atm-manager.h b/src/devices/adsl/nm-atm-manager.h index e4ec3e6aee..16dc332e14 100644 --- a/src/devices/adsl/nm-atm-manager.h +++ b/src/devices/adsl/nm-atm-manager.h @@ -22,8 +22,7 @@ #ifndef __NETWORKMANAGER_ATM_MANAGER_H__ #define __NETWORKMANAGER_ATM_MANAGER_H__ -#include -#include +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/src/devices/adsl/nm-device-adsl.c b/src/devices/adsl/nm-device-adsl.c index 4d2cac5be7..f5ed9d756f 100644 --- a/src/devices/adsl/nm-device-adsl.c +++ b/src/devices/adsl/nm-device-adsl.c @@ -29,11 +29,11 @@ #include #include -#include #include #include #include +#include "nm-glib.h" #include "nm-device-adsl.h" #include "nm-device-private.h" #include "NetworkManagerUtils.h" diff --git a/src/devices/adsl/nm-device-adsl.h b/src/devices/adsl/nm-device-adsl.h index f21381c21f..74e29d5dd1 100644 --- a/src/devices/adsl/nm-device-adsl.h +++ b/src/devices/adsl/nm-device-adsl.h @@ -22,9 +22,8 @@ #ifndef __NETWORKMANAGER_DEVICE_ADSL_H__ #define __NETWORKMANAGER_DEVICE_ADSL_H__ -#include - // Parent class +#include "nm-glib.h" #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c index 419339aca3..2cebefa869 100644 --- a/src/devices/bluetooth/nm-bluez-device.c +++ b/src/devices/bluetooth/nm-bluez-device.c @@ -21,11 +21,10 @@ #include "config.h" -#include #include -#include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include "nm-bt-error.h" diff --git a/src/devices/bluetooth/nm-bluez-device.h b/src/devices/bluetooth/nm-bluez-device.h index 92d99fa75a..5d89556082 100644 --- a/src/devices/bluetooth/nm-bluez-device.h +++ b/src/devices/bluetooth/nm-bluez-device.h @@ -21,11 +21,9 @@ #ifndef __NETWORKMANAGER_BLUEZ_DEVICE_H__ #define __NETWORKMANAGER_BLUEZ_DEVICE_H__ -#include -#include -#include #include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-connection-provider.h" diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c index 2e1c46b13c..193d9f7186 100644 --- a/src/devices/bluetooth/nm-bluez-manager.c +++ b/src/devices/bluetooth/nm-bluez-manager.c @@ -24,8 +24,8 @@ #include #include #include -#include +#include "nm-glib.h" #include "nm-logging.h" #include "nm-bluez-manager.h" #include "nm-device-factory.h" diff --git a/src/devices/bluetooth/nm-bluez-manager.h b/src/devices/bluetooth/nm-bluez-manager.h index 8320b2987f..97b9ac66cf 100644 --- a/src/devices/bluetooth/nm-bluez-manager.h +++ b/src/devices/bluetooth/nm-bluez-manager.h @@ -22,8 +22,7 @@ #ifndef __NETWORKMANAGER_BLUEZ_MANAGER_H__ #define __NETWORKMANAGER_BLUEZ_MANAGER_H__ -#include -#include +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/src/devices/bluetooth/nm-bluez4-adapter.c b/src/devices/bluetooth/nm-bluez4-adapter.c index f0aa42ae85..f31c600e73 100644 --- a/src/devices/bluetooth/nm-bluez4-adapter.c +++ b/src/devices/bluetooth/nm-bluez4-adapter.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-bluez4-adapter.h" #include "nm-bluez-device.h" diff --git a/src/devices/bluetooth/nm-bluez4-adapter.h b/src/devices/bluetooth/nm-bluez4-adapter.h index a62564127a..98d19b22ef 100644 --- a/src/devices/bluetooth/nm-bluez4-adapter.h +++ b/src/devices/bluetooth/nm-bluez4-adapter.h @@ -21,9 +21,8 @@ #ifndef __NETWORKMANAGER_BLUEZ4_ADAPTER_H__ #define __NETWORKMANAGER_BLUEZ4_ADAPTER_H__ -#include -#include +#include "nm-glib.h" #include "nm-bluez-device.h" #include "nm-connection-provider.h" diff --git a/src/devices/bluetooth/nm-bluez4-manager.h b/src/devices/bluetooth/nm-bluez4-manager.h index 13cfef9398..e5f526461b 100644 --- a/src/devices/bluetooth/nm-bluez4-manager.h +++ b/src/devices/bluetooth/nm-bluez4-manager.h @@ -22,11 +22,8 @@ #ifndef __NETWORKMANAGER_BLUEZ4_MANAGER_H__ #define __NETWORKMANAGER_BLUEZ4_MANAGER_H__ -#include -#include - -#include -#include "nm-connection-provider.h" +#include "nm-glib.h" +#include "nm-connection-provider.h" G_BEGIN_DECLS diff --git a/src/devices/bluetooth/nm-bluez5-dun.h b/src/devices/bluetooth/nm-bluez5-dun.h index 7e25972551..bc2f6c7aa2 100644 --- a/src/devices/bluetooth/nm-bluez5-dun.h +++ b/src/devices/bluetooth/nm-bluez5-dun.h @@ -21,8 +21,7 @@ #ifndef _NM_BLUEZ5_UTILS_H_ #define _NM_BLUEZ5_UTILS_H_ -#include -#include +#include "nm-glib.h" typedef struct _NMBluez5DunContext NMBluez5DunContext; diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c index 148fe3cbe9..cbbe111753 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.c +++ b/src/devices/bluetooth/nm-bluez5-manager.c @@ -25,8 +25,8 @@ #include #include #include -#include +#include "nm-glib.h" #include "nm-logging.h" #include "nm-bluez-manager.h" #include "nm-bluez5-manager.h" diff --git a/src/devices/bluetooth/nm-bluez5-manager.h b/src/devices/bluetooth/nm-bluez5-manager.h index 8152976dc4..faf6ce6692 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.h +++ b/src/devices/bluetooth/nm-bluez5-manager.h @@ -22,11 +22,8 @@ #ifndef __NETWORKMANAGER_BLUEZ5_MANAGER_H__ #define __NETWORKMANAGER_BLUEZ5_MANAGER_H__ -#include -#include - -#include -#include "nm-connection-provider.h" +#include "nm-glib.h" +#include "nm-connection-provider.h" G_BEGIN_DECLS diff --git a/src/devices/bluetooth/nm-bt-error.c b/src/devices/bluetooth/nm-bt-error.c index e3b8e7f583..11aabbdb57 100644 --- a/src/devices/bluetooth/nm-bt-error.c +++ b/src/devices/bluetooth/nm-bt-error.c @@ -20,7 +20,7 @@ #include "config.h" -#include +#include "nm-glib.h" #include "nm-bt-error.h" GQuark diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index 88033e2e8e..1de5bed104 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -24,9 +24,8 @@ #include #include -#include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-bluez-common.h" #include "nm-bluez-device.h" #include "nm-dbus-manager.h" diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 7f1394248d..a78761c3d7 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -20,12 +20,12 @@ #include "config.h" -#include #include #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-device-bond.h" #include "nm-logging.h" diff --git a/src/devices/nm-device-bond.h b/src/devices/nm-device-bond.h index 17217a57c4..8165bb8062 100644 --- a/src/devices/nm-device-bond.h +++ b/src/devices/nm-device-bond.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_BOND_H__ #define __NETWORKMANAGER_DEVICE_BOND_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 76b78c0122..3e70708db1 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -20,11 +20,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-device-bridge.h" #include "nm-logging.h" diff --git a/src/devices/nm-device-bridge.h b/src/devices/nm-device-bridge.h index c11a2c40f7..e30c48c2dc 100644 --- a/src/devices/nm-device-bridge.h +++ b/src/devices/nm-device-bridge.h @@ -21,8 +21,7 @@ #ifndef __NETWORKMANAGER_DEVICE_BRIDGE_H__ #define __NETWORKMANAGER_DEVICE_BRIDGE_H__ -#include - +#include "nm-glib.h" #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-ethernet-utils.c b/src/devices/nm-device-ethernet-utils.c index 585f6a0e0e..7c226f065e 100644 --- a/src/devices/nm-device-ethernet-utils.c +++ b/src/devices/nm-device-ethernet-utils.c @@ -19,10 +19,10 @@ #include "config.h" #include -#include #include #include +#include "nm-glib.h" #include "nm-device-ethernet-utils.h" char * diff --git a/src/devices/nm-device-ethernet-utils.h b/src/devices/nm-device-ethernet-utils.h index 5848f7e604..1ca181b2b2 100644 --- a/src/devices/nm-device-ethernet-utils.h +++ b/src/devices/nm-device-ethernet-utils.h @@ -19,7 +19,7 @@ #ifndef __NETWORKMANAGER_DEVICE_ETHERNET_UTILS_H__ #define __NETWORKMANAGER_DEVICE_ETHERNET_UTILS_H__ -#include +#include "nm-glib.h" char *nm_device_ethernet_utils_get_default_wired_name (const GSList *connections); diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index d147b1c7f5..afd3a43415 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -31,7 +30,7 @@ #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-device-ethernet.h" #include "nm-device-private.h" #include "nm-activation-request.h" diff --git a/src/devices/nm-device-ethernet.h b/src/devices/nm-device-ethernet.h index ad9ce85669..325225a3c8 100644 --- a/src/devices/nm-device-ethernet.h +++ b/src/devices/nm-device-ethernet.h @@ -22,8 +22,6 @@ #ifndef __NETWORKMANAGER_DEVICE_ETHERNET_H__ #define __NETWORKMANAGER_DEVICE_ETHERNET_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-factory.h b/src/devices/nm-device-factory.h index 6ae865ae88..1ac1fc9a41 100644 --- a/src/devices/nm-device-factory.h +++ b/src/devices/nm-device-factory.h @@ -21,9 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_FACTORY_H__ #define __NETWORKMANAGER_DEVICE_FACTORY_H__ -#include -#include - #include "nm-dbus-interface.h" #include "nm-device.h" diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c index 5841d834ff..0565153bb8 100644 --- a/src/devices/nm-device-generic.c +++ b/src/devices/nm-device-generic.c @@ -24,7 +24,6 @@ #include "nm-device-private.h" #include "nm-enum-types.h" #include "nm-platform.h" -#include "nm-glib-compat.h" #include "nm-dbus-manager.h" #include "nm-core-internal.h" diff --git a/src/devices/nm-device-generic.h b/src/devices/nm-device-generic.h index c889b1ddc7..4dad4421f0 100644 --- a/src/devices/nm-device-generic.h +++ b/src/devices/nm-device-generic.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_GENERIC_H__ #define __NETWORKMANAGER_DEVICE_GENERIC_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-gre.h b/src/devices/nm-device-gre.h index 7acff5f7f5..7e2d105c4b 100644 --- a/src/devices/nm-device-gre.h +++ b/src/devices/nm-device-gre.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_GRE_H__ #define __NETWORKMANAGER_DEVICE_GRE_H__ -#include - #include "nm-device-generic.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 2e2483c0cf..62fbe8d558 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -20,11 +20,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-device-infiniband.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" @@ -39,7 +39,6 @@ #include "nm-device-infiniband-glue.h" - G_DEFINE_TYPE (NMDeviceInfiniband, nm_device_infiniband, NM_TYPE_DEVICE) #define NM_DEVICE_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandPrivate)) diff --git a/src/devices/nm-device-infiniband.h b/src/devices/nm-device-infiniband.h index b81b762ad2..cac9a79d37 100644 --- a/src/devices/nm-device-infiniband.h +++ b/src/devices/nm-device-infiniband.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_INFINIBAND_H__ #define __NETWORKMANAGER_DEVICE_INFINIBAND_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-macvlan.h b/src/devices/nm-device-macvlan.h index 24f15437c3..189a9df02e 100644 --- a/src/devices/nm-device-macvlan.h +++ b/src/devices/nm-device-macvlan.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_MACVLAN_H__ #define __NETWORKMANAGER_DEVICE_MACVLAN_H__ -#include - #include "nm-device-generic.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-tun.h b/src/devices/nm-device-tun.h index 393c58018f..b253d68e45 100644 --- a/src/devices/nm-device-tun.h +++ b/src/devices/nm-device-tun.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_TUN_H__ #define __NETWORKMANAGER_DEVICE_TUN_H__ -#include - #include "nm-device-generic.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-veth.h b/src/devices/nm-device-veth.h index 51e8db45ea..c7b8ec3ad0 100644 --- a/src/devices/nm-device-veth.h +++ b/src/devices/nm-device-veth.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_VETH_H__ #define __NETWORKMANAGER_DEVICE_VETH_H__ -#include - #include "nm-device-ethernet.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index 158e7de5bf..f2380e71d6 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -20,11 +20,11 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-device-vlan.h" #include "nm-manager.h" #include "nm-logging.h" diff --git a/src/devices/nm-device-vlan.h b/src/devices/nm-device-vlan.h index 20fc345379..4a27226fb7 100644 --- a/src/devices/nm-device-vlan.h +++ b/src/devices/nm-device-vlan.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_VLAN_H__ #define __NETWORKMANAGER_DEVICE_VLAN_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device-vxlan.h b/src/devices/nm-device-vxlan.h index cc6081e657..9db78cdfcb 100644 --- a/src/devices/nm-device-vxlan.h +++ b/src/devices/nm-device-vxlan.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_VXLAN_H__ #define __NETWORKMANAGER_DEVICE_VXLAN_H__ -#include - #include "nm-device-generic.h" G_BEGIN_DECLS diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 985b0c65f6..4590c5f63d 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -36,8 +35,8 @@ #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" -#include "nm-glib-compat.h" #include "nm-device.h" #include "nm-device-private.h" #include "NetworkManagerUtils.h" diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 469d755ed5..cb4476435d 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -22,11 +22,10 @@ #ifndef __NETWORKMANAGER_DEVICE_H__ #define __NETWORKMANAGER_DEVICE_H__ -#include -#include #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-types.h" #include "nm-connection.h" diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index ccfab0f3b0..1de22138b6 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -24,12 +24,11 @@ #include #include #include -#include #include -#include #include #include +#include "nm-glib.h" #include "nm-device-team.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" diff --git a/src/devices/team/nm-device-team.h b/src/devices/team/nm-device-team.h index 26ba573721..76cdba1396 100644 --- a/src/devices/team/nm-device-team.h +++ b/src/devices/team/nm-device-team.h @@ -21,8 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_TEAM_H__ #define __NETWORKMANAGER_DEVICE_TEAM_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/team/nm-team-factory.h b/src/devices/team/nm-team-factory.h index 2f02ac5729..35cee90e1d 100644 --- a/src/devices/team/nm-team-factory.h +++ b/src/devices/team/nm-team-factory.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_TEAM_FACTORY_H__ #define __NETWORKMANAGER_TEAM_FACTORY_H__ -#include +#include "nm-glib.h" #define NM_TYPE_TEAM_FACTORY (nm_team_factory_get_type ()) #define NM_TEAM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_TEAM_FACTORY, NMTeamFactory)) diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index e67d1a20a6..7dc7c11b00 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -26,7 +26,6 @@ #include "config.h" -#include #include #include #include @@ -38,6 +37,7 @@ #include #include +#include "nm-glib.h" #include "nm-device.h" #include "nm-device-wifi.h" #include "nm-device-olpc-mesh.h" @@ -57,7 +57,6 @@ /* This is a bug; but we can't really change API now... */ #include "nm-vpn-dbus-interface.h" - #include "nm-device-olpc-mesh-glue.h" #include "nm-device-logging.h" diff --git a/src/devices/wifi/nm-device-olpc-mesh.h b/src/devices/wifi/nm-device-olpc-mesh.h index 67d83fb059..8d6895f27a 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.h +++ b/src/devices/wifi/nm-device-olpc-mesh.h @@ -28,8 +28,6 @@ #ifndef __NETWORKMANAGER_DEVICE_OLPC_MESH_H__ #define __NETWORKMANAGER_DEVICE_OLPC_MESH_H__ -#include - #include "nm-device.h" G_BEGIN_DECLS diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 500fa3aade..62c64a125b 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -29,7 +28,7 @@ #include #include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-dbus-manager.h" #include "nm-device.h" #include "nm-device-wifi.h" @@ -57,7 +56,6 @@ #include "nm-wifi-enum-types.h" #include "nm-connection-provider.h" - static gboolean impl_device_get_access_points (NMDeviceWifi *device, GPtrArray **aps, GError **err); diff --git a/src/devices/wifi/nm-device-wifi.h b/src/devices/wifi/nm-device-wifi.h index bcba91da2f..c74ff1c5bf 100644 --- a/src/devices/wifi/nm-device-wifi.h +++ b/src/devices/wifi/nm-device-wifi.h @@ -22,8 +22,6 @@ #ifndef __NETWORKMANAGER_DEVICE_WIFI_H__ #define __NETWORKMANAGER_DEVICE_WIFI_H__ -#include - #include "nm-device.h" #include "nm-wifi-ap.h" diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c index ea4ec2a8d6..ca272a001c 100644 --- a/src/devices/wifi/nm-wifi-ap.c +++ b/src/devices/wifi/nm-wifi-ap.c @@ -24,6 +24,7 @@ #include #include +#include "nm-glib.h" #include "nm-wifi-ap.h" #include "nm-wifi-ap-utils.h" #include "NetworkManagerUtils.h" @@ -33,7 +34,6 @@ #include "nm-core-internal.h" #include "nm-setting-wireless.h" -#include "nm-glib-compat.h" #include "gsystem-local-alloc.h" #include "nm-access-point-glue.h" diff --git a/src/devices/wifi/nm-wifi-ap.h b/src/devices/wifi/nm-wifi-ap.h index dfc5acee3b..47e901ee22 100644 --- a/src/devices/wifi/nm-wifi-ap.h +++ b/src/devices/wifi/nm-wifi-ap.h @@ -22,8 +22,7 @@ #ifndef __NETWORKMANAGER_ACCESS_POINT_H__ #define __NETWORKMANAGER_ACCESS_POINT_H__ -#include -#include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-connection.h" diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c index b59b5376dd..b7323b845d 100644 --- a/src/devices/wifi/tests/test-wifi-ap-utils.c +++ b/src/devices/wifi/tests/test-wifi-ap-utils.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-wifi-ap-utils.h" #include "nm-dbus-glib-types.h" diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c index ca724c046c..02b0e5af89 100644 --- a/src/devices/wwan/nm-device-modem.c +++ b/src/devices/wwan/nm-device-modem.c @@ -21,8 +21,8 @@ #include "config.h" #include -#include +#include "nm-glib.h" #include "nm-device-modem.h" #include "nm-modem.h" #include "nm-device-private.h" diff --git a/src/devices/wwan/nm-device-modem.h b/src/devices/wwan/nm-device-modem.h index 996195c49e..1cf399e12c 100644 --- a/src/devices/wwan/nm-device-modem.h +++ b/src/devices/wwan/nm-device-modem.h @@ -21,9 +21,6 @@ #ifndef __NETWORKMANAGER_DEVICE_MODEM_H__ #define __NETWORKMANAGER_DEVICE_MODEM_H__ -#include -#include - #include "nm-device.h" #include "nm-modem.h" diff --git a/src/devices/wwan/nm-modem-broadband.h b/src/devices/wwan/nm-modem-broadband.h index 2268bac449..a54e63a697 100644 --- a/src/devices/wwan/nm-modem-broadband.h +++ b/src/devices/wwan/nm-modem-broadband.h @@ -21,7 +21,6 @@ #ifndef __NETWORKMANAGER_MODEM_BROADBAND_H__ #define __NETWORKMANAGER_MODEM_BROADBAND_H__ -#include #include "nm-modem.h" G_BEGIN_DECLS diff --git a/src/devices/wwan/nm-modem-manager.h b/src/devices/wwan/nm-modem-manager.h index 9e0db41e3f..b0014c6a89 100644 --- a/src/devices/wwan/nm-modem-manager.h +++ b/src/devices/wwan/nm-modem-manager.h @@ -23,7 +23,6 @@ #ifndef __NETWORKMANAGER_MODEM_MANAGER_H__ #define __NETWORKMANAGER_MODEM_MANAGER_H__ -#include #include "nm-modem.h" #define NM_TYPE_MODEM_MANAGER (nm_modem_manager_get_type ()) diff --git a/src/devices/wwan/nm-modem.h b/src/devices/wwan/nm-modem.h index 2cace8902d..0889f7231a 100644 --- a/src/devices/wwan/nm-modem.h +++ b/src/devices/wwan/nm-modem.h @@ -22,7 +22,7 @@ #ifndef __NETWORKMANAGER_MODEM_H__ #define __NETWORKMANAGER_MODEM_H__ -#include +#include "nm-glib.h" #include "ppp-manager/nm-ppp-manager.h" #include "nm-device.h" diff --git a/src/devices/wwan/nm-wwan-factory.h b/src/devices/wwan/nm-wwan-factory.h index c6c03f1f09..fc85a92ca8 100644 --- a/src/devices/wwan/nm-wwan-factory.h +++ b/src/devices/wwan/nm-wwan-factory.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_WWAN_FACTORY_H__ #define __NETWORKMANAGER_WWAN_FACTORY_H__ -#include +#include "nm-glib.h" #define NM_TYPE_WWAN_FACTORY (nm_wwan_factory_get_type ()) #define NM_WWAN_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_WWAN_FACTORY, NMWwanFactory)) diff --git a/src/dhcp-manager/Makefile.am b/src/dhcp-manager/Makefile.am index 27945f55c2..b56072409a 100644 --- a/src/dhcp-manager/Makefile.am +++ b/src/dhcp-manager/Makefile.am @@ -4,6 +4,7 @@ nm_dhcp_helper_SOURCES = nm-dhcp-helper.c nm_dhcp_helper_CPPFLAGS = \ $(GLIB_CFLAGS) \ + -I$(top_srcdir)/include \ -DG_LOG_DOMAIN=\""nm-dhcp-helper"\" \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ -DNMRUNDIR=\"$(nmrundir)\" diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c index 67be01cf4f..c00782f963 100644 --- a/src/dhcp-manager/nm-dhcp-client.c +++ b/src/dhcp-manager/nm-dhcp-client.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include #include #include @@ -29,6 +28,7 @@ #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-utils.h" #include "nm-logging.h" diff --git a/src/dhcp-manager/nm-dhcp-client.h b/src/dhcp-manager/nm-dhcp-client.h index 0cbd2001bb..b5f30c5ed7 100644 --- a/src/dhcp-manager/nm-dhcp-client.h +++ b/src/dhcp-manager/nm-dhcp-client.h @@ -19,14 +19,13 @@ #ifndef __NETWORKMANAGER_DHCP_CLIENT_H__ #define __NETWORKMANAGER_DHCP_CLIENT_H__ -#include -#include - #include #include #include #include +#include "nm-glib.h" + #define NM_TYPE_DHCP_CLIENT (nm_dhcp_client_get_type ()) #define NM_DHCP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP_CLIENT, NMDhcpClient)) #define NM_DHCP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DHCP_CLIENT, NMDhcpClientClass)) diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c index cec6d1350b..4c889e73ac 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c @@ -19,12 +19,12 @@ #include "config.h" -#include #include #include #include #include +#include "nm-glib.h" #include "nm-dhcp-dhclient-utils.h" #include "nm-dhcp-utils.h" #include "nm-ip4-config.h" diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.h b/src/dhcp-manager/nm-dhcp-dhclient-utils.h index 3cd0f8b832..70ad7a17f1 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.h +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.h @@ -19,12 +19,11 @@ #ifndef __NETWORKMANAGER_DHCP_DHCLIENT_UTILS_H__ #define __NETWORKMANAGER_DHCP_DHCLIENT_UTILS_H__ -#include -#include - #include #include +#include "nm-glib.h" + char *nm_dhcp_dhclient_create_config (const char *interface, gboolean is_ip6, GBytes *client_id, diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c index 1d88da4463..d6dde54cc8 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient.c +++ b/src/dhcp-manager/nm-dhcp-dhclient.c @@ -24,9 +24,7 @@ #include #undef _XOPEN_SOURCE -#include #include -#include #include #include #include @@ -36,6 +34,7 @@ #include #include +#include "nm-glib.h" #include "nm-dhcp-dhclient.h" #include "nm-utils.h" #include "nm-logging.h" @@ -44,7 +43,6 @@ #include "NetworkManagerUtils.h" #include "nm-dhcp-listener.h" #include "gsystem-local-alloc.h" -#include "nm-glib-compat.h" G_DEFINE_TYPE (NMDhcpDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT) diff --git a/src/dhcp-manager/nm-dhcp-dhclient.h b/src/dhcp-manager/nm-dhcp-dhclient.h index 5abcc08ee3..dba9011160 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient.h +++ b/src/dhcp-manager/nm-dhcp-dhclient.h @@ -19,9 +19,7 @@ #ifndef __NETWORKMANAGER_DHCP_DHCLIENT_H__ #define __NETWORKMANAGER_DHCP_DHCLIENT_H__ -#include -#include - +#include "nm-glib.h" #include "nm-dhcp-client.h" #define NM_TYPE_DHCP_DHCLIENT (nm_dhcp_dhclient_get_type ()) diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c index acbc762096..716ec84fc9 100644 --- a/src/dhcp-manager/nm-dhcp-dhcpcd.c +++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include #include @@ -33,13 +32,13 @@ #include #include +#include "nm-glib.h" #include "nm-dhcp-dhcpcd.h" #include "nm-dhcp-manager.h" #include "nm-utils.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" #include "nm-dhcp-listener.h" -#include "nm-glib-compat.h" G_DEFINE_TYPE (NMDhcpDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT) diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.h b/src/dhcp-manager/nm-dhcp-dhcpcd.h index deed70e0f9..6f15ad223e 100644 --- a/src/dhcp-manager/nm-dhcp-dhcpcd.h +++ b/src/dhcp-manager/nm-dhcp-dhcpcd.h @@ -19,9 +19,6 @@ #ifndef __NETWORKMANAGER_DHCP_DHCPCD_H__ #define __NETWORKMANAGER_DHCP_DHCPCD_H__ -#include -#include - #include "nm-dhcp-client.h" #define NM_TYPE_DHCP_DHCPCD (nm_dhcp_dhcpcd_get_type ()) diff --git a/src/dhcp-manager/nm-dhcp-helper.c b/src/dhcp-manager/nm-dhcp-helper.c index 7855f68c96..dde95aa086 100644 --- a/src/dhcp-manager/nm-dhcp-helper.c +++ b/src/dhcp-manager/nm-dhcp-helper.c @@ -25,7 +25,7 @@ #include #include -#include +#include "nm-glib.h" #define NM_DHCP_CLIENT_DBUS_IFACE "org.freedesktop.nm_dhcp_client" diff --git a/src/dhcp-manager/nm-dhcp-listener.c b/src/dhcp-manager/nm-dhcp-listener.c index ca57ae595a..4954d57620 100644 --- a/src/dhcp-manager/nm-dhcp-listener.c +++ b/src/dhcp-manager/nm-dhcp-listener.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include #include #include @@ -30,12 +29,12 @@ #include #include +#include "nm-glib.h" #include "nm-dhcp-listener.h" #include "nm-core-internal.h" #include "nm-logging.h" #include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "NetworkManagerUtils.h" #define NM_DHCP_CLIENT_DBUS_IFACE "org.freedesktop.nm_dhcp_client" diff --git a/src/dhcp-manager/nm-dhcp-listener.h b/src/dhcp-manager/nm-dhcp-listener.h index 15ec053109..015c8eb53d 100644 --- a/src/dhcp-manager/nm-dhcp-listener.h +++ b/src/dhcp-manager/nm-dhcp-listener.h @@ -19,8 +19,7 @@ #ifndef __NETWORKMANAGER_DHCP_LISTENER_H__ #define __NETWORKMANAGER_DHCP_LISTENER_H__ -#include -#include +#include "nm-glib.h" #define NM_TYPE_DHCP_LISTENER (nm_dhcp_listener_get_type ()) #define NM_DHCP_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP_LISTENER, NMDhcpListener)) diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index fa562e6cf1..0f2b8faeb3 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -22,7 +22,6 @@ #include "config.h" -#include #include #include #include @@ -34,6 +33,7 @@ #include #include +#include "nm-glib.h" #include "nm-dhcp-manager.h" #include "nm-dhcp-dhclient.h" #include "nm-dhcp-dhcpcd.h" @@ -41,7 +41,6 @@ #include "nm-logging.h" #include "nm-config.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "NetworkManagerUtils.h" #define DHCP_TIMEOUT 45 /* default DHCP timeout, in seconds */ diff --git a/src/dhcp-manager/nm-dhcp-manager.h b/src/dhcp-manager/nm-dhcp-manager.h index 4c9e45de96..4286d9f905 100644 --- a/src/dhcp-manager/nm-dhcp-manager.h +++ b/src/dhcp-manager/nm-dhcp-manager.h @@ -22,9 +22,8 @@ #ifndef __NETWORKMANAGER_DHCP_MANAGER_H__ #define __NETWORKMANAGER_DHCP_MANAGER_H__ -#include -#include +#include "nm-glib.h" #include "nm-dhcp-client.h" #include "nm-ip4-config.h" #include "nm-dhcp4-config.h" diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c index 44a0d49e46..1ad68a5a36 100644 --- a/src/dhcp-manager/nm-dhcp-systemd.c +++ b/src/dhcp-manager/nm-dhcp-systemd.c @@ -18,9 +18,7 @@ #include "config.h" -#include #include -#include #include #include #include @@ -31,6 +29,7 @@ #include #include +#include "nm-glib.h" #include "nm-dhcp-systemd.h" #include "nm-utils.h" #include "nm-logging.h" diff --git a/src/dhcp-manager/nm-dhcp-systemd.h b/src/dhcp-manager/nm-dhcp-systemd.h index 2a7a463eb5..ff24bfcd15 100644 --- a/src/dhcp-manager/nm-dhcp-systemd.h +++ b/src/dhcp-manager/nm-dhcp-systemd.h @@ -19,9 +19,6 @@ #ifndef NM_DHCP_SYSTEMD_H #define NM_DHCP_SYSTEMD_H -#include -#include - #include "nm-dhcp-client.h" #define NM_TYPE_DHCP_SYSTEMD (nm_dhcp_systemd_get_type ()) diff --git a/src/dhcp-manager/nm-dhcp-utils.c b/src/dhcp-manager/nm-dhcp-utils.c index 4dde1a4454..85fd25746b 100644 --- a/src/dhcp-manager/nm-dhcp-utils.c +++ b/src/dhcp-manager/nm-dhcp-utils.c @@ -19,12 +19,12 @@ #include "config.h" -#include #include #include #include #include +#include "nm-glib.h" #include "nm-logging.h" #include "nm-dhcp-utils.h" #include "nm-utils.h" diff --git a/src/dhcp-manager/nm-dhcp-utils.h b/src/dhcp-manager/nm-dhcp-utils.h index 42cf900f2a..fd9e8e24df 100644 --- a/src/dhcp-manager/nm-dhcp-utils.h +++ b/src/dhcp-manager/nm-dhcp-utils.h @@ -20,10 +20,12 @@ #define __NETWORKMANAGER_DHCP_UTILS_H__ #include -#include + #include #include +#include "nm-glib.h" + NMIP4Config *nm_dhcp_utils_ip4_config_from_options (int ifindex, const char *iface, GHashTable *options, diff --git a/src/dhcp-manager/tests/test-dhcp-dhclient.c b/src/dhcp-manager/tests/test-dhcp-dhclient.c index df5eed341d..14fbe4fead 100644 --- a/src/dhcp-manager/tests/test-dhcp-dhclient.c +++ b/src/dhcp-manager/tests/test-dhcp-dhclient.c @@ -20,11 +20,11 @@ #include "config.h" -#include #include #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "NetworkManagerUtils.h" #include "nm-dhcp-dhclient-utils.h" diff --git a/src/dhcp-manager/tests/test-dhcp-utils.c b/src/dhcp-manager/tests/test-dhcp-utils.c index 3cdae732a7..3bc879812f 100644 --- a/src/dhcp-manager/tests/test-dhcp-utils.c +++ b/src/dhcp-manager/tests/test-dhcp-utils.c @@ -19,13 +19,13 @@ #include "config.h" -#include #include #include #include #include +#include "nm-glib.h" #include "nm-dhcp-utils.h" #include "nm-logging.h" #include "nm-platform.h" diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c index f26ccfaa3f..d71a0eb389 100644 --- a/src/dns-manager/nm-dns-dnsmasq.c +++ b/src/dns-manager/nm-dns-dnsmasq.c @@ -27,9 +27,9 @@ #include #include -#include #include +#include "nm-glib.h" #include "nm-dns-dnsmasq.h" #include "nm-utils.h" #include "nm-logging.h" diff --git a/src/dns-manager/nm-dns-dnsmasq.h b/src/dns-manager/nm-dns-dnsmasq.h index fc80f07940..f0393c1222 100644 --- a/src/dns-manager/nm-dns-dnsmasq.h +++ b/src/dns-manager/nm-dns-dnsmasq.h @@ -19,9 +19,6 @@ #ifndef __NETWORKMANAGER_DNS_DNSMASQ_H__ #define __NETWORKMANAGER_DNS_DNSMASQ_H__ -#include -#include - #include "nm-dns-plugin.h" #define NM_TYPE_DNS_DNSMASQ (nm_dns_dnsmasq_get_type ()) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index ac4a050ec0..59cddb9a6a 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -35,10 +35,9 @@ #include -#include -#include #include +#include "nm-glib.h" #include "nm-utils.h" #include "nm-core-internal.h" #include "nm-dns-manager.h" diff --git a/src/dns-manager/nm-dns-manager.h b/src/dns-manager/nm-dns-manager.h index a3e6cb2699..ef1272b985 100644 --- a/src/dns-manager/nm-dns-manager.h +++ b/src/dns-manager/nm-dns-manager.h @@ -24,7 +24,7 @@ #ifndef __NETWORKMANAGER_DNS_MANAGER_H__ #define __NETWORKMANAGER_DNS_MANAGER_H__ -#include +#include "nm-glib.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c index 5b95d1c50a..c384c66342 100644 --- a/src/dns-manager/nm-dns-plugin.c +++ b/src/dns-manager/nm-dns-plugin.c @@ -24,8 +24,8 @@ #include #include #include -#include +#include "nm-glib.h" #include "nm-dns-plugin.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" diff --git a/src/dns-manager/nm-dns-plugin.h b/src/dns-manager/nm-dns-plugin.h index ee735a5abf..3e7ce5b174 100644 --- a/src/dns-manager/nm-dns-plugin.h +++ b/src/dns-manager/nm-dns-plugin.h @@ -19,8 +19,7 @@ #ifndef __NETWORKMANAGER_DNS_PLUGIN_H__ #define __NETWORKMANAGER_DNS_PLUGIN_H__ -#include -#include +#include "nm-glib.h" #define NM_TYPE_DNS_PLUGIN (nm_dns_plugin_get_type ()) #define NM_DNS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DNS_PLUGIN, NMDnsPlugin)) diff --git a/src/dns-manager/nm-dns-unbound.h b/src/dns-manager/nm-dns-unbound.h index 261326b2d4..abc056b926 100644 --- a/src/dns-manager/nm-dns-unbound.h +++ b/src/dns-manager/nm-dns-unbound.h @@ -18,8 +18,6 @@ #ifndef __NETWORKMANAGER_DNS_UNBOUND_H__ #define __NETWORKMANAGER_DNS_UNBOUND_H__ -#include - #include "nm-dns-plugin.h" #define NM_TYPE_DNS_UNBOUND (nm_dns_unbound_get_type ()) diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index dfe776cb42..ea4a2b258e 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -28,10 +28,10 @@ #include #include +#include "nm-glib.h" #include "nm-dnsmasq-manager.h" #include "nm-dnsmasq-utils.h" #include "nm-logging.h" -#include "nm-glib-compat.h" #include "nm-utils.h" #include "NetworkManagerUtils.h" diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.h b/src/dnsmasq-manager/nm-dnsmasq-manager.h index 257cc7559e..4b43658bef 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.h +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.h @@ -21,9 +21,8 @@ #ifndef __NETWORKMANAGER_DNSMASQ_MANAGER_H__ #define __NETWORKMANAGER_DNSMASQ_MANAGER_H__ -#include -#include +#include "nm-glib.h" #include "nm-ip4-config.h" #define NM_TYPE_DNSMASQ_MANAGER (nm_dnsmasq_manager_get_type ()) diff --git a/src/dnsmasq-manager/nm-dnsmasq-utils.h b/src/dnsmasq-manager/nm-dnsmasq-utils.h index bb468c824b..ed0b9ebc81 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-utils.h +++ b/src/dnsmasq-manager/nm-dnsmasq-utils.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_DNSMASQ_UTILS_H__ #define __NETWORKMANAGER_DNSMASQ_UTILS_H__ -#include +#include "nm-glib.h" #include "nm-platform.h" gboolean nm_dnsmasq_utils_get_range (const NMPlatformIP4Address *addr, diff --git a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c index fae4cae076..e36500d2d4 100644 --- a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c +++ b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-dnsmasq-utils.h" #include "nm-logging.h" diff --git a/src/main-utils.c b/src/main-utils.c index b0d8df3efa..94437b8b63 100644 --- a/src/main-utils.c +++ b/src/main-utils.c @@ -29,13 +29,11 @@ #include #include -#include #include #include #include -#include "nm-glib-compat.h" - +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "main-utils.h" #include "NetworkManagerUtils.h" diff --git a/src/main-utils.h b/src/main-utils.h index 4955029532..af68568027 100644 --- a/src/main-utils.h +++ b/src/main-utils.h @@ -21,7 +21,7 @@ #ifndef __MAIN_UTILS_H__ #define __MAIN_UTILS_H__ -#include +#include "nm-glib.h" void nm_main_utils_ensure_root (void); diff --git a/src/main.c b/src/main.c index 27babf81ec..31f63b7ae3 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -40,6 +39,7 @@ #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-dbus-interface.h" #include "NetworkManagerUtils.h" diff --git a/src/nm-activation-request.h b/src/nm-activation-request.h index 69756069ac..62b4f62846 100644 --- a/src/nm-activation-request.h +++ b/src/nm-activation-request.h @@ -21,9 +21,8 @@ #ifndef __NETWORKMANAGER_ACTIVATION_REQUEST_H__ #define __NETWORKMANAGER_ACTIVATION_REQUEST_H__ -#include -#include +#include "nm-glib.h" #include "nm-types.h" #include "nm-connection.h" #include "nm-active-connection.h" diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index b0bdd77a81..4c449d1de9 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -20,8 +20,8 @@ #include "config.h" -#include +#include "nm-glib.h" #include "nm-types.h" #include "nm-active-connection.h" #include "nm-dbus-interface.h" @@ -35,7 +35,6 @@ #include "NetworkManagerUtils.h" #include "gsystem-local-alloc.h" #include "nm-active-connection-glue.h" -#include "nm-glib-compat.h" /* Base class for anything implementing the Connection.Active D-Bus interface */ G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, G_TYPE_OBJECT) diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index 4db5e6ff56..01568c8fe0 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_ACTIVE_CONNECTION_H__ #define __NETWORKMANAGER_ACTIVE_CONNECTION_H__ -#include +#include "nm-glib.h" #include "nm-types.h" #include "nm-connection.h" diff --git a/src/nm-auth-manager.h b/src/nm-auth-manager.h index cc3b5d3c72..4589651a09 100644 --- a/src/nm-auth-manager.h +++ b/src/nm-auth-manager.h @@ -21,8 +21,8 @@ #ifndef NM_AUTH_MANAGER_H #define NM_AUTH_MANAGER_H -#include +#include "nm-glib.h" #include "nm-auth-subject.h" G_BEGIN_DECLS diff --git a/src/nm-auth-subject.c b/src/nm-auth-subject.c index c67424e788..12dcee044a 100644 --- a/src/nm-auth-subject.c +++ b/src/nm-auth-subject.c @@ -32,11 +32,10 @@ #include #include -#include +#include "nm-glib.h" #include "nm-dbus-manager.h" #include "nm-enum-types.h" -#include "nm-glib-compat.h" #include "NetworkManagerUtils.h" #include "gsystem-local-alloc.h" diff --git a/src/nm-auth-subject.h b/src/nm-auth-subject.h index cc004fa90c..6f4898692d 100644 --- a/src/nm-auth-subject.h +++ b/src/nm-auth-subject.h @@ -22,11 +22,10 @@ #define __NETWORKMANAGER_AUTH_SUBJECT_H__ #include -#include -#include #include #include +#include "nm-glib.h" #include "nm-types.h" #define NM_TYPE_AUTH_SUBJECT (nm_auth_subject_get_type ()) diff --git a/src/nm-auth-utils.c b/src/nm-auth-utils.c index 1e14c7babf..1a56f191a9 100644 --- a/src/nm-auth-utils.c +++ b/src/nm-auth-utils.c @@ -21,8 +21,8 @@ #include "config.h" #include -#include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "nm-setting-connection.h" #include "nm-auth-utils.h" diff --git a/src/nm-auth-utils.h b/src/nm-auth-utils.h index 138c616d97..bf571ac4b0 100644 --- a/src/nm-auth-utils.h +++ b/src/nm-auth-utils.h @@ -21,10 +21,10 @@ #ifndef __NETWORKMANAGER_MANAGER_AUTH_H__ #define __NETWORKMANAGER_MANAGER_AUTH_H__ -#include #include #include +#include "nm-glib.h" #include "nm-types.h" #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network" diff --git a/src/nm-config-data.h b/src/nm-config-data.h index 36aa66af95..052a6b265b 100644 --- a/src/nm-config-data.h +++ b/src/nm-config-data.h @@ -21,9 +21,8 @@ #ifndef NM_CONFIG_DATA_H #define NM_CONFIG_DATA_H -#include -#include +#include "nm-glib.h" #include "nm-types.h" G_BEGIN_DECLS diff --git a/src/nm-config.c b/src/nm-config.c index 3490959a7c..aa0e05a5d8 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -24,10 +24,12 @@ #include #include +#include + +#include "nm-glib.h" #include "nm-config.h" #include "nm-logging.h" #include "nm-utils.h" -#include "nm-glib-compat.h" #include "nm-device.h" #include "NetworkManagerUtils.h" #include "gsystem-local-alloc.h" @@ -35,9 +37,6 @@ #include "nm-core-internal.h" #include "nm-keyfile-internal.h" -#include -#include - #define DEFAULT_CONFIG_MAIN_FILE NMCONFDIR "/NetworkManager.conf" #define DEFAULT_CONFIG_DIR NMCONFDIR "/conf.d" #define DEFAULT_CONFIG_MAIN_FILE_OLD NMCONFDIR "/nm-system-settings.conf" diff --git a/src/nm-config.h b/src/nm-config.h index 870d4e4fe5..2eece45a15 100644 --- a/src/nm-config.h +++ b/src/nm-config.h @@ -22,9 +22,8 @@ #ifndef __NETWORKMANAGER_CONFIG_H__ #define __NETWORKMANAGER_CONFIG_H__ -#include -#include +#include "nm-glib.h" #include "nm-types.h" #include "nm-config-data.h" diff --git a/src/nm-connection-provider.h b/src/nm-connection-provider.h index 8d5f7a696d..31b654f3eb 100644 --- a/src/nm-connection-provider.h +++ b/src/nm-connection-provider.h @@ -16,9 +16,9 @@ #ifndef __NETWORKMANAGER_CONNECTION_PROVIDER_H__ #define __NETWORKMANAGER_CONNECTION_PROVIDER_H__ -#include #include +#include "nm-glib.h" #include "nm-types.h" #define NM_TYPE_CONNECTION_PROVIDER (nm_connection_provider_get_type ()) diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index d3f9f25e75..e8b854cdd6 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -26,8 +26,8 @@ #include #endif -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-connectivity.h" #include "nm-config.h" #include "nm-logging.h" diff --git a/src/nm-connectivity.h b/src/nm-connectivity.h index fc584d5fed..66e943cd48 100644 --- a/src/nm-connectivity.h +++ b/src/nm-connectivity.h @@ -21,10 +21,8 @@ #ifndef __NETWORKMANAGER_CONNECTIVITY_H__ #define __NETWORKMANAGER_CONNECTIVITY_H__ -#include -#include -#include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-types.h" diff --git a/src/nm-dbus-manager.c b/src/nm-dbus-manager.c index 4f3ea07223..0a664b0a12 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-dbus-manager.c @@ -26,9 +26,9 @@ #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-dbus-manager.h" -#include "nm-glib-compat.h" #include "nm-properties-changed-signal.h" #include diff --git a/src/nm-dbus-manager.h b/src/nm-dbus-manager.h index c87ee02455..a0e3121990 100644 --- a/src/nm-dbus-manager.h +++ b/src/nm-dbus-manager.h @@ -23,10 +23,10 @@ #define __NM_DBUS_MANAGER_H__ #include -#include #include #include +#include "nm-glib.h" #include "nm-types.h" G_BEGIN_DECLS diff --git a/src/nm-dcb.c b/src/nm-dcb.c index 8bf3858a3d..b5a1346274 100644 --- a/src/nm-dcb.c +++ b/src/nm-dcb.c @@ -23,7 +23,7 @@ #include #include -#include +#include "nm-glib.h" #include "nm-dcb.h" #include "nm-platform.h" #include "NetworkManagerUtils.h" diff --git a/src/nm-dcb.h b/src/nm-dcb.h index e409dd4832..e12fa18030 100644 --- a/src/nm-dcb.h +++ b/src/nm-dcb.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_DCB_H__ #define __NETWORKMANAGER_DCB_H__ -#include +#include "nm-glib.h" #include "nm-setting-dcb.h" gboolean nm_dcb_enable (const char *iface, gboolean enable, GError **error); diff --git a/src/nm-default-route-manager.h b/src/nm-default-route-manager.h index 7fc27bbd1c..4c1b032859 100644 --- a/src/nm-default-route-manager.h +++ b/src/nm-default-route-manager.h @@ -18,8 +18,8 @@ * Copyright (C) 2014 Red Hat, Inc. */ -#include +#include "nm-glib.h" #include "nm-connection.h" #include "nm-types.h" diff --git a/src/nm-dhcp4-config.c b/src/nm-dhcp4-config.c index 096cf16d99..ae945fdf33 100644 --- a/src/nm-dhcp4-config.c +++ b/src/nm-dhcp4-config.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-dbus-manager.h" #include "nm-dhcp4-config.h" @@ -30,7 +30,6 @@ #include "nm-dbus-glib-types.h" #include "nm-utils.h" - G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, G_TYPE_OBJECT) #define NM_DHCP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP4_CONFIG, NMDhcp4ConfigPrivate)) diff --git a/src/nm-dhcp4-config.h b/src/nm-dhcp4-config.h index 227d44817b..c7f3797e24 100644 --- a/src/nm-dhcp4-config.h +++ b/src/nm-dhcp4-config.h @@ -21,9 +21,8 @@ #ifndef __NETWORKMANAGER_DHCP4_CONFIG_H__ #define __NETWORKMANAGER_DHCP4_CONFIG_H__ -#include -#include +#include "nm-glib.h" #include "nm-types.h" #define NM_TYPE_DHCP4_CONFIG (nm_dhcp4_config_get_type ()) diff --git a/src/nm-dhcp6-config.c b/src/nm-dhcp6-config.c index f93e9644c4..f96807caba 100644 --- a/src/nm-dhcp6-config.c +++ b/src/nm-dhcp6-config.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-dbus-manager.h" #include "nm-dhcp6-config.h" @@ -30,7 +30,6 @@ #include "nm-dbus-glib-types.h" #include "nm-utils.h" - G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, G_TYPE_OBJECT) #define NM_DHCP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP6_CONFIG, NMDhcp6ConfigPrivate)) diff --git a/src/nm-dhcp6-config.h b/src/nm-dhcp6-config.h index eaca61b1ce..53d8b52a4f 100644 --- a/src/nm-dhcp6-config.h +++ b/src/nm-dhcp6-config.h @@ -21,9 +21,8 @@ #ifndef __NETWORKMANAGER_DHCP6_CONFIG_H__ #define __NETWORKMANAGER_DHCP6_CONFIG_H__ -#include -#include +#include "nm-glib.h" #include "nm-types.h" #define NM_TYPE_DHCP6_CONFIG (nm_dhcp6_config_get_type ()) diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index eede0584ee..8adec92970 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -21,11 +21,10 @@ #include "config.h" -#include -#include #include #include +#include "nm-glib.h" #include "nm-dispatcher.h" #include "nm-dispatcher-api.h" #include "NetworkManagerUtils.h" @@ -38,7 +37,6 @@ #include "nm-ip4-config.h" #include "nm-ip6-config.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-settings-connection.h" #include "nm-platform.h" #include "nm-core-internal.h" diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h index e93816b6b7..d4ea329d34 100644 --- a/src/nm-dispatcher.h +++ b/src/nm-dispatcher.h @@ -22,9 +22,9 @@ #ifndef __NETWORKMANAGER_DISPATCHER_H__ #define __NETWORKMANAGER_DISPATCHER_H__ -#include #include +#include "nm-glib.h" #include "nm-types.h" #include "nm-connection.h" diff --git a/src/nm-firewall-manager.c b/src/nm-firewall-manager.c index 9bffac7599..304ee7e932 100644 --- a/src/nm-firewall-manager.c +++ b/src/nm-firewall-manager.c @@ -21,9 +21,8 @@ #include "config.h" #include -#include -#include +#include "nm-glib.h" #include "nm-firewall-manager.h" #include "nm-logging.h" #include "gsystem-local-alloc.h" diff --git a/src/nm-firewall-manager.h b/src/nm-firewall-manager.h index 84cb5498ae..6423cbbb18 100644 --- a/src/nm-firewall-manager.h +++ b/src/nm-firewall-manager.h @@ -21,7 +21,7 @@ #ifndef __NETWORKMANAGER_FIREWALL_MANAGER_H__ #define __NETWORKMANAGER_FIREWALL_MANAGER_H__ -#include +#include "nm-glib.h" #define FIREWALL_DBUS_SERVICE "org.fedoraproject.FirewallD1" #define FIREWALL_DBUS_PATH "/org/fedoraproject/FirewallD1" diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index bec6cc8359..8fd57493ee 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -20,7 +20,6 @@ #include "config.h" -#include #include #include #include @@ -38,6 +37,7 @@ * Forward declare if_nametoindex. */ extern unsigned int if_nametoindex (const char *__ifname); +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "NetworkManagerUtils.h" #include "nm-linux-platform.h" diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index 4415c453ea..753b74cb9d 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -21,8 +21,8 @@ #ifndef __NETWORKMANAGER_IP4_CONFIG_H__ #define __NETWORKMANAGER_IP4_CONFIG_H__ -#include +#include "nm-glib.h" #include "nm-types.h" #include "nm-setting-ip4-config.h" diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index 1cedff5f5d..2122f64f4d 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -24,9 +24,9 @@ #include #include +#include "nm-glib.h" #include "nm-ip6-config.h" -#include "nm-glib-compat.h" #include "nm-utils.h" #include "nm-platform.h" #include "nm-dbus-manager.h" diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h index e8cbc0e5f9..06919026c3 100644 --- a/src/nm-ip6-config.h +++ b/src/nm-ip6-config.h @@ -21,9 +21,9 @@ #ifndef __NETWORKMANAGER_IP6_CONFIG_H__ #define __NETWORKMANAGER_IP6_CONFIG_H__ -#include #include +#include "nm-glib.h" #include "nm-types.h" #include "nm-setting-ip6-config.h" diff --git a/src/nm-logging.c b/src/nm-logging.c index eed89dec06..90598775fa 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -39,7 +39,7 @@ #include #endif -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-logging.h" #include "nm-errors.h" #include "gsystem-local-alloc.h" diff --git a/src/nm-logging.h b/src/nm-logging.h index c34ef4559b..668125927b 100644 --- a/src/nm-logging.h +++ b/src/nm-logging.h @@ -26,9 +26,8 @@ #error nm-test-utils.h must be included as last header #endif -#include -#include +#include "nm-glib.h" #include "nm-macros-internal.h" /* Log domains */ diff --git a/src/nm-manager.c b/src/nm-manager.c index d8072d1d69..9a035c0fd4 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -28,11 +28,10 @@ #include #include #include -#include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" -#include "nm-glib-compat.h" #include "nm-manager.h" #include "nm-logging.h" #include "nm-dbus-manager.h" diff --git a/src/nm-manager.h b/src/nm-manager.h index a8e7d7ad32..665a8dd701 100644 --- a/src/nm-manager.h +++ b/src/nm-manager.h @@ -22,9 +22,8 @@ #ifndef __NETWORKMANAGER_MANAGER_H__ #define __NETWORKMANAGER_MANAGER_H__ -#include -#include +#include "nm-glib.h" #include "nm-types.h" #include "nm-connection.h" diff --git a/src/nm-multi-index.c b/src/nm-multi-index.c index d45f4834fd..8a7e4d1dac 100644 --- a/src/nm-multi-index.c +++ b/src/nm-multi-index.c @@ -20,14 +20,13 @@ #include "config.h" +#include "nm-glib.h" #include "nm-multi-index.h" #include -#include "nm-glib-compat.h" #include "nm-macros-internal.h" - struct NMMultiIndex { NMMultiIndexFuncEqual equal_fcn; NMMultiIndexFuncClone clone_fcn; diff --git a/src/nm-multi-index.h b/src/nm-multi-index.h index e41ef54e7c..3438d1cf60 100644 --- a/src/nm-multi-index.h +++ b/src/nm-multi-index.h @@ -21,7 +21,7 @@ #ifndef __NM_MULTI_INDEX__ #define __NM_MULTI_INDEX__ -#include +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/src/nm-policy.c b/src/nm-policy.c index 69d12d7de0..ef8239aa35 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -26,8 +26,8 @@ #include #include -#include +#include "nm-glib.h" #include "nm-policy.h" #include "NetworkManagerUtils.h" #include "nm-activation-request.h" @@ -45,7 +45,6 @@ #include "nm-dispatcher.h" #include "nm-utils.h" #include "nm-core-internal.h" -#include "nm-glib-compat.h" #include "nm-manager.h" #include "nm-settings.h" #include "nm-settings-connection.h" diff --git a/src/nm-properties-changed-signal.h b/src/nm-properties-changed-signal.h index 97a3b2c024..6f76e8a4ae 100644 --- a/src/nm-properties-changed-signal.h +++ b/src/nm-properties-changed-signal.h @@ -22,7 +22,7 @@ #ifndef _NM_PROPERTIES_CHANGED_SIGNAL_H_ #define _NM_PROPERTIES_CHANGED_SIGNAL_H_ -#include +#include "nm-glib.h" void nm_properties_changed_signal_add_property (GType type, const char *dbus_property_name, diff --git a/src/nm-rfkill-manager.h b/src/nm-rfkill-manager.h index 220f3c2c6f..cea6c7aee1 100644 --- a/src/nm-rfkill-manager.h +++ b/src/nm-rfkill-manager.h @@ -19,8 +19,8 @@ * Copyright (C) 2007 - 2013 Red Hat, Inc. */ -#include +#include "nm-glib.h" #include "nm-types.h" #ifndef __NETWORKMANAGER_RFKILL_MANAGER_H__ diff --git a/src/nm-route-manager.h b/src/nm-route-manager.h index 1e4ce4840f..e72bce735c 100644 --- a/src/nm-route-manager.h +++ b/src/nm-route-manager.h @@ -18,8 +18,8 @@ * Copyright (C) 2015 Red Hat, Inc. */ -#include +#include "nm-glib.h" #include "nm-types.h" #ifndef __NETWORKMANAGER_ROUTE_MANAGER_H__ diff --git a/src/nm-session-monitor.c b/src/nm-session-monitor.c index 84436d08b9..8a12552945 100644 --- a/src/nm-session-monitor.c +++ b/src/nm-session-monitor.c @@ -25,9 +25,8 @@ #include #include #include -#include -#include "nm-glib-compat.h" +#include "nm-glib.h" #include "nm-session-monitor.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" diff --git a/src/nm-session-monitor.h b/src/nm-session-monitor.h index 32f747f231..ef7bd5161f 100644 --- a/src/nm-session-monitor.h +++ b/src/nm-session-monitor.h @@ -21,8 +21,8 @@ #ifndef __NETWORKMANAGER_SESSION_MONITOR_H__ #define __NETWORKMANAGER_SESSION_MONITOR_H__ -#include +#include "nm-glib.h" #include "nm-types.h" G_BEGIN_DECLS diff --git a/src/nm-sleep-monitor-systemd.c b/src/nm-sleep-monitor-systemd.c index 1e3a309758..dab41a7a0b 100644 --- a/src/nm-sleep-monitor-systemd.c +++ b/src/nm-sleep-monitor-systemd.c @@ -23,9 +23,9 @@ #include #include #include -#include #include +#include "nm-glib.h" #include "nm-logging.h" #include "nm-dbus-manager.h" #include "nm-core-internal.h" diff --git a/src/nm-sleep-monitor-upower.c b/src/nm-sleep-monitor-upower.c index a9abb08b02..e3599a2fc5 100644 --- a/src/nm-sleep-monitor-upower.c +++ b/src/nm-sleep-monitor-upower.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include "nm-glib.h" #include "nm-logging.h" #include "nm-core-internal.h" diff --git a/src/nm-sleep-monitor.h b/src/nm-sleep-monitor.h index 84623771a9..3f13d3256f 100644 --- a/src/nm-sleep-monitor.h +++ b/src/nm-sleep-monitor.h @@ -20,8 +20,8 @@ #ifndef __NETWORKMANAGER_SLEEP_MONITOR_H__ #define __NETWORKMANAGER_SLEEP_MONITOR_H__ -#include +#include "nm-glib.h" #include "nm-types.h" G_BEGIN_DECLS diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 16eb351fa1..448101da4c 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -21,13 +21,12 @@ #ifndef __NETWORKMANAGER_PLATFORM_H__ #define __NETWORKMANAGER_PLATFORM_H__ -#include -#include "nm-glib-compat.h" #include #include #include #include +#include "nm-glib.h" #include "nm-types.h" #include "NetworkManagerUtils.h" diff --git a/src/platform/tests/monitor.c b/src/platform/tests/monitor.c index a989e63e14..933e124ffd 100644 --- a/src/platform/tests/monitor.c +++ b/src/platform/tests/monitor.c @@ -3,10 +3,10 @@ #include #include +#include "nm-glib.h" #include "nm-fake-platform.h" #include "nm-linux-platform.h" #include "nm-logging.h" -#include "nm-glib-compat.h" int main (int argc, char **argv) diff --git a/src/platform/wifi/wifi-utils-nl80211.c b/src/platform/wifi/wifi-utils-nl80211.c index 2a52de5c15..e427f3368a 100644 --- a/src/platform/wifi/wifi-utils-nl80211.c +++ b/src/platform/wifi/wifi-utils-nl80211.c @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -37,6 +36,7 @@ #include +#include "nm-glib.h" #include "wifi-utils-private.h" #include "wifi-utils-nl80211.h" #include "nm-platform.h" diff --git a/src/platform/wifi/wifi-utils-private.h b/src/platform/wifi/wifi-utils-private.h index c334a82845..9e5b206891 100644 --- a/src/platform/wifi/wifi-utils-private.h +++ b/src/platform/wifi/wifi-utils-private.h @@ -21,8 +21,8 @@ #ifndef __WIFI_UTILS_PRIVATE_H__ #define __WIFI_UTILS_PRIVATE_H__ -#include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "wifi-utils.h" diff --git a/src/platform/wifi/wifi-utils-wext.c b/src/platform/wifi/wifi-utils-wext.c index e58b72bc4e..52d1e49b1c 100644 --- a/src/platform/wifi/wifi-utils-wext.c +++ b/src/platform/wifi/wifi-utils-wext.c @@ -28,8 +28,8 @@ #include #include -#include +#include "nm-glib.h" #include "wifi-utils-private.h" #include "wifi-utils-wext.h" #include "nm-logging.h" @@ -44,7 +44,6 @@ #include #include - typedef struct { WifiData parent; int fd; diff --git a/src/platform/wifi/wifi-utils.c b/src/platform/wifi/wifi-utils.c index 69c8cbc952..eab99bf860 100644 --- a/src/platform/wifi/wifi-utils.c +++ b/src/platform/wifi/wifi-utils.c @@ -24,8 +24,8 @@ #include #include #include -#include +#include "nm-glib.h" #include "wifi-utils.h" #include "wifi-utils-private.h" #include "wifi-utils-nl80211.h" diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h index a2830dcd77..a5c9feaf49 100644 --- a/src/platform/wifi/wifi-utils.h +++ b/src/platform/wifi/wifi-utils.h @@ -23,8 +23,8 @@ #define __WIFI_UTILS_H__ #include -#include +#include "nm-glib.h" #include "nm-dbus-interface.h" typedef struct WifiData WifiData; diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 48c9ff23de..6e1e5c2a2a 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -42,8 +42,8 @@ #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" -#include "nm-glib-compat.h" #include "nm-ppp-manager.h" #include "nm-dbus-manager.h" #include "nm-logging.h" diff --git a/src/ppp-manager/nm-ppp-manager.h b/src/ppp-manager/nm-ppp-manager.h index f8cbda1365..9528721532 100644 --- a/src/ppp-manager/nm-ppp-manager.h +++ b/src/ppp-manager/nm-ppp-manager.h @@ -22,10 +22,8 @@ #ifndef __NETWORKMANAGER_PPP_MANAGER_H__ #define __NETWORKMANAGER_PPP_MANAGER_H__ -#include -#include -#include +#include "nm-glib.h" #include "nm-ppp-status.h" #include "nm-activation-request.h" #include "nm-connection.h" diff --git a/src/ppp-manager/nm-pppd-plugin.c b/src/ppp-manager/nm-pppd-plugin.c index 0a3bcca8d3..9b07519b01 100644 --- a/src/ppp-manager/nm-pppd-plugin.c +++ b/src/ppp-manager/nm-pppd-plugin.c @@ -29,16 +29,15 @@ #include #include #include -#include #define INET6 #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-pppd-plugin.h" #include "nm-ppp-status.h" -#include "nm-glib-compat.h" int plugin_init (void); diff --git a/src/rdisc/nm-rdisc.h b/src/rdisc/nm-rdisc.h index 463e19121b..4c83fb4e36 100644 --- a/src/rdisc/nm-rdisc.h +++ b/src/rdisc/nm-rdisc.h @@ -21,11 +21,11 @@ #ifndef __NETWORKMANAGER_RDISC_H__ #define __NETWORKMANAGER_RDISC_H__ -#include #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #define NM_TYPE_RDISC (nm_rdisc_get_type ()) diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 99602d9483..7da9ee5f43 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -23,10 +23,10 @@ #include #include -#include #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-logging.h" #include "nm-agent-manager.h" diff --git a/src/settings/nm-agent-manager.h b/src/settings/nm-agent-manager.h index ac29df2291..ab010edb71 100644 --- a/src/settings/nm-agent-manager.h +++ b/src/settings/nm-agent-manager.h @@ -21,9 +21,8 @@ #ifndef __NETWORKMANAGER_AGENT_MANAGER_H__ #define __NETWORKMANAGER_AGENT_MANAGER_H__ -#include -#include #include +#include "nm-glib.h" #include "nm-secret-agent.h" #include "nm-types.h" diff --git a/src/settings/nm-inotify-helper.c b/src/settings/nm-inotify-helper.c index 2d0210aee4..2c4fe9e6d8 100644 --- a/src/settings/nm-inotify-helper.c +++ b/src/settings/nm-inotify-helper.c @@ -23,9 +23,9 @@ #include #include #include -#include #include +#include "nm-glib.h" #include "nm-inotify-helper.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" diff --git a/src/settings/nm-inotify-helper.h b/src/settings/nm-inotify-helper.h index 31e6b9ff81..1dd73a5aca 100644 --- a/src/settings/nm-inotify-helper.h +++ b/src/settings/nm-inotify-helper.h @@ -21,10 +21,10 @@ #ifndef __INOTIFY_HELPER_H__ #define __INOTIFY_HELPER_H__ -#include -#include #include +#include "nm-glib.h" + /* NOTE: this code should be killed once we depend on a new enough glib to * include the patches from https://bugzilla.gnome.org/show_bug.cgi?id=532815 */ diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index 69a5cea226..be21f16a77 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -23,15 +23,14 @@ #include #include -#include #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-secret-agent.h" #include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" -#include "nm-glib-compat.h" #include "nm-logging.h" #include "nm-auth-subject.h" #include "nm-simple-connection.h" diff --git a/src/settings/nm-secret-agent.h b/src/settings/nm-secret-agent.h index f3f4ff89c5..ed49f93572 100644 --- a/src/settings/nm-secret-agent.h +++ b/src/settings/nm-secret-agent.h @@ -21,10 +21,9 @@ #ifndef __NETWORKMANAGER_SECRET_AGENT_H__ #define __NETWORKMANAGER_SECRET_AGENT_H__ -#include -#include #include +#include "nm-glib.h" #include "nm-types.h" #define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ()) diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index c25dfac01a..24e9395963 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -26,6 +26,7 @@ #include #include +#include "nm-glib.h" #include "nm-settings-connection.h" #include "nm-session-monitor.h" #include "nm-dbus-manager.h" @@ -37,7 +38,6 @@ #include "NetworkManagerUtils.h" #include "nm-properties-changed-signal.h" #include "nm-core-internal.h" -#include "nm-glib-compat.h" #include "gsystem-local-alloc.h" #define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps" diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h index d196efe655..2c163cb73d 100644 --- a/src/settings/nm-settings.h +++ b/src/settings/nm-settings.h @@ -28,6 +28,7 @@ #include +#include "nm-glib.h" #include "nm-types.h" #define NM_TYPE_SETTINGS (nm_settings_get_type ()) diff --git a/src/settings/nm-system-config-interface.h b/src/settings/nm-system-config-interface.h index bc158d78b8..1dce93189e 100644 --- a/src/settings/nm-system-config-interface.h +++ b/src/settings/nm-system-config-interface.h @@ -22,9 +22,9 @@ #ifndef __NETWORKMANAGER_SYSTEM_CONFIG_INTERFACE_H__ #define __NETWORKMANAGER_SYSTEM_CONFIG_INTERFACE_H__ -#include -#include + #include +#include "nm-glib.h" #include "nm-types.h" G_BEGIN_DECLS diff --git a/src/settings/plugins/ibft/plugin.c b/src/settings/plugins/ibft/plugin.c index 954929a6db..2c3504f309 100644 --- a/src/settings/plugins/ibft/plugin.c +++ b/src/settings/plugins/ibft/plugin.c @@ -25,12 +25,11 @@ #include #include -#include #include -#include #include +#include "nm-glib.h" #include "nm-dbus-glib-types.h" #include "nm-system-config-interface.h" #include "nm-logging.h" diff --git a/src/settings/plugins/ibft/plugin.h b/src/settings/plugins/ibft/plugin.h index 2c811359e4..f9426fcb04 100644 --- a/src/settings/plugins/ibft/plugin.h +++ b/src/settings/plugins/ibft/plugin.h @@ -21,7 +21,7 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include +#include "nm-glib.h" #define SC_TYPE_PLUGIN_IBFT (sc_plugin_ibft_get_type ()) #define SC_PLUGIN_IBFT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IBFT, SCPluginIbft)) diff --git a/src/settings/plugins/ibft/reader.c b/src/settings/plugins/ibft/reader.c index 9bc6346278..45006f7f1a 100644 --- a/src/settings/plugins/ibft/reader.c +++ b/src/settings/plugins/ibft/reader.c @@ -31,9 +31,9 @@ #include #include -#include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include "nm-platform.h" #include "NetworkManagerUtils.h" diff --git a/src/settings/plugins/ibft/reader.h b/src/settings/plugins/ibft/reader.h index 0b2f22b659..bea32e2497 100644 --- a/src/settings/plugins/ibft/reader.h +++ b/src/settings/plugins/ibft/reader.h @@ -21,9 +21,10 @@ #ifndef __READER_H__ #define __READER_H__ -#include #include +#include "nm-glib.h" + gboolean read_ibft_blocks (const char *iscsiadm_path, GSList **out_blocks, GError **error); diff --git a/src/settings/plugins/ifcfg-rh/common.h b/src/settings/plugins/ifcfg-rh/common.h index 0ec355ee4e..168177ff9a 100644 --- a/src/settings/plugins/ifcfg-rh/common.h +++ b/src/settings/plugins/ifcfg-rh/common.h @@ -21,7 +21,7 @@ #ifndef __COMMON_H__ #define __COMMON_H__ -#include +#include "nm-glib.h" #define IFCFG_TAG "ifcfg-" #define KEYS_TAG "keys-" diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index d33b41cd0c..cef69c13b2 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -30,9 +30,7 @@ #include #include -#include #include -#include #include #include @@ -44,6 +42,7 @@ #include +#include "nm-glib.h" #include "common.h" #include "nm-dbus-glib-types.h" #include "plugin.h" diff --git a/src/settings/plugins/ifcfg-rh/plugin.h b/src/settings/plugins/ifcfg-rh/plugin.h index d37decfd6f..2f757edff0 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.h +++ b/src/settings/plugins/ifcfg-rh/plugin.h @@ -24,7 +24,7 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include +#include "nm-glib.h" #define SC_TYPE_PLUGIN_IFCFG (sc_plugin_ifcfg_get_type ()) #define SC_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IFCFG, SCPluginIfcfg)) diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index ee407ea126..69f08ebffd 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -31,7 +31,6 @@ #include #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include diff --git a/src/settings/plugins/ifcfg-rh/reader.h b/src/settings/plugins/ifcfg-rh/reader.h index 2096ffc40e..a9f830f119 100644 --- a/src/settings/plugins/ifcfg-rh/reader.h +++ b/src/settings/plugins/ifcfg-rh/reader.h @@ -21,9 +21,9 @@ #ifndef __READER_H__ #define __READER_H__ -#include #include +#include "nm-glib.h" #include "shvar.h" NMConnection *connection_from_file (const char *filename, diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h index de7a358556..1778206577 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.h +++ b/src/settings/plugins/ifcfg-rh/shvar.h @@ -31,7 +31,7 @@ #ifndef _SHVAR_H #define _SHVAR_H -#include +#include "nm-glib.h" G_BEGIN_DECLS diff --git a/src/settings/plugins/ifcfg-rh/utils.c b/src/settings/plugins/ifcfg-rh/utils.c index a793288d91..4d38c9b1c0 100644 --- a/src/settings/plugins/ifcfg-rh/utils.c +++ b/src/settings/plugins/ifcfg-rh/utils.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include "nm-macros-internal.h" #include "NetworkManagerUtils.h" diff --git a/src/settings/plugins/ifcfg-rh/utils.h b/src/settings/plugins/ifcfg-rh/utils.h index 547bfcb2d7..d8b4784cea 100644 --- a/src/settings/plugins/ifcfg-rh/utils.h +++ b/src/settings/plugins/ifcfg-rh/utils.h @@ -21,8 +21,8 @@ #ifndef _UTILS_H_ #define _UTILS_H_ -#include #include +#include "nm-glib.h" #include "shvar.h" #include "common.h" #include "nm-logging.h" diff --git a/src/settings/plugins/ifcfg-rh/writer.h b/src/settings/plugins/ifcfg-rh/writer.h index 894313dd06..2c7168d330 100644 --- a/src/settings/plugins/ifcfg-rh/writer.h +++ b/src/settings/plugins/ifcfg-rh/writer.h @@ -22,9 +22,11 @@ #define _WRITER_H_ #include -#include + #include +#include "nm-glib.h" + gboolean writer_can_write_connection (NMConnection *connection, GError **error); diff --git a/src/settings/plugins/ifnet/net_parser.h b/src/settings/plugins/ifnet/net_parser.h index d10979cca6..c6966248ea 100644 --- a/src/settings/plugins/ifnet/net_parser.h +++ b/src/settings/plugins/ifnet/net_parser.h @@ -22,7 +22,7 @@ #ifndef _NET_PARSER_H #define _NET_PARSER_H -#include +#include "nm-glib.h" #define CONF_NET_FILE SYSCONFDIR "/conf.d/net" diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c index 81d73807ab..332fdf5152 100644 --- a/src/settings/plugins/ifnet/net_utils.c +++ b/src/settings/plugins/ifnet/net_utils.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include "nm-glib.h" #include "net_utils.h" #include "wpa_parser.h" #include "net_parser.h" diff --git a/src/settings/plugins/ifnet/net_utils.h b/src/settings/plugins/ifnet/net_utils.h index 096f846afe..bcb265dbd4 100644 --- a/src/settings/plugins/ifnet/net_utils.h +++ b/src/settings/plugins/ifnet/net_utils.h @@ -22,10 +22,10 @@ #ifndef _IFNET_UTILS_H #define _IFNET_UTILS_H #define IFNET_PLUGIN_NAME "SCPlugin-Ifnet" -#include #include #include #include +#include "nm-glib.h" #include "net_parser.h" #define has_default_ip4_route(conn_name) has_default_route((conn_name), &is_ip4_address) #define has_default_ip6_route(conn_name) has_default_route((conn_name), &is_ip6_address) diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c index 550f31a5fc..b82a9d07cb 100644 --- a/src/settings/plugins/ifnet/plugin.c +++ b/src/settings/plugins/ifnet/plugin.c @@ -25,12 +25,11 @@ #include #include -#include -#include #include #include +#include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-system-config-interface.h" #include "nm-logging.h" diff --git a/src/settings/plugins/ifnet/plugin.h b/src/settings/plugins/ifnet/plugin.h index 6ac0f482f1..89e0fa3b86 100644 --- a/src/settings/plugins/ifnet/plugin.h +++ b/src/settings/plugins/ifnet/plugin.h @@ -23,7 +23,7 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include +#include "nm-glib.h" #define SC_TYPE_PLUGIN_IFNET (sc_plugin_ifnet_get_type ()) #define SC_PLUGIN_IFNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IFNET, SCPluginIfnet)) diff --git a/src/settings/plugins/ifnet/tests/test-ifnet.c b/src/settings/plugins/ifnet/tests/test-ifnet.c index 72d7e27840..18876e62c6 100644 --- a/src/settings/plugins/ifnet/tests/test-ifnet.c +++ b/src/settings/plugins/ifnet/tests/test-ifnet.c @@ -24,12 +24,12 @@ #include #include -#include #include #include #include #include +#include "nm-glib.h" #include "nm-linux-platform.h" #include "nm-logging.h" diff --git a/src/settings/plugins/ifnet/wpa_parser.h b/src/settings/plugins/ifnet/wpa_parser.h index 3a0d377e5c..9f2cf6054d 100644 --- a/src/settings/plugins/ifnet/wpa_parser.h +++ b/src/settings/plugins/ifnet/wpa_parser.h @@ -22,7 +22,7 @@ #ifndef _WPA_PARSER_H #define _WPA_PARSER_H -#include +#include "nm-glib.h" #define WPA_SUPPLICANT_CONF SYSCONFDIR "/wpa_supplicant/wpa_supplicant.conf" diff --git a/src/settings/plugins/ifupdown/interface_parser.h b/src/settings/plugins/ifupdown/interface_parser.h index e68abcf641..0b6c8c9f21 100644 --- a/src/settings/plugins/ifupdown/interface_parser.h +++ b/src/settings/plugins/ifupdown/interface_parser.h @@ -24,7 +24,7 @@ #ifndef _INTERFACE_PARSER_H #define _INTERFACE_PARSER_H -#include +#include "nm-glib.h" typedef struct _if_data { diff --git a/src/settings/plugins/ifupdown/nm-ifupdown-connection.h b/src/settings/plugins/ifupdown/nm-ifupdown-connection.h index be2ebc0a3e..bc2df73123 100644 --- a/src/settings/plugins/ifupdown/nm-ifupdown-connection.h +++ b/src/settings/plugins/ifupdown/nm-ifupdown-connection.h @@ -25,6 +25,7 @@ #define __NETWORKMANAGER_IFUPDOWN_CONNECTION_H__ #include +#include "nm-glib.h" #include "interface_parser.h" G_BEGIN_DECLS diff --git a/src/settings/plugins/ifupdown/plugin.c b/src/settings/plugins/ifupdown/plugin.c index d67405b037..f2a700c190 100644 --- a/src/settings/plugins/ifupdown/plugin.c +++ b/src/settings/plugins/ifupdown/plugin.c @@ -27,11 +27,10 @@ #include #include -#include #include -#include #include +#include "nm-glib.h" #include "interface_parser.h" #include "nm-dbus-interface.h" diff --git a/src/settings/plugins/ifupdown/plugin.h b/src/settings/plugins/ifupdown/plugin.h index 943b8b9f6e..a9aa56f45a 100644 --- a/src/settings/plugins/ifupdown/plugin.h +++ b/src/settings/plugins/ifupdown/plugin.h @@ -24,7 +24,7 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include +#include "nm-glib.h" #define PLUGIN_NAME "ifupdown" diff --git a/src/settings/plugins/ifupdown/tests/test-ifupdown.c b/src/settings/plugins/ifupdown/tests/test-ifupdown.c index d285a464d7..edadd283e3 100644 --- a/src/settings/plugins/ifupdown/tests/test-ifupdown.c +++ b/src/settings/plugins/ifupdown/tests/test-ifupdown.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include "nm-logging.h" #include "interface_parser.h" diff --git a/src/settings/plugins/keyfile/common.h b/src/settings/plugins/keyfile/common.h index 86fe002855..871a745923 100644 --- a/src/settings/plugins/keyfile/common.h +++ b/src/settings/plugins/keyfile/common.h @@ -21,7 +21,7 @@ #ifndef __COMMON_H__ #define __COMMON_H__ -#include +#include "nm-glib.h" #define KEYFILE_PLUGIN_NAME "keyfile" #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2015 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c index 71f407dd57..f34dc9fb3f 100644 --- a/src/settings/plugins/keyfile/plugin.c +++ b/src/settings/plugins/keyfile/plugin.c @@ -27,9 +27,7 @@ #include #include -#include #include -#include #include #include @@ -37,6 +35,7 @@ #include #include #include +#include "nm-glib.h" #include "nm-core-internal.h" #include "plugin.h" diff --git a/src/settings/plugins/keyfile/plugin.h b/src/settings/plugins/keyfile/plugin.h index 48579785d8..4d77a92596 100644 --- a/src/settings/plugins/keyfile/plugin.h +++ b/src/settings/plugins/keyfile/plugin.h @@ -22,7 +22,7 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include +#include "nm-glib.h" #define SC_TYPE_PLUGIN_KEYFILE (sc_plugin_keyfile_get_type ()) #define SC_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_KEYFILE, SCPluginKeyfile)) diff --git a/src/settings/plugins/keyfile/reader.h b/src/settings/plugins/keyfile/reader.h index 55819630eb..44bf55cb2d 100644 --- a/src/settings/plugins/keyfile/reader.h +++ b/src/settings/plugins/keyfile/reader.h @@ -22,9 +22,10 @@ #ifndef _KEYFILE_PLUGIN_READER_H #define _KEYFILE_PLUGIN_READER_H -#include #include +#include "nm-glib.h" + NMConnection *nm_keyfile_plugin_connection_from_file (const char *filename, GError **error); #endif /* _KEYFILE_PLUGIN_READER_H */ diff --git a/src/settings/plugins/keyfile/utils.c b/src/settings/plugins/keyfile/utils.c index 4809c642c0..1685e22b53 100644 --- a/src/settings/plugins/keyfile/utils.c +++ b/src/settings/plugins/keyfile/utils.c @@ -20,16 +20,15 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "gsystem-local-alloc.h" #include "utils.h" #include #include #include - static const char temp_letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; diff --git a/src/settings/plugins/keyfile/utils.h b/src/settings/plugins/keyfile/utils.h index d0862284cd..a4c136500b 100644 --- a/src/settings/plugins/keyfile/utils.h +++ b/src/settings/plugins/keyfile/utils.h @@ -21,7 +21,7 @@ #ifndef _UTILS_H_ #define _UTILS_H_ -#include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #define NM_KEYFILE_CONNECTION_LOG_PATH(path) str_if_set (path,"in-memory") diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index e6ee7f97cc..d5c087d2f7 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.c @@ -27,8 +27,7 @@ #include #include -#include "nm-glib-compat.h" - +#include "nm-glib.h" #include "nm-logging.h" #include "writer.h" #include "common.h" @@ -36,7 +35,6 @@ #include "nm-keyfile-internal.h" #include "gsystem-local-alloc.h" - typedef struct { const char *keyfile_dir; } WriteInfo; diff --git a/src/settings/plugins/keyfile/writer.h b/src/settings/plugins/keyfile/writer.h index 95885106df..e7bb346c20 100644 --- a/src/settings/plugins/keyfile/writer.h +++ b/src/settings/plugins/keyfile/writer.h @@ -22,9 +22,10 @@ #ifndef _KEYFILE_PLUGIN_WRITER_H #define _KEYFILE_PLUGIN_WRITER_H -#include #include +#include "nm-glib.h" + gboolean nm_keyfile_plugin_write_connection (NMConnection *connection, const char *existing_path, gboolean force_rename, diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index b78a24d031..62fc8e0a43 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -23,9 +23,9 @@ #include #include -#include #include +#include "nm-glib.h" #include "nm-supplicant-config.h" #include "nm-supplicant-settings-verify.h" #include "nm-logging.h" diff --git a/src/supplicant-manager/nm-supplicant-config.h b/src/supplicant-manager/nm-supplicant-config.h index 3324f637f4..5b5356cd48 100644 --- a/src/supplicant-manager/nm-supplicant-config.h +++ b/src/supplicant-manager/nm-supplicant-config.h @@ -22,10 +22,10 @@ #ifndef __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ #define __NETWORKMANAGER_SUPPLICANT_CONFIG_H__ -#include #include #include #include +#include "nm-glib.h" #include "nm-supplicant-types.h" G_BEGIN_DECLS diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index d2361f51e6..50daabebf2 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -23,13 +23,12 @@ #include #include -#include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-supplicant-interface.h" #include "nm-logging.h" #include "nm-supplicant-config.h" -#include "nm-glib-compat.h" #include "gsystem-local-alloc.h" #include "nm-core-internal.h" #include "nm-dbus-compat.h" diff --git a/src/supplicant-manager/nm-supplicant-interface.h b/src/supplicant-manager/nm-supplicant-interface.h index 6be89f4222..9d930f2f8b 100644 --- a/src/supplicant-manager/nm-supplicant-interface.h +++ b/src/supplicant-manager/nm-supplicant-interface.h @@ -22,7 +22,7 @@ #ifndef __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ #define __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ -#include +#include "nm-glib.h" #include "nm-supplicant-types.h" /* @@ -120,7 +120,6 @@ typedef struct { const char *message); } NMSupplicantInterfaceClass; - GType nm_supplicant_interface_get_type (void); NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname, diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c index 083f2ebcb7..fff5c079ee 100644 --- a/src/supplicant-manager/nm-supplicant-manager.c +++ b/src/supplicant-manager/nm-supplicant-manager.c @@ -22,11 +22,9 @@ #include "config.h" #include -#include #include -#include "nm-glib-compat.h" - +#include "nm-glib.h" #include "nm-supplicant-manager.h" #include "nm-supplicant-interface.h" #include "nm-logging.h" diff --git a/src/supplicant-manager/nm-supplicant-manager.h b/src/supplicant-manager/nm-supplicant-manager.h index 3b8fddf4e6..0378a4e0e8 100644 --- a/src/supplicant-manager/nm-supplicant-manager.h +++ b/src/supplicant-manager/nm-supplicant-manager.h @@ -22,7 +22,7 @@ #ifndef __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ #define __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ -#include +#include "nm-glib.h" #include "nm-supplicant-types.h" #include "nm-device.h" diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.c b/src/supplicant-manager/nm-supplicant-settings-verify.c index 1328fd5113..1114befedc 100644 --- a/src/supplicant-manager/nm-supplicant-settings-verify.c +++ b/src/supplicant-manager/nm-supplicant-settings-verify.c @@ -20,12 +20,12 @@ #include "config.h" -#include #include #include #include #include +#include "nm-glib.h" #include "nm-supplicant-settings-verify.h" struct Opt { diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index f9aff5d97b..39043ec50f 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -22,9 +22,9 @@ #include -#include #include +#include "nm-glib.h" #include "nm-test-device.h" #include "nm-fake-platform.h" #include "nm-logging.h" diff --git a/src/tests/test-dcb.c b/src/tests/test-dcb.c index 2fef34ba09..b6ca0b76ad 100644 --- a/src/tests/test-dcb.c +++ b/src/tests/test-dcb.c @@ -20,9 +20,9 @@ #include "config.h" -#include #include +#include "nm-glib.h" #include "nm-dcb.h" #include "nm-logging.h" diff --git a/src/tests/test-general-with-expect.c b/src/tests/test-general-with-expect.c index f671c15deb..e652abe342 100644 --- a/src/tests/test-general-with-expect.c +++ b/src/tests/test-general-with-expect.c @@ -20,13 +20,13 @@ #include "config.h" -#include #include #include #include #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" #include "nm-multi-index.h" diff --git a/src/tests/test-general.c b/src/tests/test-general.c index eda7a1f892..129802db75 100644 --- a/src/tests/test-general.c +++ b/src/tests/test-general.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-logging.h" #include "nm-core-internal.h" diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c index 81295fa3eb..0bf050663b 100644 --- a/src/tests/test-ip4-config.c +++ b/src/tests/test-ip4-config.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-ip4-config.h" #include "nm-platform.h" #include "nm-logging.h" diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c index 421fa37599..1bac506827 100644 --- a/src/tests/test-ip6-config.c +++ b/src/tests/test-ip6-config.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "nm-ip6-config.h" #include "nm-logging.h" diff --git a/src/tests/test-resolvconf-capture.c b/src/tests/test-resolvconf-capture.c index 313c23f4d7..f8d3e9d450 100644 --- a/src/tests/test-resolvconf-capture.c +++ b/src/tests/test-resolvconf-capture.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" diff --git a/src/tests/test-route-manager.c b/src/tests/test-route-manager.c index 9b66c2dd38..6b31fe1959 100644 --- a/src/tests/test-route-manager.c +++ b/src/tests/test-route-manager.c @@ -20,10 +20,10 @@ #include "config.h" -#include #include #include +#include "nm-glib.h" #include "test-common.h" #include "nm-platform.h" diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c index 7e626ec585..da693c9a3a 100644 --- a/src/tests/test-wired-defname.c +++ b/src/tests/test-wired-defname.c @@ -20,11 +20,10 @@ #include "config.h" -#include -#include #include #include +#include "nm-glib.h" #include "nm-device-ethernet-utils.h" #include "nm-logging.h" diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index 8749e3573b..e6a2ca94dc 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include #include @@ -29,6 +28,7 @@ #include #include +#include "nm-glib.h" #include "nm-vpn-connection.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" @@ -38,7 +38,6 @@ #include "nm-active-connection.h" #include "nm-dbus-glib-types.h" #include "NetworkManagerUtils.h" -#include "nm-glib-compat.h" #include "settings/nm-settings-connection.h" #include "nm-dispatcher.h" #include "nm-agent-manager.h" diff --git a/src/vpn-manager/nm-vpn-connection.h b/src/vpn-manager/nm-vpn-connection.h index 0e63caac3f..a6dc62d3e0 100644 --- a/src/vpn-manager/nm-vpn-connection.h +++ b/src/vpn-manager/nm-vpn-connection.h @@ -22,8 +22,6 @@ #ifndef __NETWORKMANAGER_VPN_CONNECTION_H__ #define __NETWORKMANAGER_VPN_CONNECTION_H__ -#include -#include #include "nm-vpn-dbus-interface.h" #include "nm-device.h" #include "nm-auth-subject.h" diff --git a/src/vpn-manager/nm-vpn-manager.c b/src/vpn-manager/nm-vpn-manager.c index 1de9b753f3..d3f959c54e 100644 --- a/src/vpn-manager/nm-vpn-manager.c +++ b/src/vpn-manager/nm-vpn-manager.c @@ -22,8 +22,8 @@ #include "config.h" #include -#include +#include "nm-glib.h" #include "nm-vpn-manager.h" #include "nm-vpn-service.h" #include "nm-vpn-connection.h" diff --git a/src/vpn-manager/nm-vpn-manager.h b/src/vpn-manager/nm-vpn-manager.h index b75a617955..c7fe2b1f80 100644 --- a/src/vpn-manager/nm-vpn-manager.h +++ b/src/vpn-manager/nm-vpn-manager.h @@ -22,8 +22,7 @@ #ifndef __NETWORKMANAGER_VPN_MANAGER_H__ #define __NETWORKMANAGER_VPN_MANAGER_H__ -#include -#include +#include "nm-glib.h" #include "nm-vpn-connection.h" #define NM_TYPE_VPN_MANAGER (nm_vpn_manager_get_type ()) diff --git a/src/vpn-manager/nm-vpn-service.c b/src/vpn-manager/nm-vpn-service.c index 77220dd2ea..3eb0e2e398 100644 --- a/src/vpn-manager/nm-vpn-service.c +++ b/src/vpn-manager/nm-vpn-service.c @@ -21,18 +21,17 @@ #include "config.h" -#include #include #include #include #include #include +#include "nm-glib.h" #include "nm-vpn-service.h" #include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-vpn-manager.h" -#include "nm-glib-compat.h" G_DEFINE_TYPE (NMVpnService, nm_vpn_service, G_TYPE_OBJECT) diff --git a/src/vpn-manager/nm-vpn-service.h b/src/vpn-manager/nm-vpn-service.h index cafa6904af..6e935950e2 100644 --- a/src/vpn-manager/nm-vpn-service.h +++ b/src/vpn-manager/nm-vpn-service.h @@ -22,8 +22,7 @@ #ifndef __NETWORKMANAGER_VPN_SERVICE_H__ #define __NETWORKMANAGER_VPN_SERVICE_H__ -#include -#include +#include "nm-glib.h" #include "nm-device.h" #include "nm-vpn-connection.h" From ee707ba95aa9281c9ca752d56a59fa104b23d2f4 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 7 Jul 2015 10:29:45 -0400 Subject: [PATCH 05/13] libnm-glib: drop private bus support Anything that actually *needs* private bus support will be built against libnm these days anyway. --- libnm-glib/nm-client.c | 60 ++++++++----------- libnm-glib/nm-dbus-helpers-private.h | 2 - libnm-glib/nm-dbus-helpers.c | 53 ----------------- libnm-glib/nm-object-private.h | 2 - libnm-glib/nm-object.c | 50 ++++++---------- libnm-glib/nm-remote-settings.c | 87 ++++++++++++---------------- libnm-glib/nm-secret-agent.c | 50 +++++++--------- 7 files changed, 100 insertions(+), 204 deletions(-) diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 0322449a44..e47a2751b1 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -1798,23 +1798,19 @@ constructed (GObject *object) object, NULL); - if (_nm_object_is_connection_private (NM_OBJECT (object))) - priv->manager_running = TRUE; - else { - priv->bus_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)), - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - g_assert (priv->bus_proxy); + priv->bus_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)), + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + g_assert (priv->bus_proxy); - dbus_g_proxy_add_signal (priv->bus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->bus_proxy, - "NameOwnerChanged", - G_CALLBACK (proxy_name_owner_changed), - object, NULL); - } + dbus_g_proxy_add_signal (priv->bus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (priv->bus_proxy, + "NameOwnerChanged", + G_CALLBACK (proxy_name_owner_changed), + object, NULL); g_signal_connect (object, "notify::" NM_CLIENT_WIRELESS_ENABLED, G_CALLBACK (wireless_enabled_cb), NULL); @@ -1835,15 +1831,13 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) if (!nm_client_parent_initable_iface->init (initable, cancellable, error)) return FALSE; - if (!_nm_object_is_connection_private (NM_OBJECT (client))) { - if (!dbus_g_proxy_call (priv->bus_proxy, - "NameHasOwner", error, - G_TYPE_STRING, NM_DBUS_SERVICE, - G_TYPE_INVALID, - G_TYPE_BOOLEAN, &priv->manager_running, - G_TYPE_INVALID)) - return FALSE; - } + if (!dbus_g_proxy_call (priv->bus_proxy, + "NameHasOwner", error, + G_TYPE_STRING, NM_DBUS_SERVICE, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &priv->manager_running, + G_TYPE_INVALID)) + return FALSE; if (priv->manager_running && !get_permissions_sync (client, error)) return FALSE; @@ -1953,16 +1947,12 @@ init_async (GAsyncInitable *initable, int io_priority, user_data, init_async); g_simple_async_result_set_op_res_gboolean (init_data->result, TRUE); - if (_nm_object_is_connection_private (NM_OBJECT (init_data->client))) - finish_init (init_data); - else { - /* Check if NM is running */ - dbus_g_proxy_begin_call (priv->bus_proxy, "NameHasOwner", - init_async_got_manager_running, - init_data, NULL, - G_TYPE_STRING, NM_DBUS_SERVICE, - G_TYPE_INVALID); - } + /* Check if NM is running */ + dbus_g_proxy_begin_call (priv->bus_proxy, "NameHasOwner", + init_async_got_manager_running, + init_data, NULL, + G_TYPE_STRING, NM_DBUS_SERVICE, + G_TYPE_INVALID); } static gboolean diff --git a/libnm-glib/nm-dbus-helpers-private.h b/libnm-glib/nm-dbus-helpers-private.h index 417faf3bd4..b2c992b6e7 100644 --- a/libnm-glib/nm-dbus-helpers-private.h +++ b/libnm-glib/nm-dbus-helpers-private.h @@ -28,8 +28,6 @@ DBusGConnection *_nm_dbus_new_connection (GError **error); -gboolean _nm_dbus_is_connection_private (DBusGConnection *connection); - DBusGProxy * _nm_dbus_new_proxy_for_connection (DBusGConnection *connection, const char *path, const char *interface); diff --git a/libnm-glib/nm-dbus-helpers.c b/libnm-glib/nm-dbus-helpers.c index 076f19863e..44ae13a804 100644 --- a/libnm-glib/nm-dbus-helpers.c +++ b/libnm-glib/nm-dbus-helpers.c @@ -27,74 +27,21 @@ #include "nm-dbus-helpers-private.h" #include "NetworkManager.h" -static dbus_int32_t priv_slot = -1; - -static gboolean -_ensure_dbus_data_slot (void) -{ - static gsize init_value = 0; - gboolean success = TRUE; - - if (g_once_init_enter (&init_value)) { - success = dbus_connection_allocate_data_slot (&priv_slot); - g_once_init_leave (&init_value, 1); - } - return success; -} - DBusGConnection * _nm_dbus_new_connection (GError **error) { DBusGConnection *connection = NULL; - if (!_ensure_dbus_data_slot ()) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_FAILED, "failed to allocated data slot"); - return NULL; - } - -#if HAVE_DBUS_GLIB_100 - /* If running as root try the private bus first */ - if (0 == geteuid ()) { - connection = dbus_g_connection_open ("unix:path=" NMRUNDIR "/private", error); - if (connection) { - DBusConnection *dbus_connection = dbus_g_connection_get_connection (connection); - - /* Mark this connection as private */ - dbus_connection_set_data (dbus_connection, priv_slot, GUINT_TO_POINTER (TRUE), NULL); - dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE); - return connection; - } - /* Fall back to a bus if for some reason private socket isn't available */ - g_clear_error (error); - } -#endif - if (connection == NULL) connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, error); return connection; } -gboolean -_nm_dbus_is_connection_private (DBusGConnection *connection) -{ - if (!_ensure_dbus_data_slot ()) - return FALSE; - return !!dbus_connection_get_data (dbus_g_connection_get_connection (connection), priv_slot); -} - DBusGProxy * _nm_dbus_new_proxy_for_connection (DBusGConnection *connection, const char *path, const char *interface) { - /* Private connections can't use dbus_g_proxy_new_for_name() or - * dbus_g_proxy_new_for_name_owner() because peer-to-peer connections don't - * have either a bus daemon or name owners, both of which those functions - * require. - */ - if (_nm_dbus_is_connection_private (connection)) - return dbus_g_proxy_new_for_peer (connection, path, interface); - return dbus_g_proxy_new_for_name (connection, NM_DBUS_SERVICE, path, interface); } diff --git a/libnm-glib/nm-object-private.h b/libnm-glib/nm-object-private.h index 1b18918c8e..519f6776b7 100644 --- a/libnm-glib/nm-object-private.h +++ b/libnm-glib/nm-object-private.h @@ -42,8 +42,6 @@ DBusGProxy *_nm_object_new_proxy (NMObject *self, const char *path, const char *interface); -gboolean _nm_object_is_connection_private (NMObject *self); - void _nm_object_register_properties (NMObject *object, DBusGProxy *proxy, const NMPropertiesInfo *info); diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 206b3f5b4d..b92b0ca61c 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -174,23 +174,19 @@ constructed (GObject *object) priv->properties_proxy = _nm_object_new_proxy (self, NULL, DBUS_INTERFACE_PROPERTIES); - if (_nm_object_is_connection_private (self)) - priv->nm_running = TRUE; - else { - priv->bus_proxy = dbus_g_proxy_new_for_name (priv->connection, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - g_assert (priv->bus_proxy); + priv->bus_proxy = dbus_g_proxy_new_for_name (priv->connection, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + g_assert (priv->bus_proxy); - dbus_g_proxy_add_signal (priv->bus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->bus_proxy, - "NameOwnerChanged", - G_CALLBACK (proxy_name_owner_changed), - object, NULL); - } + dbus_g_proxy_add_signal (priv->bus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (priv->bus_proxy, + "NameOwnerChanged", + G_CALLBACK (proxy_name_owner_changed), + object, NULL); } static gboolean @@ -272,16 +268,12 @@ init_async (GAsyncInitable *initable, int io_priority, simple = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, init_async); - if (_nm_object_is_connection_private (NM_OBJECT (initable))) - _nm_object_reload_properties_async (NM_OBJECT (initable), init_async_got_properties, simple); - else { - /* Check if NM is running */ - dbus_g_proxy_begin_call (priv->bus_proxy, "NameHasOwner", - init_async_got_manager_running, - simple, NULL, - G_TYPE_STRING, NM_DBUS_SERVICE, - G_TYPE_INVALID); - } + /* Check if NM is running */ + dbus_g_proxy_begin_call (priv->bus_proxy, "NameHasOwner", + init_async_got_manager_running, + simple, NULL, + G_TYPE_STRING, NM_DBUS_SERVICE, + G_TYPE_INVALID); } static gboolean @@ -1438,9 +1430,3 @@ _nm_object_new_proxy (NMObject *self, const char *path, const char *interface) return _nm_dbus_new_proxy_for_connection (priv->connection, path ? path : priv->path, interface); } - -gboolean -_nm_object_is_connection_private (NMObject *self) -{ - return _nm_dbus_is_connection_private (NM_OBJECT_GET_PRIVATE (self)->connection); -} diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 37a4622d87..d2fa2db73e 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -132,7 +132,6 @@ G_DEFINE_TYPE_WITH_CODE (NMRemoteSettings, nm_remote_settings, G_TYPE_OBJECT, typedef struct { DBusGConnection *bus; - gboolean private_bus; gboolean inited; DBusGProxy *proxy; @@ -1177,26 +1176,24 @@ constructed (GObject *object) priv = NM_REMOTE_SETTINGS_GET_PRIVATE (object); - if (priv->private_bus == FALSE) { - /* D-Bus proxy for clearing connections on NameOwnerChanged */ - priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - g_assert (priv->dbus_proxy); + /* D-Bus proxy for clearing connections on NameOwnerChanged */ + priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->bus, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + g_assert (priv->dbus_proxy); - dbus_g_object_register_marshaller (g_cclosure_marshal_generic, - G_TYPE_NONE, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_add_signal (priv->dbus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->dbus_proxy, - "NameOwnerChanged", - G_CALLBACK (name_owner_changed), - object, NULL); - } + dbus_g_object_register_marshaller (g_cclosure_marshal_generic, + G_TYPE_NONE, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_add_signal (priv->dbus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (priv->dbus_proxy, + "NameOwnerChanged", + G_CALLBACK (name_owner_changed), + object, NULL); priv->proxy = _nm_dbus_new_proxy_for_connection (priv->bus, NM_DBUS_PATH_SETTINGS, @@ -1239,23 +1236,20 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings); GHashTable *props; - if (priv->private_bus == FALSE) { - if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", error, - G_TYPE_STRING, NM_DBUS_SERVICE, - G_TYPE_INVALID, - G_TYPE_BOOLEAN, &priv->service_running, - G_TYPE_INVALID)) { - priv->service_running = FALSE; - return FALSE; - } + if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", error, + G_TYPE_STRING, NM_DBUS_SERVICE, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &priv->service_running, + G_TYPE_INVALID)) { + priv->service_running = FALSE; + return FALSE; + } - /* If NM isn't running we'll grab properties from name_owner_changed() - * when it starts. - */ - if (!priv->service_running) - return TRUE; - } else - priv->service_running = TRUE; + /* If NM isn't running we'll grab properties from name_owner_changed() + * when it starts. + */ + if (!priv->service_running) + return TRUE; priv->listcon_call = dbus_g_proxy_begin_call (priv->proxy, "ListConnections", fetch_connections_done, NM_REMOTE_SETTINGS (initable), NULL, @@ -1376,17 +1370,12 @@ init_async (GAsyncInitable *initable, int io_priority, init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, init_async); - if (priv->private_bus) { - priv->service_running = TRUE; - init_get_properties (init_data); - } else { - /* Check if NM is running */ - dbus_g_proxy_begin_call (priv->dbus_proxy, "NameHasOwner", - init_async_got_manager_running, - init_data, NULL, - G_TYPE_STRING, NM_DBUS_SERVICE, - G_TYPE_INVALID); - } + /* Check if NM is running */ + dbus_g_proxy_begin_call (priv->dbus_proxy, "NameHasOwner", + init_async_got_manager_running, + init_data, NULL, + G_TYPE_STRING, NM_DBUS_SERVICE, + G_TYPE_INVALID); } static gboolean @@ -1444,10 +1433,8 @@ set_property (GObject *object, guint prop_id, case PROP_BUS: /* Construct only */ priv->bus = g_value_dup_boxed (value); - if (!priv->bus) { + if (!priv->bus) priv->bus = _nm_dbus_new_connection (NULL); - priv->private_bus = _nm_dbus_is_connection_private (priv->bus); - } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index 3da765857c..32b8564f0f 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -65,7 +65,6 @@ typedef struct { NMSecretAgentCapabilities capabilities; DBusGConnection *bus; - gboolean private_bus; DBusGProxy *dbus_proxy; DBusGProxy *manager_proxy; DBusGProxyCall *reg_call; @@ -227,12 +226,6 @@ verify_sender (NMSecretAgent *self, g_return_val_if_fail (context != NULL, FALSE); - /* Private bus connection is always to NetworkManager, which is always - * UID 0. - */ - if (priv->private_bus) - return TRUE; - /* Verify the sender's UID is 0, and that the sender is the same as * NetworkManager's bus name owner. */ @@ -626,7 +619,7 @@ nm_secret_agent_register (NMSecretAgent *self) g_return_val_if_fail (class->save_secrets != NULL, FALSE); g_return_val_if_fail (class->delete_secrets != NULL, FALSE); - if (!priv->nm_owner && !priv->private_bus) + if (!priv->nm_owner) return FALSE; priv->suppress_auto = FALSE; @@ -671,7 +664,7 @@ nm_secret_agent_unregister (NMSecretAgent *self) g_return_val_if_fail (priv->bus != NULL, FALSE); g_return_val_if_fail (priv->manager_proxy != NULL, FALSE); - if (!priv->nm_owner && !priv->private_bus) + if (!priv->nm_owner) return FALSE; dbus_g_proxy_call_no_reply (priv->manager_proxy, "Unregister", G_TYPE_INVALID); @@ -853,29 +846,26 @@ nm_secret_agent_init (NMSecretAgent *self) g_error_free (error); return; } - priv->private_bus = _nm_dbus_is_connection_private (priv->bus); - if (priv->private_bus == FALSE) { - priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - g_assert (priv->dbus_proxy); + priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->bus, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + g_assert (priv->dbus_proxy); - dbus_g_object_register_marshaller (g_cclosure_marshal_generic, - G_TYPE_NONE, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_add_signal (priv->dbus_proxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->dbus_proxy, - "NameOwnerChanged", - G_CALLBACK (name_owner_changed), - self, NULL); + dbus_g_object_register_marshaller (g_cclosure_marshal_generic, + G_TYPE_NONE, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_add_signal (priv->dbus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (priv->dbus_proxy, + "NameOwnerChanged", + G_CALLBACK (name_owner_changed), + self, NULL); - get_nm_owner (self); - } + get_nm_owner (self); priv->manager_proxy = _nm_dbus_new_proxy_for_connection (priv->bus, NM_DBUS_PATH_AGENT_MANAGER, @@ -885,7 +875,7 @@ nm_secret_agent_init (NMSecretAgent *self) return; } - if (priv->nm_owner || priv->private_bus) + if (priv->nm_owner) priv->auto_register_id = g_idle_add (auto_register_cb, self); } From f3d10b3ec8aa6674f8146ea6d1fd9d872af50083 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 21 Apr 2015 09:52:25 -0400 Subject: [PATCH 06/13] core: add missing g_dbus_error_strip_remote_error() calls --- src/devices/bluetooth/nm-bluez-device.c | 1 + src/devices/bluetooth/nm-bluez-manager.c | 5 ++++- src/devices/bluetooth/nm-bluez4-adapter.c | 1 + src/devices/bluetooth/nm-bluez5-manager.c | 4 ++-- src/nm-auth-manager.c | 2 ++ src/nm-dispatcher.c | 1 + src/nm-sleep-monitor-systemd.c | 1 + .../nm-supplicant-interface.c | 19 ++++++++++++++++--- src/vpn-manager/nm-vpn-connection.c | 10 ++++++---- 9 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c index 2cebefa869..39afd091a5 100644 --- a/src/devices/bluetooth/nm-bluez-device.c +++ b/src/devices/bluetooth/nm-bluez-device.c @@ -888,6 +888,7 @@ get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_da G_VARIANT_TYPE ("(a{sv})"), &err); if (!v_properties) { + g_dbus_error_strip_remote_error (err); nm_log_warn (LOGD_BT, "bluez[%s] error getting device properties: %s", priv->path, err->message); g_error_free (err); diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c index 193d9f7186..8d41ca3f1b 100644 --- a/src/devices/bluetooth/nm-bluez-manager.c +++ b/src/devices/bluetooth/nm-bluez-manager.c @@ -280,7 +280,10 @@ check_bluez_and_try_setup_do_introspect (GObject *source_object, result = _nm_dbus_proxy_call_finish (priv->introspect_proxy, res, G_VARIANT_TYPE ("(s)"), &error); if (!result) { - char *reason2 = g_strdup_printf ("introspect failed with %s", error->message); + char *reason2; + + g_dbus_error_strip_remote_error (error); + reason2 = g_strdup_printf ("introspect failed with %s", error->message); check_bluez_and_try_setup_final_step (self, 0, reason2); g_error_free (error); g_free (reason2); diff --git a/src/devices/bluetooth/nm-bluez4-adapter.c b/src/devices/bluetooth/nm-bluez4-adapter.c index f31c600e73..e02e72095c 100644 --- a/src/devices/bluetooth/nm-bluez4-adapter.c +++ b/src/devices/bluetooth/nm-bluez4-adapter.c @@ -197,6 +197,7 @@ get_properties_cb (GObject *proxy, GAsyncResult *result, gpointer user_data) ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, G_VARIANT_TYPE ("(a{sv})"), &err); if (!ret) { + g_dbus_error_strip_remote_error (err); nm_log_warn (LOGD_BT, "bluez error getting adapter properties: %s", err->message); g_error_free (err); goto done; diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c index cbbe111753..7fe0c074ba 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.c +++ b/src/devices/bluetooth/nm-bluez5-manager.c @@ -207,8 +207,8 @@ get_managed_objects_cb (GDBusProxy *proxy, if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) nm_log_warn (LOGD_BT, "Couldn't get managed objects: not running Bluez5?"); else { - nm_log_warn (LOGD_BT, "Couldn't get managed objects: %s", - error && error->message ? error->message : "(unknown)"); + g_dbus_error_strip_remote_error (error); + nm_log_warn (LOGD_BT, "Couldn't get managed objects: %s", error->message); } g_clear_error (&error); return; diff --git a/src/nm-auth-manager.c b/src/nm-auth-manager.c index 3ee0889298..9caca771f4 100644 --- a/src/nm-auth-manager.c +++ b/src/nm-auth-manager.c @@ -154,6 +154,7 @@ cancel_check_authorization_cb (GDBusProxy *proxy, value = g_dbus_proxy_call_finish (proxy, res, &error); if (value == NULL) { + g_dbus_error_strip_remote_error (error); _LOGD ("Error cancelling authorization check: %s", error->message); g_error_free (error); } else @@ -195,6 +196,7 @@ check_authorization_cb (GDBusProxy *proxy, g_object_ref (self)); } else _LOGD ("call[%u]: CheckAuthorization failed: %s", data->call_id, error->message); + g_dbus_error_strip_remote_error (error); g_simple_async_result_set_error (data->simple, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index 8adec92970..36691eed24 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -622,6 +622,7 @@ _dispatcher_call (DispatcherAction action, g_variant_unref (ret); success = TRUE; } else { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_DISPATCH, "(%u) failed: %s", reqid, error->message); g_clear_error (&error); success = FALSE; diff --git a/src/nm-sleep-monitor-systemd.c b/src/nm-sleep-monitor-systemd.c index dab41a7a0b..1dd6ae4605 100644 --- a/src/nm-sleep-monitor-systemd.c +++ b/src/nm-sleep-monitor-systemd.c @@ -89,6 +89,7 @@ inhibit_done (GObject *source, res = g_dbus_proxy_call_with_unix_fd_list_finish (sd_proxy, &fd_list, result, &error); if (!res) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_SUSPEND, "Inhibit failed: %s", error->message); g_error_free (error); } else { diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index 50daabebf2..56bd5dc46a 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -413,7 +413,9 @@ nm_supplicant_interface_credentials_reply (NMSupplicantInterface *self, 5000, NULL, error); - /* reply will be unrefed when function exits */ + if (error && *error) + g_dbus_error_strip_remote_error (*error); + return !!reply; } @@ -746,6 +748,7 @@ interface_get_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) g_variant_get (variant, "(&o)", &path); interface_add_done (self, path); } else { + g_dbus_error_strip_remote_error (error); nm_log_err (LOGD_SUPPLICANT, "(%s): error getting interface: %s", priv->dev, error->message); set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); } @@ -794,10 +797,12 @@ interface_add_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) * activation. Wait for it to start by moving back to the INIT * state. */ + g_dbus_error_strip_remote_error (error); nm_log_dbg (LOGD_SUPPLICANT, "(%s): failed to activate supplicant: %s", priv->dev, error->message); set_state (self, NM_SUPPLICANT_INTERFACE_STATE_INIT); } else { + g_dbus_error_strip_remote_error (error); nm_log_err (LOGD_SUPPLICANT, "(%s): error adding interface: %s", priv->dev, error->message); set_state (self, NM_SUPPLICANT_INTERFACE_STATE_DOWN); } @@ -914,8 +919,10 @@ log_result_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) reply = g_dbus_proxy_call_finish (proxy, result, &error); if ( !reply && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) - && !strstr (error->message, "fi.w1.wpa_supplicant1.NotConnected")) + && !strstr (error->message, "fi.w1.wpa_supplicant1.NotConnected")) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_SUPPLICANT, "Failed to %s: %s.", (char *) user_data, error->message); + } } void @@ -973,6 +980,7 @@ select_network_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) reply = g_dbus_proxy_call_finish (proxy, result, &err); if (!reply && !g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_dbus_error_strip_remote_error (err); nm_log_warn (LOGD_SUPPLICANT, "Couldn't select network config: %s.", err->message); emit_error_helper (NM_SUPPLICANT_INTERFACE (user_data), err); } @@ -1015,6 +1023,7 @@ add_blob_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) if (reply) call_select_network (self); else { + g_dbus_error_strip_remote_error (err); nm_log_warn (LOGD_SUPPLICANT, "Couldn't set network certificates: %s.", err->message); emit_error_helper (self, err); } @@ -1045,6 +1054,7 @@ add_network_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) priv->net_path = NULL; if (error) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_SUPPLICANT, "Adding network to supplicant failed: %s.", error->message); emit_error_helper (self, error); return; @@ -1090,6 +1100,7 @@ set_ap_scan_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); if (!reply) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_SUPPLICANT, "Couldn't send AP scan mode to the supplicant interface: %s.", error->message); emit_error_helper (self, error); @@ -1157,8 +1168,10 @@ scan_request_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; - if (error) + if (error) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_SUPPLICANT, "Could not get scan request result: %s", error->message); + } g_signal_emit (NM_SUPPLICANT_INTERFACE (user_data), signals[SCAN_DONE], 0, error ? FALSE : TRUE); } diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index e6a2ca94dc..4db6fff1d2 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1547,6 +1547,7 @@ connect_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) self = NM_VPN_CONNECTION (user_data); if (error) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_VPN, "VPN connection '%s' failed to connect: '%s'.", nm_connection_get_id (NM_VPN_CONNECTION_GET_PRIVATE (self)->connection), error->message); @@ -1587,6 +1588,7 @@ connect_interactive_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_d (GAsyncReadyCallback) connect_cb, self); } else if (error) { + g_dbus_error_strip_remote_error (error); nm_log_warn (LOGD_VPN, "VPN connection '%s' failed to connect interactively: '%s'.", nm_connection_get_id (priv->connection), error->message); _set_vpn_state (self, STATE_FAILED, NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED, FALSE); @@ -1946,11 +1948,11 @@ plugin_need_secrets_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_d priv = NM_VPN_CONNECTION_GET_PRIVATE (self); if (error) { - nm_log_err (LOGD_VPN, "(%s/%s) plugin NeedSecrets request #%d failed: %s %s", + g_dbus_error_strip_remote_error (error); + nm_log_err (LOGD_VPN, "(%s/%s) plugin NeedSecrets request #%d failed: %s", nm_connection_get_uuid (priv->connection), nm_connection_get_id (priv->connection), priv->secrets_idx + 1, - g_quark_to_string (error->domain), error->message); _set_vpn_state (self, STATE_FAILED, NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS, FALSE); return; @@ -1997,10 +1999,10 @@ plugin_new_secrets_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_da priv = NM_VPN_CONNECTION_GET_PRIVATE (self); if (error) { - nm_log_err (LOGD_VPN, "(%s/%s) sending new secrets to the plugin failed: %s %s", + g_dbus_error_strip_remote_error (error); + nm_log_err (LOGD_VPN, "(%s/%s) sending new secrets to the plugin failed: %s", nm_connection_get_uuid (priv->connection), nm_connection_get_id (priv->connection), - g_quark_to_string (error->domain), error->message); _set_vpn_state (self, STATE_FAILED, NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS, FALSE); } else From 6fcc1deee0a9549d753813f9406ea1d74a2a8e8c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 13 Apr 2015 13:31:42 -0400 Subject: [PATCH 07/13] core: add an NMExportedObject base class Add NMExportedObject, make it the base class of all D-Bus-exported types, and move the nm-properties-changed-signal logic into it. (Also, make NMSettings use the same properties-changed code as everything else, which it was not previously doing, presumably for historical reasons). (This is mostly just shuffling code around at this point, but NMExportedObject will be more important in the gdbus port, since gdbus-codegen doesn't do a very good job of supporting objects that export multiple interfaces [as each NMDevice subclass does, for example], so we will need more glue/helper code in NMExportedObject then.) --- src/Makefile.am | 6 +- src/devices/adsl/nm-device-adsl.c | 4 +- src/devices/bluetooth/nm-device-bt.c | 3 +- src/devices/nm-device-bond.c | 4 +- src/devices/nm-device-bridge.c | 4 +- src/devices/nm-device-ethernet.c | 4 +- src/devices/nm-device-generic.c | 4 +- src/devices/nm-device-gre.c | 4 +- src/devices/nm-device-infiniband.c | 4 +- src/devices/nm-device-macvlan.c | 4 +- src/devices/nm-device-tun.c | 4 +- src/devices/nm-device-veth.c | 4 +- src/devices/nm-device-vlan.c | 4 +- src/devices/nm-device-vxlan.c | 4 +- src/devices/nm-device.c | 8 +- src/devices/nm-device.h | 6 +- src/devices/team/nm-device-team.c | 5 +- src/devices/wifi/nm-device-olpc-mesh.c | 4 +- src/devices/wifi/nm-device-wifi.c | 4 +- src/devices/wifi/nm-wifi-ap.c | 5 +- src/devices/wifi/nm-wifi-ap.h | 6 +- src/devices/wwan/nm-device-modem.c | 4 +- src/devices/wwan/nm-modem.c | 1 - src/dhcp-manager/tests/Makefile.am | 1 + src/nm-active-connection.c | 5 +- src/nm-active-connection.h | 7 +- src/nm-dbus-manager.c | 28 --- src/nm-dbus-manager.h | 4 - src/nm-dhcp4-config.c | 5 +- src/nm-dhcp4-config.h | 8 +- src/nm-dhcp6-config.c | 5 +- src/nm-dhcp6-config.h | 8 +- src/nm-exported-object.c | 247 ++++++++++++++++++ src/nm-exported-object.h | 53 ++++ src/nm-ip4-config.c | 5 +- src/nm-ip4-config.h | 8 +- src/nm-ip6-config.c | 5 +- src/nm-ip6-config.h | 7 +- src/nm-manager.c | 5 +- src/nm-manager.h | 8 +- src/nm-properties-changed-signal.c | 248 ------------------- src/nm-properties-changed-signal.h | 31 --- src/ppp-manager/nm-ppp-manager.c | 6 +- src/ppp-manager/nm-ppp-manager.h | 6 +- src/settings/nm-agent-manager.c | 6 +- src/settings/nm-agent-manager.h | 8 +- src/settings/nm-settings-connection.c | 6 +- src/settings/nm-settings-connection.h | 5 +- src/settings/nm-settings.c | 63 +---- src/settings/nm-settings.h | 7 +- src/settings/plugins/ifcfg-rh/plugin.c | 6 +- src/settings/plugins/ifcfg-rh/plugin.h | 6 +- src/settings/plugins/ifnet/Makefile.am | 1 + src/settings/plugins/ifnet/tests/Makefile.am | 1 + src/settings/plugins/ifupdown/Makefile.am | 1 + src/vpn-manager/nm-vpn-connection.c | 4 +- 56 files changed, 399 insertions(+), 515 deletions(-) create mode 100644 src/nm-exported-object.c create mode 100644 src/nm-exported-object.h delete mode 100644 src/nm-properties-changed-signal.c delete mode 100644 src/nm-properties-changed-signal.h diff --git a/src/Makefile.am b/src/Makefile.am index cc0a0aecd1..3181a1f099 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -324,6 +324,8 @@ nm_sources = \ nm-dispatcher.h \ nm-enum-types.c \ nm-enum-types.h \ + nm-exported-object.c \ + nm-exported-object.h \ nm-firewall-manager.c \ nm-firewall-manager.h \ nm-ip4-config.c \ @@ -344,8 +346,6 @@ nm_sources = \ nm-multi-index.h \ nm-policy.c \ nm-policy.h \ - nm-properties-changed-signal.c \ - nm-properties-changed-signal.h \ nm-rfkill-manager.c \ nm-rfkill-manager.h \ nm-session-monitor.h \ @@ -505,6 +505,8 @@ libnm_iface_helper_la_SOURCES = \ nm-route-manager.c \ nm-route-manager.h \ \ + nm-exported-object.c \ + nm-exported-object.h \ nm-ip4-config.c \ nm-ip4-config.h \ nm-ip6-config.c \ diff --git a/src/devices/adsl/nm-device-adsl.c b/src/devices/adsl/nm-device-adsl.c index f5ed9d756f..a557a0c88f 100644 --- a/src/devices/adsl/nm-device-adsl.c +++ b/src/devices/adsl/nm-device-adsl.c @@ -39,7 +39,6 @@ #include "NetworkManagerUtils.h" #include "nm-logging.h" #include "nm-enum-types.h" -#include "nm-dbus-manager.h" #include "nm-platform.h" #include "ppp-manager/nm-ppp-manager.h" @@ -615,7 +614,6 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass) parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; parent_class->deactivate = deactivate; - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_adsl_object_info); } diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index 1de5bed104..7fd793b451 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -1196,7 +1196,6 @@ nm_device_bt_class_init (NMDeviceBtClass *klass) G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_bt_object_info); } diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index a78761c3d7..734a84ea78 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -33,7 +33,6 @@ #include "nm-device-private.h" #include "nm-platform.h" #include "nm-dbus-glib-types.h" -#include "nm-dbus-manager.h" #include "nm-enum-types.h" #include "nm-device-factory.h" #include "nm-core-internal.h" @@ -542,8 +541,7 @@ nm_device_bond_class_init (NMDeviceBondClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_bond_object_info); } diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 3e70708db1..a0b1e83cbb 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -31,7 +31,6 @@ #include "NetworkManagerUtils.h" #include "nm-device-private.h" #include "nm-dbus-glib-types.h" -#include "nm-dbus-manager.h" #include "nm-enum-types.h" #include "nm-platform.h" #include "nm-device-factory.h" @@ -466,8 +465,7 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_bridge_object_info); } diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index afd3a43415..8fcf4827fb 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -41,7 +41,6 @@ #include "ppp-manager/nm-ppp-manager.h" #include "nm-logging.h" #include "nm-enum-types.h" -#include "nm-dbus-manager.h" #include "nm-platform.h" #include "nm-platform-utils.h" #include "nm-dcb.h" @@ -1706,8 +1705,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_ethernet_object_info); } diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c index 0565153bb8..db5b2b6b4d 100644 --- a/src/devices/nm-device-generic.c +++ b/src/devices/nm-device-generic.c @@ -24,7 +24,6 @@ #include "nm-device-private.h" #include "nm-enum-types.h" #include "nm-platform.h" -#include "nm-dbus-manager.h" #include "nm-core-internal.h" #include "nm-device-generic-glue.h" @@ -203,7 +202,6 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_generic_object_info); } diff --git a/src/devices/nm-device-gre.c b/src/devices/nm-device-gre.c index b3510d2e25..53f2901d97 100644 --- a/src/devices/nm-device-gre.c +++ b/src/devices/nm-device-gre.c @@ -25,7 +25,6 @@ #include "nm-device-gre.h" #include "nm-device-private.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-manager.h" #include "nm-platform.h" @@ -256,8 +255,7 @@ nm_device_gre_class_init (NMDeviceGreClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_gre_object_info); } diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 62fbe8d558..98e2f1de09 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -30,7 +30,6 @@ #include "NetworkManagerUtils.h" #include "nm-device-private.h" #include "nm-enum-types.h" -#include "nm-dbus-manager.h" #include "nm-activation-request.h" #include "nm-ip4-config.h" #include "nm-platform.h" @@ -295,8 +294,7 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_infiniband_object_info); } diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 0bfe3fe9fc..42811f1a65 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -24,7 +24,6 @@ #include "nm-device-macvlan.h" #include "nm-device-private.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-manager.h" #include "nm-platform.h" @@ -164,8 +163,7 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_macvlan_object_info); } diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index 5aaff8b1a0..d996470af5 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -25,7 +25,6 @@ #include "nm-device-tun.h" #include "nm-device-private.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-platform.h" #include "nm-device-factory.h" @@ -258,8 +257,7 @@ nm_device_tun_class_init (NMDeviceTunClass *klass) FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_tun_object_info); } diff --git a/src/devices/nm-device-veth.c b/src/devices/nm-device-veth.c index 04f03fbbe5..89ab4297f1 100644 --- a/src/devices/nm-device-veth.c +++ b/src/devices/nm-device-veth.c @@ -32,7 +32,6 @@ #include "nm-logging.h" #include "nm-manager.h" #include "nm-platform.h" -#include "nm-dbus-manager.h" #include "nm-device-factory.h" #include "nm-device-veth-glue.h" @@ -166,8 +165,7 @@ nm_device_veth_class_init (NMDeviceVethClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_veth_object_info); } diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index f2380e71d6..a31eb77b87 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -32,7 +32,6 @@ #include "NetworkManagerUtils.h" #include "nm-device-private.h" #include "nm-enum-types.h" -#include "nm-dbus-manager.h" #include "nm-connection-provider.h" #include "nm-activation-request.h" #include "nm-ip4-config.h" @@ -606,8 +605,7 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_vlan_object_info); } diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c index 186e00de00..50e698aded 100644 --- a/src/devices/nm-device-vxlan.c +++ b/src/devices/nm-device-vxlan.c @@ -24,7 +24,6 @@ #include "nm-device-vxlan.h" #include "nm-device-private.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-manager.h" #include "nm-platform.h" @@ -342,8 +341,7 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_vxlan_object_info); } diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4590c5f63d..5097e44807 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -55,7 +55,6 @@ #include "nm-dhcp6-config.h" #include "nm-rfkill-manager.h" #include "nm-firewall-manager.h" -#include "nm-properties-changed-signal.h" #include "nm-enum-types.h" #include "nm-settings-connection.h" #include "nm-connection-provider.h" @@ -79,7 +78,7 @@ static void ip_check_ping_watch_cb (GPid pid, gint status, gpointer user_data); #include "nm-device-glue.h" -G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, NM_TYPE_EXPORTED_OBJECT) #define NM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE, NMDevicePrivate)) @@ -526,6 +525,7 @@ nm_device_dbus_export (NMDevice *self) priv->path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++); _LOGD (LOGD_DEVICE, "exported as %s", priv->path); + nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); } @@ -9766,10 +9766,8 @@ nm_device_class_init (NMDeviceClass *klass) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_object_info); dbus_g_error_domain_register (NM_DEVICE_ERROR, NULL, NM_TYPE_DEVICE_ERROR); } - diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index cb4476435d..88c71b161e 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -25,7 +25,7 @@ #include #include -#include "nm-glib.h" +#include "nm-exported-object.h" #include "nm-dbus-interface.h" #include "nm-types.h" #include "nm-connection.h" @@ -104,7 +104,7 @@ typedef enum { /*< skip >*/ } NMDeviceCheckConAvailableFlags; struct _NMDevice { - GObject parent; + NMExportedObject parent; }; /* The flags have an relaxing meaning, that means, specifying more flags, can make @@ -118,7 +118,7 @@ typedef enum { /*< skip >*/ } NMDeviceCheckDevAvailableFlags; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; const char *connection_type; diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 1de22138b6..129f0bb26e 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -35,7 +35,6 @@ #include "nm-device-private.h" #include "nm-platform.h" #include "nm-dbus-glib-types.h" -#include "nm-dbus-manager.h" #include "nm-enum-types.h" #include "nm-team-enum-types.h" #include "nm-core-internal.h" @@ -824,7 +823,7 @@ nm_device_team_class_init (NMDeviceTeamClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_team_object_info); } diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index 7dc7c11b00..cdc9606d61 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -50,7 +50,6 @@ #include "nm-setting-olpc-mesh.h" #include "nm-manager.h" #include "nm-enum-types.h" -#include "nm-dbus-manager.h" #include "nm-platform.h" #include "nm-wifi-enum-types.h" @@ -551,8 +550,7 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_olpc_mesh_object_info); } diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 62c64a125b..c6e1fa749e 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -29,7 +29,6 @@ #include #include "nm-glib.h" -#include "nm-dbus-manager.h" #include "nm-device.h" #include "nm-device-wifi.h" #include "nm-device-private.h" @@ -3062,8 +3061,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) scanning_allowed_accumulator, NULL, NULL, G_TYPE_BOOLEAN, 0); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (klass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass), &dbus_glib_nm_device_wifi_object_info); } diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c index ca272a001c..804d3566a6 100644 --- a/src/devices/wifi/nm-wifi-ap.c +++ b/src/devices/wifi/nm-wifi-ap.c @@ -67,7 +67,7 @@ typedef struct #define NM_AP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_AP, NMAccessPointPrivate)) -G_DEFINE_TYPE (NMAccessPoint, nm_ap, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMAccessPoint, nm_ap, NM_TYPE_EXPORTED_OBJECT) enum { PROP_0, @@ -1074,8 +1074,7 @@ nm_ap_class_init (NMAccessPointClass *ap_class) -1, G_MAXINT, -1, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (ap_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (ap_class), &dbus_glib_nm_access_point_object_info); } diff --git a/src/devices/wifi/nm-wifi-ap.h b/src/devices/wifi/nm-wifi-ap.h index 47e901ee22..3c8e2f009b 100644 --- a/src/devices/wifi/nm-wifi-ap.h +++ b/src/devices/wifi/nm-wifi-ap.h @@ -22,7 +22,7 @@ #ifndef __NETWORKMANAGER_ACCESS_POINT_H__ #define __NETWORKMANAGER_ACCESS_POINT_H__ -#include "nm-glib.h" +#include "nm-exported-object.h" #include "nm-dbus-interface.h" #include "nm-connection.h" @@ -45,11 +45,11 @@ #define NM_AP_LAST_SEEN "last-seen" typedef struct { - GObject parent; + NMExportedObject parent; } NMAccessPoint; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; } NMAccessPointClass; diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c index 02b0e5af89..bd115b429a 100644 --- a/src/devices/wwan/nm-device-modem.c +++ b/src/devices/wwan/nm-device-modem.c @@ -28,7 +28,6 @@ #include "nm-device-private.h" #include "nm-rfkill-manager.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" #include "nm-settings-connection.h" #include "nm-modem-broadband.h" #include "NetworkManagerUtils.h" @@ -795,7 +794,6 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (mclass), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (mclass), &dbus_glib_nm_device_modem_object_info); } diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index 3385a6fd3b..eeab0390e7 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -26,7 +26,6 @@ #include "nm-platform.h" #include "nm-dbus-manager.h" #include "nm-setting-connection.h" -#include "nm-properties-changed-signal.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" #include "nm-device-private.h" diff --git a/src/dhcp-manager/tests/Makefile.am b/src/dhcp-manager/tests/Makefile.am index 8aa79a29be..206974ba42 100644 --- a/src/dhcp-manager/tests/Makefile.am +++ b/src/dhcp-manager/tests/Makefile.am @@ -9,6 +9,7 @@ AM_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) \ -DTESTDIR="\"$(abs_srcdir)\"" noinst_PROGRAMS = \ diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 4c449d1de9..3ffe5359a4 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -37,7 +37,7 @@ #include "nm-active-connection-glue.h" /* Base class for anything implementing the Connection.Active D-Bus interface */ -G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_EXPORTED_OBJECT) #define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ NM_TYPE_ACTIVE_CONNECTION, \ @@ -1066,8 +1066,7 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class) NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_UINT); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (ac_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (ac_class), &dbus_glib_nm_active_connection_object_info); } diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index 01568c8fe0..a483895ade 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -21,8 +21,7 @@ #ifndef __NETWORKMANAGER_ACTIVE_CONNECTION_H__ #define __NETWORKMANAGER_ACTIVE_CONNECTION_H__ -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #include "nm-connection.h" #define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type ()) @@ -61,11 +60,11 @@ #define NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED "device-metered-changed" struct _NMActiveConnection { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; /* re-emits device state changes as a convenience for subclasses for * device states >= DISCONNECTED. diff --git a/src/nm-dbus-manager.c b/src/nm-dbus-manager.c index 0a664b0a12..48f0084228 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-dbus-manager.c @@ -29,7 +29,6 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-dbus-manager.h" -#include "nm-properties-changed-signal.h" #include #include @@ -854,33 +853,6 @@ object_destroyed (NMDBusManager *self, gpointer object) g_hash_table_remove (NM_DBUS_MANAGER_GET_PRIVATE (self)->exported, object); } -void -nm_dbus_manager_register_exported_type (NMDBusManager *self, - GType object_type, - const DBusGObjectInfo *info) -{ - const char *properties_info, *dbus_name, *gobject_name, *tmp_access; - - dbus_g_object_type_install_info (object_type, info); - if (!info->exported_properties) - return; - - properties_info = info->exported_properties; - while (*properties_info) { - /* The format is: "interface\0DBusPropertyName\0gobject_property_name\0access\0" */ - dbus_name = strchr (properties_info, '\0') + 1; - gobject_name = strchr (dbus_name, '\0') + 1; - tmp_access = strchr (gobject_name, '\0') + 1; - properties_info = strchr (tmp_access, '\0') + 1; - - /* Note that nm-properties-changed-signal takes advantage of the - * fact that @dbus_name and @gobject_name are static data that won't - * ever be freed. - */ - nm_properties_changed_signal_add_property (object_type, dbus_name, gobject_name); - } -} - void nm_dbus_manager_register_object (NMDBusManager *self, const char *path, diff --git a/src/nm-dbus-manager.h b/src/nm-dbus-manager.h index a0e3121990..2ce12a2d41 100644 --- a/src/nm-dbus-manager.h +++ b/src/nm-dbus-manager.h @@ -104,10 +104,6 @@ gboolean nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self, gulong *out_uid, gulong *out_pid); -void nm_dbus_manager_register_exported_type (NMDBusManager *self, - GType object_type, - const DBusGObjectInfo *info); - void nm_dbus_manager_register_object (NMDBusManager *self, const char *path, gpointer object); diff --git a/src/nm-dhcp4-config.c b/src/nm-dhcp4-config.c index ae945fdf33..08b5911503 100644 --- a/src/nm-dhcp4-config.c +++ b/src/nm-dhcp4-config.c @@ -30,7 +30,7 @@ #include "nm-dbus-glib-types.h" #include "nm-utils.h" -G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, NM_TYPE_EXPORTED_OBJECT) #define NM_DHCP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP4_CONFIG, NMDhcp4ConfigPrivate)) @@ -185,7 +185,6 @@ nm_dhcp4_config_class_init (NMDhcp4ConfigClass *config_class) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (config_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class), &dbus_glib_nm_dhcp4_config_object_info); } diff --git a/src/nm-dhcp4-config.h b/src/nm-dhcp4-config.h index c7f3797e24..29c3647ffa 100644 --- a/src/nm-dhcp4-config.h +++ b/src/nm-dhcp4-config.h @@ -21,9 +21,7 @@ #ifndef __NETWORKMANAGER_DHCP4_CONFIG_H__ #define __NETWORKMANAGER_DHCP4_CONFIG_H__ - -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #define NM_TYPE_DHCP4_CONFIG (nm_dhcp4_config_get_type ()) #define NM_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP4_CONFIG, NMDhcp4Config)) @@ -33,11 +31,11 @@ #define NM_DHCP4_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP4_CONFIG, NMDhcp4ConfigClass)) struct _NMDhcp4Config { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; } NMDhcp4ConfigClass; diff --git a/src/nm-dhcp6-config.c b/src/nm-dhcp6-config.c index f96807caba..e127443345 100644 --- a/src/nm-dhcp6-config.c +++ b/src/nm-dhcp6-config.c @@ -30,7 +30,7 @@ #include "nm-dbus-glib-types.h" #include "nm-utils.h" -G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, NM_TYPE_EXPORTED_OBJECT) #define NM_DHCP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP6_CONFIG, NMDhcp6ConfigPrivate)) @@ -185,7 +185,6 @@ nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (config_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class), &dbus_glib_nm_dhcp6_config_object_info); } diff --git a/src/nm-dhcp6-config.h b/src/nm-dhcp6-config.h index 53d8b52a4f..e5688d06b5 100644 --- a/src/nm-dhcp6-config.h +++ b/src/nm-dhcp6-config.h @@ -21,9 +21,7 @@ #ifndef __NETWORKMANAGER_DHCP6_CONFIG_H__ #define __NETWORKMANAGER_DHCP6_CONFIG_H__ - -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #define NM_TYPE_DHCP6_CONFIG (nm_dhcp6_config_get_type ()) #define NM_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP6_CONFIG, NMDhcp6Config)) @@ -33,11 +31,11 @@ #define NM_DHCP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP6_CONFIG, NMDhcp6ConfigClass)) struct _NMDhcp6Config { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; } NMDhcp6ConfigClass; diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c new file mode 100644 index 0000000000..c991b8b614 --- /dev/null +++ b/src/nm-exported-object.c @@ -0,0 +1,247 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * 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. + * + * Copyright 2014-2015 Red Hat, Inc. + */ + +#include "config.h" + +#include + +#include "nm-exported-object.h" +#include "nm-dbus-glib-types.h" +#include "nm-logging.h" + +G_DEFINE_ABSTRACT_TYPE (NMExportedObject, nm_exported_object, G_TYPE_OBJECT) + +typedef struct { + GHashTable *pending_notifies; + guint notify_idle_id; +} NMExportedObjectPrivate; + +#define NM_EXPORTED_OBJECT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectPrivate)) + +enum { + PROPERTIES_CHANGED, + + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +typedef struct { + GHashTable *properties; +} NMExportedObjectClassInfo; + +GQuark nm_exported_object_class_info_quark (void); +G_DEFINE_QUARK (NMExportedObjectClassInfo, nm_exported_object_class_info) + +/** + * nm_exported_object_class_add_interface: + * @object_class: an #NMExportedObjectClass + * @info: generated #DBusGObjectInfo for the class + * + * Adds @info to the list of D-Bus interfaces implemented by @object_class and + * sets up automatic dbus-glib handling for instances of that class. + * + * If @info includes any properties, then a "PropertiesChanged" signal will + * be emitted on @info's interface whenever any of those properties change on + * an exported instance of @object_class. + */ +void +nm_exported_object_class_add_interface (NMExportedObjectClass *object_class, + const DBusGObjectInfo *info) +{ + GType object_type = G_TYPE_FROM_CLASS (object_class); + NMExportedObjectClassInfo *classinfo; + const char *properties_info, *dbus_name, *gobject_name, *tmp_access; + char *hyphen_name, *p; + + dbus_g_object_type_install_info (object_type, info); + if (!info->exported_properties) + return; + + classinfo = g_type_get_qdata (object_type, nm_exported_object_class_info_quark ()); + if (!classinfo) { + classinfo = g_slice_new (NMExportedObjectClassInfo); + classinfo->properties = g_hash_table_new (g_str_hash, g_str_equal); + g_type_set_qdata (object_type, nm_exported_object_class_info_quark (), classinfo); + } + + properties_info = info->exported_properties; + while (*properties_info) { + /* The format is: "interface\0DBusPropertyName\0gobject_property_name\0access\0" */ + dbus_name = strchr (properties_info, '\0') + 1; + gobject_name = strchr (dbus_name, '\0') + 1; + tmp_access = strchr (gobject_name, '\0') + 1; + properties_info = strchr (tmp_access, '\0') + 1; + + if (strchr (gobject_name, '_')) { + hyphen_name = g_strdup (gobject_name); + for (p = hyphen_name; *p; p++) { + if (*p == '_') + *p = '-'; + } + g_assert (!g_hash_table_contains (classinfo->properties, hyphen_name)); + g_hash_table_insert (classinfo->properties, + (char *) g_intern_string (hyphen_name), + (char *) dbus_name); + g_free (hyphen_name); + } else { + g_assert (!g_hash_table_contains (classinfo->properties, (char *) gobject_name)); + g_hash_table_insert (classinfo->properties, + (char *) gobject_name, + (char *) dbus_name); + } + } +} + +static void +destroy_value (gpointer data) +{ + GValue *val = (GValue *) data; + + g_value_unset (val); + g_slice_free (GValue, val); +} + +static void +nm_exported_object_init (NMExportedObject *self) +{ + NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self); + + priv->pending_notifies = g_hash_table_new_full (g_str_hash, g_str_equal, + NULL, destroy_value); +} + +static void +add_to_string (gpointer key, gpointer value, gpointer user_data) +{ + const char *name = (const char *) key; + GString *buf = user_data; + GValue str_val = G_VALUE_INIT; + + g_value_init (&str_val, G_TYPE_STRING); + if (!g_value_transform ((GValue *) value, &str_val)) { + if (G_VALUE_HOLDS_OBJECT (value)) { + GObject *obj = g_value_get_object (value); + + if (obj) { + g_string_append_printf (buf, "{%s: %p (%s)}, ", name, obj, + G_OBJECT_TYPE_NAME (obj)); + } else + g_string_append_printf (buf, "{%s: %p}, ", name, obj); + } else + g_string_append_printf (buf, "{%s: }, ", name); + } else + g_string_append_printf (buf, "{%s: %s}, ", name, g_value_get_string (&str_val)); + g_value_unset (&str_val); +} + +static gboolean +idle_emit_properties_changed (gpointer self) +{ + NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self); + + priv->notify_idle_id = 0; + + if (nm_logging_enabled (LOGL_DEBUG, LOGD_DBUS_PROPS)) { + GString *buf = g_string_new (NULL); + + g_hash_table_foreach (priv->pending_notifies, add_to_string, buf); + nm_log_dbg (LOGD_DBUS_PROPS, "%s -> %s", G_OBJECT_TYPE_NAME (self), buf->str); + g_string_free (buf, TRUE); + } + + g_signal_emit (self, signals[PROPERTIES_CHANGED], 0, priv->pending_notifies); + g_hash_table_remove_all (priv->pending_notifies); + + return FALSE; +} + +static void +nm_exported_object_notify (GObject *object, GParamSpec *pspec) +{ + NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object); + NMExportedObjectClassInfo *classinfo; + const char *dbus_property_name = NULL; + GValue *value; + GType type; + + for (type = G_OBJECT_TYPE (object); type; type = g_type_parent (type)) { + classinfo = g_type_get_qdata (type, nm_exported_object_class_info_quark ()); + if (!classinfo) + continue; + + dbus_property_name = g_hash_table_lookup (classinfo->properties, pspec->name); + if (dbus_property_name) + break; + } + if (!dbus_property_name) { + nm_log_trace (LOGD_DBUS_PROPS, "ignoring notification for prop %s on type %s", + pspec->name, G_OBJECT_TYPE_NAME (object)); + return; + } + + value = g_slice_new0 (GValue); + g_value_init (value, pspec->value_type); + g_object_get_property (object, pspec->name, value); + g_hash_table_insert (priv->pending_notifies, (char *) dbus_property_name, value); + + if (!priv->notify_idle_id) + priv->notify_idle_id = g_idle_add (idle_emit_properties_changed, object); +} + +static void +nm_exported_object_dispose (GObject *object) +{ + NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object); + + g_hash_table_remove_all (priv->pending_notifies); + nm_clear_g_source (&priv->notify_idle_id); + + G_OBJECT_CLASS (nm_exported_object_parent_class)->dispose (object); +} + +static void +nm_exported_object_finalize (GObject *object) +{ + NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object); + + g_hash_table_destroy (priv->pending_notifies); + + G_OBJECT_CLASS (nm_exported_object_parent_class)->finalize (object); +} + +static void +nm_exported_object_class_init (NMExportedObjectClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (NMExportedObjectPrivate)); + + object_class->notify = nm_exported_object_notify; + object_class->dispose = nm_exported_object_dispose; + object_class->finalize = nm_exported_object_finalize; + + signals[PROPERTIES_CHANGED] = g_signal_new ("properties-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT); + +} diff --git a/src/nm-exported-object.h b/src/nm-exported-object.h new file mode 100644 index 0000000000..d9f4d28f53 --- /dev/null +++ b/src/nm-exported-object.h @@ -0,0 +1,53 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * 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. + * + * Copyright 2014 Red Hat, Inc. + */ + +#ifndef NM_EXPORTED_OBJECT_H +#define NM_EXPORTED_OBJECT_H + +#include + +#include "nm-glib.h" +#include "nm-types.h" + +G_BEGIN_DECLS + +#define NM_TYPE_EXPORTED_OBJECT (nm_exported_object_get_type ()) +#define NM_EXPORTED_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_EXPORTED_OBJECT, NMExportedObject)) +#define NM_EXPORTED_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectClass)) +#define NM_IS_EXPORTED_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_EXPORTED_OBJECT)) +#define NM_IS_EXPORTED_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_EXPORTED_OBJECT)) +#define NM_EXPORTED_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectClass)) + +typedef struct { + GObject parent; +} NMExportedObject; + +typedef struct { + GObjectClass parent; +} NMExportedObjectClass; + +GType nm_exported_object_get_type (void); + +void nm_exported_object_class_add_interface (NMExportedObjectClass *object_class, + const DBusGObjectInfo *info); + +G_END_DECLS + +#endif /* NM_EXPORTED_OBJECT_H */ diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index e23e364578..a30b5ea97a 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -37,7 +37,7 @@ #include "nm-core-internal.h" #include "gsystem-local-alloc.h" -G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_EXPORTED_OBJECT) #define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate)) @@ -2410,7 +2410,6 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) g_object_class_install_properties (object_class, LAST_PROP, obj_properties); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (config_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class), &dbus_glib_nm_ip4_config_object_info); } diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index 753b74cb9d..a5e30a7318 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -21,9 +21,7 @@ #ifndef __NETWORKMANAGER_IP4_CONFIG_H__ #define __NETWORKMANAGER_IP4_CONFIG_H__ - -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #include "nm-setting-ip4-config.h" #define NM_TYPE_IP4_CONFIG (nm_ip4_config_get_type ()) @@ -34,11 +32,11 @@ #define NM_IP4_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP4_CONFIG, NMIP4ConfigClass)) struct _NMIP4Config { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; } NMIP4ConfigClass; /* internal */ diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index 2122f64f4d..7ac436500e 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -36,7 +36,7 @@ #include "nm-core-internal.h" #include "NetworkManagerUtils.h" -G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, NM_TYPE_EXPORTED_OBJECT) #define NM_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP6_CONFIG, NMIP6ConfigPrivate)) @@ -2215,7 +2215,6 @@ nm_ip6_config_class_init (NMIP6ConfigClass *config_class) g_object_class_install_properties (object_class, LAST_PROP, obj_properties); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (config_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class), &dbus_glib_nm_ip6_config_object_info); } diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h index 06919026c3..5404913494 100644 --- a/src/nm-ip6-config.h +++ b/src/nm-ip6-config.h @@ -23,8 +23,7 @@ #include -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #include "nm-setting-ip6-config.h" #define NM_TYPE_IP6_CONFIG (nm_ip6_config_get_type ()) @@ -35,11 +34,11 @@ #define NM_IP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP6_CONFIG, NMIP6ConfigClass)) struct _NMIP6Config { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; } NMIP6ConfigClass; /* internal */ diff --git a/src/nm-manager.c b/src/nm-manager.c index 9a035c0fd4..96ec61ec33 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -194,7 +194,7 @@ typedef struct { #define NM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MANAGER, NMManagerPrivate)) -G_DEFINE_TYPE (NMManager, nm_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMManager, nm_manager, NM_TYPE_EXPORTED_OBJECT) enum { DEVICE_ADDED, @@ -5298,8 +5298,7 @@ nm_manager_class_init (NMManagerClass *manager_class) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (manager_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class), &dbus_glib_nm_manager_object_info); dbus_g_error_domain_register (NM_MANAGER_ERROR, NM_DBUS_INTERFACE, NM_TYPE_MANAGER_ERROR); diff --git a/src/nm-manager.h b/src/nm-manager.h index 665a8dd701..d8b566851d 100644 --- a/src/nm-manager.h +++ b/src/nm-manager.h @@ -22,9 +22,7 @@ #ifndef __NETWORKMANAGER_MANAGER_H__ #define __NETWORKMANAGER_MANAGER_H__ - -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #include "nm-connection.h" #define NM_TYPE_MANAGER (nm_manager_get_type ()) @@ -63,11 +61,11 @@ struct _NMManager { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; /* Signals */ void (*device_added) (NMManager *manager, NMDevice *device); diff --git a/src/nm-properties-changed-signal.c b/src/nm-properties-changed-signal.c deleted file mode 100644 index c6dbb3d532..0000000000 --- a/src/nm-properties-changed-signal.c +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * 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. - * - * Copyright (C) 2007 - 2008 Novell, Inc. - * Copyright (C) 2008 - 2012 Red Hat, Inc. - */ - -#include "config.h" - -#include -#include - -#include -#include "nm-logging.h" -#include "nm-properties-changed-signal.h" -#include "nm-dbus-glib-types.h" - -typedef struct { - GHashTable *exported_props; - guint signal_id; -} NMPropertiesChangedClassInfo; - -typedef struct { - GHashTable *hash; - guint signal_id; - guint idle_id; -} NMPropertiesChangedInfo; - -static GQuark -nm_properties_changed_signal_quark (void) -{ - static GQuark q; - - if (G_UNLIKELY (q == 0)) - q = g_quark_from_static_string ("nm-properties-changed-signal"); - - return q; -} - -static void -destroy_value (gpointer data) -{ - GValue *val = (GValue *) data; - - g_value_unset (val); - g_slice_free (GValue, val); -} - -static void -properties_changed_info_destroy (gpointer data) -{ - NMPropertiesChangedInfo *info = data; - - if (info->idle_id) - g_source_remove (info->idle_id); - - g_hash_table_destroy (info->hash); - g_slice_free (NMPropertiesChangedInfo, info); -} - -static void -add_to_string (gpointer key, gpointer value, gpointer user_data) -{ - const char *name = (const char *) key; - GString *buf = user_data; - GValue str_val = G_VALUE_INIT; - - g_value_init (&str_val, G_TYPE_STRING); - if (!g_value_transform ((GValue *) value, &str_val)) { - if (G_VALUE_HOLDS_OBJECT (value)) { - GObject *obj = g_value_get_object (value); - - if (obj) { - g_string_append_printf (buf, "{%s: %p (%s)}, ", name, obj, - G_OBJECT_TYPE_NAME (obj)); - } else - g_string_append_printf (buf, "{%s: %p}, ", name, obj); - } else - g_string_append_printf (buf, "{%s: }, ", name); - } else - g_string_append_printf (buf, "{%s: %s}, ", name, g_value_get_string (&str_val)); - g_value_unset (&str_val); -} - -static gboolean -properties_changed (gpointer data) -{ - GObject *object = G_OBJECT (data); - NMPropertiesChangedInfo *info = g_object_get_qdata (object, nm_properties_changed_signal_quark ()); - - g_assert (info); - - if (nm_logging_enabled (LOGL_DEBUG, LOGD_DBUS_PROPS)) { - GString *buf = g_string_new (NULL); - - g_hash_table_foreach (info->hash, add_to_string, buf); - nm_log_dbg (LOGD_DBUS_PROPS, "%s -> %s", G_OBJECT_TYPE_NAME (object), buf->str); - g_string_free (buf, TRUE); - } - - g_signal_emit (object, info->signal_id, 0, info->hash); - g_hash_table_remove_all (info->hash); - - return FALSE; -} - -static void -idle_id_reset (gpointer data) -{ - GObject *object = G_OBJECT (data); - NMPropertiesChangedInfo *info = g_object_get_qdata (object, nm_properties_changed_signal_quark ()); - - /* info is unset when the object is being destroyed */ - if (info) - info->idle_id = 0; -} - -static void -notify (GObject *object, GParamSpec *pspec) -{ - NMPropertiesChangedClassInfo *classinfo; - NMPropertiesChangedInfo *info; - const char *dbus_property_name = NULL; - GValue *value; - GType type; - - for (type = G_OBJECT_TYPE (object); type; type = g_type_parent (type)) { - classinfo = g_type_get_qdata (type, nm_properties_changed_signal_quark ()); - if (!classinfo) - continue; - - dbus_property_name = g_hash_table_lookup (classinfo->exported_props, pspec->name); - if (dbus_property_name) - break; - } - if (!dbus_property_name) { - nm_log_trace (LOGD_DBUS_PROPS, "ignoring notification for prop %s on type %s", - pspec->name, G_OBJECT_TYPE_NAME (object)); - return; - } - - info = g_object_get_qdata (object, nm_properties_changed_signal_quark ()); - if (!info) { - info = g_slice_new0 (NMPropertiesChangedInfo); - info->hash = g_hash_table_new_full (g_str_hash, g_str_equal, - NULL, destroy_value); - info->signal_id = classinfo->signal_id; - - g_object_set_qdata_full (object, nm_properties_changed_signal_quark (), - info, properties_changed_info_destroy); - } - - value = g_slice_new0 (GValue); - g_value_init (value, pspec->value_type); - g_object_get_property (object, pspec->name, value); - g_hash_table_insert (info->hash, (char *) dbus_property_name, value); - - if (!info->idle_id) - info->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, properties_changed, object, idle_id_reset); -} - -static NMPropertiesChangedClassInfo * -nm_properties_changed_signal_setup_type (GType type) -{ - NMPropertiesChangedClassInfo *classinfo; - NMPropertiesChangedClassInfo *parent_classinfo = NULL; - GObjectClass *object_class; - GType parent; - - classinfo = g_slice_new (NMPropertiesChangedClassInfo); - g_type_set_qdata (type, nm_properties_changed_signal_quark (), classinfo); - - object_class = g_type_class_ref (type); - object_class->notify = notify; - g_type_class_unref (object_class); - - classinfo->exported_props = g_hash_table_new (g_str_hash, g_str_equal); - - /* See if we've already added the signal to a parent class. (We can't just use - * g_signal_lookup() here because it prints a warning if the signal doesn't exist!) - */ - parent = g_type_parent (type); - while (parent) { - parent_classinfo = g_type_get_qdata (parent, nm_properties_changed_signal_quark ()); - if (parent_classinfo) - break; - parent = g_type_parent (parent); - } - - if (parent_classinfo) - classinfo->signal_id = parent_classinfo->signal_id; - else { - classinfo->signal_id = g_signal_new ("properties-changed", - type, - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__BOXED, - G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT); - } - - return classinfo; -} - -void -nm_properties_changed_signal_add_property (GType type, - const char *dbus_property_name, - const char *gobject_property_name) -{ - NMPropertiesChangedClassInfo *classinfo; - char *hyphen_name, *p; - - classinfo = g_type_get_qdata (type, nm_properties_changed_signal_quark ()); - if (!classinfo) - classinfo = nm_properties_changed_signal_setup_type (type); - - g_assert (!g_hash_table_contains (classinfo->exported_props, (char *) gobject_property_name)); - g_hash_table_insert (classinfo->exported_props, - (char *) gobject_property_name, - (char *) dbus_property_name); - - if (!strchr (gobject_property_name, '_')) - return; - hyphen_name = g_strdup (gobject_property_name); - for (p = hyphen_name; *p; p++) { - if (*p == '_') - *p = '-'; - } - g_assert (!g_hash_table_contains (classinfo->exported_props, hyphen_name)); - g_hash_table_insert (classinfo->exported_props, - (char *) g_intern_string (hyphen_name), - (char *) dbus_property_name); - g_free (hyphen_name); -} diff --git a/src/nm-properties-changed-signal.h b/src/nm-properties-changed-signal.h deleted file mode 100644 index 6f76e8a4ae..0000000000 --- a/src/nm-properties-changed-signal.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * 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. - * - * Copyright (C) 2007 - 2008 Novell, Inc. - * Copyright (C) 2008 Red Hat, Inc. - */ - -#ifndef _NM_PROPERTIES_CHANGED_SIGNAL_H_ -#define _NM_PROPERTIES_CHANGED_SIGNAL_H_ - -#include "nm-glib.h" - -void nm_properties_changed_signal_add_property (GType type, - const char *dbus_property_name, - const char *gobject_property_name); - -#endif /* _NM_PROPERTIES_CHANGED_SIGNAL_H_ */ diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 6e1e5c2a2a..0a45dd1542 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -95,7 +95,7 @@ typedef struct { #define NM_PPP_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_PPP_MANAGER, NMPPPManagerPrivate)) -G_DEFINE_TYPE (NMPPPManager, nm_ppp_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMPPPManager, nm_ppp_manager, NM_TYPE_EXPORTED_OBJECT) enum { STATE_CHANGED, @@ -672,8 +672,8 @@ nm_ppp_manager_class_init (NMPPPManagerClass *manager_class) G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); - dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class), - &dbus_glib_nm_ppp_manager_object_info); + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class), + &dbus_glib_nm_ppp_manager_object_info); } /*******************************************/ diff --git a/src/ppp-manager/nm-ppp-manager.h b/src/ppp-manager/nm-ppp-manager.h index 9528721532..057f40982f 100644 --- a/src/ppp-manager/nm-ppp-manager.h +++ b/src/ppp-manager/nm-ppp-manager.h @@ -23,7 +23,7 @@ #define __NETWORKMANAGER_PPP_MANAGER_H__ -#include "nm-glib.h" +#include "nm-exported-object.h" #include "nm-ppp-status.h" #include "nm-activation-request.h" #include "nm-connection.h" @@ -42,11 +42,11 @@ #define NM_PPP_MANAGER_PARENT_IFACE "parent-iface" typedef struct { - GObject parent; + NMExportedObject parent; } NMPPPManager; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; /* Signals */ void (*state_changed) (NMPPPManager *manager, NMPPPStatus status); diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 7da9ee5f43..f41c49636a 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -43,7 +43,7 @@ #include "nm-simple-connection.h" #include "NetworkManagerUtils.h" -G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, NM_TYPE_EXPORTED_OBJECT) #define NM_AGENT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ NM_TYPE_AGENT_MANAGER, \ @@ -1622,8 +1622,8 @@ nm_agent_manager_class_init (NMAgentManagerClass *agent_manager_class) G_TYPE_NONE, 1, G_TYPE_OBJECT); - dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (agent_manager_class), - &dbus_glib_nm_agent_manager_object_info); + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (agent_manager_class), + &dbus_glib_nm_agent_manager_object_info); dbus_g_error_domain_register (NM_AGENT_MANAGER_ERROR, NM_DBUS_INTERFACE_AGENT_MANAGER, diff --git a/src/settings/nm-agent-manager.h b/src/settings/nm-agent-manager.h index ab010edb71..4ece8940e0 100644 --- a/src/settings/nm-agent-manager.h +++ b/src/settings/nm-agent-manager.h @@ -22,9 +22,9 @@ #define __NETWORKMANAGER_AGENT_MANAGER_H__ #include -#include "nm-glib.h" + +#include "nm-exported-object.h" #include "nm-secret-agent.h" -#include "nm-types.h" #define NM_TYPE_AGENT_MANAGER (nm_agent_manager_get_type ()) #define NM_AGENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AGENT_MANAGER, NMAgentManager)) @@ -34,11 +34,11 @@ #define NM_AGENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AGENT_MANAGER, NMAgentManagerClass)) struct _NMAgentManager { - GObject parent; + NMExportedObject parent; }; typedef struct { - GObjectClass parent; + NMExportedObjectClass parent; /* Signals */ void (*agent_registered) (NMAgentManager *agent_mgr, NMSecretAgent *agent); diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 24e9395963..f8b2ad1dc4 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -36,7 +36,6 @@ #include "nm-auth-subject.h" #include "nm-agent-manager.h" #include "NetworkManagerUtils.h" -#include "nm-properties-changed-signal.h" #include "nm-core-internal.h" #include "gsystem-local-alloc.h" @@ -113,7 +112,7 @@ static void impl_settings_connection_clear_secrets (NMSettingsConnection *self, static void nm_settings_connection_connection_interface_init (NMConnectionInterface *iface); -G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, G_TYPE_OBJECT, +G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_EXPORTED_OBJECT, G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_settings_connection_connection_interface_init) ) @@ -2513,8 +2512,7 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class), &dbus_glib_nm_settings_connection_object_info); } diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index 0d3963d3df..734d917877 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -24,6 +24,7 @@ #include +#include "nm-exported-object.h" #include #include "nm-types.h" @@ -95,11 +96,11 @@ typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *self, gpointer user_data); struct _NMSettingsConnection { - GObject parent; + NMExportedObject parent; }; struct _NMSettingsConnectionClass { - GObjectClass parent; + NMExportedObjectClass parent; /* virtual methods */ void (*replace_and_commit) (NMSettingsConnection *self, diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 183a14b377..7dd2e694c7 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -156,7 +156,7 @@ static void unrecognized_specs_changed (NMSystemConfigInterface *config, gpointe static void connection_provider_init (NMConnectionProvider *cp_class); -G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, G_TYPE_OBJECT, 0, +G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION_PROVIDER, connection_provider_init)) @@ -192,7 +192,6 @@ typedef struct { #define NM_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTINGS, NMSettingsPrivate)) enum { - PROPERTIES_CHANGED, CONNECTION_ADDED, CONNECTION_UPDATED, CONNECTION_UPDATED_BY_USER, @@ -456,51 +455,6 @@ nm_settings_get_connection_by_path (NMSettings *self, const char *path) return (NMSettingsConnection *) g_hash_table_lookup (priv->connections, path); } -static char* -uscore_to_wincaps (const char *uscore) -{ - const char *p; - GString *str; - gboolean last_was_uscore; - - last_was_uscore = TRUE; - - str = g_string_new (NULL); - p = uscore; - while (p && *p) { - if (*p == '-' || *p == '_') - last_was_uscore = TRUE; - else { - if (last_was_uscore) { - g_string_append_c (str, g_ascii_toupper (*p)); - last_was_uscore = FALSE; - } else - g_string_append_c (str, *p); - } - ++p; - } - - return g_string_free (str, FALSE); -} - -static void -notify (GObject *object, GParamSpec *pspec) -{ - GValue *value; - GHashTable *hash; - - value = g_slice_new0 (GValue); - hash = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); - - g_value_init (value, pspec->value_type); - g_object_get_property (object, pspec->name, value); - g_hash_table_insert (hash, uscore_to_wincaps (pspec->name), value); - g_signal_emit (object, signals[PROPERTIES_CHANGED], 0, hash); - g_hash_table_destroy (hash); - g_value_unset (value); - g_slice_free (GValue, value); -} - gboolean nm_settings_has_connection (NMSettings *self, NMConnection *connection) { @@ -2329,7 +2283,6 @@ nm_settings_class_init (NMSettingsClass *class) g_type_class_add_private (class, sizeof (NMSettingsPrivate)); /* virtual methods */ - object_class->notify = notify; object_class->get_property = get_property; object_class->dispose = dispose; object_class->finalize = finalize; @@ -2365,14 +2318,6 @@ nm_settings_class_init (NMSettingsClass *class) G_PARAM_STATIC_STRINGS)); /* signals */ - signals[PROPERTIES_CHANGED] = - g_signal_new ("properties-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSettingsClass, properties_changed), - NULL, NULL, - g_cclosure_marshal_VOID__BOXED, - G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT); signals[CONNECTION_ADDED] = g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_ADDED, G_OBJECT_CLASS_TYPE (object_class), @@ -2435,14 +2380,14 @@ nm_settings_class_init (NMSettingsClass *class) g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class), + &dbus_glib_nm_settings_object_info); + dbus_g_error_domain_register (NM_SETTINGS_ERROR, NM_DBUS_INTERFACE_SETTINGS, NM_TYPE_SETTINGS_ERROR); dbus_g_error_domain_register (NM_CONNECTION_ERROR, NM_DBUS_INTERFACE_SETTINGS_CONNECTION, NM_TYPE_CONNECTION_ERROR); - - dbus_g_object_type_install_info (NM_TYPE_SETTINGS, &dbus_glib_nm_settings_object_info); - } diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h index 2c163cb73d..f28d010bdf 100644 --- a/src/settings/nm-settings.h +++ b/src/settings/nm-settings.h @@ -28,8 +28,7 @@ #include -#include "nm-glib.h" -#include "nm-types.h" +#include "nm-exported-object.h" #define NM_TYPE_SETTINGS (nm_settings_get_type ()) #define NM_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS, NMSettings)) @@ -52,11 +51,11 @@ #define NM_SETTINGS_SIGNAL_AGENT_REGISTERED "agent-registered" struct _NMSettings { - GObject parent_instance; + NMExportedObject parent_instance; }; typedef struct { - GObjectClass parent_class; + NMExportedObjectClass parent_class; /* Signals */ void (*properties_changed) (NMSettings *self, GHashTable *properties); diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index cef69c13b2..4b968aa08d 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -98,7 +98,7 @@ static NMIfcfgConnection *update_connection (SCPluginIfcfg *plugin, static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class); -G_DEFINE_TYPE_EXTENDED (SCPluginIfcfg, sc_plugin_ifcfg, G_TYPE_OBJECT, 0, +G_DEFINE_TYPE_EXTENDED (SCPluginIfcfg, sc_plugin_ifcfg, NM_TYPE_EXPORTED_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE, system_config_interface_init)) @@ -897,8 +897,8 @@ sc_plugin_ifcfg_class_init (SCPluginIfcfgClass *req_class) NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES); - dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (req_class), - &dbus_glib_nm_ifcfg_rh_object_info); + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (req_class), + &dbus_glib_nm_ifcfg_rh_object_info); } static void diff --git a/src/settings/plugins/ifcfg-rh/plugin.h b/src/settings/plugins/ifcfg-rh/plugin.h index 2f757edff0..85eb1f7a8d 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.h +++ b/src/settings/plugins/ifcfg-rh/plugin.h @@ -24,7 +24,7 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include "nm-glib.h" +#include "nm-exported-object.h" #define SC_TYPE_PLUGIN_IFCFG (sc_plugin_ifcfg_get_type ()) #define SC_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IFCFG, SCPluginIfcfg)) @@ -37,11 +37,11 @@ typedef struct _SCPluginIfcfg SCPluginIfcfg; typedef struct _SCPluginIfcfgClass SCPluginIfcfgClass; struct _SCPluginIfcfg { - GObject parent; + NMExportedObject parent; }; struct _SCPluginIfcfgClass { - GObjectClass parent; + NMExportedObjectClass parent; }; GType sc_plugin_ifcfg_get_type (void); diff --git a/src/settings/plugins/ifnet/Makefile.am b/src/settings/plugins/ifnet/Makefile.am index b0cfd9a11e..e2dec3b6f6 100644 --- a/src/settings/plugins/ifnet/Makefile.am +++ b/src/settings/plugins/ifnet/Makefile.am @@ -13,6 +13,7 @@ AM_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) \ -DSYSCONFDIR=\"$(sysconfdir)\" -DSBINDIR=\"$(sbindir)\" diff --git a/src/settings/plugins/ifnet/tests/Makefile.am b/src/settings/plugins/ifnet/tests/Makefile.am index c41d4df94a..afb215bac8 100644 --- a/src/settings/plugins/ifnet/tests/Makefile.am +++ b/src/settings/plugins/ifnet/tests/Makefile.am @@ -15,6 +15,7 @@ AM_CPPFLAGS= \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(CHECK_CFLAGS) \ $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) \ $(CODE_COVERAGE_CFLAGS) \ -DTEST_IFNET_DIR=\"$(abs_srcdir)\" \ -DTEST_SCRATCH_DIR=\"$(abs_builddir)/\" \ diff --git a/src/settings/plugins/ifupdown/Makefile.am b/src/settings/plugins/ifupdown/Makefile.am index 0ca543e344..a67b96bd27 100644 --- a/src/settings/plugins/ifupdown/Makefile.am +++ b/src/settings/plugins/ifupdown/Makefile.am @@ -12,6 +12,7 @@ AM_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ -DSYSCONFDIR=\"$(sysconfdir)\" diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index 4db6fff1d2..29a0e9798f 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -32,7 +32,6 @@ #include "nm-vpn-connection.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" -#include "nm-dbus-manager.h" #include "nm-platform.h" #include "nm-logging.h" #include "nm-active-connection.h" @@ -2362,8 +2361,7 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), - G_TYPE_FROM_CLASS (object_class), + nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (connection_class), &dbus_glib_nm_vpn_connection_object_info); } From c1dd3b6eed11eaa30d4dd80d22845676e3ff8fec Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 3 Apr 2015 10:08:52 -0400 Subject: [PATCH 08/13] core: move D-Bus export/unexport into NMExportedObject Move D-Bus export/unexport handling into NMExportedObject and remove type-specific export/get_path methods (export paths are now specified at the class level, and NMExportedObject handles the counters for all exported types automatically). Since all exportable objects now use the same get_path() method, we can also add some helper methods to simplify get_property() implementations for object-path and object-path-array properties. --- src/NetworkManagerUtils.c | 43 ++++++++++ src/NetworkManagerUtils.h | 3 + src/devices/nm-device-bond.c | 8 +- src/devices/nm-device-bridge.c | 9 +- src/devices/nm-device-gre.c | 2 +- src/devices/nm-device-macvlan.c | 2 +- src/devices/nm-device-veth.c | 2 +- src/devices/nm-device-vlan.c | 2 +- src/devices/nm-device-vxlan.c | 2 +- src/devices/nm-device.c | 80 ++++------------- src/devices/nm-device.h | 3 - src/devices/team/nm-device-team.c | 8 +- src/devices/wifi/nm-device-olpc-mesh.c | 5 +- src/devices/wifi/nm-device-wifi.c | 35 ++++---- src/devices/wifi/nm-wifi-ap.c | 40 ++------- src/devices/wifi/nm-wifi-ap.h | 2 - src/devices/wwan/nm-modem.c | 1 - src/nm-active-connection.c | 33 ++------ src/nm-active-connection.h | 4 - src/nm-auth-utils.c | 1 - src/nm-dhcp4-config.c | 18 +--- src/nm-dhcp4-config.h | 2 - src/nm-dhcp6-config.c | 18 +--- src/nm-dhcp6-config.h | 2 - src/nm-dispatcher.c | 2 +- src/nm-exported-object.c | 113 ++++++++++++++++++++++++- src/nm-exported-object.h | 7 ++ src/nm-iface-helper.c | 6 ++ src/nm-ip4-config.c | 30 +------ src/nm-ip4-config.h | 4 - src/nm-ip6-config.c | 30 +------ src/nm-ip6-config.h | 4 - src/nm-manager.c | 64 ++++++-------- src/nm-policy.c | 9 +- src/nm-sleep-monitor-systemd.c | 1 - src/ppp-manager/nm-ppp-manager.c | 14 ++- src/settings/nm-agent-manager.c | 7 +- src/settings/nm-settings-connection.c | 8 +- src/settings/nm-settings.c | 12 +-- src/vpn-manager/nm-vpn-connection.c | 16 ++-- src/vpn-manager/nm-vpn-manager.c | 1 - 41 files changed, 304 insertions(+), 349 deletions(-) diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index d91a4e61b8..c866c5f496 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -2904,3 +2904,46 @@ nm_utils_setpgid (gpointer unused G_GNUC_UNUSED) pid = getpid (); setpgid (pid, pid); } + +/** + * nm_utils_g_value_set_object_path: + * @value: a #GValue, initialized to store an object path + * @object: (allow-none): an #NMExportedObject + * + * Sets @value to @object's object path. If @object is %NULL, or not + * exported, @value is set to "/". + */ +void +nm_utils_g_value_set_object_path (GValue *value, gpointer object) +{ + g_return_if_fail (!object || NM_IS_EXPORTED_OBJECT (object)); + + if (object && nm_exported_object_is_exported (object)) + g_value_set_boxed (value, nm_exported_object_get_path (object)); + else + g_value_set_boxed (value, "/"); +} + +/** + * nm_utils_g_value_set_object_path_array: + * @value: a #GValue, initialized to store an object path + * @objects: a #GSList of #NMExportedObjects + * + * Sets @value to an array of object paths of the objects in @objects. + */ +void +nm_utils_g_value_set_object_path_array (GValue *value, GSList *objects) +{ + GPtrArray *paths; + GSList *iter; + + paths = g_ptr_array_new (); + for (iter = objects; iter; iter = iter->next) { + NMExportedObject *object = iter->data; + + if (!nm_exported_object_is_exported (object)) + continue; + g_ptr_array_add (paths, g_strdup (nm_exported_object_get_path (object))); + } + g_value_take_boxed (value, paths); +} diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 47593fb87b..5cc34cdf69 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -262,4 +262,7 @@ gboolean nm_utils_get_testing_initialized (void); NMUtilsTestFlags nm_utils_get_testing (void); void _nm_utils_set_testing (NMUtilsTestFlags flags); +void nm_utils_g_value_set_object_path (GValue *value, gpointer object); +void nm_utils_g_value_set_object_path_array (GValue *value, GSList *objects); + #endif /* __NETWORKMANAGER_UTILS_H__ */ diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 734a84ea78..f00f618fa9 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -475,18 +475,14 @@ static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - GPtrArray *slaves; - GSList *list, *iter; + GSList *list; switch (prop_id) { break; case PROP_SLAVES: - slaves = g_ptr_array_new (); list = nm_device_master_get_slaves (NM_DEVICE (object)); - for (iter = list; iter; iter = iter->next) - g_ptr_array_add (slaves, g_strdup (nm_device_get_path (NM_DEVICE (iter->data)))); + nm_utils_g_value_set_object_path_array (value, list); g_slist_free (list); - g_value_take_boxed (value, slaves); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index a0b1e83cbb..cce97875d7 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -401,17 +401,14 @@ static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - GPtrArray *slaves; - GSList *list, *iter; + GSList *list; switch (prop_id) { + break; case PROP_SLAVES: - slaves = g_ptr_array_new (); list = nm_device_master_get_slaves (NM_DEVICE (object)); - for (iter = list; iter; iter = iter->next) - g_ptr_array_add (slaves, g_strdup (nm_device_get_path (NM_DEVICE (iter->data)))); + nm_utils_g_value_set_object_path_array (value, list); g_slist_free (list); - g_value_take_boxed (value, slaves); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/devices/nm-device-gre.c b/src/devices/nm-device-gre.c index 53f2901d97..9cda059603 100644 --- a/src/devices/nm-device-gre.c +++ b/src/devices/nm-device-gre.c @@ -136,7 +136,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_PARENT: parent = nm_manager_get_device_by_ifindex (nm_manager_get (), priv->props.parent_ifindex); - g_value_set_boxed (value, parent ? nm_device_get_path (parent) : "/"); + nm_utils_g_value_set_object_path (value, parent); break; case PROP_INPUT_FLAGS: g_value_set_uint (value, priv->props.input_flags); diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 42811f1a65..e2d256671e 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -114,7 +114,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_PARENT: parent = nm_manager_get_device_by_ifindex (nm_manager_get (), priv->props.parent_ifindex); - g_value_set_boxed (value, parent ? nm_device_get_path (parent) : "/"); + nm_utils_g_value_set_object_path (value, parent); break; case PROP_MODE: g_value_set_string (value, priv->props.mode); diff --git a/src/devices/nm-device-veth.c b/src/devices/nm-device-veth.c index 89ab4297f1..944e9da616 100644 --- a/src/devices/nm-device-veth.c +++ b/src/devices/nm-device-veth.c @@ -136,7 +136,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_PEER: peer = get_peer (self); - g_value_set_boxed (value, peer ? nm_device_get_path (peer) : "/"); + nm_utils_g_value_set_object_path (value, peer); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index a31eb77b87..511656ffe0 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -514,7 +514,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_PARENT: - g_value_set_boxed (value, priv->parent ? nm_device_get_path (priv->parent) : "/"); + nm_utils_g_value_set_object_path (value, priv->parent); break; case PROP_INT_PARENT_DEVICE: g_value_set_object (value, priv->parent); diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c index 50e698aded..072d019a62 100644 --- a/src/devices/nm-device-vxlan.c +++ b/src/devices/nm-device-vxlan.c @@ -156,7 +156,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_PARENT: parent = nm_manager_get_device_by_ifindex (nm_manager_get (), priv->props.parent_ifindex); - g_value_set_boxed (value, parent ? nm_device_get_path (parent) : "/"); + nm_utils_g_value_set_object_path (value, parent); break; case PROP_ID: g_value_set_uint (value, priv->props.id); diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 5097e44807..853ad638b3 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -45,7 +45,6 @@ #include "nm-rdisc.h" #include "nm-lndp-rdisc.h" #include "nm-dhcp-manager.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-activation-request.h" #include "nm-ip4-config.h" @@ -198,7 +197,6 @@ typedef struct { GSList *pending_actions; char * udi; - char * path; char * iface; /* may change, could be renamed by user */ int ifindex; char * ip_iface; @@ -512,31 +510,6 @@ nm_device_has_capability (NMDevice *self, NMDeviceCapabilities caps) /***********************************************************/ -void -nm_device_dbus_export (NMDevice *self) -{ - static guint32 devcount = 0; - NMDevicePrivate *priv; - - g_return_if_fail (NM_IS_DEVICE (self)); - - priv = NM_DEVICE_GET_PRIVATE (self); - g_return_if_fail (priv->path == NULL); - - priv->path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++); - _LOGD (LOGD_DEVICE, "exported as %s", priv->path); - - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); -} - -const char * -nm_device_get_path (NMDevice *self) -{ - g_return_val_if_fail (self != NULL, NULL); - - return NM_DEVICE_GET_PRIVATE (self)->path; -} - const char * nm_device_get_udi (NMDevice *self) { @@ -6388,25 +6361,23 @@ nm_device_set_ip4_config (NMDevice *self, nm_ip4_config_replace (old_config, new_config, &has_changes); if (has_changes) { _LOGD (LOGD_IP4, "update IP4Config instance (%s)", - nm_ip4_config_get_dbus_path (old_config)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); } } else { has_changes = TRUE; priv->ip4_config = g_object_ref (new_config); - if (success && !nm_ip4_config_get_dbus_path (new_config)) { - /* Export over D-Bus */ - nm_ip4_config_export (new_config); - } + if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config))) + nm_exported_object_export (NM_EXPORTED_OBJECT (new_config)); _LOGD (LOGD_IP4, "set IP4Config instance (%s)", - nm_ip4_config_get_dbus_path (new_config)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config))); } } else if (old_config) { has_changes = TRUE; priv->ip4_config = NULL; _LOGD (LOGD_IP4, "clear IP4Config instance (%s)", - nm_ip4_config_get_dbus_path (old_config)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); /* Device config is invalid if combined config is invalid */ g_clear_object (&priv->dev_ip4_config); } @@ -6523,25 +6494,23 @@ nm_device_set_ip6_config (NMDevice *self, nm_ip6_config_replace (old_config, new_config, &has_changes); if (has_changes) { _LOGD (LOGD_IP6, "update IP6Config instance (%s)", - nm_ip6_config_get_dbus_path (old_config)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); } } else { has_changes = TRUE; priv->ip6_config = g_object_ref (new_config); - if (success && !nm_ip6_config_get_dbus_path (new_config)) { - /* Export over D-Bus */ - nm_ip6_config_export (new_config); - } + if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config))) + nm_exported_object_export (NM_EXPORTED_OBJECT (new_config)); _LOGD (LOGD_IP6, "set IP6Config instance (%s)", - nm_ip6_config_get_dbus_path (new_config)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config))); } } else if (old_config) { has_changes = TRUE; priv->ip6_config = NULL; _LOGD (LOGD_IP6, "clear IP6Config instance (%s)", - nm_ip6_config_get_dbus_path (old_config)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config))); } nm_default_route_manager_ip6_update_default_route (nm_default_route_manager_get (), self); @@ -9157,7 +9126,6 @@ finalize (GObject *object) g_slist_free_full (priv->pending_actions, g_free); g_clear_pointer (&priv->physical_port_id, g_free); g_free (priv->udi); - g_free (priv->path); g_free (priv->iface); g_free (priv->ip_iface); g_free (priv->driver); @@ -9297,7 +9265,6 @@ get_property (GObject *object, guint prop_id, { NMDevice *self = NM_DEVICE (object); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - const char *ac_path = NULL; GPtrArray *array; GHashTableIter iter; NMConnection *connection; @@ -9340,28 +9307,16 @@ get_property (GObject *object, guint prop_id, g_value_set_uint (value, priv->mtu); break; case PROP_IP4_CONFIG: - if (ip_config_valid (priv->state) && priv->ip4_config) - g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->ip4_config : NULL); break; case PROP_DHCP4_CONFIG: - if (ip_config_valid (priv->state) && priv->dhcp4_config) - g_value_set_boxed (value, nm_dhcp4_config_get_dbus_path (priv->dhcp4_config)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->dhcp4_config : NULL); break; case PROP_IP6_CONFIG: - if (ip_config_valid (priv->state) && priv->ip6_config) - g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->ip6_config : NULL); break; case PROP_DHCP6_CONFIG: - if (ip_config_valid (priv->state) && priv->dhcp6_config) - g_value_set_boxed (value, nm_dhcp6_config_get_dbus_path (priv->dhcp6_config)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->dhcp6_config : NULL); break; case PROP_STATE: g_value_set_uint (value, priv->state); @@ -9371,9 +9326,7 @@ get_property (GObject *object, guint prop_id, dbus_g_type_struct_set (value, 0, priv->state, 1, priv->state_reason, G_MAXUINT); break; case PROP_ACTIVE_CONNECTION: - if (priv->act_request) - ac_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (priv->act_request)); - g_value_set_boxed (value, ac_path ? ac_path : "/"); + nm_utils_g_value_set_object_path (value, priv->act_request); break; case PROP_DEVICE_TYPE: g_value_set_uint (value, priv->type); @@ -9431,9 +9384,12 @@ static void nm_device_class_init (NMDeviceClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (klass); g_type_class_add_private (object_class, sizeof (NMDevicePrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/Devices/%u"; + /* Virtual methods */ object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 88c71b161e..c6d414bfdf 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -265,9 +265,6 @@ typedef void (*NMDeviceAuthRequestFunc) (NMDevice *device, GType nm_device_get_type (void); -const char * nm_device_get_path (NMDevice *dev); -void nm_device_dbus_export (NMDevice *device); - void nm_device_finish_init (NMDevice *device); const char * nm_device_get_udi (NMDevice *dev); diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 129f0bb26e..38c125db45 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -740,18 +740,14 @@ static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - GPtrArray *slaves; - GSList *list, *iter; + GSList *list; switch (prop_id) { break; case PROP_SLAVES: - slaves = g_ptr_array_new (); list = nm_device_master_get_slaves (NM_DEVICE (object)); - for (iter = list; iter; iter = iter->next) - g_ptr_array_add (slaves, g_strdup (nm_device_get_path (NM_DEVICE (iter->data)))); + nm_utils_g_value_set_object_path_array (value, list); g_slist_free (list); - g_value_take_boxed (value, slaves); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index cdc9606d61..ad401f5e52 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -475,10 +475,7 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_COMPANION: - if (priv->companion) - g_value_set_boxed (value, nm_device_get_path (priv->companion)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, priv->companion); break; case PROP_ACTIVE_CHANNEL: g_value_set_uint (value, nm_platform_mesh_get_channel (NM_PLATFORM_GET, nm_device_get_ifindex (NM_DEVICE (device)))); diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index c6e1fa749e..0c434bf462 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -381,7 +381,7 @@ set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap, gboolean recheck_avai if (force_remove_old_ap || mode == NM_802_11_MODE_ADHOC || mode == NM_802_11_MODE_AP || nm_ap_get_fake (old_ap)) { emit_ap_added_removed (self, ACCESS_POINT_REMOVED, old_ap, FALSE); - g_hash_table_remove (priv->aps, nm_ap_get_dbus_path (old_ap)); + g_hash_table_remove (priv->aps, nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_ap))); if (recheck_available_connections) nm_device_recheck_available_connections (NM_DEVICE (self)); } @@ -983,7 +983,7 @@ can_auto_connect (NMDevice *device, ap = find_first_compatible_ap (self, connection, FALSE); if (ap) { /* All good; connection is usable */ - *specific_object = (char *) nm_ap_get_dbus_path (ap); + *specific_object = (char *) nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)); return TRUE; } @@ -1025,7 +1025,7 @@ impl_device_get_access_points (NMDeviceWifi *self, NMAccessPoint *ap = NM_AP (iter->data); if (nm_ap_get_ssid (ap)) - g_ptr_array_add (*aps, g_strdup (nm_ap_get_dbus_path (ap))); + g_ptr_array_add (*aps, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)))); } g_slist_free (sorted); return TRUE; @@ -1041,7 +1041,7 @@ impl_device_get_all_access_points (NMDeviceWifi *self, *aps = g_ptr_array_new (); sorted = get_sorted_ap_list (self); for (iter = sorted; iter; iter = iter->next) - g_ptr_array_add (*aps, g_strdup (nm_ap_get_dbus_path (NM_AP (iter->data)))); + g_ptr_array_add (*aps, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data)))); g_slist_free (sorted); return TRUE; } @@ -1494,7 +1494,7 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface, NMAccessPoint *ap; NMAccessPoint *found_ap = NULL; const GByteArray *ssid; - const char *bssid; + const char *bssid, *ap_path; g_return_if_fail (self != NULL); g_return_if_fail (properties != NULL); @@ -1538,10 +1538,8 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface, nm_ap_update_from_properties (found_ap, object_path, properties); } else { nm_ap_dump (ap, "added ", nm_device_get_iface (NM_DEVICE (self))); - nm_ap_export_to_dbus (ap); - g_hash_table_insert (priv->aps, - (gpointer) nm_ap_get_dbus_path (ap), - g_object_ref (ap)); + ap_path = nm_exported_object_export (NM_EXPORTED_OBJECT (ap)); + g_hash_table_insert (priv->aps, (gpointer) ap_path, g_object_ref (ap)); emit_ap_added_removed (self, ACCESS_POINT_ADDED, ap, TRUE); } @@ -1606,7 +1604,7 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface, } else { nm_ap_dump (ap, "removed ", nm_device_get_iface (NM_DEVICE (self))); emit_ap_added_removed (self, ACCESS_POINT_REMOVED, ap, TRUE); - g_hash_table_remove (priv->aps, nm_ap_get_dbus_path (ap)); + g_hash_table_remove (priv->aps, nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap))); schedule_ap_list_dump (self); } } @@ -2302,7 +2300,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) } if (ap) { - nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), nm_ap_get_dbus_path (ap)); + nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), + nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap))); goto done; } @@ -2318,13 +2317,13 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) if (nm_ap_is_hotspot (ap)) nm_ap_set_address (ap, nm_device_get_hw_address (device)); - nm_ap_export_to_dbus (ap); - g_hash_table_insert (priv->aps, (gpointer) nm_ap_get_dbus_path (ap), ap); + ap_path = nm_exported_object_export (NM_EXPORTED_OBJECT (ap)); + g_hash_table_insert (priv->aps, (gpointer) ap_path, ap); g_object_freeze_notify (G_OBJECT (self)); set_current_ap (self, ap, FALSE, FALSE); emit_ap_added_removed (self, ACCESS_POINT_ADDED, ap, TRUE); g_object_thaw_notify (G_OBJECT (self)); - nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), nm_ap_get_dbus_path (ap)); + nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), ap_path); return NM_ACT_STAGE_RETURN_SUCCESS; done: @@ -2695,7 +2694,8 @@ activation_success_handler (NMDevice *device) nm_ap_set_max_bitrate (priv->current_ap, nm_platform_wifi_get_rate (NM_PLATFORM_GET, ifindex)); } - nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), nm_ap_get_dbus_path (priv->current_ap)); + nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), + nm_exported_object_get_path (NM_EXPORTED_OBJECT (priv->current_ap))); } periodic_update (self); @@ -2925,10 +2925,7 @@ get_property (GObject *object, guint prop_id, g_value_take_boxed (value, array); break; case PROP_ACTIVE_ACCESS_POINT: - if (priv->current_ap) - g_value_set_boxed (value, nm_ap_get_dbus_path (priv->current_ap)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, priv->current_ap); break; case PROP_SCANNING: g_value_set_boolean (value, nm_supplicant_interface_get_scanning (priv->sup_iface)); diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c index 804d3566a6..7166e1f8bd 100644 --- a/src/devices/wifi/nm-wifi-ap.c +++ b/src/devices/wifi/nm-wifi-ap.c @@ -30,7 +30,6 @@ #include "NetworkManagerUtils.h" #include "nm-utils.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" #include "nm-core-internal.h" #include "nm-setting-wireless.h" @@ -43,9 +42,7 @@ */ typedef struct { - char *dbus_path; char *supplicant_path; /* D-Bus object path of this AP from wpa_supplicant */ - guint32 id; /* ID for stable sorting of APs */ /* Scanned or cached values */ GByteArray * ssid; @@ -94,20 +91,13 @@ nm_ap_get_supplicant_path (NMAccessPoint *ap) return NM_AP_GET_PRIVATE (ap)->supplicant_path; } -const char * -nm_ap_get_dbus_path (NMAccessPoint *ap) -{ - g_return_val_if_fail (NM_IS_AP (ap), NULL); - - return NM_AP_GET_PRIVATE (ap)->dbus_path; -} - guint32 nm_ap_get_id (NMAccessPoint *ap) { g_return_val_if_fail (NM_IS_AP (ap), 0); + g_return_val_if_fail (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (ap)), 0); - return NM_AP_GET_PRIVATE (ap)->id; + return atoi (strrchr (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)), '/') + 1); } const GByteArray * nm_ap_get_ssid (const NMAccessPoint *ap) @@ -299,6 +289,7 @@ guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap) { g_return_val_if_fail (NM_IS_AP (ap), 0); + g_return_val_if_fail (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (ap)), 0); return NM_AP_GET_PRIVATE (ap)->max_bitrate; } @@ -876,32 +867,11 @@ nm_ap_complete_connection (NMAccessPoint *self, /*****************************************************************/ -void -nm_ap_export_to_dbus (NMAccessPoint *ap) -{ - NMAccessPointPrivate *priv; - static guint32 counter = 0; - - g_return_if_fail (NM_IS_AP (ap)); - - priv = NM_AP_GET_PRIVATE (ap); - - if (priv->dbus_path) { - nm_log_err (LOGD_CORE, "Tried to export AP %s twice.", priv->dbus_path); - return; - } - - priv->id = counter++; - priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_ACCESS_POINT "/%d", priv->id); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, ap); -} - static void nm_ap_init (NMAccessPoint *ap) { NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (ap); - priv->dbus_path = NULL; priv->mode = NM_802_11_MODE_INFRA; priv->flags = NM_802_11_AP_FLAGS_NONE; priv->wpa_flags = NM_802_11_AP_SEC_NONE; @@ -914,7 +884,6 @@ finalize (GObject *object) { NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (object); - g_free (priv->dbus_path); g_free (priv->supplicant_path); if (priv->ssid) g_byte_array_free (priv->ssid, TRUE); @@ -988,6 +957,7 @@ static void nm_ap_class_init (NMAccessPointClass *ap_class) { GObjectClass *object_class = G_OBJECT_CLASS (ap_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (ap_class); const NM80211ApSecurityFlags all_sec_flags = NM_802_11_AP_SEC_NONE | NM_802_11_AP_SEC_PAIR_WEP40 | NM_802_11_AP_SEC_PAIR_WEP104 @@ -1002,6 +972,8 @@ nm_ap_class_init (NMAccessPointClass *ap_class) g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate)); + exported_object_class->export_path = NM_DBUS_PATH_ACCESS_POINT "/%u"; + /* virtual methods */ object_class->set_property = set_property; object_class->get_property = get_property; diff --git a/src/devices/wifi/nm-wifi-ap.h b/src/devices/wifi/nm-wifi-ap.h index 3c8e2f009b..84aff983c2 100644 --- a/src/devices/wifi/nm-wifi-ap.h +++ b/src/devices/wifi/nm-wifi-ap.h @@ -58,7 +58,6 @@ GType nm_ap_get_type (void); NMAccessPoint * nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties); NMAccessPoint * nm_ap_new_fake_from_connection (NMConnection *connection); -void nm_ap_export_to_dbus (NMAccessPoint *ap); void nm_ap_update_from_properties (NMAccessPoint *ap, const char *supplicant_path, @@ -72,7 +71,6 @@ gboolean nm_ap_complete_connection (NMAccessPoint *self, gboolean lock_bssid, GError **error); -const char * nm_ap_get_dbus_path (NMAccessPoint *ap); const char * nm_ap_get_supplicant_path (NMAccessPoint *ap); guint32 nm_ap_get_id (NMAccessPoint *ap); const GByteArray *nm_ap_get_ssid (const NMAccessPoint *ap); diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index eeab0390e7..24b6b4160b 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -24,7 +24,6 @@ #include #include "nm-modem.h" #include "nm-platform.h" -#include "nm-dbus-manager.h" #include "nm-setting-connection.h" #include "nm-logging.h" #include "NetworkManagerUtils.h" diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 3ffe5359a4..e52b467136 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -27,7 +27,6 @@ #include "nm-dbus-interface.h" #include "nm-logging.h" #include "nm-dbus-glib-types.h" -#include "nm-dbus-manager.h" #include "nm-device.h" #include "nm-settings-connection.h" #include "nm-auth-utils.h" @@ -45,7 +44,6 @@ G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_EXPORT typedef struct { NMConnection *connection; - char *path; char *specific_object; NMDevice *device; @@ -228,7 +226,7 @@ nm_active_connection_set_connection (NMActiveConnection *self, NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); /* Can't change connection after the ActiveConnection is exported over D-Bus */ - g_return_if_fail (priv->path == NULL); + g_return_if_fail (!nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self))); g_return_if_fail (priv->connection == NULL || !NM_IS_SETTINGS_CONNECTION (priv->connection)); if (priv->connection) @@ -236,12 +234,6 @@ nm_active_connection_set_connection (NMActiveConnection *self, priv->connection = g_object_ref (connection); } -const char * -nm_active_connection_get_path (NMActiveConnection *self) -{ - return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->path; -} - const char * nm_active_connection_get_specific_object (NMActiveConnection *self) { @@ -317,18 +309,6 @@ nm_active_connection_get_default6 (NMActiveConnection *self) return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->is_default6; } -void -nm_active_connection_export (NMActiveConnection *self) -{ - NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); - static guint32 counter = 0; - - g_assert (priv->device || priv->vpn); - - priv->path = g_strdup_printf (NM_DBUS_PATH "/ActiveConnection/%d", counter++); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); -} - NMAuthSubject * nm_active_connection_get_subject (NMActiveConnection *self) { @@ -566,7 +546,7 @@ nm_active_connection_set_master (NMActiveConnection *self, NMActiveConnection *m /* Master is write-once, and must be set before exporting the object */ g_return_if_fail (priv->master == NULL); - g_return_if_fail (priv->path == NULL); + g_return_if_fail (!nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self))); if (priv->device) { /* Note, the master ActiveConnection may not yet have a device */ g_return_if_fail (priv->device != nm_active_connection_get_device (master)); @@ -792,7 +772,7 @@ get_property (GObject *object, guint prop_id, case PROP_DEVICES: devices = g_ptr_array_sized_new (1); if (priv->device && priv->state < NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) - g_ptr_array_add (devices, g_strdup (nm_device_get_path (priv->device))); + g_ptr_array_add (devices, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (priv->device)))); g_value_take_boxed (value, devices); break; case PROP_STATE: @@ -830,7 +810,7 @@ get_property (GObject *object, guint prop_id, case PROP_MASTER: if (priv->master) master_device = nm_active_connection_get_device (priv->master); - g_value_set_boxed (value, master_device ? nm_device_get_path (master_device) : "/"); + nm_utils_g_value_set_object_path (value, master_device); break; case PROP_INT_SUBJECT: g_value_set_object (value, priv->subject); @@ -874,8 +854,6 @@ dispose (GObject *object) priv->chain = NULL; } - g_free (priv->path); - priv->path = NULL; g_free (priv->specific_object); priv->specific_object = NULL; @@ -898,9 +876,12 @@ static void nm_active_connection_class_init (NMActiveConnectionClass *ac_class) { GObjectClass *object_class = G_OBJECT_CLASS (ac_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (ac_class); g_type_class_add_private (ac_class, sizeof (NMActiveConnectionPrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/ActiveConnection/%u"; + /* virtual methods */ object_class->get_property = get_property; object_class->set_property = set_property; diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index a483895ade..ccdc563f06 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -96,8 +96,6 @@ void nm_active_connection_authorize (NMActiveConnection *self, gpointer user_data1, gpointer user_data2); -void nm_active_connection_export (NMActiveConnection *self); - NMConnection *nm_active_connection_get_connection (NMActiveConnection *self); void nm_active_connection_set_connection (NMActiveConnection *self, @@ -109,8 +107,6 @@ const char * nm_active_connection_get_uuid (NMActiveConnection *self); const char * nm_active_connection_get_connection_type (NMActiveConnection *self); -const char * nm_active_connection_get_path (NMActiveConnection *self); - const char * nm_active_connection_get_specific_object (NMActiveConnection *self); void nm_active_connection_set_specific_object (NMActiveConnection *self, diff --git a/src/nm-auth-utils.c b/src/nm-auth-utils.c index 1a56f191a9..606f86c1ab 100644 --- a/src/nm-auth-utils.c +++ b/src/nm-auth-utils.c @@ -27,7 +27,6 @@ #include "nm-setting-connection.h" #include "nm-auth-utils.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" #include "nm-auth-subject.h" #include "nm-auth-manager.h" #include "nm-session-monitor.h" diff --git a/src/nm-dhcp4-config.c b/src/nm-dhcp4-config.c index 08b5911503..bc495589fe 100644 --- a/src/nm-dhcp4-config.c +++ b/src/nm-dhcp4-config.c @@ -24,7 +24,6 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" -#include "nm-dbus-manager.h" #include "nm-dhcp4-config.h" #include "nm-dhcp4-config-glue.h" #include "nm-dbus-glib-types.h" @@ -35,7 +34,6 @@ G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, NM_TYPE_EXPORTED_OBJECT) #define NM_DHCP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP4_CONFIG, NMDhcp4ConfigPrivate)) typedef struct { - char *dbus_path; GHashTable *options; } NMDhcp4ConfigPrivate; @@ -110,14 +108,6 @@ nm_dhcp4_config_list_options (NMDhcp4Config *self) return list; } -const char * -nm_dhcp4_config_get_dbus_path (NMDhcp4Config *self) -{ - g_return_val_if_fail (NM_IS_DHCP4_CONFIG (self), NULL); - - return NM_DHCP4_CONFIG_GET_PRIVATE (self)->dbus_path; -} - static void nm_gvalue_destroy (gpointer data) { @@ -131,10 +121,8 @@ static void nm_dhcp4_config_init (NMDhcp4Config *self) { NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self); - static guint32 counter = 0; - priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP4Config/%d", counter++); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, self); + nm_exported_object_export (NM_EXPORTED_OBJECT (self)); priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); } @@ -144,7 +132,6 @@ finalize (GObject *object) { NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object); - g_free (priv->dbus_path); g_hash_table_destroy (priv->options); G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->finalize (object); @@ -170,9 +157,12 @@ static void nm_dhcp4_config_class_init (NMDhcp4ConfigClass *config_class) { GObjectClass *object_class = G_OBJECT_CLASS (config_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class); g_type_class_add_private (config_class, sizeof (NMDhcp4ConfigPrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/DHCP4Config/%u"; + /* virtual methods */ object_class->get_property = get_property; object_class->finalize = finalize; diff --git a/src/nm-dhcp4-config.h b/src/nm-dhcp4-config.h index 29c3647ffa..8dabecc8c2 100644 --- a/src/nm-dhcp4-config.h +++ b/src/nm-dhcp4-config.h @@ -45,8 +45,6 @@ GType nm_dhcp4_config_get_type (void); NMDhcp4Config *nm_dhcp4_config_new (void); -const char *nm_dhcp4_config_get_dbus_path (NMDhcp4Config *config); - void nm_dhcp4_config_add_option (NMDhcp4Config *config, const char *key, const char *option); diff --git a/src/nm-dhcp6-config.c b/src/nm-dhcp6-config.c index e127443345..1d3168f28e 100644 --- a/src/nm-dhcp6-config.c +++ b/src/nm-dhcp6-config.c @@ -24,7 +24,6 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" -#include "nm-dbus-manager.h" #include "nm-dhcp6-config.h" #include "nm-dhcp6-config-glue.h" #include "nm-dbus-glib-types.h" @@ -35,7 +34,6 @@ G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, NM_TYPE_EXPORTED_OBJECT) #define NM_DHCP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP6_CONFIG, NMDhcp6ConfigPrivate)) typedef struct { - char *dbus_path; GHashTable *options; } NMDhcp6ConfigPrivate; @@ -110,14 +108,6 @@ nm_dhcp6_config_list_options (NMDhcp6Config *self) return list; } -const char * -nm_dhcp6_config_get_dbus_path (NMDhcp6Config *self) -{ - g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL); - - return NM_DHCP6_CONFIG_GET_PRIVATE (self)->dbus_path; -} - static void nm_gvalue_destroy (gpointer data) { @@ -131,10 +121,8 @@ static void nm_dhcp6_config_init (NMDhcp6Config *self) { NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self); - static guint32 counter = 0; - priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP6Config/%d", counter++); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, self); + nm_exported_object_export (NM_EXPORTED_OBJECT (self)); priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); } @@ -144,7 +132,6 @@ finalize (GObject *object) { NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object); - g_free (priv->dbus_path); g_hash_table_destroy (priv->options); G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->finalize (object); @@ -170,9 +157,12 @@ static void nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class) { GObjectClass *object_class = G_OBJECT_CLASS (config_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class); g_type_class_add_private (config_class, sizeof (NMDhcp6ConfigPrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/DHCP6Config/%u"; + /* virtual methods */ object_class->get_property = get_property; object_class->finalize = finalize; diff --git a/src/nm-dhcp6-config.h b/src/nm-dhcp6-config.h index e5688d06b5..f0b79cc6fc 100644 --- a/src/nm-dhcp6-config.h +++ b/src/nm-dhcp6-config.h @@ -45,8 +45,6 @@ GType nm_dhcp6_config_get_type (void); NMDhcp6Config *nm_dhcp6_config_new (void); -const char *nm_dhcp6_config_get_dbus_path (NMDhcp6Config *config); - void nm_dhcp6_config_add_option (NMDhcp6Config *config, const char *key, const char *option); diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index 36691eed24..c64c991188 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -275,7 +275,7 @@ fill_device_props (NMDevice *device, g_variant_builder_add (dev_builder, "{sv}", NMD_DEVICE_PROPS_STATE, g_variant_new_uint32 (nm_device_get_state (device))); g_variant_builder_add (dev_builder, "{sv}", NMD_DEVICE_PROPS_PATH, - g_variant_new_object_path (nm_device_get_path (device))); + g_variant_new_object_path (nm_exported_object_get_path (NM_EXPORTED_OBJECT (device)))); ip4_config = nm_device_get_ip4_config (device); if (ip4_config) diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c index c991b8b614..7fd6c623ea 100644 --- a/src/nm-exported-object.c +++ b/src/nm-exported-object.c @@ -24,11 +24,18 @@ #include "nm-exported-object.h" #include "nm-dbus-glib-types.h" +#include "nm-dbus-manager.h" #include "nm-logging.h" -G_DEFINE_ABSTRACT_TYPE (NMExportedObject, nm_exported_object, G_TYPE_OBJECT) +static GHashTable *prefix_counters; + +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (NMExportedObject, nm_exported_object, G_TYPE_OBJECT, + prefix_counters = g_hash_table_new (g_str_hash, g_str_equal); + ) typedef struct { + char *path; + GHashTable *pending_notifies; guint notify_idle_id; } NMExportedObjectPrivate; @@ -110,6 +117,107 @@ nm_exported_object_class_add_interface (NMExportedObjectClass *object_class, } } +/** + * nm_exported_object_export: + * @self: an #NMExportedObject + * + * Exports @self on all active and future D-Bus connections. + * + * The path to export @self on is taken from its #NMObjectClass's %export_path + * member. If the %export_path contains "%u", then it will be replaced with a + * monotonically increasing integer ID (with each distinct %export_path having + * its own counter). Otherwise, %export_path will be used literally (implying + * that @self must be a singleton). + * + * Returns: the path @self was exported under + */ +const char * +nm_exported_object_export (NMExportedObject *self) +{ + NMExportedObjectPrivate *priv; + const char *class_export_path, *p; + + g_return_val_if_fail (NM_IS_EXPORTED_OBJECT (self), NULL); + priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self); + + g_return_val_if_fail (priv->path == NULL, priv->path); + + class_export_path = NM_EXPORTED_OBJECT_GET_CLASS (self)->export_path; + p = strchr (class_export_path, '%'); + if (p) { + guint *counter; + + g_return_val_if_fail (p[1] == 'u', NULL); + g_return_val_if_fail (strchr (p + 1, '%') == NULL, NULL); + + counter = g_hash_table_lookup (prefix_counters, class_export_path); + if (!counter) { + counter = g_new0 (guint, 1); + g_hash_table_insert (prefix_counters, g_strdup (class_export_path), counter); + } + + priv->path = g_strdup_printf (class_export_path, (*counter)++); + } else + priv->path = g_strdup (class_export_path); + + nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); + + return priv->path; +} + +/** + * nm_exported_object_get_path: + * @self: an #NMExportedObject + * + * Gets @self's D-Bus path. + * + * Returns: @self's D-Bus path, or %NULL if @self is not exported. + */ +const char * +nm_exported_object_get_path (NMExportedObject *self) +{ + g_return_val_if_fail (NM_IS_EXPORTED_OBJECT (self), NULL); + + return NM_EXPORTED_OBJECT_GET_PRIVATE (self)->path; +} + +/** + * nm_exported_object_is_exported: + * @self: an #NMExportedObject + * + * Checks if @self is exported + * + * Returns: %TRUE if @self is exported + */ +gboolean +nm_exported_object_is_exported (NMExportedObject *self) +{ + g_return_val_if_fail (NM_IS_EXPORTED_OBJECT (self), FALSE); + + return NM_EXPORTED_OBJECT_GET_PRIVATE (self)->path != NULL; +} + +/** + * nm_exported_object_unexport: + * @self: an #NMExportedObject + * + * Unexports @self on all active D-Bus connections (and prevents it from being + * auto-exported on future connections). + */ +void +nm_exported_object_unexport (NMExportedObject *self) +{ + NMExportedObjectPrivate *priv; + + g_return_if_fail (NM_IS_EXPORTED_OBJECT (self)); + priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self); + + g_return_if_fail (priv->path != NULL); + + g_clear_pointer (&priv->path, g_free); + nm_dbus_manager_unregister_object (nm_dbus_manager_get (), self); +} + static void destroy_value (gpointer data) { @@ -211,6 +319,9 @@ nm_exported_object_dispose (GObject *object) { NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object); + if (priv->path) + nm_exported_object_unexport (NM_EXPORTED_OBJECT (object)); + g_hash_table_remove_all (priv->pending_notifies); nm_clear_g_source (&priv->notify_idle_id); diff --git a/src/nm-exported-object.h b/src/nm-exported-object.h index d9f4d28f53..ed67a6dbc8 100644 --- a/src/nm-exported-object.h +++ b/src/nm-exported-object.h @@ -41,6 +41,8 @@ typedef struct { typedef struct { GObjectClass parent; + + const char *export_path; } NMExportedObjectClass; GType nm_exported_object_get_type (void); @@ -48,6 +50,11 @@ GType nm_exported_object_get_type (void); void nm_exported_object_class_add_interface (NMExportedObjectClass *object_class, const DBusGObjectInfo *info); +const char *nm_exported_object_export (NMExportedObject *self); +const char *nm_exported_object_get_path (NMExportedObject *self); +gboolean nm_exported_object_is_exported (NMExportedObject *self); +void nm_exported_object_unexport (NMExportedObject *self); + G_END_DECLS #endif /* NM_EXPORTED_OBJECT_H */ diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 8fd57493ee..1302c070c0 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -507,6 +507,7 @@ gboolean nm_config_get_configure_and_quit (gpointer unused); gconstpointer nm_dbus_manager_get (void); void nm_dbus_manager_register_exported_type (gpointer unused, GType gtype, gconstpointer unused2); void nm_dbus_manager_register_object (gpointer unused, const char *path, gpointer object); +void nm_dbus_manager_unregister_object (gpointer unused, gpointer object); gconstpointer nm_config_get (void) @@ -542,3 +543,8 @@ nm_dbus_manager_register_object (gpointer unused, const char *path, gpointer obj { } +void +nm_dbus_manager_unregister_object (gpointer unused, gpointer object) +{ +} + diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index a30b5ea97a..389e99c662 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -28,7 +28,6 @@ #include "nm-utils.h" #include "nm-platform.h" -#include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" #include "nm-ip4-config-glue.h" #include "NetworkManagerUtils.h" @@ -42,8 +41,6 @@ G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_EXPORTED_OBJECT) #define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate)) typedef struct { - char *path; - gboolean never_default; guint32 gateway; gboolean has_gateway; @@ -96,26 +93,6 @@ nm_ip4_config_new (int ifindex) NULL); } -void -nm_ip4_config_export (NMIP4Config *config) -{ - NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); - static guint32 counter = 0; - - if (!priv->path) { - priv->path = g_strdup_printf (NM_DBUS_PATH "/IP4Config/%d", counter++); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, config); - } -} - -const char * -nm_ip4_config_get_dbus_path (const NMIP4Config *config) -{ - NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); - - return priv->path; -} - int nm_ip4_config_get_ifindex (const NMIP4Config *config) { @@ -1197,7 +1174,7 @@ nm_ip4_config_dump (const NMIP4Config *config, const char *detail) g_message ("--------- NMIP4Config %p (%s)", config, detail); - str = nm_ip4_config_get_dbus_path (config); + str = nm_exported_object_get_path (NM_EXPORTED_OBJECT (config)); if (str) g_message (" path: %s", str); @@ -2134,8 +2111,6 @@ finalize (GObject *object) { NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object); - g_free (priv->path); - g_array_unref (priv->addresses); g_array_unref (priv->routes); g_array_unref (priv->nameservers); @@ -2343,9 +2318,12 @@ static void nm_ip4_config_class_init (NMIP4ConfigClass *config_class) { GObjectClass *object_class = G_OBJECT_CLASS (config_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class); g_type_class_add_private (config_class, sizeof (NMIP4ConfigPrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/IP4Config/%u"; + object_class->get_property = get_property; object_class->set_property = set_property; object_class->finalize = finalize; diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index a5e30a7318..bffebe2cd8 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -63,10 +63,6 @@ NMIP4Config * nm_ip4_config_new (int ifindex); int nm_ip4_config_get_ifindex (const NMIP4Config *config); -/* D-Bus integration */ -void nm_ip4_config_export (NMIP4Config *config); -const char * nm_ip4_config_get_dbus_path (const NMIP4Config *config); - /* Integration with nm-platform and nm-setting */ NMIP4Config *nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf); gboolean nm_ip4_config_commit (const NMIP4Config *config, int ifindex, gboolean routes_full_sync, gint64 default_route_metric); diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index 7ac436500e..1206da87c5 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -29,7 +29,6 @@ #include "nm-utils.h" #include "nm-platform.h" -#include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" #include "nm-ip6-config-glue.h" #include "nm-route-manager.h" @@ -41,8 +40,6 @@ G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, NM_TYPE_EXPORTED_OBJECT) #define NM_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP6_CONFIG, NMIP6ConfigPrivate)) typedef struct { - char *path; - gboolean never_default; struct in6_addr gateway; GArray *addresses; @@ -85,26 +82,6 @@ nm_ip6_config_new (int ifindex) NULL); } -void -nm_ip6_config_export (NMIP6Config *config) -{ - NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); - static guint32 counter = 0; - - if (!priv->path) { - priv->path = g_strdup_printf (NM_DBUS_PATH "/IP6Config/%d", counter++); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, config); - } -} - -const char * -nm_ip6_config_get_dbus_path (const NMIP6Config *config) -{ - NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); - - return priv->path; -} - int nm_ip6_config_get_ifindex (const NMIP6Config *config) { @@ -1167,7 +1144,7 @@ nm_ip6_config_dump (const NMIP6Config *config, const char *detail) g_message ("--------- NMIP6Config %p (%s)", config, detail); - str = nm_ip6_config_get_dbus_path (config); + str = nm_exported_object_get_path (NM_EXPORTED_OBJECT (config)); if (str) g_message (" path: %s", str); @@ -1892,8 +1869,6 @@ finalize (GObject *object) { NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object); - g_free (priv->path); - g_array_unref (priv->addresses); g_array_unref (priv->routes); g_array_unref (priv->nameservers); @@ -2152,9 +2127,12 @@ static void nm_ip6_config_class_init (NMIP6ConfigClass *config_class) { GObjectClass *object_class = G_OBJECT_CLASS (config_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class); g_type_class_add_private (config_class, sizeof (NMIP6ConfigPrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/IP6Config/%u"; + /* virtual methods */ object_class->get_property = get_property; object_class->set_property = set_property; diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h index 5404913494..98a21e5c8f 100644 --- a/src/nm-ip6-config.h +++ b/src/nm-ip6-config.h @@ -64,10 +64,6 @@ NMIP6Config * nm_ip6_config_new (int ifindex); int nm_ip6_config_get_ifindex (const NMIP6Config *config); -/* D-Bus integration */ -void nm_ip6_config_export (NMIP6Config *config); -const char * nm_ip6_config_get_dbus_path (const NMIP6Config *config); - /* Integration with nm-platform and nm-setting */ NMIP6Config *nm_ip6_config_capture (int ifindex, gboolean capture_resolv_conf, NMSettingIP6ConfigPrivacy use_temporary); gboolean nm_ip6_config_commit (const NMIP6Config *config, int ifindex, gboolean routes_full_sync); diff --git a/src/nm-manager.c b/src/nm-manager.c index 96ec61ec33..a5983a3480 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -253,7 +253,7 @@ static gboolean active_connection_remove (NMManager *self, NMActiveConnection *active) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); - gboolean notify = !!nm_active_connection_get_path (active); + gboolean notify = nm_exported_object_is_exported (NM_EXPORTED_OBJECT (active)); GSList *found; /* FIXME: switch to a GList for faster removal */ @@ -375,7 +375,7 @@ active_connection_add (NMManager *self, NMActiveConnection *active) g_signal_emit (self, signals[ACTIVE_CONNECTION_ADDED], 0, active); /* Only notify D-Bus if the active connection is actually exported */ - if (nm_active_connection_get_path (active)) + if (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (active))) g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); } @@ -446,7 +446,7 @@ active_connection_get_by_path (NMManager *manager, const char *path) for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { NMActiveConnection *candidate = iter->data; - if (g_strcmp0 (path, nm_active_connection_get_path (candidate)) == 0) + if (g_strcmp0 (path, nm_exported_object_get_path (NM_EXPORTED_OBJECT (candidate))) == 0) return candidate; } return NULL; @@ -474,7 +474,7 @@ nm_manager_get_device_by_path (NMManager *manager, const char *path) g_return_val_if_fail (path != NULL, NULL); for (iter = NM_MANAGER_GET_PRIVATE (manager)->devices; iter; iter = iter->next) { - if (!strcmp (nm_device_get_path (NM_DEVICE (iter->data)), path)) + if (!strcmp (nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data)), path)) return NM_DEVICE (iter->data); } return NULL; @@ -832,7 +832,7 @@ remove_device (NMManager *manager, g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES); nm_device_removed (device); - nm_dbus_manager_unregister_object (priv->dbus_mgr, device); + nm_exported_object_unexport (NM_EXPORTED_OBJECT (device)); g_object_unref (device); check_if_startup_complete (manager); @@ -1597,7 +1597,7 @@ assume_connection (NMManager *self, NMDevice *device, NMConnection *connection) nm_active_connection_set_master (active, master_ac); nm_active_connection_set_assumed (active, TRUE); - nm_active_connection_export (active); + nm_exported_object_export (NM_EXPORTED_OBJECT (active)); active_connection_add (self, active); nm_device_queue_activation (device, NM_ACT_REQUEST (active)); g_object_unref (active); @@ -1719,6 +1719,7 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume) GSList *iter, *remove = NULL; gboolean connection_assumed = FALSE; int ifindex; + const char *dbus_path; /* No duplicates */ ifindex = nm_device_get_ifindex (device); @@ -1800,7 +1801,9 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume) sleeping = manager_sleeping (self); nm_device_set_initial_unmanaged_flag (device, NM_UNMANAGED_INTERNAL, sleeping); - nm_device_dbus_export (device); + dbus_path = nm_exported_object_export (NM_EXPORTED_OBJECT (device)); + nm_log_dbg (LOGD_DEVICE, "(%s): exported as %s", nm_device_get_iface (device), dbus_path); + nm_device_finish_init (device); if (try_assume) { @@ -2050,8 +2053,7 @@ impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err) *devices = g_ptr_array_sized_new (g_slist_length (priv->devices)); for (iter = priv->devices; iter; iter = iter->next) - g_ptr_array_add (*devices, g_strdup (nm_device_get_path (NM_DEVICE (iter->data)))); - + g_ptr_array_add (*devices, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data)))); return TRUE; } @@ -2066,7 +2068,7 @@ impl_manager_get_device_by_ip_iface (NMManager *self, device = find_device_by_ip_iface (self, iface); if (device) { - path = nm_device_get_path (device); + path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (device)); if (path) *out_object_path = g_strdup (path); } @@ -2537,7 +2539,7 @@ _internal_activate_vpn (NMManager *self, NMActiveConnection *active, GError **er NM_VPN_CONNECTION (active), error); if (success) { - nm_active_connection_export (active); + nm_exported_object_export (NM_EXPORTED_OBJECT (active)); g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); } return success; @@ -2707,7 +2709,7 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError * nm_device_steal_connection (existing, connection); /* Export the new ActiveConnection to clients and start it on the device */ - nm_active_connection_export (active); + nm_exported_object_export (NM_EXPORTED_OBJECT (active)); g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); nm_device_queue_activation (device, NM_ACT_REQUEST (active)); return TRUE; @@ -2787,7 +2789,7 @@ _new_vpn_active_connection (NMManager *self, return (NMActiveConnection *) nm_vpn_connection_new (connection, device, - nm_active_connection_get_path (parent), + nm_exported_object_get_path (NM_EXPORTED_OBJECT (parent)), subject); } @@ -3072,7 +3074,7 @@ _activation_auth_done (NMActiveConnection *active, if (success) { if (_internal_activate_generic (self, active, &error)) { - dbus_g_method_return (context, nm_active_connection_get_path (active)); + dbus_g_method_return (context, nm_exported_object_get_path (NM_EXPORTED_OBJECT (active))); g_object_unref (active); return; } @@ -3225,7 +3227,7 @@ activation_add_done (NMSettings *self, NULL, NULL); dbus_g_method_return (context, nm_connection_get_path (NM_CONNECTION (new_connection)), - nm_active_connection_get_path (info->active)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (info->active))); goto done; } error = local; @@ -3494,7 +3496,7 @@ impl_manager_deactivate_connection (NMManager *self, for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { NMActiveConnection *ac = iter->data; - if (g_strcmp0 (nm_active_connection_get_path (ac), active_path) == 0) { + if (g_strcmp0 (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ac)), active_path) == 0) { connection = nm_active_connection_get_connection (ac); break; } @@ -4751,7 +4753,7 @@ nm_manager_new (NMSettings *settings, g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, G_CALLBACK (connection_changed), singleton); - nm_dbus_manager_register_object (priv->dbus_mgr, NM_DBUS_PATH, singleton); + nm_exported_object_export (NM_EXPORTED_OBJECT (singleton)); g_signal_connect (nm_platform_get (), NM_PLATFORM_SIGNAL_LINK_CHANGED, @@ -4867,9 +4869,6 @@ get_property (GObject *object, guint prop_id, { NMManager *self = NM_MANAGER (object); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); - GSList *iter; - GPtrArray *array; - const char *path; const char *type; switch (prop_id) { @@ -4905,28 +4904,20 @@ get_property (GObject *object, guint prop_id, g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WIMAX].hw_enabled); break; case PROP_ACTIVE_CONNECTIONS: - array = g_ptr_array_sized_new (3); - for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { - path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (iter->data)); - if (path) - g_ptr_array_add (array, g_strdup (path)); - } - g_value_take_boxed (value, array); + nm_utils_g_value_set_object_path_array (value, priv->active_connections); break; case PROP_CONNECTIVITY: g_value_set_uint (value, nm_connectivity_get_state (priv->connectivity)); break; case PROP_PRIMARY_CONNECTION: - path = priv->primary_connection ? nm_active_connection_get_path (priv->primary_connection) : NULL; - g_value_set_boxed (value, path ? path : "/"); + nm_utils_g_value_set_object_path (value, priv->primary_connection); break; case PROP_PRIMARY_CONNECTION_TYPE: type = priv->primary_connection ? nm_active_connection_get_connection_type (priv->primary_connection) : NULL; g_value_set_string (value, type ? type : ""); break; case PROP_ACTIVATING_CONNECTION: - path = priv->activating_connection ? nm_active_connection_get_path (priv->activating_connection) : NULL; - g_value_set_boxed (value, path ? path : "/"); + nm_utils_g_value_set_object_path (value, priv->activating_connection); break; case PROP_HOSTNAME: g_value_set_string (value, priv->hostname); @@ -4935,13 +4926,7 @@ get_property (GObject *object, guint prop_id, g_value_set_boolean (value, priv->sleeping); break; case PROP_DEVICES: - array = g_ptr_array_sized_new (5); - for (iter = priv->devices; iter; iter = g_slist_next (iter)) { - path = nm_device_get_path (NM_DEVICE (iter->data)); - if (path) - g_ptr_array_add (array, g_strdup (path)); - } - g_value_take_boxed (value, array); + nm_utils_g_value_set_object_path_array (value, priv->devices); break; case PROP_METERED: g_value_set_uint (value, priv->metered); @@ -5086,9 +5071,12 @@ static void nm_manager_class_init (NMManagerClass *manager_class) { GObjectClass *object_class = G_OBJECT_CLASS (manager_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (manager_class); g_type_class_add_private (manager_class, sizeof (NMManagerPrivate)); + exported_object_class->export_path = NM_DBUS_PATH; + /* virtual methods */ object_class->set_property = set_property; object_class->get_property = get_property; diff --git a/src/nm-policy.c b/src/nm-policy.c index ef8239aa35..2f924ee664 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -34,7 +34,6 @@ #include "nm-logging.h" #include "nm-device.h" #include "nm-default-route-manager.h" -#include "nm-dbus-manager.h" #include "nm-setting-ip4-config.h" #include "nm-setting-connection.h" #include "nm-platform.h" @@ -770,7 +769,7 @@ process_secondaries (NMPolicy *policy, if (connected) { nm_log_dbg (LOGD_DEVICE, "Secondary connection '%s' SUCCEEDED; active path '%s'", nm_active_connection_get_id (active), - nm_active_connection_get_path (active)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (active))); /* Secondary connection activated */ secondary_data->secondaries = g_slist_remove (secondary_data->secondaries, secondary_active); @@ -786,7 +785,7 @@ process_secondaries (NMPolicy *policy, } else { nm_log_dbg (LOGD_DEVICE, "Secondary connection '%s' FAILED; active path '%s'", nm_active_connection_get_id (active), - nm_active_connection_get_path (active)); + nm_exported_object_get_path (NM_EXPORTED_OBJECT (active))); /* Secondary connection failed -> do not watch other connections */ priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data); @@ -1063,7 +1062,7 @@ activate_secondary_connections (NMPolicy *policy, nm_connection_get_id (connection), nm_connection_get_uuid (connection)); ac = nm_manager_activate_connection (priv->manager, NM_CONNECTION (settings_con), - nm_active_connection_get_path (NM_ACTIVE_CONNECTION (req)), + nm_exported_object_get_path (NM_EXPORTED_OBJECT (req)), device, nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (req)), &error); @@ -1686,7 +1685,7 @@ _deactivate_if_active (NMManager *manager, NMConnection *connection) if (nm_active_connection_get_connection (ac) == connection && (state <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) { if (!nm_manager_deactivate_connection (manager, - nm_active_connection_get_path (ac), + nm_exported_object_get_path (NM_EXPORTED_OBJECT (ac)), NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, &error)) { nm_log_warn (LOGD_DEVICE, "Connection '%s' disappeared, but error deactivating it: (%d) %s", diff --git a/src/nm-sleep-monitor-systemd.c b/src/nm-sleep-monitor-systemd.c index 1dd6ae4605..175c0c1233 100644 --- a/src/nm-sleep-monitor-systemd.c +++ b/src/nm-sleep-monitor-systemd.c @@ -27,7 +27,6 @@ #include "nm-glib.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" #include "nm-core-internal.h" #include "NetworkManagerUtils.h" diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 0a45dd1542..bd720950ee 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -75,7 +75,6 @@ static void _ppp_kill (NMPPPManager *manager); typedef struct { GPid pid; - char *dbus_path; char *parent_iface; @@ -123,13 +122,7 @@ nm_ppp_manager_init (NMPPPManager *manager) static void constructed (GObject *object) { - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object); - DBusGConnection *connection; - static guint32 counter = 0; - - priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/PPP/%d", counter++); - connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ()); - dbus_g_connection_register_g_object (connection, priv->dbus_path, object); + nm_exported_object_export (NM_EXPORTED_OBJECT (object)); G_OBJECT_CLASS (nm_ppp_manager_parent_class)->constructed (object); } @@ -618,9 +611,12 @@ static void nm_ppp_manager_class_init (NMPPPManagerClass *manager_class) { GObjectClass *object_class = G_OBJECT_CLASS (manager_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (manager_class); g_type_class_add_private (manager_class, sizeof (NMPPPManagerPrivate)); + exported_object_class->export_path = NM_DBUS_PATH "/PPP"; + object_class->constructed = constructed; object_class->dispose = dispose; object_class->finalize = finalize; @@ -1001,7 +997,7 @@ create_pppd_cmd_line (NMPPPManager *self, nm_cmd_line_add_int (cmd, 0); nm_cmd_line_add_string (cmd, "ipparam"); - nm_cmd_line_add_string (cmd, priv->dbus_path); + nm_cmd_line_add_string (cmd, nm_exported_object_get_path (NM_EXPORTED_OBJECT (self))); nm_cmd_line_add_string (cmd, "plugin"); nm_cmd_line_add_string (cmd, NM_PPPD_PLUGIN); diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index f41c49636a..0293d783d1 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -1553,7 +1553,7 @@ constructed (GObject *object) priv->dbus_mgr = g_object_ref (nm_dbus_manager_get ()); priv->auth_mgr = g_object_ref (nm_auth_manager_get ()); - nm_dbus_manager_register_object (priv->dbus_mgr, NM_DBUS_PATH_AGENT_MANAGER, object); + nm_exported_object_export (NM_EXPORTED_OBJECT (object)); g_signal_connect (priv->dbus_mgr, NM_DBUS_MANAGER_NAME_OWNER_CHANGED, @@ -1593,7 +1593,7 @@ dispose (GObject *object) g_signal_handlers_disconnect_by_func (priv->dbus_mgr, G_CALLBACK (name_owner_changed_cb), object); - nm_dbus_manager_unregister_object (priv->dbus_mgr, object); + nm_exported_object_unexport (NM_EXPORTED_OBJECT (object)); g_clear_object (&priv->dbus_mgr); } @@ -1604,9 +1604,12 @@ static void nm_agent_manager_class_init (NMAgentManagerClass *agent_manager_class) { GObjectClass *object_class = G_OBJECT_CLASS (agent_manager_class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (agent_manager_class); g_type_class_add_private (agent_manager_class, sizeof (NMAgentManagerPrivate)); + exported_object_class->export_path = NM_DBUS_PATH_AGENT_MANAGER; + /* virtual methods */ object_class->constructed = constructed; object_class->dispose = dispose; diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index f8b2ad1dc4..a417563d2c 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -29,7 +29,6 @@ #include "nm-glib.h" #include "nm-settings-connection.h" #include "nm-session-monitor.h" -#include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" #include "nm-logging.h" #include "nm-auth-utils.h" @@ -1790,10 +1789,10 @@ nm_settings_connection_signal_remove (NMSettingsConnection *self) /* Emit removed first */ g_signal_emit_by_name (self, NM_SETTINGS_CONNECTION_REMOVED); - /* And unregistered last to ensure the removed signal goes out before + /* And unregister last to ensure the removed signal goes out before * we take the connection off the bus. */ - nm_dbus_manager_unregister_object (nm_dbus_manager_get (), G_OBJECT (self)); + nm_exported_object_unexport (NM_EXPORTED_OBJECT (self)); } gboolean @@ -2430,9 +2429,12 @@ static void nm_settings_connection_class_init (NMSettingsConnectionClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (class); g_type_class_add_private (class, sizeof (NMSettingsConnectionPrivate)); + exported_object_class->export_path = NM_DBUS_PATH_SETTINGS "/%u"; + /* Virtual methods */ object_class->constructed = constructed; object_class->dispose = dispose; diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 7dd2e694c7..663898a421 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -973,11 +973,10 @@ static void claim_connection (NMSettings *self, NMSettingsConnection *connection) { NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); - static guint32 ec_counter = 0; GError *error = NULL; GHashTableIter iter; gpointer data; - char *path; + const char *path; NMSettingsConnection *existing; g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection)); @@ -1043,10 +1042,8 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection) /* Export the connection over D-Bus */ g_warn_if_fail (nm_connection_get_path (NM_CONNECTION (connection)) == NULL); - path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++); + path = nm_exported_object_export (NM_EXPORTED_OBJECT (connection)); nm_connection_set_path (NM_CONNECTION (connection), path); - nm_dbus_manager_register_object (priv->dbus_mgr, path, G_OBJECT (connection)); - g_free (path); g_hash_table_insert (priv->connections, (gpointer) nm_connection_get_path (NM_CONNECTION (connection)), @@ -2141,7 +2138,7 @@ nm_settings_new (GError **error) if (!priv->hostname.hostnamed_proxy) setup_hostname_file_monitors (self); - nm_dbus_manager_register_object (priv->dbus_mgr, NM_DBUS_PATH_SETTINGS, self); + nm_exported_object_export (NM_EXPORTED_OBJECT (self)); return self; } @@ -2279,9 +2276,12 @@ static void nm_settings_class_init (NMSettingsClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); + NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (class); g_type_class_add_private (class, sizeof (NMSettingsPrivate)); + exported_object_class->export_path = NM_DBUS_PATH_SETTINGS; + /* virtual methods */ object_class->get_property = get_property; object_class->dispose = dispose; diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index 29a0e9798f..680fccbd46 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1360,7 +1360,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict) g_clear_object (&priv->ip4_config); priv->ip4_config = config; - nm_ip4_config_export (config); + nm_exported_object_export (NM_EXPORTED_OBJECT (config)); g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG); nm_vpn_connection_config_maybe_complete (self, TRUE); } @@ -1497,7 +1497,7 @@ next: g_clear_object (&priv->ip6_config); priv->ip6_config = config; - nm_ip6_config_export (config); + nm_exported_object_export (NM_EXPORTED_OBJECT (config)); g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG); nm_vpn_connection_config_maybe_complete (self, TRUE); } @@ -2278,20 +2278,14 @@ get_property (GObject *object, guint prop_id, g_value_set_string (value, priv->banner ? priv->banner : ""); break; case PROP_IP4_CONFIG: - if (ip_config_valid (priv->vpn_state) && priv->ip4_config) - g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip4_config : NULL); break; case PROP_IP6_CONFIG: - if (ip_config_valid (priv->vpn_state) && priv->ip6_config) - g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config)); - else - g_value_set_boxed (value, "/"); + nm_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip6_config : NULL); break; case PROP_MASTER: parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object)); - g_value_set_boxed (value, parent_dev ? nm_device_get_path (parent_dev) : "/"); + nm_utils_g_value_set_object_path (value, parent_dev); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/vpn-manager/nm-vpn-manager.c b/src/vpn-manager/nm-vpn-manager.c index d3f959c54e..2a6f48b79c 100644 --- a/src/vpn-manager/nm-vpn-manager.c +++ b/src/vpn-manager/nm-vpn-manager.c @@ -28,7 +28,6 @@ #include "nm-vpn-service.h" #include "nm-vpn-connection.h" #include "nm-setting-vpn.h" -#include "nm-dbus-manager.h" #include "nm-vpn-dbus-interface.h" #include "nm-enum-types.h" #include "nm-logging.h" From 94078a139a4353518875aade615b087f546310af Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 7 Apr 2015 13:20:20 -0400 Subject: [PATCH 09/13] core: port NMDhcp4Config/NMDhcp6Config to GVariant In the gdbus port, the :options properties will be GVariant-valued (and thus immutable), so having APIs that let you repeatedly modify them would make things complicated. Since we actually only ever set all the options at once, just change the APIs to do that, rather than setting the options one-by-one. Since nm-dispatcher already works in terms of GVariant, it makes things simpler there if NMDhcp[46]Config can return its options as a GVariant. And since we'll need it to be a GVariant internally later anyway, just port everything to GVariant now, and convert it to a GHashTable for dbus-glib only in get_property(). --- src/devices/nm-device.c | 38 +++----------------- src/nm-dhcp4-config.c | 77 +++++++++++++++++------------------------ src/nm-dhcp4-config.h | 9 ++--- src/nm-dhcp6-config.c | 77 +++++++++++++++++------------------------ src/nm-dhcp6-config.h | 9 ++--- src/nm-dispatcher.c | 66 +++++++++++------------------------ 6 files changed, 94 insertions(+), 182 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 853ad638b3..271201444f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3417,22 +3417,6 @@ dhcp4_fail (NMDevice *self, gboolean timeout) g_warn_if_reached (); } -static void -dhcp4_update_config (NMDevice *self, NMDhcp4Config *config, GHashTable *options) -{ - GHashTableIter iter; - const char *key, *value; - - /* Update the DHCP4 config object with new DHCP options */ - nm_dhcp4_config_reset (config); - - g_hash_table_iter_init (&iter, options); - while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) - nm_dhcp4_config_add_option (config, key, value); - - g_object_notify (G_OBJECT (self), NM_DEVICE_DHCP4_CONFIG); -} - static void dhcp4_state_changed (NMDhcpClient *client, NMDhcpState state, @@ -3458,7 +3442,8 @@ dhcp4_state_changed (NMDhcpClient *client, break; } - dhcp4_update_config (self, priv->dhcp4_config, options); + nm_dhcp4_config_set_options (priv->dhcp4_config, options); + g_object_notify (G_OBJECT (self), NM_DEVICE_DHCP4_CONFIG); if (priv->ip4_state == IP_CONF) nm_device_activate_schedule_ip4_config_result (self, ip4_config); @@ -4073,22 +4058,6 @@ dhcp6_timeout (NMDevice *self, NMDhcpClient *client) } } -static void -dhcp6_update_config (NMDevice *self, NMDhcp6Config *config, GHashTable *options) -{ - GHashTableIter iter; - const char *key, *value; - - /* Update the DHCP6 config object with new DHCP options */ - nm_dhcp6_config_reset (config); - - g_hash_table_iter_init (&iter, options); - while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) - nm_dhcp6_config_add_option (config, key, value); - - g_object_notify (G_OBJECT (self), NM_DEVICE_DHCP6_CONFIG); -} - static void dhcp6_state_changed (NMDhcpClient *client, NMDhcpState state, @@ -4109,7 +4078,8 @@ dhcp6_state_changed (NMDhcpClient *client, g_clear_object (&priv->dhcp6_ip6_config); if (ip6_config) { priv->dhcp6_ip6_config = g_object_ref (ip6_config); - dhcp6_update_config (self, priv->dhcp6_config, options); + nm_dhcp6_config_set_options (priv->dhcp6_config, options); + g_object_notify (G_OBJECT (self), NM_DEVICE_DHCP6_CONFIG); } if (priv->ip6_state == IP_CONF) { diff --git a/src/nm-dhcp4-config.c b/src/nm-dhcp4-config.c index bc495589fe..d2d93d31fd 100644 --- a/src/nm-dhcp4-config.c +++ b/src/nm-dhcp4-config.c @@ -34,7 +34,7 @@ G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, NM_TYPE_EXPORTED_OBJECT) #define NM_DHCP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP4_CONFIG, NMDhcp4ConfigPrivate)) typedef struct { - GHashTable *options; + GVariant *options; } NMDhcp4ConfigPrivate; @@ -53,68 +53,50 @@ nm_dhcp4_config_new (void) } void -nm_dhcp4_config_add_option (NMDhcp4Config *self, - const char *key, - const char *option) +nm_dhcp4_config_set_options (NMDhcp4Config *self, + GHashTable *options) { - GValue *svalue; + NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self); + GHashTableIter iter; + const char *key, *value; + GVariantBuilder builder; g_return_if_fail (NM_IS_DHCP4_CONFIG (self)); - g_return_if_fail (key != NULL); - g_return_if_fail (option != NULL); + g_return_if_fail (options != NULL); - svalue = g_slice_new0 (GValue); - g_value_init (svalue, G_TYPE_STRING); - g_value_set_string (svalue, option); - g_hash_table_insert (NM_DHCP4_CONFIG_GET_PRIVATE (self)->options, g_strdup (key), svalue); - g_object_notify (G_OBJECT (self), NM_DHCP4_CONFIG_OPTIONS); -} + g_variant_unref (priv->options); -void -nm_dhcp4_config_reset (NMDhcp4Config *self) -{ - g_return_if_fail (NM_IS_DHCP4_CONFIG (self)); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_hash_table_iter_init (&iter, options); + while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) + g_variant_builder_add (&builder, "{sv}", key, g_variant_new_string (value)); - g_hash_table_remove_all (NM_DHCP4_CONFIG_GET_PRIVATE (self)->options); + priv->options = g_variant_builder_end (&builder); + g_variant_ref_sink (priv->options); g_object_notify (G_OBJECT (self), NM_DHCP4_CONFIG_OPTIONS); } const char * nm_dhcp4_config_get_option (NMDhcp4Config *self, const char *key) { - GValue *value; + NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self); + const char *value; g_return_val_if_fail (NM_IS_DHCP4_CONFIG (self), NULL); g_return_val_if_fail (key != NULL, NULL); - value = g_hash_table_lookup (NM_DHCP4_CONFIG_GET_PRIVATE (self)->options, key); - return value ? g_value_get_string (value) : NULL; + if (g_variant_lookup (priv->options, key, "&s", &value)) + return value; + else + return NULL; } -/* Caller owns the list, but not the values in the list */ -GSList * -nm_dhcp4_config_list_options (NMDhcp4Config *self) +GVariant * +nm_dhcp4_config_get_options (NMDhcp4Config *self) { - GHashTableIter iter; - const char *option = NULL; - GSList *list = NULL; - g_return_val_if_fail (NM_IS_DHCP4_CONFIG (self), NULL); - g_hash_table_iter_init (&iter, NM_DHCP4_CONFIG_GET_PRIVATE (self)->options); - while (g_hash_table_iter_next (&iter, (gpointer) &option, NULL)) - list = g_slist_prepend (list, (gpointer) option); - - return list; -} - -static void -nm_gvalue_destroy (gpointer data) -{ - GValue *value = (GValue *) data; - - g_value_unset (value); - g_slice_free (GValue, value); + return g_variant_ref (NM_DHCP4_CONFIG_GET_PRIVATE (self)->options); } static void @@ -124,7 +106,8 @@ nm_dhcp4_config_init (NMDhcp4Config *self) nm_exported_object_export (NM_EXPORTED_OBJECT (self)); - priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); + priv->options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0); + g_variant_ref_sink (priv->options); } static void @@ -132,7 +115,7 @@ finalize (GObject *object) { NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object); - g_hash_table_destroy (priv->options); + g_variant_unref (priv->options); G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->finalize (object); } @@ -145,7 +128,11 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_OPTIONS: - g_value_set_boxed (value, priv->options); + /* dbus_g_value_parse_g_variant() will call g_value_init(), but + * @value is already inited. + */ + g_value_unset (value); + dbus_g_value_parse_g_variant (priv->options, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/nm-dhcp4-config.h b/src/nm-dhcp4-config.h index 8dabecc8c2..080e28deff 100644 --- a/src/nm-dhcp4-config.h +++ b/src/nm-dhcp4-config.h @@ -45,14 +45,11 @@ GType nm_dhcp4_config_get_type (void); NMDhcp4Config *nm_dhcp4_config_new (void); -void nm_dhcp4_config_add_option (NMDhcp4Config *config, - const char *key, - const char *option); - -void nm_dhcp4_config_reset (NMDhcp4Config *config); +void nm_dhcp4_config_set_options (NMDhcp4Config *config, + GHashTable *options); const char *nm_dhcp4_config_get_option (NMDhcp4Config *config, const char *option); -GSList *nm_dhcp4_config_list_options (NMDhcp4Config *config); +GVariant *nm_dhcp4_config_get_options (NMDhcp4Config *config); #endif /* __NETWORKMANAGER_DHCP4_CONFIG_H__ */ diff --git a/src/nm-dhcp6-config.c b/src/nm-dhcp6-config.c index 1d3168f28e..6b27c532bd 100644 --- a/src/nm-dhcp6-config.c +++ b/src/nm-dhcp6-config.c @@ -34,7 +34,7 @@ G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, NM_TYPE_EXPORTED_OBJECT) #define NM_DHCP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP6_CONFIG, NMDhcp6ConfigPrivate)) typedef struct { - GHashTable *options; + GVariant *options; } NMDhcp6ConfigPrivate; @@ -53,68 +53,50 @@ nm_dhcp6_config_new (void) } void -nm_dhcp6_config_add_option (NMDhcp6Config *self, - const char *key, - const char *option) +nm_dhcp6_config_set_options (NMDhcp6Config *self, + GHashTable *options) { - GValue *svalue; + NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self); + GHashTableIter iter; + const char *key, *value; + GVariantBuilder builder; g_return_if_fail (NM_IS_DHCP6_CONFIG (self)); - g_return_if_fail (key != NULL); - g_return_if_fail (option != NULL); + g_return_if_fail (options != NULL); - svalue = g_slice_new0 (GValue); - g_value_init (svalue, G_TYPE_STRING); - g_value_set_string (svalue, option); - g_hash_table_insert (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options, g_strdup (key), svalue); - g_object_notify (G_OBJECT (self), NM_DHCP6_CONFIG_OPTIONS); -} + g_variant_unref (priv->options); -void -nm_dhcp6_config_reset (NMDhcp6Config *self) -{ - g_return_if_fail (NM_IS_DHCP6_CONFIG (self)); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_hash_table_iter_init (&iter, options); + while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) + g_variant_builder_add (&builder, "{sv}", key, g_variant_new_string (value)); - g_hash_table_remove_all (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options); + priv->options = g_variant_builder_end (&builder); + g_variant_ref_sink (priv->options); g_object_notify (G_OBJECT (self), NM_DHCP6_CONFIG_OPTIONS); } const char * nm_dhcp6_config_get_option (NMDhcp6Config *self, const char *key) { - GValue *value; + NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self); + const char *value; g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL); g_return_val_if_fail (key != NULL, NULL); - value = g_hash_table_lookup (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options, key); - return value ? g_value_get_string (value) : NULL; + if (g_variant_lookup (priv->options, key, "&s", &value)) + return value; + else + return NULL; } -/* Caller owns the list, but not the values in the list */ -GSList * -nm_dhcp6_config_list_options (NMDhcp6Config *self) +GVariant * +nm_dhcp6_config_get_options (NMDhcp6Config *self) { - GHashTableIter iter; - const char *option = NULL; - GSList *list = NULL; - g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL); - g_hash_table_iter_init (&iter, NM_DHCP6_CONFIG_GET_PRIVATE (self)->options); - while (g_hash_table_iter_next (&iter, (gpointer) &option, NULL)) - list = g_slist_prepend (list, (gpointer) option); - - return list; -} - -static void -nm_gvalue_destroy (gpointer data) -{ - GValue *value = (GValue *) data; - - g_value_unset (value); - g_slice_free (GValue, value); + return g_variant_ref (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options); } static void @@ -124,7 +106,8 @@ nm_dhcp6_config_init (NMDhcp6Config *self) nm_exported_object_export (NM_EXPORTED_OBJECT (self)); - priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy); + priv->options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0); + g_variant_ref_sink (priv->options); } static void @@ -132,7 +115,7 @@ finalize (GObject *object) { NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object); - g_hash_table_destroy (priv->options); + g_variant_unref (priv->options); G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->finalize (object); } @@ -145,7 +128,11 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_OPTIONS: - g_value_set_boxed (value, priv->options); + /* dbus_g_value_parse_g_variant() will call g_value_init(), but + * @value is already inited. + */ + g_value_unset (value); + dbus_g_value_parse_g_variant (priv->options, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/nm-dhcp6-config.h b/src/nm-dhcp6-config.h index f0b79cc6fc..c018d97f0c 100644 --- a/src/nm-dhcp6-config.h +++ b/src/nm-dhcp6-config.h @@ -45,14 +45,11 @@ GType nm_dhcp6_config_get_type (void); NMDhcp6Config *nm_dhcp6_config_new (void); -void nm_dhcp6_config_add_option (NMDhcp6Config *config, - const char *key, - const char *option); - -void nm_dhcp6_config_reset (NMDhcp6Config *config); +void nm_dhcp6_config_set_options (NMDhcp6Config *config, + GHashTable *options); const char *nm_dhcp6_config_get_option (NMDhcp6Config *config, const char *option); -GSList *nm_dhcp6_config_list_options (NMDhcp6Config *self); +GVariant *nm_dhcp6_config_get_options (NMDhcp6Config *self); #endif /* __NETWORKMANAGER_DHCP6_CONFIG_H__ */ diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index c64c991188..cba3b5cad6 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -220,45 +220,13 @@ dump_ip6_to_props (NMIP6Config *ip6, GVariantBuilder *builder) g_variant_builder_end (&int_builder)); } -static void -dump_dhcp4_to_props (NMDhcp4Config *config, GVariantBuilder *builder) -{ - GSList *options, *iter; - - options = nm_dhcp4_config_list_options (config); - for (iter = options; iter; iter = g_slist_next (iter)) { - const char *option = (const char *) iter->data; - const char *val; - - val = nm_dhcp4_config_get_option (config, option); - g_variant_builder_add (builder, "{sv}", option, g_variant_new_string (val)); - } - g_slist_free (options); -} - -static void -dump_dhcp6_to_props (NMDhcp6Config *config, GVariantBuilder *builder) -{ - GSList *options, *iter; - - options = nm_dhcp6_config_list_options (config); - for (iter = options; iter; iter = g_slist_next (iter)) { - const char *option = (const char *) iter->data; - const char *val; - - val = nm_dhcp6_config_get_option (config, option); - g_variant_builder_add (builder, "{sv}", option, g_variant_new_string (val)); - } - g_slist_free (options); -} - static void fill_device_props (NMDevice *device, GVariantBuilder *dev_builder, GVariantBuilder *ip4_builder, GVariantBuilder *ip6_builder, - GVariantBuilder *dhcp4_builder, - GVariantBuilder *dhcp6_builder) + GVariant **dhcp4_props, + GVariant **dhcp6_props) { NMIP4Config *ip4_config; NMIP6Config *ip6_config; @@ -287,11 +255,11 @@ fill_device_props (NMDevice *device, dhcp4_config = nm_device_get_dhcp4_config (device); if (dhcp4_config) - dump_dhcp4_to_props (dhcp4_config, dhcp4_builder); + *dhcp4_props = nm_dhcp4_config_get_options (dhcp4_config); dhcp6_config = nm_device_get_dhcp6_config (device); if (dhcp6_config) - dump_dhcp6_to_props (dhcp6_config, dhcp6_builder); + *dhcp6_props = nm_dhcp6_config_get_options (dhcp6_config); } static void @@ -485,8 +453,8 @@ _dispatcher_call (DispatcherAction action, GVariantBuilder device_props; GVariantBuilder device_ip4_props; GVariantBuilder device_ip6_props; - GVariantBuilder device_dhcp4_props; - GVariantBuilder device_dhcp6_props; + GVariant *device_dhcp4_props = NULL; + GVariant *device_dhcp6_props = NULL; GVariantBuilder vpn_ip4_props; GVariantBuilder vpn_ip6_props; DispatchInfo *info = NULL; @@ -572,8 +540,6 @@ _dispatcher_call (DispatcherAction action, g_variant_builder_init (&device_props, G_VARIANT_TYPE_VARDICT); g_variant_builder_init (&device_ip4_props, G_VARIANT_TYPE_VARDICT); g_variant_builder_init (&device_ip6_props, G_VARIANT_TYPE_VARDICT); - g_variant_builder_init (&device_dhcp4_props, G_VARIANT_TYPE_VARDICT); - g_variant_builder_init (&device_dhcp6_props, G_VARIANT_TYPE_VARDICT); g_variant_builder_init (&vpn_ip4_props, G_VARIANT_TYPE_VARDICT); g_variant_builder_init (&vpn_ip6_props, G_VARIANT_TYPE_VARDICT); @@ -593,21 +559,26 @@ _dispatcher_call (DispatcherAction action, } } + if (!device_dhcp4_props) + device_dhcp4_props = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0)); + if (!device_dhcp6_props) + device_dhcp6_props = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0)); + /* Send the action to the dispatcher */ if (blocking) { GVariant *ret; GVariantIter *results; ret = _nm_dbus_proxy_call_sync (dispatcher_proxy, "Action", - g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}a{sv}a{sv}sa{sv}a{sv}b)", + g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv}@a{sv}sa{sv}a{sv}b)", action_to_string (action), connection_dict, &connection_props, &device_props, &device_ip4_props, &device_ip6_props, - &device_dhcp4_props, - &device_dhcp6_props, + device_dhcp4_props, + device_dhcp6_props, vpn_iface ? vpn_iface : "", &vpn_ip4_props, &vpn_ip6_props, @@ -634,15 +605,15 @@ _dispatcher_call (DispatcherAction action, info->callback = callback; info->user_data = user_data; g_dbus_proxy_call (dispatcher_proxy, "Action", - g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}a{sv}a{sv}sa{sv}a{sv}b)", + g_variant_new ("(s@a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv}@a{sv}sa{sv}a{sv}b)", action_to_string (action), connection_dict, &connection_props, &device_props, &device_ip4_props, &device_ip6_props, - &device_dhcp4_props, - &device_dhcp6_props, + device_dhcp4_props, + device_dhcp6_props, vpn_iface ? vpn_iface : "", &vpn_ip4_props, &vpn_ip6_props, @@ -652,6 +623,9 @@ _dispatcher_call (DispatcherAction action, success = TRUE; } + g_variant_unref (device_dhcp4_props); + g_variant_unref (device_dhcp6_props); + done: if (success && info) { /* Track the request in case of cancelation */ From 1bcf42f37b2b69e37ecb41d34f16765119c25348 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 20 Apr 2015 10:48:57 -0400 Subject: [PATCH 10/13] bluetooth, vpn-manager: use GDBusProxies to monitor services Create a GDBusProxy for the service to be monitored and use that to tell whether it is running, rather than using NMDBusManager and the global NameOwnerChanged signal. --- src/devices/bluetooth/nm-bluez5-manager.c | 65 +++++----------------- src/devices/bluetooth/nm-device-bt.c | 68 +++++++++++------------ src/vpn-manager/nm-vpn-service.c | 54 +++++++++++------- 3 files changed, 81 insertions(+), 106 deletions(-) diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c index 7fe0c074ba..ceb8d484d6 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.c +++ b/src/devices/bluetooth/nm-bluez5-manager.c @@ -33,13 +33,9 @@ #include "nm-bluez-device.h" #include "nm-bluez-common.h" -#include "nm-dbus-manager.h" #include "nm-core-internal.h" typedef struct { - NMDBusManager *dbus_mgr; - gulong name_owner_changed_id; - NMConnectionProvider *provider; GDBusProxy *proxy; @@ -224,6 +220,8 @@ get_managed_objects_cb (GDBusProxy *proxy, g_variant_unref (variant); } +static void name_owner_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data); + static void on_proxy_acquired (GObject *object, GAsyncResult *res, @@ -241,6 +239,9 @@ on_proxy_acquired (GObject *object, return; } + g_signal_connect (priv->proxy, "notify::g-name-owner", + G_CALLBACK (name_owner_changed_cb), self); + /* Get already managed devices. */ g_dbus_proxy_call (priv->proxy, "GetManagedObjects", NULL, @@ -275,24 +276,19 @@ bluez_connect (NMBluez5Manager *self) } static void -name_owner_changed_cb (NMDBusManager *dbus_mgr, - const char *name, - const char *old_owner, - const char *new_owner, +name_owner_changed_cb (GObject *object, + GParamSpec *pspec, gpointer user_data) { NMBluez5Manager *self = NM_BLUEZ5_MANAGER (user_data); NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self); - gboolean old_owner_good = (old_owner && strlen (old_owner)); - gboolean new_owner_good = (new_owner && strlen (new_owner)); + char *owner; - /* Can't handle the signal if its not from the Bluez */ - if (strcmp (BLUEZ_SERVICE, name)) - return; - - if (old_owner_good && !new_owner_good) { - if (priv->devices) + if (priv->devices) { + owner = g_dbus_proxy_get_name_owner (priv->proxy); + if (!owner) remove_all_devices (self); + g_free (owner); } } @@ -302,8 +298,8 @@ bluez_cleanup (NMBluez5Manager *self, gboolean do_signal) NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self); if (priv->proxy) { - g_object_unref (priv->proxy); - priv->proxy = NULL; + g_signal_handlers_disconnect_by_func (priv->proxy, G_CALLBACK (name_owner_changed_cb), self); + g_clear_object (&priv->proxy); } if (do_signal) @@ -312,19 +308,6 @@ bluez_cleanup (NMBluez5Manager *self, gboolean do_signal) g_hash_table_remove_all (priv->devices); } -static void -dbus_connection_changed_cb (NMDBusManager *dbus_mgr, - DBusGConnection *connection, - gpointer user_data) -{ - NMBluez5Manager *self = NM_BLUEZ5_MANAGER (user_data); - - if (!connection) - bluez_cleanup (self, TRUE); - else - bluez_connect (self); -} - /****************************************************************/ NMBluez5Manager * @@ -342,19 +325,6 @@ nm_bluez5_manager_init (NMBluez5Manager *self) { NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self); - priv->dbus_mgr = nm_dbus_manager_get (); - g_assert (priv->dbus_mgr); - - g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_NAME_OWNER_CHANGED, - G_CALLBACK (name_owner_changed_cb), - self); - - g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED, - G_CALLBACK (dbus_connection_changed_cb), - self); - bluez_connect (self); priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -365,16 +335,9 @@ static void dispose (GObject *object) { NMBluez5Manager *self = NM_BLUEZ5_MANAGER (object); - NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self); bluez_cleanup (self, FALSE); - if (priv->dbus_mgr) { - g_signal_handlers_disconnect_by_func (priv->dbus_mgr, name_owner_changed_cb, self); - g_signal_handlers_disconnect_by_func (priv->dbus_mgr, dbus_connection_changed_cb, self); - priv->dbus_mgr = NULL; - } - G_OBJECT_CLASS (nm_bluez5_manager_parent_class)->dispose (object); } diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index 7fd793b451..55b8d0aef5 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -28,7 +28,6 @@ #include "nm-glib.h" #include "nm-bluez-common.h" #include "nm-bluez-device.h" -#include "nm-dbus-manager.h" #include "nm-device-bt.h" #include "nm-device-private.h" #include "nm-logging.h" @@ -46,7 +45,9 @@ #include "nm-bt-error.h" #include "nm-bt-enum-types.h" -#define MM_DBUS_SERVICE "org.freedesktop.ModemManager1" +#define MM_DBUS_SERVICE "org.freedesktop.ModemManager1" +#define MM_DBUS_PATH "/org/freedesktop/ModemManager1" +#define MM_DBUS_INTERFACE "org.freedesktop.ModemManager1" #include "nm-device-logging.h" _LOG_DECLARE_SELF(NMDeviceBt); @@ -58,8 +59,7 @@ G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE) static gboolean modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason); typedef struct { - NMDBusManager *dbus_mgr; - guint mm_watch_id; + GDBusProxy *mm_proxy; gboolean mm_running; NMBluezDevice *bt_device; @@ -966,25 +966,17 @@ set_mm_running (NMDeviceBt *self, gboolean running) } static void -mm_name_owner_changed (NMDBusManager *dbus_mgr, - const char *name, - const char *old_owner, - const char *new_owner, +mm_name_owner_changed (GObject *object, + GParamSpec *pspec, NMDeviceBt *self) { - gboolean old_owner_good; - gboolean new_owner_good; + char *owner; - /* Can't handle the signal if its not from the modem service */ - if (strcmp (MM_DBUS_SERVICE, name) != 0) - return; - - old_owner_good = (old_owner && strlen (old_owner)); - new_owner_good = (new_owner && strlen (new_owner)); - - if (!old_owner_good && new_owner_good) + owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (object)); + if (owner) { set_mm_running (self, TRUE); - else if (old_owner_good && !new_owner_good) + g_free (owner); + } else set_mm_running (self, FALSE); } @@ -1020,18 +1012,27 @@ static void nm_device_bt_init (NMDeviceBt *self) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self); - gboolean mm_running; + GError *error = NULL; - priv->dbus_mgr = nm_dbus_manager_get (); - - priv->mm_watch_id = g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_NAME_OWNER_CHANGED, - G_CALLBACK (mm_name_owner_changed), - self); - - /* Initial check to see if ModemManager is running */ - mm_running = nm_dbus_manager_name_has_owner (priv->dbus_mgr, MM_DBUS_SERVICE); - set_mm_running (self, mm_running); + priv->mm_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | + G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NULL, + MM_DBUS_SERVICE, + MM_DBUS_PATH, + MM_DBUS_INTERFACE, + NULL, &error); + if (priv->mm_proxy) { + g_signal_connect (priv->mm_proxy, "notify::g-name-owner", + G_CALLBACK (mm_name_owner_changed), + self); + mm_name_owner_changed (G_OBJECT (priv->mm_proxy), NULL, self); + } else { + _LOGW (LOGD_MB, "Could not create proxy for '%s': %s", + MM_DBUS_SERVICE, error->message); + g_clear_error (&error); + } } static void @@ -1112,11 +1113,10 @@ dispose (GObject *object) g_signal_handlers_disconnect_matched (priv->bt_device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); - if (priv->dbus_mgr && priv->mm_watch_id) { - g_signal_handler_disconnect (priv->dbus_mgr, priv->mm_watch_id); - priv->mm_watch_id = 0; + if (priv->mm_proxy) { + g_signal_handlers_disconnect_by_func (priv->mm_proxy, G_CALLBACK (mm_name_owner_changed), object); + g_clear_object (&priv->mm_proxy); } - priv->dbus_mgr = NULL; modem_cleanup (NM_DEVICE_BT (object)); g_clear_object (&priv->bt_device); diff --git a/src/vpn-manager/nm-vpn-service.c b/src/vpn-manager/nm-vpn-service.c index 3eb0e2e398..56cb6abe74 100644 --- a/src/vpn-manager/nm-vpn-service.c +++ b/src/vpn-manager/nm-vpn-service.c @@ -29,7 +29,6 @@ #include "nm-glib.h" #include "nm-vpn-service.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-vpn-manager.h" @@ -45,6 +44,7 @@ typedef struct { GSList *pending; guint start_timeout; + GDBusProxy *proxy; gboolean service_running; } NMVpnServicePrivate; @@ -54,6 +54,8 @@ typedef struct { static gboolean start_pending_vpn (NMVpnService *self, GError **error); +static void _name_owner_changed (GObject *object, GParamSpec *pspec, gpointer user_data); + NMVpnService * nm_vpn_service_new (const char *namefile, GError **error) { @@ -86,7 +88,21 @@ nm_vpn_service_new (const char *namefile, GError **error) if (!priv->name) goto error; - priv->service_running = nm_dbus_manager_name_has_owner (nm_dbus_manager_get (), priv->dbus_service); + priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | + G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NULL, + priv->dbus_service, + NM_VPN_DBUS_PLUGIN_PATH, + NM_VPN_DBUS_PLUGIN_INTERFACE, + NULL, error); + if (!priv->proxy) + goto error; + + g_signal_connect (priv->proxy, "notify::g-name-owner", + G_CALLBACK (_name_owner_changed), self); + _name_owner_changed (G_OBJECT (priv->proxy), NULL, self); g_key_file_free (kf); return self; @@ -288,18 +304,16 @@ nm_vpn_service_activate (NMVpnService *service, } static void -_name_owner_changed (NMDBusManager *mgr, - const char *name, - const char *old, - const char *new, +_name_owner_changed (GObject *object, + GParamSpec *pspec, gpointer user_data) { NMVpnService *service = NM_VPN_SERVICE (user_data); NMVpnServicePrivate *priv = NM_VPN_SERVICE_GET_PRIVATE (service); - gboolean old_owner_good, new_owner_good, success; + gboolean success; + char *owner; - if (strcmp (name, priv->dbus_service)) - return; + owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (object)); /* Service changed, no need to wait for the timeout any longer */ if (priv->start_timeout) { @@ -307,22 +321,21 @@ _name_owner_changed (NMDBusManager *mgr, priv->start_timeout = 0; } - old_owner_good = (old && old[0]); - new_owner_good = (new && new[0]); - - if (!old_owner_good && new_owner_good) { + if (owner && !priv->service_running) { /* service appeared */ priv->service_running = TRUE; nm_log_info (LOGD_VPN, "VPN service '%s' appeared; activating connections", priv->name); /* Expect success because the VPN service has already appeared */ success = start_active_vpn (service, NULL); g_warn_if_fail (success); - } else if (old_owner_good && !new_owner_good) { + } else if (!owner && priv->service_running) { /* service went away */ priv->service_running = FALSE; nm_log_info (LOGD_VPN, "VPN service '%s' disappeared", priv->name); nm_vpn_service_stop_connections (service, FALSE, NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED); } + + g_free (owner); } /******************************************************************************/ @@ -330,10 +343,6 @@ _name_owner_changed (NMDBusManager *mgr, static void nm_vpn_service_init (NMVpnService *self) { - g_signal_connect (nm_dbus_manager_get (), - NM_DBUS_MANAGER_NAME_OWNER_CHANGED, - G_CALLBACK (_name_owner_changed), - self); } static void @@ -351,9 +360,12 @@ dispose (GObject *object) g_assert (priv->active == NULL); g_assert (priv->pending == NULL); - g_signal_handlers_disconnect_by_func (nm_dbus_manager_get (), - G_CALLBACK (_name_owner_changed), - self); + if (priv->proxy) { + g_signal_handlers_disconnect_by_func (priv->proxy, + G_CALLBACK (_name_owner_changed), + self); + g_clear_object (&priv->proxy); + } G_OBJECT_CLASS (nm_vpn_service_parent_class)->dispose (object); } From 2a2fd1216b15efc6ef15ba4e49c0aa7b5969e6d7 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 27 Apr 2015 14:54:32 -0400 Subject: [PATCH 11/13] settings: rework NMSecretAgent disconnection detection Have NMSecretAgent emit "disconnected" when it detects that it has been disconnected, rather than having both the agent and the agent manager monitor it separately. --- src/settings/nm-agent-manager.c | 42 +++++++--------------- src/settings/nm-secret-agent.c | 64 ++++++++++++++++++++++++++------- src/settings/nm-secret-agent.h | 4 +++ 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 0293d783d1..eb0073be0a 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -50,7 +50,6 @@ G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, NM_TYPE_EXPORTED_OBJECT) NMAgentManagerPrivate)) typedef struct { - NMDBusManager *dbus_mgr; NMAuthManager *auth_mgr; /* Auth chains for checking agent permissions */ @@ -263,6 +262,14 @@ find_agent_by_identifier_and_uid (NMAgentManager *self, return NULL; } +static void +agent_disconnected_cb (NMSecretAgent *agent, gpointer user_data) +{ + /* The agent quit, so remove it and let interested clients know */ + remove_agent (NM_AGENT_MANAGER (user_data), + nm_secret_agent_get_dbus_owner (agent)); +} + static void impl_agent_manager_register_with_capabilities (NMAgentManager *self, const char *identifier, @@ -305,6 +312,8 @@ impl_agent_manager_register_with_capabilities (NMAgentManager *self, "Failed to initialize the agent"); goto done; } + g_signal_connect (agent, NM_SECRET_AGENT_DISCONNECTED, + G_CALLBACK (agent_disconnected_cb), self); nm_log_dbg (LOGD_AGENTS, "(%s) requesting permissions", nm_secret_agent_get_description (agent)); @@ -343,11 +352,10 @@ static void impl_agent_manager_unregister (NMAgentManager *self, DBusGMethodInvocation *context) { - NMAgentManagerPrivate *priv = NM_AGENT_MANAGER_GET_PRIVATE (self); GError *error = NULL; char *sender = NULL; - if (!nm_dbus_manager_get_caller_info (priv->dbus_mgr, + if (!nm_dbus_manager_get_caller_info (nm_dbus_manager_get (), context, &sender, NULL, @@ -1450,19 +1458,6 @@ nm_agent_manager_all_agents_have_capability (NMAgentManager *manager, /*************************************************************/ -static void -name_owner_changed_cb (NMDBusManager *dbus_mgr, - const char *name, - const char *old_owner, - const char *new_owner, - gpointer user_data) -{ - if (old_owner) { - /* The agent quit, so remove it and let interested clients know */ - remove_agent (NM_AGENT_MANAGER (user_data), old_owner); - } -} - static void agent_permissions_changed_done (NMAuthChain *chain, GError *error, @@ -1550,16 +1545,10 @@ constructed (GObject *object) G_OBJECT_CLASS (nm_agent_manager_parent_class)->constructed (object); - priv->dbus_mgr = g_object_ref (nm_dbus_manager_get ()); priv->auth_mgr = g_object_ref (nm_auth_manager_get ()); nm_exported_object_export (NM_EXPORTED_OBJECT (object)); - g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_NAME_OWNER_CHANGED, - G_CALLBACK (name_owner_changed_cb), - object); - g_signal_connect (priv->auth_mgr, NM_AUTH_MANAGER_SIGNAL_CHANGED, G_CALLBACK (authority_changed_cb), @@ -1589,13 +1578,8 @@ dispose (GObject *object) object); g_clear_object (&priv->auth_mgr); } - if (priv->dbus_mgr) { - g_signal_handlers_disconnect_by_func (priv->dbus_mgr, - G_CALLBACK (name_owner_changed_cb), - object); - nm_exported_object_unexport (NM_EXPORTED_OBJECT (object)); - g_clear_object (&priv->dbus_mgr); - } + + nm_exported_object_unexport (NM_EXPORTED_OBJECT (object)); G_OBJECT_CLASS (nm_agent_manager_parent_class)->dispose (object); } diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index be21f16a77..e1355a76cd 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -47,17 +47,24 @@ typedef struct { NMAuthSubject *subject; char *identifier; char *owner_username; + char *dbus_owner; NMSecretAgentCapabilities capabilities; guint32 hash; GSList *permissions; DBusGProxy *proxy; - guint proxy_destroy_id; GHashTable *requests; } NMSecretAgentPrivate; +enum { + DISCONNECTED, + + LAST_SIGNAL +}; +static guint signals[LAST_SIGNAL] = { 0 }; + /*************************************************************/ typedef struct { @@ -107,7 +114,7 @@ nm_secret_agent_get_description (NMSecretAgent *agent) priv = NM_SECRET_AGENT_GET_PRIVATE (agent); if (!priv->description) { priv->description = g_strdup_printf ("%s/%s/%lu", - nm_auth_subject_get_unix_process_dbus_sender (priv->subject), + priv->dbus_owner, priv->identifier, nm_auth_subject_get_unix_process_uid (priv->subject)); } @@ -120,7 +127,7 @@ nm_secret_agent_get_dbus_owner (NMSecretAgent *agent) { g_return_val_if_fail (NM_IS_SECRET_AGENT (agent), NULL); - return nm_auth_subject_get_unix_process_dbus_sender (NM_SECRET_AGENT_GET_PRIVATE (agent)->subject); + return NM_SECRET_AGENT_GET_PRIVATE (agent)->dbus_owner; } const char * @@ -450,15 +457,35 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self, callback_data); } +static void proxy_cleanup (NMSecretAgent *self); + +static void +name_owner_changed_cb (NMDBusManager *dbus_mgr, + const char *name, + const char *old_owner, + const char *new_owner, + gpointer user_data) +{ + NMSecretAgent *self = NM_SECRET_AGENT (user_data); + NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self); + + if (!new_owner && !g_strcmp0 (old_owner, priv->dbus_owner)) + proxy_cleanup (self); +} + static void proxy_cleanup (NMSecretAgent *self) { NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self); if (priv->proxy) { - g_signal_handler_disconnect (priv->proxy, priv->proxy_destroy_id); - priv->proxy_destroy_id = 0; + g_signal_handlers_disconnect_by_func (priv->proxy, proxy_cleanup, self); g_clear_object (&priv->proxy); + + g_signal_handlers_disconnect_by_func (nm_dbus_manager_get (), name_owner_changed_cb, self); + g_clear_pointer (&priv->dbus_owner, g_free); + + g_signal_emit (self, signals[DISCONNECTED], 0); } } @@ -472,7 +499,7 @@ nm_secret_agent_new (DBusGMethodInvocation *context, { NMSecretAgent *self; NMSecretAgentPrivate *priv; - char *hash_str, *username; + char *hash_str; struct passwd *pw; g_return_val_if_fail (context != NULL, NULL); @@ -483,13 +510,13 @@ nm_secret_agent_new (DBusGMethodInvocation *context, pw = getpwuid (nm_auth_subject_get_unix_process_uid (subject)); g_return_val_if_fail (pw != NULL, NULL); g_return_val_if_fail (pw->pw_name[0] != '\0', NULL); - username = g_strdup (pw->pw_name); self = (NMSecretAgent *) g_object_new (NM_TYPE_SECRET_AGENT, NULL); priv = NM_SECRET_AGENT_GET_PRIVATE (self); priv->identifier = g_strdup (identifier); - priv->owner_username = g_strdup (username); + priv->owner_username = g_strdup (pw->pw_name); + priv->dbus_owner = g_strdup (nm_auth_subject_get_unix_process_dbus_sender (subject)); priv->capabilities = capabilities; priv->subject = g_object_ref (subject); @@ -499,14 +526,17 @@ nm_secret_agent_new (DBusGMethodInvocation *context, priv->proxy = nm_dbus_manager_new_proxy (nm_dbus_manager_get (), context, - nm_auth_subject_get_unix_process_dbus_sender (subject), + priv->dbus_owner, NM_DBUS_PATH_SECRET_AGENT, NM_DBUS_INTERFACE_SECRET_AGENT); g_assert (priv->proxy); - priv->proxy_destroy_id = g_signal_connect_swapped (priv->proxy, "destroy", - G_CALLBACK (proxy_cleanup), self); + g_signal_connect_swapped (priv->proxy, "destroy", + G_CALLBACK (proxy_cleanup), self); + g_signal_connect (nm_dbus_manager_get (), + NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + G_CALLBACK (name_owner_changed_cb), + self); - g_free (username); return self; } @@ -555,5 +585,15 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class) /* virtual methods */ object_class->dispose = dispose; object_class->finalize = finalize; + + /* signals */ + signals[DISCONNECTED] = + g_signal_new (NM_SECRET_AGENT_DISCONNECTED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMSecretAgentClass, disconnected), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } diff --git a/src/settings/nm-secret-agent.h b/src/settings/nm-secret-agent.h index ed49f93572..d8712c59ed 100644 --- a/src/settings/nm-secret-agent.h +++ b/src/settings/nm-secret-agent.h @@ -33,12 +33,16 @@ #define NM_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT)) #define NM_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgentClass)) +#define NM_SECRET_AGENT_DISCONNECTED "disconnected" + struct _NMSecretAgent { GObject parent; }; typedef struct { GObjectClass parent; + + void (*disconnected) (NMSecretAgent *self); } NMSecretAgentClass; GType nm_secret_agent_get_type (void); From 1424f249e3f00693784456a9ccaa0f7577af685f Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 1 Jul 2015 17:35:22 -0400 Subject: [PATCH 12/13] settings: fix/reorganize NMSettingConnection secrets code NMSettingConnection's for_each_secret() function works in a slightly-too-GHashTable-specific way. Reorganize the code now to make the change to GVariants easier later. Also, fix a few bugs: - In the (unlikely) case of a non-secret being stored in vpn.secrets, we were treating it as though it was a secret with flags NONE. - The code was comparing against NONE when it meant !AGENT_OWNED in a few places. (With the current set of NMSettingSecretFlags values, this worked, but in the future it might not.) - In some cases we never called for_each_secret() with the @remove_non_secrets flag, meaning we might have ended up passing non-secrets to other code. --- src/settings/nm-settings-connection.c | 107 +++++++++++++++++--------- 1 file changed, 71 insertions(+), 36 deletions(-) diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index a417563d2c..c56a340835 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -180,9 +180,8 @@ typedef struct { /**************************************************************/ -/* Return TRUE to continue, FALSE to stop */ -typedef gboolean (*ForEachSecretFunc) (GHashTableIter *iter, - NMSettingSecretFlags flags, +/* Return TRUE to keep, FALSE to drop */ +typedef gboolean (*ForEachSecretFunc) (NMSettingSecretFlags flags, gpointer user_data); static void @@ -248,9 +247,13 @@ for_each_secret (NMConnection *self, g_hash_table_iter_init (&vpn_secrets_iter, g_value_get_boxed (val)); while (g_hash_table_iter_next (&vpn_secrets_iter, (gpointer) &secret_name, NULL)) { secret_flags = NM_SETTING_SECRET_FLAG_NONE; - nm_setting_get_secret_flags (setting, secret_name, &secret_flags, NULL); - if (callback (&vpn_secrets_iter, secret_flags, callback_data) == FALSE) - return; + if (!nm_setting_get_secret_flags (setting, secret_name, &secret_flags, NULL)) { + if (remove_non_secrets) + g_hash_table_iter_remove (&vpn_secrets_iter); + continue; + } + if (!callback (secret_flags, callback_data)) + g_hash_table_iter_remove (&vpn_secrets_iter); } } else { if (!nm_setting_get_secret_flags (setting, secret_name, &secret_flags, NULL)) { @@ -258,13 +261,49 @@ for_each_secret (NMConnection *self, g_hash_table_iter_remove (&secret_iter); continue; } - if (callback (&secret_iter, secret_flags, callback_data) == FALSE) - return; + if (!callback (secret_flags, callback_data)) + g_hash_table_iter_remove (&secret_iter); } } } } +typedef gboolean (*FindSecretFunc) (NMSettingSecretFlags flags, + gpointer user_data); + +typedef struct { + FindSecretFunc find_func; + gpointer find_func_data; + gboolean found; +} FindSecretData; + +static gboolean +find_secret_for_each_func (NMSettingSecretFlags flags, + gpointer user_data) +{ + FindSecretData *data = user_data; + + if (!data->found) + data->found = data->find_func (flags, data->find_func_data); + return TRUE; +} + +static gboolean +find_secret (NMConnection *self, + GHashTable *secrets, + FindSecretFunc callback, + gpointer callback_data) +{ + FindSecretData data; + + data.find_func = callback; + data.find_func_data = callback_data; + data.found = FALSE; + + for_each_secret (self, secrets, FALSE, find_secret_for_each_func, &data); + return data.found; +} + /**************************************************************/ static void @@ -754,38 +793,29 @@ supports_secrets (NMSettingsConnection *self, const char *setting_name) return TRUE; } -static gboolean -clear_nonagent_secrets (GHashTableIter *iter, - NMSettingSecretFlags flags, - gpointer user_data) -{ - if (flags != NM_SETTING_SECRET_FLAG_AGENT_OWNED) - g_hash_table_iter_remove (iter); - return TRUE; -} +typedef struct { + NMSettingSecretFlags required; + NMSettingSecretFlags forbidden; +} ForEachSecretFlags; static gboolean -clear_unsaved_secrets (GHashTableIter *iter, - NMSettingSecretFlags flags, +validate_secret_flags (NMSettingSecretFlags flags, gpointer user_data) { - if (flags & (NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) - g_hash_table_iter_remove (iter); + ForEachSecretFlags *cmp_flags = user_data; + + if (!NM_FLAGS_ALL (flags, cmp_flags->required)) + return FALSE; + if (NM_FLAGS_ANY (flags, cmp_flags->forbidden)) + return FALSE; return TRUE; } static gboolean -has_system_owned_secrets (GHashTableIter *iter, - NMSettingSecretFlags flags, - gpointer user_data) +secret_is_system_owned (NMSettingSecretFlags flags, + gpointer user_data) { - gboolean *has_system_owned = user_data; - - if (flags == NM_SETTING_SECRET_FLAG_NONE) { - *has_system_owned = TRUE; - return FALSE; - } - return TRUE; + return !NM_FLAGS_HAS (flags, NM_SETTING_SECRET_FLAG_AGENT_OWNED); } static void @@ -820,6 +850,7 @@ agent_secrets_done_cb (NMAgentManager *manager, GError *local = NULL; GVariant *dict; gboolean agent_had_system = FALSE; + ForEachSecretFlags cmp_flags = { NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAG_NONE }; if (error) { _LOGD ("(%s:%u) secrets request error: (%d) %s", @@ -854,7 +885,7 @@ agent_secrets_done_cb (NMAgentManager *manager, * save those system-owned secrets. If not, discard them and use the * existing secrets, or fail the connection. */ - for_each_secret (NM_CONNECTION (self), secrets, TRUE, has_system_owned_secrets, &agent_had_system); + agent_had_system = find_secret (NM_CONNECTION (self), secrets, secret_is_system_owned, NULL); if (agent_had_system) { if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) { /* No user interaction was allowed when requesting secrets; the @@ -865,7 +896,7 @@ agent_secrets_done_cb (NMAgentManager *manager, call_id, agent_dbus_owner); - for_each_secret (NM_CONNECTION (self), secrets, FALSE, clear_nonagent_secrets, NULL); + cmp_flags.required |= NM_SETTING_SECRET_FLAG_AGENT_OWNED; } else if (agent_has_modify == FALSE) { /* Agent didn't successfully authenticate; clear system-owned secrets * from the secrets the agent returned. @@ -874,7 +905,7 @@ agent_secrets_done_cb (NMAgentManager *manager, setting_name, call_id); - for_each_secret (NM_CONNECTION (self), secrets, FALSE, clear_nonagent_secrets, NULL); + cmp_flags.required |= NM_SETTING_SECRET_FLAG_AGENT_OWNED; } } } else { @@ -890,8 +921,12 @@ agent_secrets_done_cb (NMAgentManager *manager, /* If no user interaction was allowed, make sure that no "unsaved" secrets * came back. Unsaved secrets by definition require user interaction. */ - if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) - for_each_secret (NM_CONNECTION (self), secrets, TRUE, clear_unsaved_secrets, NULL); + if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) { + cmp_flags.forbidden |= ( NM_SETTING_SECRET_FLAG_NOT_SAVED + | NM_SETTING_SECRET_FLAG_NOT_REQUIRED); + } + + for_each_secret (NM_CONNECTION (self), secrets, TRUE, validate_secret_flags, &cmp_flags); /* Update the connection with our existing secrets from backing storage */ nm_connection_clear_secrets (NM_CONNECTION (self)); From 02370be7f31bbcd7a5ecd808c239d48bdad42024 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 16 Apr 2015 14:20:51 -0400 Subject: [PATCH 13/13] core: rename NMDBusManager to NMBusManager Our gdbus generated types use the same names as their corresponding "real" types, but with "NM" changed to "NMDBus". Unfortunately, that means that introspection/nmdbus-manager.c (the generated type for src/nm-manager.c) uses the same type name as the entirely unrelated src/nm-dbus-manager.c. Fix this by removing the "d" from src/nm-dbus-manager.c. (We could rename the generated type instead, but then it becomes inconsistent with all the other generated types, and we're already using it as "NMDBusManager" in libnm/nm-manager.c.) --- src/Makefile.am | 4 +- src/dhcp-manager/nm-dhcp-listener.c | 16 +- src/main.c | 6 +- src/nm-auth-subject.c | 24 +- src/{nm-dbus-manager.c => nm-bus-manager.c} | 246 ++++++++++---------- src/nm-bus-manager.h | 129 ++++++++++ src/nm-dbus-manager.h | 129 ---------- src/nm-dispatcher.c | 1 - src/nm-exported-object.c | 6 +- src/nm-iface-helper.c | 18 +- src/nm-manager.c | 16 +- src/nm-types.h | 2 +- src/ppp-manager/nm-ppp-manager.c | 1 - src/settings/nm-agent-manager.c | 12 +- src/settings/nm-secret-agent.c | 20 +- src/settings/nm-settings.c | 10 +- src/tests/config/test-config.c | 6 +- 17 files changed, 319 insertions(+), 327 deletions(-) rename src/{nm-dbus-manager.c => nm-bus-manager.c} (76%) create mode 100644 src/nm-bus-manager.h delete mode 100644 src/nm-dbus-manager.h diff --git a/src/Makefile.am b/src/Makefile.am index 3181a1f099..e457cbc3dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -300,6 +300,8 @@ nm_sources = \ nm-activation-request.h \ nm-active-connection.c \ nm-active-connection.h \ + nm-bus-manager.c \ + nm-bus-manager.h \ nm-config.c \ nm-config.h \ nm-config-data.c \ @@ -308,8 +310,6 @@ nm_sources = \ nm-connection-provider.h \ nm-connectivity.c \ nm-connectivity.h \ - nm-dbus-manager.c \ - nm-dbus-manager.h \ nm-dcb.c \ nm-dcb.h \ nm-route-manager.c \ diff --git a/src/dhcp-manager/nm-dhcp-listener.c b/src/dhcp-manager/nm-dhcp-listener.c index 4954d57620..d675dcfcd4 100644 --- a/src/dhcp-manager/nm-dhcp-listener.c +++ b/src/dhcp-manager/nm-dhcp-listener.c @@ -33,7 +33,7 @@ #include "nm-dhcp-listener.h" #include "nm-core-internal.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-dbus-glib-types.h" #include "NetworkManagerUtils.h" @@ -42,7 +42,7 @@ #define PRIV_SOCK_TAG "dhcp" typedef struct { - NMDBusManager * dbus_mgr; + NMBusManager * dbus_mgr; guint new_conn_id; guint dis_conn_id; GHashTable * proxies; @@ -161,7 +161,7 @@ out: #if HAVE_DBUS_GLIB_100 static void -new_connection_cb (NMDBusManager *mgr, +new_connection_cb (NMBusManager *mgr, DBusGConnection *connection, NMDhcpListener *self) { @@ -176,7 +176,7 @@ new_connection_cb (NMDBusManager *mgr, } static void -dis_connection_cb (NMDBusManager *mgr, +dis_connection_cb (NMBusManager *mgr, DBusGConnection *connection, NMDhcpListener *self) { @@ -206,17 +206,17 @@ nm_dhcp_listener_init (NMDhcpListener *self) /* Maps DBusGConnection :: DBusGProxy */ priv->proxies = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); - priv->dbus_mgr = nm_dbus_manager_get (); + priv->dbus_mgr = nm_bus_manager_get (); #if HAVE_DBUS_GLIB_100 /* Register the socket our DHCP clients will return lease info on */ - nm_dbus_manager_private_server_register (priv->dbus_mgr, PRIV_SOCK_PATH, PRIV_SOCK_TAG); + nm_bus_manager_private_server_register (priv->dbus_mgr, PRIV_SOCK_PATH, PRIV_SOCK_TAG); priv->new_conn_id = g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, G_CALLBACK (new_connection_cb), self); priv->dis_conn_id = g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, G_CALLBACK (dis_connection_cb), self); #else diff --git a/src/main.c b/src/main.c index 31f63b7ae3..a0b6e37553 100644 --- a/src/main.c +++ b/src/main.c @@ -46,7 +46,7 @@ #include "main-utils.h" #include "nm-manager.h" #include "nm-linux-platform.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-device.h" #include "nm-dhcp-manager.h" #include "nm-logging.h" @@ -422,7 +422,7 @@ main (int argc, char *argv[]) #endif ); - if (!nm_dbus_manager_get_connection (nm_dbus_manager_get ())) { + if (!nm_bus_manager_get_connection (nm_bus_manager_get ())) { #if HAVE_DBUS_GLIB_100 nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available"); #else @@ -431,7 +431,7 @@ main (int argc, char *argv[]) #endif } else { /* Start our DBus service */ - if (!nm_dbus_manager_start_service (nm_dbus_manager_get ())) { + if (!nm_bus_manager_start_service (nm_bus_manager_get ())) { nm_log_err (LOGD_CORE, "failed to start the dbus service."); goto done; } diff --git a/src/nm-auth-subject.c b/src/nm-auth-subject.c index 12dcee044a..7570b3cf58 100644 --- a/src/nm-auth-subject.c +++ b/src/nm-auth-subject.c @@ -34,7 +34,7 @@ #include #include "nm-glib.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-enum-types.h" #include "NetworkManagerUtils.h" #include "gsystem-local-alloc.h" @@ -180,18 +180,18 @@ _new_unix_process (DBusGMethodInvocation *context, g_return_val_if_fail (context || (connection && message), NULL); if (context) { - success = nm_dbus_manager_get_caller_info (nm_dbus_manager_get (), - context, - &dbus_sender, - &uid, - &pid); + success = nm_bus_manager_get_caller_info (nm_bus_manager_get (), + context, + &dbus_sender, + &uid, + &pid); } else if (message) { - success = nm_dbus_manager_get_caller_info_from_message (nm_dbus_manager_get (), - connection, - message, - &dbus_sender, - &uid, - &pid); + success = nm_bus_manager_get_caller_info_from_message (nm_bus_manager_get (), + connection, + message, + &dbus_sender, + &uid, + &pid); } else g_assert_not_reached (); diff --git a/src/nm-dbus-manager.c b/src/nm-bus-manager.c similarity index 76% rename from src/nm-dbus-manager.c rename to src/nm-bus-manager.c index 48f0084228..a600c225d4 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-bus-manager.c @@ -28,7 +28,7 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include #include @@ -50,11 +50,11 @@ enum { static guint signals[NUMBER_OF_SIGNALS]; -G_DEFINE_TYPE(NMDBusManager, nm_dbus_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE(NMBusManager, nm_bus_manager, G_TYPE_OBJECT) -#define NM_DBUS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - NM_TYPE_DBUS_MANAGER, \ - NMDBusManagerPrivate)) +#define NM_BUS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ + NM_TYPE_BUS_MANAGER, \ + NMBusManagerPrivate)) typedef struct _PrivateServer PrivateServer; @@ -71,40 +71,40 @@ typedef struct { guint proxy_destroy_id; guint reconnect_id; -} NMDBusManagerPrivate; +} NMBusManagerPrivate; -static gboolean nm_dbus_manager_init_bus (NMDBusManager *self); -static void nm_dbus_manager_cleanup (NMDBusManager *self, gboolean dispose); -static void start_reconnection_timeout (NMDBusManager *self); -static void object_destroyed (NMDBusManager *self, gpointer object); +static gboolean nm_bus_manager_init_bus (NMBusManager *self); +static void nm_bus_manager_cleanup (NMBusManager *self, gboolean dispose); +static void start_reconnection_timeout (NMBusManager *self); +static void object_destroyed (NMBusManager *self, gpointer object); -NM_DEFINE_SINGLETON_DESTRUCTOR (NMDBusManager); -NM_DEFINE_SINGLETON_WEAK_REF (NMDBusManager); +NM_DEFINE_SINGLETON_DESTRUCTOR (NMBusManager); +NM_DEFINE_SINGLETON_WEAK_REF (NMBusManager); -NMDBusManager * -nm_dbus_manager_get (void) +NMBusManager * +nm_bus_manager_get (void) { if (G_UNLIKELY (!singleton_instance)) { - nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL)); - if (!nm_dbus_manager_init_bus (singleton_instance)) + nm_bus_manager_setup (g_object_new (NM_TYPE_BUS_MANAGER, NULL)); + if (!nm_bus_manager_init_bus (singleton_instance)) start_reconnection_timeout (singleton_instance); } return singleton_instance; } void -nm_dbus_manager_setup (NMDBusManager *instance) +nm_bus_manager_setup (NMBusManager *instance) { static char already_setup = FALSE; - g_assert (NM_IS_DBUS_MANAGER (instance)); + g_assert (NM_IS_BUS_MANAGER (instance)); g_assert (!already_setup); g_assert (!singleton_instance); already_setup = TRUE; singleton_instance = instance; nm_singleton_instance_weak_ref_register (); - nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", "NMDBusManager", singleton_instance); + nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", "NMBusManager", singleton_instance); } /**************************************************************/ @@ -115,7 +115,7 @@ struct _PrivateServer { char *address; DBusServer *server; GHashTable *connections; - NMDBusManager *manager; + NMBusManager *manager; }; static DBusHandlerResult @@ -194,7 +194,7 @@ private_server_dbus_connection_destroy (DBusConnection *conn) static PrivateServer * private_server_new (const char *path, const char *tag, - NMDBusManager *manager) + NMBusManager *manager) { PrivateServer *s; DBusServer *server; @@ -247,11 +247,11 @@ private_server_free (gpointer ptr) } void -nm_dbus_manager_private_server_register (NMDBusManager *self, - const char *path, - const char *tag) +nm_bus_manager_private_server_register (NMBusManager *self, + const char *path, + const char *tag) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); PrivateServer *s; GSList *iter; @@ -287,14 +287,14 @@ private_server_get_connection_owner (PrivateServer *s, DBusGConnection *connecti /**************************************************************/ static gboolean -_bus_get_unix_pid (NMDBusManager *self, +_bus_get_unix_pid (NMBusManager *self, const char *sender, gulong *out_pid, GError **error) { guint32 unix_pid = G_MAXUINT32; - if (!dbus_g_proxy_call_with_timeout (NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy, + if (!dbus_g_proxy_call_with_timeout (NM_BUS_MANAGER_GET_PRIVATE (self)->proxy, "GetConnectionUnixProcessID", 2000, error, G_TYPE_STRING, sender, G_TYPE_INVALID, @@ -314,7 +314,7 @@ _bus_get_unix_pid (NMDBusManager *self, * return the sender and the UID of the sender. */ static gboolean -_get_caller_info (NMDBusManager *self, +_get_caller_info (NMBusManager *self, DBusGMethodInvocation *context, DBusConnection *connection, DBusMessage *message, @@ -322,7 +322,7 @@ _get_caller_info (NMDBusManager *self, gulong *out_uid, gulong *out_pid) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); DBusGConnection *gconn; char *sender; const char *priv_sender; @@ -392,32 +392,32 @@ _get_caller_info (NMDBusManager *self, } gboolean -nm_dbus_manager_get_caller_info (NMDBusManager *self, - DBusGMethodInvocation *context, - char **out_sender, - gulong *out_uid, - gulong *out_pid) +nm_bus_manager_get_caller_info (NMBusManager *self, + DBusGMethodInvocation *context, + char **out_sender, + gulong *out_uid, + gulong *out_pid) { return _get_caller_info (self, context, NULL, NULL, out_sender, out_uid, out_pid); } gboolean -nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self, - DBusConnection *connection, - DBusMessage *message, - char **out_sender, - gulong *out_uid, - gulong *out_pid) +nm_bus_manager_get_caller_info_from_message (NMBusManager *self, + DBusConnection *connection, + DBusMessage *message, + char **out_sender, + gulong *out_uid, + gulong *out_pid) { return _get_caller_info (self, NULL, connection, message, out_sender, out_uid, out_pid); } gboolean -nm_dbus_manager_get_unix_user (NMDBusManager *self, - const char *sender, - gulong *out_uid) +nm_bus_manager_get_unix_user (NMBusManager *self, + const char *sender, + gulong *out_uid) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GSList *iter; DBusError error; @@ -455,9 +455,9 @@ nm_dbus_manager_get_unix_user (NMDBusManager *self, #if HAVE_DBUS_GLIB_100 static void -private_connection_new (NMDBusManager *self, DBusGConnection *connection) +private_connection_new (NMBusManager *self, DBusGConnection *connection) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; GObject *object; const char *path; @@ -472,9 +472,9 @@ private_connection_new (NMDBusManager *self, DBusGConnection *connection) } static void -private_connection_disconnected (NMDBusManager *self, DBusGConnection *connection) +private_connection_disconnected (NMBusManager *self, DBusGConnection *connection) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); const char *owner; owner = private_server_get_connection_owner (priv->priv_server, connection); @@ -486,9 +486,9 @@ private_connection_disconnected (NMDBusManager *self, DBusGConnection *connectio } static void -private_server_setup (NMDBusManager *self) +private_server_setup (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); /* Skip this step if this is just a test program */ if (nm_utils_get_testing ()) @@ -504,11 +504,11 @@ private_server_setup (NMDBusManager *self) priv->private_servers = g_slist_append (priv->private_servers, priv->priv_server); g_signal_connect (self, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG, (GCallback) private_connection_new, NULL); g_signal_connect (self, - NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, + NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG, (GCallback) private_connection_disconnected, NULL); } @@ -516,9 +516,9 @@ private_server_setup (NMDBusManager *self) #endif /* HAVE_DBUS_GLIB_100 */ static void -nm_dbus_manager_init (NMDBusManager *self) +nm_bus_manager_init (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); priv->exported = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); @@ -528,10 +528,10 @@ nm_dbus_manager_init (NMDBusManager *self) } static void -nm_dbus_manager_dispose (GObject *object) +nm_bus_manager_dispose (GObject *object) { - NMDBusManager *self = NM_DBUS_MANAGER (object); - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManager *self = NM_BUS_MANAGER (object); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; GObject *exported; @@ -548,54 +548,54 @@ nm_dbus_manager_dispose (GObject *object) priv->private_servers = NULL; priv->priv_server = NULL; - nm_dbus_manager_cleanup (self, TRUE); + nm_bus_manager_cleanup (self, TRUE); if (priv->reconnect_id) { g_source_remove (priv->reconnect_id); priv->reconnect_id = 0; } - G_OBJECT_CLASS (nm_dbus_manager_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_bus_manager_parent_class)->dispose (object); } static void -nm_dbus_manager_class_init (NMDBusManagerClass *klass) +nm_bus_manager_class_init (NMBusManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (NMDBusManagerPrivate)); + g_type_class_add_private (klass, sizeof (NMBusManagerPrivate)); - object_class->dispose = nm_dbus_manager_dispose; + object_class->dispose = nm_bus_manager_dispose; signals[DBUS_CONNECTION_CHANGED] = - g_signal_new (NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED, + g_signal_new (NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMDBusManagerClass, dbus_connection_changed), + G_STRUCT_OFFSET (NMBusManagerClass, dbus_connection_changed), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[NAME_OWNER_CHANGED] = - g_signal_new (NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + g_signal_new (NM_BUS_MANAGER_NAME_OWNER_CHANGED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMDBusManagerClass, name_owner_changed), + G_STRUCT_OFFSET (NMBusManagerClass, name_owner_changed), NULL, NULL, NULL, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); signals[PRIVATE_CONNECTION_NEW] = - g_signal_new (NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW, + g_signal_new (NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - G_STRUCT_OFFSET (NMDBusManagerClass, private_connection_new), + G_STRUCT_OFFSET (NMBusManagerClass, private_connection_new), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); signals[PRIVATE_CONNECTION_DISCONNECTED] = - g_signal_new (NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED, + g_signal_new (NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - G_STRUCT_OFFSET (NMDBusManagerClass, private_connection_disconnected), + G_STRUCT_OFFSET (NMBusManagerClass, private_connection_disconnected), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); } @@ -603,9 +603,9 @@ nm_dbus_manager_class_init (NMDBusManagerClass *klass) /* Only cleanup a specific dbus connection, not all our private data */ static void -nm_dbus_manager_cleanup (NMDBusManager *self, gboolean dispose) +nm_bus_manager_cleanup (NMBusManager *self, gboolean dispose) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->proxy) { if (dispose) { @@ -626,15 +626,15 @@ nm_dbus_manager_cleanup (NMDBusManager *self, gboolean dispose) } static gboolean -nm_dbus_manager_reconnect (gpointer user_data) +nm_bus_manager_reconnect (gpointer user_data) { - NMDBusManager *self = NM_DBUS_MANAGER (user_data); - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManager *self = NM_BUS_MANAGER (user_data); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); g_assert (self != NULL); - if (nm_dbus_manager_init_bus (self)) { - if (nm_dbus_manager_start_service (self)) { + if (nm_bus_manager_init_bus (self)) { + if (nm_bus_manager_start_service (self)) { nm_log_info (LOGD_CORE, "reconnected to the system bus."); g_signal_emit (self, signals[DBUS_CONNECTION_CHANGED], 0, priv->connection); @@ -644,38 +644,38 @@ nm_dbus_manager_reconnect (gpointer user_data) } /* Try again */ - nm_dbus_manager_cleanup (self, FALSE); + nm_bus_manager_cleanup (self, FALSE); return TRUE; } static void -start_reconnection_timeout (NMDBusManager *self) +start_reconnection_timeout (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->reconnect_id) g_source_remove (priv->reconnect_id); /* Schedule timeout for reconnection attempts */ - priv->reconnect_id = g_timeout_add_seconds (3, nm_dbus_manager_reconnect, self); + priv->reconnect_id = g_timeout_add_seconds (3, nm_bus_manager_reconnect, self); } char * -nm_dbus_manager_get_name_owner (NMDBusManager *self, - const char *name, - GError **error) +nm_bus_manager_get_name_owner (NMBusManager *self, + const char *name, + GError **error) { char *owner = NULL; - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), NULL); g_return_val_if_fail (name != NULL, NULL); if (error) g_return_val_if_fail (*error == NULL, NULL); - if (!NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy) + if (!NM_BUS_MANAGER_GET_PRIVATE (self)->proxy) return NULL; - if (!dbus_g_proxy_call_with_timeout (NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy, + if (!dbus_g_proxy_call_with_timeout (NM_BUS_MANAGER_GET_PRIVATE (self)->proxy, "GetNameOwner", 2000, error, G_TYPE_STRING, name, G_TYPE_INVALID, @@ -688,19 +688,19 @@ nm_dbus_manager_get_name_owner (NMDBusManager *self, } gboolean -nm_dbus_manager_name_has_owner (NMDBusManager *self, - const char *name) +nm_bus_manager_name_has_owner (NMBusManager *self, + const char *name) { gboolean has_owner = FALSE; GError *err = NULL; - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), FALSE); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), FALSE); g_return_val_if_fail (name != NULL, FALSE); - if (!NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy) + if (!NM_BUS_MANAGER_GET_PRIVATE (self)->proxy) return FALSE; - if (!dbus_g_proxy_call (NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy, + if (!dbus_g_proxy_call (NM_BUS_MANAGER_GET_PRIVATE (self)->proxy, "NameHasOwner", &err, G_TYPE_STRING, name, G_TYPE_INVALID, @@ -728,13 +728,13 @@ proxy_name_owner_changed (DBusGProxy *proxy, static void destroy_cb (DBusGProxy *proxy, gpointer user_data) { - NMDBusManager *self = NM_DBUS_MANAGER (user_data); + NMBusManager *self = NM_BUS_MANAGER (user_data); /* Clean up existing connection */ nm_log_warn (LOGD_CORE, "disconnected by the system bus."); - NM_DBUS_MANAGER_GET_PRIVATE (self)->proxy = NULL; + NM_BUS_MANAGER_GET_PRIVATE (self)->proxy = NULL; - nm_dbus_manager_cleanup (self, FALSE); + nm_bus_manager_cleanup (self, FALSE); g_signal_emit (G_OBJECT (self), signals[DBUS_CONNECTION_CHANGED], 0, NULL); @@ -742,9 +742,9 @@ destroy_cb (DBusGProxy *proxy, gpointer user_data) } static gboolean -nm_dbus_manager_init_bus (NMDBusManager *self) +nm_bus_manager_init_bus (NMBusManager *self) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->connection) { nm_log_warn (LOGD_CORE, "DBus Manager already has a valid connection."); @@ -790,15 +790,15 @@ nm_dbus_manager_init_bus (NMDBusManager *self) * when we register on the bus, clients may start to call. */ gboolean -nm_dbus_manager_start_service (NMDBusManager *self) +nm_bus_manager_start_service (NMBusManager *self) { - NMDBusManagerPrivate *priv; + NMBusManagerPrivate *priv; int result; GError *err = NULL; - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), FALSE); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), FALSE); - priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + priv = NM_BUS_MANAGER_GET_PRIVATE (self); if (priv->started) { nm_log_err (LOGD_CORE, "Service has already started."); @@ -832,33 +832,33 @@ nm_dbus_manager_start_service (NMDBusManager *self) } DBusConnection * -nm_dbus_manager_get_dbus_connection (NMDBusManager *self) +nm_bus_manager_get_dbus_connection (NMBusManager *self) { - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), NULL); - return NM_DBUS_MANAGER_GET_PRIVATE (self)->connection; + return NM_BUS_MANAGER_GET_PRIVATE (self)->connection; } DBusGConnection * -nm_dbus_manager_get_connection (NMDBusManager *self) +nm_bus_manager_get_connection (NMBusManager *self) { - g_return_val_if_fail (NM_IS_DBUS_MANAGER (self), NULL); + g_return_val_if_fail (NM_IS_BUS_MANAGER (self), NULL); - return NM_DBUS_MANAGER_GET_PRIVATE (self)->g_connection; + return NM_BUS_MANAGER_GET_PRIVATE (self)->g_connection; } static void -object_destroyed (NMDBusManager *self, gpointer object) +object_destroyed (NMBusManager *self, gpointer object) { - g_hash_table_remove (NM_DBUS_MANAGER_GET_PRIVATE (self)->exported, object); + g_hash_table_remove (NM_BUS_MANAGER_GET_PRIVATE (self)->exported, object); } void -nm_dbus_manager_register_object (NMDBusManager *self, - const char *path, - gpointer object) +nm_bus_manager_register_object (NMBusManager *self, + const char *path, + gpointer object) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; DBusConnection *connection; @@ -884,9 +884,9 @@ nm_dbus_manager_register_object (NMDBusManager *self, } void -nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object) +nm_bus_manager_unregister_object (NMBusManager *self, gpointer object) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); GHashTableIter iter; DBusConnection *connection; @@ -911,8 +911,8 @@ nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object) } /** - * nm_dbus_manager_new_proxy: - * @self: the #NMDBusManager + * nm_bus_manager_new_proxy: + * @self: the #NMBusManager * @context: the method call context this proxy should be created * @name: any name on the message bus * @path: name of the object instance to call methods on @@ -926,13 +926,13 @@ nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object) * Returns: a #DBusGProxy capable of calling D-Bus methods of the calling process */ DBusGProxy * -nm_dbus_manager_new_proxy (NMDBusManager *self, - DBusGMethodInvocation *context, - const char *name, - const char *path, - const char *iface) +nm_bus_manager_new_proxy (NMBusManager *self, + DBusGMethodInvocation *context, + const char *name, + const char *path, + const char *iface) { - NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self); + NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self); DBusGConnection *connection; GSList *iter; const char *owner; diff --git a/src/nm-bus-manager.h b/src/nm-bus-manager.h new file mode 100644 index 0000000000..06b362d4e3 --- /dev/null +++ b/src/nm-bus-manager.h @@ -0,0 +1,129 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * 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. + * + * Copyright (C) 2006 - 2008 Red Hat, Inc. + * Copyright (C) 2006 - 2008 Novell, Inc. + */ + +#ifndef __NM_BUS_MANAGER_H__ +#define __NM_BUS_MANAGER_H__ + +#include +#include +#include + +#include "nm-glib.h" +#include "nm-types.h" + +G_BEGIN_DECLS + +typedef gboolean (* NMDBusSignalHandlerFunc) (DBusConnection * connection, + DBusMessage * message, + gpointer user_data); + +#define NM_TYPE_BUS_MANAGER (nm_bus_manager_get_type ()) +#define NM_BUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_BUS_MANAGER, NMBusManager)) +#define NM_BUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NM_TYPE_BUS_MANAGER, NMBusManagerClass)) +#define NM_IS_BUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_BUS_MANAGER)) +#define NM_IS_BUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_BUS_MANAGER)) +#define NM_BUS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_BUS_MANAGER, NMBusManagerClass)) + +#define NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED "dbus-connection-changed" +#define NM_BUS_MANAGER_NAME_OWNER_CHANGED "name-owner-changed" +#define NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "private-connection-new" +#define NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "private-connection-disconnected" + +struct _NMBusManager { + GObject parent; +}; + +typedef struct { + GObjectClass parent; + + /* Signals */ + void (*dbus_connection_changed) (NMBusManager *mgr, + DBusConnection *connection); + + void (*name_owner_changed) (NMBusManager *mgr, + const char *name, + const char *old_owner, + const char *new_owner); + + void (*private_connection_new) (NMBusManager *mgr, + DBusGConnection *connection); + + void (*private_connection_disconnected) (NMBusManager *mgr, + DBusGConnection *connection); +} NMBusManagerClass; + +GType nm_bus_manager_get_type (void); + +NMBusManager * nm_bus_manager_get (void); +void nm_bus_manager_setup (NMBusManager *instance); + +char * nm_bus_manager_get_name_owner (NMBusManager *self, + const char *name, + GError **error); + +gboolean nm_bus_manager_start_service (NMBusManager *self); + +gboolean nm_bus_manager_name_has_owner (NMBusManager *self, + const char *name); + +DBusConnection * nm_bus_manager_get_dbus_connection (NMBusManager *self); +DBusGConnection * nm_bus_manager_get_connection (NMBusManager *self); + +gboolean nm_bus_manager_get_caller_info (NMBusManager *self, + DBusGMethodInvocation *context, + char **out_sender, + gulong *out_uid, + gulong *out_pid); + +gboolean nm_bus_manager_get_unix_user (NMBusManager *self, + const char *sender, + gulong *out_uid); + +gboolean nm_bus_manager_get_caller_info_from_message (NMBusManager *self, + DBusConnection *connection, + DBusMessage *message, + char **out_sender, + gulong *out_uid, + gulong *out_pid); + +void nm_bus_manager_register_object (NMBusManager *self, + const char *path, + gpointer object); + +void nm_bus_manager_unregister_object (NMBusManager *self, gpointer object); + +void nm_bus_manager_private_server_register (NMBusManager *self, + const char *path, + const char *tag); + +DBusGProxy *nm_bus_manager_new_proxy (NMBusManager *self, + DBusGMethodInvocation *context, + const char *name, + const char *path, + const char *iface); + +#if !HAVE_DBUS_GLIB_GMI_GET_CONNECTION +DBusGConnection *dbus_g_method_invocation_get_g_connection (DBusGMethodInvocation *context); +#endif + +G_END_DECLS + +#endif /* __NM_BUS_MANAGER_H__ */ diff --git a/src/nm-dbus-manager.h b/src/nm-dbus-manager.h deleted file mode 100644 index 2ce12a2d41..0000000000 --- a/src/nm-dbus-manager.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * 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. - * - * Copyright (C) 2006 - 2008 Red Hat, Inc. - * Copyright (C) 2006 - 2008 Novell, Inc. - */ - -#ifndef __NM_DBUS_MANAGER_H__ -#define __NM_DBUS_MANAGER_H__ - -#include -#include -#include - -#include "nm-glib.h" -#include "nm-types.h" - -G_BEGIN_DECLS - -typedef gboolean (* NMDBusSignalHandlerFunc) (DBusConnection * connection, - DBusMessage * message, - gpointer user_data); - -#define NM_TYPE_DBUS_MANAGER (nm_dbus_manager_get_type ()) -#define NM_DBUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_DBUS_MANAGER, NMDBusManager)) -#define NM_DBUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NM_TYPE_DBUS_MANAGER, NMDBusManagerClass)) -#define NM_IS_DBUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_DBUS_MANAGER)) -#define NM_IS_DBUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_DBUS_MANAGER)) -#define NM_DBUS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_DBUS_MANAGER, NMDBusManagerClass)) - -#define NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED "dbus-connection-changed" -#define NM_DBUS_MANAGER_NAME_OWNER_CHANGED "name-owner-changed" -#define NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "private-connection-new" -#define NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "private-connection-disconnected" - -struct _NMDBusManager { - GObject parent; -}; - -typedef struct { - GObjectClass parent; - - /* Signals */ - void (*dbus_connection_changed) (NMDBusManager *mgr, - DBusConnection *connection); - - void (*name_owner_changed) (NMDBusManager *mgr, - const char *name, - const char *old_owner, - const char *new_owner); - - void (*private_connection_new) (NMDBusManager *mgr, - DBusGConnection *connection); - - void (*private_connection_disconnected) (NMDBusManager *mgr, - DBusGConnection *connection); -} NMDBusManagerClass; - -GType nm_dbus_manager_get_type (void); - -NMDBusManager * nm_dbus_manager_get (void); -void nm_dbus_manager_setup (NMDBusManager *instance); - -char * nm_dbus_manager_get_name_owner (NMDBusManager *self, - const char *name, - GError **error); - -gboolean nm_dbus_manager_start_service (NMDBusManager *self); - -gboolean nm_dbus_manager_name_has_owner (NMDBusManager *self, - const char *name); - -DBusConnection * nm_dbus_manager_get_dbus_connection (NMDBusManager *self); -DBusGConnection * nm_dbus_manager_get_connection (NMDBusManager *self); - -gboolean nm_dbus_manager_get_caller_info (NMDBusManager *self, - DBusGMethodInvocation *context, - char **out_sender, - gulong *out_uid, - gulong *out_pid); - -gboolean nm_dbus_manager_get_unix_user (NMDBusManager *self, - const char *sender, - gulong *out_uid); - -gboolean nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self, - DBusConnection *connection, - DBusMessage *message, - char **out_sender, - gulong *out_uid, - gulong *out_pid); - -void nm_dbus_manager_register_object (NMDBusManager *self, - const char *path, - gpointer object); - -void nm_dbus_manager_unregister_object (NMDBusManager *self, gpointer object); - -void nm_dbus_manager_private_server_register (NMDBusManager *self, - const char *path, - const char *tag); - -DBusGProxy *nm_dbus_manager_new_proxy (NMDBusManager *self, - DBusGMethodInvocation *context, - const char *name, - const char *path, - const char *iface); - -#if !HAVE_DBUS_GLIB_GMI_GET_CONNECTION -DBusGConnection *dbus_g_method_invocation_get_g_connection (DBusGMethodInvocation *context); -#endif - -G_END_DECLS - -#endif /* __NM_DBUS_MANAGER_H__ */ diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index cba3b5cad6..d8e6be2f7b 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -30,7 +30,6 @@ #include "NetworkManagerUtils.h" #include "nm-utils.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" #include "nm-device.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c index 7fd6c623ea..1023842332 100644 --- a/src/nm-exported-object.c +++ b/src/nm-exported-object.c @@ -24,7 +24,7 @@ #include "nm-exported-object.h" #include "nm-dbus-glib-types.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-logging.h" static GHashTable *prefix_counters; @@ -160,7 +160,7 @@ nm_exported_object_export (NMExportedObject *self) } else priv->path = g_strdup (class_export_path); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); + nm_bus_manager_register_object (nm_bus_manager_get (), priv->path, self); return priv->path; } @@ -215,7 +215,7 @@ nm_exported_object_unexport (NMExportedObject *self) g_return_if_fail (priv->path != NULL); g_clear_pointer (&priv->path, g_free); - nm_dbus_manager_unregister_object (nm_dbus_manager_get (), self); + nm_bus_manager_unregister_object (nm_bus_manager_get (), self); } static void diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 1302c070c0..a35d0d7c04 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -504,10 +504,9 @@ nm_main_config_reload (int signal) gconstpointer nm_config_get (void); const char *nm_config_get_dhcp_client (gpointer unused); gboolean nm_config_get_configure_and_quit (gpointer unused); -gconstpointer nm_dbus_manager_get (void); -void nm_dbus_manager_register_exported_type (gpointer unused, GType gtype, gconstpointer unused2); -void nm_dbus_manager_register_object (gpointer unused, const char *path, gpointer object); -void nm_dbus_manager_unregister_object (gpointer unused, gpointer object); +gconstpointer nm_bus_manager_get (void); +void nm_bus_manager_register_object (gpointer unused, const char *path, gpointer object); +void nm_bus_manager_unregister_object (gpointer unused, gpointer object); gconstpointer nm_config_get (void) @@ -528,23 +527,18 @@ nm_config_get_configure_and_quit (gpointer unused) } gconstpointer -nm_dbus_manager_get (void) +nm_bus_manager_get (void) { return GUINT_TO_POINTER (1); } void -nm_dbus_manager_register_exported_type (gpointer unused, GType gtype, gconstpointer unused2) +nm_bus_manager_register_object (gpointer unused, const char *path, gpointer object) { } void -nm_dbus_manager_register_object (gpointer unused, const char *path, gpointer object) -{ -} - -void -nm_dbus_manager_unregister_object (gpointer unused, gpointer object) +nm_bus_manager_unregister_object (gpointer unused, gpointer object) { } diff --git a/src/nm-manager.c b/src/nm-manager.c index a5983a3480..7d1d2b3ca5 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -34,7 +34,7 @@ #include "gsystem-local-alloc.h" #include "nm-manager.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-vpn-manager.h" #include "nm-device.h" #include "nm-device-generic.h" @@ -166,7 +166,7 @@ typedef struct { NMPolicy *policy; - NMDBusManager *dbus_mgr; + NMBusManager *dbus_mgr; gboolean prop_filter_added; NMRfkillManager *rfkill_mgr; @@ -3992,7 +3992,7 @@ impl_manager_set_logging (NMManager *manager, GError *error = NULL; gulong caller_uid = G_MAXULONG; - if (!nm_dbus_manager_get_caller_info (priv->dbus_mgr, context, NULL, &caller_uid, NULL)) { + if (!nm_bus_manager_get_caller_info (priv->dbus_mgr, context, NULL, &caller_uid, NULL)) { error = g_error_new_literal (NM_MANAGER_ERROR, NM_MANAGER_ERROR_PERMISSION_DENIED, "Failed to get request UID."); @@ -4626,7 +4626,7 @@ periodic_update_active_connection_timestamps (gpointer user_data) } static void -dbus_connection_changed_cb (NMDBusManager *dbus_mgr, +dbus_connection_changed_cb (NMBusManager *dbus_mgr, DBusConnection *dbus_connection, gpointer user_data) { @@ -4686,7 +4686,7 @@ nm_manager_new (NMSettings *settings, priv = NM_MANAGER_GET_PRIVATE (singleton); - bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + bus = nm_bus_manager_get_connection (priv->dbus_mgr); if (!bus) { g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, "Failed to initialize D-Bus connection"); @@ -4817,9 +4817,9 @@ nm_manager_init (NMManager *manager) priv->state = NM_STATE_DISCONNECTED; priv->startup = TRUE; - priv->dbus_mgr = nm_dbus_manager_get (); + priv->dbus_mgr = nm_bus_manager_get (); g_signal_connect (priv->dbus_mgr, - NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED, + NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED, G_CALLBACK (dbus_connection_changed_cb), manager); @@ -5027,7 +5027,7 @@ dispose (GObject *object) /* Unregister property filter */ if (priv->dbus_mgr) { - bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + bus = nm_bus_manager_get_connection (priv->dbus_mgr); if (bus) { dbus_connection = dbus_g_connection_get_connection (bus); if (dbus_connection && priv->prop_filter_added) { diff --git a/src/nm-types.h b/src/nm-types.h index 530f9f7b5b..7d3cf48129 100644 --- a/src/nm-types.h +++ b/src/nm-types.h @@ -30,11 +30,11 @@ typedef struct _NMActiveConnection NMActiveConnection; typedef struct _NMVpnConnection NMVpnConnection; typedef struct _NMActRequest NMActRequest; typedef struct _NMAuthSubject NMAuthSubject; +typedef struct _NMBusManager NMBusManager; typedef struct _NMConfig NMConfig; typedef struct _NMConfigData NMConfigData; typedef struct _NMConnectionProvider NMConnectionProvider; typedef struct _NMConnectivity NMConnectivity; -typedef struct _NMDBusManager NMDBusManager; typedef struct _NMDefaultRouteManager NMDefaultRouteManager; typedef struct _NMDevice NMDevice; typedef struct _NMDhcp4Config NMDhcp4Config; diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index bd720950ee..f767c29e31 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -45,7 +45,6 @@ #include "nm-glib.h" #include "NetworkManagerUtils.h" #include "nm-ppp-manager.h" -#include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-platform.h" #include "nm-core-internal.h" diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index eb0073be0a..eaf5ff3f2b 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -38,7 +38,7 @@ #include "nm-setting-connection.h" #include "nm-enum-types.h" #include "nm-auth-manager.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-session-monitor.h" #include "nm-simple-connection.h" #include "NetworkManagerUtils.h" @@ -355,11 +355,11 @@ impl_agent_manager_unregister (NMAgentManager *self, GError *error = NULL; char *sender = NULL; - if (!nm_dbus_manager_get_caller_info (nm_dbus_manager_get (), - context, - &sender, - NULL, - NULL)) { + if (!nm_bus_manager_get_caller_info (nm_bus_manager_get (), + context, + &sender, + NULL, + NULL)) { error = g_error_new_literal (NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED, "Unable to determine request sender."); diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index e1355a76cd..a2b5da5795 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -29,7 +29,7 @@ #include "nm-glib.h" #include "nm-dbus-interface.h" #include "nm-secret-agent.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-dbus-glib-types.h" #include "nm-logging.h" #include "nm-auth-subject.h" @@ -460,7 +460,7 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self, static void proxy_cleanup (NMSecretAgent *self); static void -name_owner_changed_cb (NMDBusManager *dbus_mgr, +name_owner_changed_cb (NMBusManager *dbus_mgr, const char *name, const char *old_owner, const char *new_owner, @@ -482,7 +482,7 @@ proxy_cleanup (NMSecretAgent *self) g_signal_handlers_disconnect_by_func (priv->proxy, proxy_cleanup, self); g_clear_object (&priv->proxy); - g_signal_handlers_disconnect_by_func (nm_dbus_manager_get (), name_owner_changed_cb, self); + g_signal_handlers_disconnect_by_func (nm_bus_manager_get (), name_owner_changed_cb, self); g_clear_pointer (&priv->dbus_owner, g_free); g_signal_emit (self, signals[DISCONNECTED], 0); @@ -524,16 +524,16 @@ nm_secret_agent_new (DBusGMethodInvocation *context, priv->hash = g_str_hash (hash_str); g_free (hash_str); - priv->proxy = nm_dbus_manager_new_proxy (nm_dbus_manager_get (), - context, - priv->dbus_owner, - NM_DBUS_PATH_SECRET_AGENT, - NM_DBUS_INTERFACE_SECRET_AGENT); + priv->proxy = nm_bus_manager_new_proxy (nm_bus_manager_get (), + context, + priv->dbus_owner, + NM_DBUS_PATH_SECRET_AGENT, + NM_DBUS_INTERFACE_SECRET_AGENT); g_assert (priv->proxy); g_signal_connect_swapped (priv->proxy, "destroy", G_CALLBACK (proxy_cleanup), self); - g_signal_connect (nm_dbus_manager_get (), - NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + g_signal_connect (nm_bus_manager_get (), + NM_BUS_MANAGER_NAME_OWNER_CHANGED, G_CALLBACK (name_owner_changed_cb), self); diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 663898a421..ba5035a513 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -67,7 +67,7 @@ #include "nm-settings-connection.h" #include "nm-system-config-interface.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-auth-utils.h" #include "nm-auth-subject.h" #include "nm-session-monitor.h" @@ -161,7 +161,7 @@ G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT, 0, typedef struct { - NMDBusManager *dbus_mgr; + NMBusManager *dbus_mgr; NMAgentManager *agent_mgr; @@ -1435,13 +1435,13 @@ impl_settings_add_connection_unsaved (NMSettings *self, } static gboolean -ensure_root (NMDBusManager *dbus_mgr, +ensure_root (NMBusManager *dbus_mgr, DBusGMethodInvocation *context) { gulong caller_uid; GError *error = NULL; - if (!nm_dbus_manager_get_caller_info (dbus_mgr, context, NULL, &caller_uid, NULL)) { + if (!nm_bus_manager_get_caller_info (dbus_mgr, context, NULL, &caller_uid, NULL)) { error = g_error_new_literal (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_PERMISSION_DENIED, "Unable to determine request UID."); @@ -2102,7 +2102,7 @@ nm_settings_new (GError **error) priv = NM_SETTINGS_GET_PRIVATE (self); priv->config = nm_config_get (); - priv->dbus_mgr = nm_dbus_manager_get (); + priv->dbus_mgr = nm_bus_manager_get (); /* Load the plugins; fail if a plugin is not found. */ if (!load_plugins (self, nm_config_get_plugins (priv->config), error)) { diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index 39043ec50f..69e6894347 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -28,7 +28,7 @@ #include "nm-test-device.h" #include "nm-fake-platform.h" #include "nm-logging.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "nm-test-utils.h" @@ -757,10 +757,10 @@ main (int argc, char **argv) /* Initialize the DBus manager singleton explicitly, because it is accessed by * the class initializer of NMDevice (used by the NMTestDevice stub). - * This way, we skip calling nm_dbus_manager_init_bus() which would + * This way, we skip calling nm_bus_manager_init_bus() which would * either fail and/or cause unexpected actions in the test. * */ - nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL)); + nm_bus_manager_setup (g_object_new (NM_TYPE_BUS_MANAGER, NULL)); nm_fake_platform_setup ();