summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@redhat.com>2015-07-24 13:25:55 -0400
committerDan Winship <danw@redhat.com>2015-07-24 13:25:55 -0400
commit232d045c2e15ab9559fd462c162771de14b51720 (patch)
treeecddf2f1e6fe3b2c5578fa81fd3e399489d4291d
parent8bca864111a248ac4965f4f5887580c9829624da (diff)
parent02370be7f31bbcd7a5ecd808c239d48bdad42024 (diff)
downloadNetworkManager-232d045c2e15ab9559fd462c162771de14b51720.tar.gz
all: merge branch 'pre-gdbus-bgo622927'
Misc pre-gdbus-port stuff https://bugzilla.gnome.org/show_bug.cgi?id=622927
-rw-r--r--callouts/nm-dispatcher-utils.c2
-rw-r--r--callouts/nm-dispatcher-utils.h2
-rw-r--r--callouts/nm-dispatcher.c4
-rw-r--r--callouts/tests/test-dispatcher-envp.c3
-rw-r--r--clients/cli/agent.c2
-rw-r--r--clients/cli/common.c4
-rw-r--r--clients/cli/connections.c2
-rw-r--r--clients/cli/devices.c2
-rw-r--r--clients/cli/general.c3
-rw-r--r--clients/cli/nmcli.c3
-rw-r--r--clients/cli/polkit-agent.c4
-rw-r--r--clients/cli/settings.c3
-rw-r--r--clients/cli/utils.c2
-rw-r--r--clients/common/nm-polkit-listener.c3
-rw-r--r--clients/common/nm-polkit-listener.h4
-rw-r--r--clients/nm-online.c3
-rw-r--r--clients/tui/newt/nmt-newt-types.h4
-rw-r--r--clients/tui/newt/nmt-newt-utils.c2
-rw-r--r--clients/tui/newt/nmt-newt-utils.h3
-rw-r--r--clients/tui/nm-editor-bindings.c1
-rw-r--r--clients/tui/nmt-editor.c2
-rw-r--r--clients/tui/nmt-mac-entry.h1
-rw-r--r--clients/tui/nmt-page-bond.c2
-rw-r--r--clients/tui/nmt-page-bridge-port.c2
-rw-r--r--clients/tui/nmt-page-bridge.c2
-rw-r--r--clients/tui/nmt-page-dsl.c2
-rw-r--r--clients/tui/nmt-page-dsl.h1
-rw-r--r--clients/tui/nmt-page-ethernet.c2
-rw-r--r--clients/tui/nmt-page-infiniband.c2
-rw-r--r--clients/tui/nmt-page-ip4.c2
-rw-r--r--clients/tui/nmt-page-ip6.c2
-rw-r--r--clients/tui/nmt-page-ppp.c2
-rw-r--r--clients/tui/nmt-page-team-port.c2
-rw-r--r--clients/tui/nmt-page-team.c2
-rw-r--r--clients/tui/nmt-page-team.h1
-rw-r--r--clients/tui/nmt-page-vlan.c2
-rw-r--r--clients/tui/nmt-page-wifi.c2
-rw-r--r--clients/tui/nmt-route-editor.c2
-rw-r--r--clients/tui/nmt-utils.h2
-rw-r--r--clients/tui/nmtui.c2
-rw-r--r--clients/tui/vpn-helpers.c2
-rw-r--r--clients/tui/vpn-helpers.h3
-rw-r--r--configure.ac2
-rw-r--r--include/Makefile.am3
-rw-r--r--include/nm-dbus-compat.h74
-rw-r--r--include/nm-glib.h (renamed from include/nm-glib-compat.h)11
-rw-r--r--include/nm-gvaluearray-compat.h4
-rw-r--r--include/nm-macros-internal.h3
-rw-r--r--include/nm-test-utils.h4
-rw-r--r--introspection/Makefile.am8
-rw-r--r--introspection/nm-active-connection.xml1
-rw-r--r--introspection/nm-dhcp4-config.xml1
-rw-r--r--introspection/nm-dhcp6-config.xml1
-rw-r--r--libnm-core/crypto.c2
-rw-r--r--libnm-core/crypto.h2
-rw-r--r--libnm-core/crypto_gnutls.c2
-rw-r--r--libnm-core/crypto_nss.c2
-rw-r--r--libnm-core/nm-connection.c2
-rw-r--r--libnm-core/nm-core-internal.h2
-rw-r--r--libnm-core/nm-dbus-utils.c3
-rw-r--r--libnm-core/nm-errors.c3
-rw-r--r--libnm-core/nm-keyfile-internal.h3
-rw-r--r--libnm-core/nm-keyfile-reader.c3
-rw-r--r--libnm-core/nm-keyfile-utils.c3
-rw-r--r--libnm-core/nm-keyfile-writer.c2
-rw-r--r--libnm-core/nm-property-compare.c7
-rw-r--r--libnm-core/nm-property-compare.h2
-rw-r--r--libnm-core/nm-setting-ip-config.c2
-rw-r--r--libnm-core/nm-setting-private.h2
-rw-r--r--libnm-core/nm-setting-serial.c2
-rw-r--r--libnm-core/nm-setting.c2
-rw-r--r--libnm-core/nm-utils.c2
-rw-r--r--libnm-core/tests/test-compare.c3
-rw-r--r--libnm-core/tests/test-crypto.c2
-rw-r--r--libnm-core/tests/test-general.c3
-rw-r--r--libnm-core/tests/test-secrets.c2
-rw-r--r--libnm-core/tests/test-setting-8021x.c2
-rw-r--r--libnm-core/tests/test-setting-dcb.c2
-rw-r--r--libnm-core/tests/test-settings-defaults.c2
-rw-r--r--libnm-glib/libnm-glib-test.c3
-rw-r--r--libnm-glib/libnm_glib.c4
-rw-r--r--libnm-glib/nm-access-point.c3
-rw-r--r--libnm-glib/nm-active-connection.c6
-rw-r--r--libnm-glib/nm-client.c64
-rw-r--r--libnm-glib/nm-dbus-helpers-private.h5
-rw-r--r--libnm-glib/nm-dbus-helpers.c55
-rw-r--r--libnm-glib/nm-device-bond.c3
-rw-r--r--libnm-glib/nm-device-bridge.c3
-rw-r--r--libnm-glib/nm-device-bt.c3
-rw-r--r--libnm-glib/nm-device-ethernet.c3
-rw-r--r--libnm-glib/nm-device-infiniband.c3
-rw-r--r--libnm-glib/nm-device-modem.c3
-rw-r--r--libnm-glib/nm-device-olpc-mesh.c3
-rw-r--r--libnm-glib/nm-device-team.c3
-rw-r--r--libnm-glib/nm-device-vlan.c3
-rw-r--r--libnm-glib/nm-device-wifi.c3
-rw-r--r--libnm-glib/nm-device-wimax.c3
-rw-r--r--libnm-glib/nm-device.c6
-rw-r--r--libnm-glib/nm-object-cache.c2
-rw-r--r--libnm-glib/nm-object-cache.h3
-rw-r--r--libnm-glib/nm-object-private.h4
-rw-r--r--libnm-glib/nm-object.c59
-rw-r--r--libnm-glib/nm-remote-connection.c3
-rw-r--r--libnm-glib/nm-remote-settings.c93
-rw-r--r--libnm-glib/nm-secret-agent.c58
-rw-r--r--libnm-glib/nm-types.c2
-rw-r--r--libnm-glib/nm-vpn-plugin.c8
-rw-r--r--libnm-glib/nm-wimax-nsp.c3
-rw-r--r--libnm-glib/tests/common.c2
-rw-r--r--libnm-glib/tests/common.h2
-rw-r--r--libnm-glib/tests/test-nm-client.c2
-rw-r--r--libnm-glib/tests/test-remote-settings-client.c2
-rw-r--r--libnm-util/crypto.c2
-rw-r--r--libnm-util/crypto.h2
-rw-r--r--libnm-util/crypto_gnutls.c2
-rw-r--r--libnm-util/crypto_nss.c2
-rw-r--r--libnm-util/nm-connection.c2
-rw-r--r--libnm-util/nm-param-spec-specialized.c2
-rw-r--r--libnm-util/nm-param-spec-specialized.h2
-rw-r--r--libnm-util/nm-setting-ip4-config.c3
-rw-r--r--libnm-util/nm-setting-ip6-config.c2
-rw-r--r--libnm-util/nm-setting-private.h2
-rw-r--r--libnm-util/nm-setting-serial.c2
-rw-r--r--libnm-util/nm-utils.c3
-rw-r--r--libnm-util/nm-value-transforms.c2
-rw-r--r--libnm-util/tests/test-crypto.c2
-rw-r--r--libnm-util/tests/test-general.c2
-rw-r--r--libnm-util/tests/test-libnm-linking.c3
-rw-r--r--libnm-util/tests/test-secrets.c2
-rw-r--r--libnm-util/tests/test-setting-8021x.c2
-rw-r--r--libnm-util/tests/test-setting-dcb.c3
-rw-r--r--libnm-util/tests/test-settings-defaults.c2
-rw-r--r--libnm/nm-access-point.c3
-rw-r--r--libnm/nm-active-connection.c2
-rw-r--r--libnm/nm-client.c2
-rw-r--r--libnm/nm-dbus-helpers.c3
-rw-r--r--libnm/nm-dbus-helpers.h13
-rw-r--r--libnm/nm-device-bond.c3
-rw-r--r--libnm/nm-device-bridge.c3
-rw-r--r--libnm/nm-device-bt.c3
-rw-r--r--libnm/nm-device-ethernet.c3
-rw-r--r--libnm/nm-device-infiniband.c3
-rw-r--r--libnm/nm-device-modem.c3
-rw-r--r--libnm/nm-device-olpc-mesh.c3
-rw-r--r--libnm/nm-device-team.c3
-rw-r--r--libnm/nm-device-vlan.c3
-rw-r--r--libnm/nm-device-wifi.c3
-rw-r--r--libnm/nm-device-wimax.c3
-rw-r--r--libnm/nm-device.c2
-rw-r--r--libnm/nm-manager.c2
-rw-r--r--libnm/nm-object-cache.c2
-rw-r--r--libnm/nm-object-cache.h3
-rw-r--r--libnm/nm-object-private.h2
-rw-r--r--libnm/nm-object.c3
-rw-r--r--libnm/nm-remote-connection.c3
-rw-r--r--libnm/nm-remote-settings.c2
-rw-r--r--libnm/nm-secret-agent-old.c2
-rw-r--r--libnm/nm-vpn-plugin-old.c3
-rw-r--r--libnm/nm-wimax-nsp.c3
-rw-r--r--libnm/tests/common.c9
-rw-r--r--libnm/tests/common.h3
-rw-r--r--libnm/tests/test-nm-client.c3
-rw-r--r--libnm/tests/test-remote-settings-client.c2
-rw-r--r--libnm/tests/test-secret-agent.c2
-rw-r--r--src/Makefile.am10
-rw-r--r--src/NetworkManagerUtils.c46
-rw-r--r--src/NetworkManagerUtils.h5
-rw-r--r--src/devices/adsl/nm-atm-manager.c2
-rw-r--r--src/devices/adsl/nm-atm-manager.h3
-rw-r--r--src/devices/adsl/nm-device-adsl.c6
-rw-r--r--src/devices/adsl/nm-device-adsl.h3
-rw-r--r--src/devices/bluetooth/nm-bluez-device.c4
-rw-r--r--src/devices/bluetooth/nm-bluez-device.h4
-rw-r--r--src/devices/bluetooth/nm-bluez-manager.c7
-rw-r--r--src/devices/bluetooth/nm-bluez-manager.h3
-rw-r--r--src/devices/bluetooth/nm-bluez4-adapter.c3
-rw-r--r--src/devices/bluetooth/nm-bluez4-adapter.h3
-rw-r--r--src/devices/bluetooth/nm-bluez4-manager.h7
-rw-r--r--src/devices/bluetooth/nm-bluez5-dun.h3
-rw-r--r--src/devices/bluetooth/nm-bluez5-manager.c71
-rw-r--r--src/devices/bluetooth/nm-bluez5-manager.h7
-rw-r--r--src/devices/bluetooth/nm-bt-error.c2
-rw-r--r--src/devices/bluetooth/nm-device-bt.c74
-rw-r--r--src/devices/nm-device-bond.c14
-rw-r--r--src/devices/nm-device-bond.h2
-rw-r--r--src/devices/nm-device-bridge.c15
-rw-r--r--src/devices/nm-device-bridge.h3
-rw-r--r--src/devices/nm-device-ethernet-utils.c2
-rw-r--r--src/devices/nm-device-ethernet-utils.h2
-rw-r--r--src/devices/nm-device-ethernet.c7
-rw-r--r--src/devices/nm-device-ethernet.h2
-rw-r--r--src/devices/nm-device-factory.h3
-rw-r--r--src/devices/nm-device-generic.c5
-rw-r--r--src/devices/nm-device-generic.h2
-rw-r--r--src/devices/nm-device-gre.c6
-rw-r--r--src/devices/nm-device-gre.h2
-rw-r--r--src/devices/nm-device-infiniband.c7
-rw-r--r--src/devices/nm-device-infiniband.h2
-rw-r--r--src/devices/nm-device-macvlan.c6
-rw-r--r--src/devices/nm-device-macvlan.h2
-rw-r--r--src/devices/nm-device-tun.c4
-rw-r--r--src/devices/nm-device-tun.h2
-rw-r--r--src/devices/nm-device-veth.c6
-rw-r--r--src/devices/nm-device-veth.h2
-rw-r--r--src/devices/nm-device-vlan.c8
-rw-r--r--src/devices/nm-device-vlan.h2
-rw-r--r--src/devices/nm-device-vxlan.c6
-rw-r--r--src/devices/nm-device-vxlan.h2
-rw-r--r--src/devices/nm-device.c127
-rw-r--r--src/devices/nm-device.h10
-rw-r--r--src/devices/team/nm-device-team.c22
-rw-r--r--src/devices/team/nm-device-team.h2
-rw-r--r--src/devices/team/nm-team-factory.h2
-rw-r--r--src/devices/wifi/nm-device-olpc-mesh.c12
-rw-r--r--src/devices/wifi/nm-device-olpc-mesh.h2
-rw-r--r--src/devices/wifi/nm-device-wifi.c43
-rw-r--r--src/devices/wifi/nm-device-wifi.h2
-rw-r--r--src/devices/wifi/nm-wifi-ap.c47
-rw-r--r--src/devices/wifi/nm-wifi-ap.h9
-rw-r--r--src/devices/wifi/tests/test-wifi-ap-utils.c2
-rw-r--r--src/devices/wwan/nm-device-modem.c6
-rw-r--r--src/devices/wwan/nm-device-modem.h3
-rw-r--r--src/devices/wwan/nm-modem-broadband.h1
-rw-r--r--src/devices/wwan/nm-modem-manager.c2
-rw-r--r--src/devices/wwan/nm-modem-manager.h1
-rw-r--r--src/devices/wwan/nm-modem.c2
-rw-r--r--src/devices/wwan/nm-modem.h2
-rw-r--r--src/devices/wwan/nm-wwan-factory.h2
-rw-r--r--src/dhcp-manager/Makefile.am1
-rw-r--r--src/dhcp-manager/nm-dhcp-client.c2
-rw-r--r--src/dhcp-manager/nm-dhcp-client.h5
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient-utils.c2
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient-utils.h5
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient.c4
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient.h4
-rw-r--r--src/dhcp-manager/nm-dhcp-dhcpcd.c3
-rw-r--r--src/dhcp-manager/nm-dhcp-dhcpcd.h3
-rw-r--r--src/dhcp-manager/nm-dhcp-helper.c2
-rw-r--r--src/dhcp-manager/nm-dhcp-listener.c19
-rw-r--r--src/dhcp-manager/nm-dhcp-listener.h3
-rw-r--r--src/dhcp-manager/nm-dhcp-manager.c3
-rw-r--r--src/dhcp-manager/nm-dhcp-manager.h3
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c3
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.h3
-rw-r--r--src/dhcp-manager/nm-dhcp-utils.c2
-rw-r--r--src/dhcp-manager/nm-dhcp-utils.h4
-rw-r--r--src/dhcp-manager/tests/Makefile.am1
-rw-r--r--src/dhcp-manager/tests/test-dhcp-dhclient.c2
-rw-r--r--src/dhcp-manager/tests/test-dhcp-utils.c2
-rw-r--r--src/dns-manager/nm-dns-dnsmasq.c2
-rw-r--r--src/dns-manager/nm-dns-dnsmasq.h3
-rw-r--r--src/dns-manager/nm-dns-manager.c3
-rw-r--r--src/dns-manager/nm-dns-manager.h2
-rw-r--r--src/dns-manager/nm-dns-plugin.c2
-rw-r--r--src/dns-manager/nm-dns-plugin.h3
-rw-r--r--src/dns-manager/nm-dns-unbound.h2
-rw-r--r--src/dnsmasq-manager/nm-dnsmasq-manager.c2
-rw-r--r--src/dnsmasq-manager/nm-dnsmasq-manager.h3
-rw-r--r--src/dnsmasq-manager/nm-dnsmasq-utils.h2
-rw-r--r--src/dnsmasq-manager/tests/test-dnsmasq-utils.c2
-rw-r--r--src/main-utils.c4
-rw-r--r--src/main-utils.h2
-rw-r--r--src/main.c8
-rw-r--r--src/nm-activation-request.h3
-rw-r--r--src/nm-active-connection.c41
-rw-r--r--src/nm-active-connection.h11
-rw-r--r--src/nm-auth-manager.c2
-rw-r--r--src/nm-auth-manager.h2
-rw-r--r--src/nm-auth-subject.c27
-rw-r--r--src/nm-auth-subject.h3
-rw-r--r--src/nm-auth-utils.c3
-rw-r--r--src/nm-auth-utils.h2
-rw-r--r--src/nm-bus-manager.c (renamed from src/nm-dbus-manager.c)282
-rw-r--r--src/nm-bus-manager.h129
-rw-r--r--src/nm-config-data.h3
-rw-r--r--src/nm-config.c7
-rw-r--r--src/nm-config.h3
-rw-r--r--src/nm-connection-provider.h2
-rw-r--r--src/nm-connectivity.c2
-rw-r--r--src/nm-connectivity.h4
-rw-r--r--src/nm-dbus-manager.h133
-rw-r--r--src/nm-dcb.c2
-rw-r--r--src/nm-dcb.h2
-rw-r--r--src/nm-default-route-manager.h2
-rw-r--r--src/nm-dhcp4-config.c103
-rw-r--r--src/nm-dhcp4-config.h20
-rw-r--r--src/nm-dhcp6-config.c103
-rw-r--r--src/nm-dhcp6-config.h20
-rw-r--r--src/nm-dispatcher.c74
-rw-r--r--src/nm-dispatcher.h2
-rw-r--r--src/nm-exported-object.c358
-rw-r--r--src/nm-exported-object.h60
-rw-r--r--src/nm-firewall-manager.c3
-rw-r--r--src/nm-firewall-manager.h2
-rw-r--r--src/nm-iface-helper.c14
-rw-r--r--src/nm-ip4-config.c35
-rw-r--r--src/nm-ip4-config.h12
-rw-r--r--src/nm-ip6-config.c37
-rw-r--r--src/nm-ip6-config.h11
-rw-r--r--src/nm-logging.c2
-rw-r--r--src/nm-logging.h3
-rw-r--r--src/nm-manager.c88
-rw-r--r--src/nm-manager.h9
-rw-r--r--src/nm-multi-index.c3
-rw-r--r--src/nm-multi-index.h2
-rw-r--r--src/nm-policy.c12
-rw-r--r--src/nm-properties-changed-signal.c248
-rw-r--r--src/nm-properties-changed-signal.h31
-rw-r--r--src/nm-rfkill-manager.h2
-rw-r--r--src/nm-route-manager.h2
-rw-r--r--src/nm-session-monitor.c3
-rw-r--r--src/nm-session-monitor.h2
-rw-r--r--src/nm-sleep-monitor-systemd.c4
-rw-r--r--src/nm-sleep-monitor-upower.c2
-rw-r--r--src/nm-sleep-monitor.h2
-rw-r--r--src/nm-types.h2
-rw-r--r--src/platform/nm-platform.h3
-rw-r--r--src/platform/tests/monitor.c2
-rw-r--r--src/platform/wifi/wifi-utils-nl80211.c2
-rw-r--r--src/platform/wifi/wifi-utils-private.h2
-rw-r--r--src/platform/wifi/wifi-utils-wext.c3
-rw-r--r--src/platform/wifi/wifi-utils.c2
-rw-r--r--src/platform/wifi/wifi-utils.h2
-rw-r--r--src/ppp-manager/nm-ppp-manager.c143
-rw-r--r--src/ppp-manager/nm-ppp-manager.h8
-rw-r--r--src/ppp-manager/nm-pppd-plugin.c3
-rw-r--r--src/rdisc/nm-rdisc.h2
-rw-r--r--src/settings/nm-agent-manager.c65
-rw-r--r--src/settings/nm-agent-manager.h9
-rw-r--r--src/settings/nm-inotify-helper.c2
-rw-r--r--src/settings/nm-inotify-helper.h4
-rw-r--r--src/settings/nm-secret-agent.c77
-rw-r--r--src/settings/nm-secret-agent.h7
-rw-r--r--src/settings/nm-settings-connection.c123
-rw-r--r--src/settings/nm-settings-connection.h5
-rw-r--r--src/settings/nm-settings.c85
-rw-r--r--src/settings/nm-settings.h6
-rw-r--r--src/settings/nm-system-config-interface.h4
-rw-r--r--src/settings/plugins/ibft/plugin.c3
-rw-r--r--src/settings/plugins/ibft/plugin.h2
-rw-r--r--src/settings/plugins/ibft/reader.c2
-rw-r--r--src/settings/plugins/ibft/reader.h3
-rw-r--r--src/settings/plugins/ifcfg-rh/common.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/plugin.c26
-rw-r--r--src/settings/plugins/ifcfg-rh/plugin.h6
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/shvar.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/utils.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/utils.h2
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.h4
-rw-r--r--src/settings/plugins/ifnet/Makefile.am1
-rw-r--r--src/settings/plugins/ifnet/net_parser.h2
-rw-r--r--src/settings/plugins/ifnet/net_utils.c2
-rw-r--r--src/settings/plugins/ifnet/net_utils.h2
-rw-r--r--src/settings/plugins/ifnet/plugin.c3
-rw-r--r--src/settings/plugins/ifnet/plugin.h2
-rw-r--r--src/settings/plugins/ifnet/tests/Makefile.am1
-rw-r--r--src/settings/plugins/ifnet/tests/test-ifnet.c2
-rw-r--r--src/settings/plugins/ifnet/wpa_parser.h2
-rw-r--r--src/settings/plugins/ifupdown/Makefile.am1
-rw-r--r--src/settings/plugins/ifupdown/interface_parser.h2
-rw-r--r--src/settings/plugins/ifupdown/nm-ifupdown-connection.h1
-rw-r--r--src/settings/plugins/ifupdown/plugin.c3
-rw-r--r--src/settings/plugins/ifupdown/plugin.h2
-rw-r--r--src/settings/plugins/ifupdown/tests/test-ifupdown.c2
-rw-r--r--src/settings/plugins/keyfile/common.h2
-rw-r--r--src/settings/plugins/keyfile/plugin.c3
-rw-r--r--src/settings/plugins/keyfile/plugin.h2
-rw-r--r--src/settings/plugins/keyfile/reader.h3
-rw-r--r--src/settings/plugins/keyfile/utils.c3
-rw-r--r--src/settings/plugins/keyfile/utils.h2
-rw-r--r--src/settings/plugins/keyfile/writer.c4
-rw-r--r--src/settings/plugins/keyfile/writer.h3
-rw-r--r--src/supplicant-manager/nm-supplicant-config.c2
-rw-r--r--src/supplicant-manager/nm-supplicant-config.h2
-rw-r--r--src/supplicant-manager/nm-supplicant-interface.c27
-rw-r--r--src/supplicant-manager/nm-supplicant-interface.h3
-rw-r--r--src/supplicant-manager/nm-supplicant-manager.c4
-rw-r--r--src/supplicant-manager/nm-supplicant-manager.h2
-rw-r--r--src/supplicant-manager/nm-supplicant-settings-verify.c2
-rw-r--r--src/tests/config/test-config.c8
-rw-r--r--src/tests/test-dcb.c2
-rw-r--r--src/tests/test-general-with-expect.c2
-rw-r--r--src/tests/test-general.c2
-rw-r--r--src/tests/test-ip4-config.c2
-rw-r--r--src/tests/test-ip6-config.c2
-rw-r--r--src/tests/test-resolvconf-capture.c2
-rw-r--r--src/tests/test-route-manager.c2
-rw-r--r--src/tests/test-wired-defname.c3
-rw-r--r--src/vpn-manager/nm-vpn-connection.c33
-rw-r--r--src/vpn-manager/nm-vpn-connection.h2
-rw-r--r--src/vpn-manager/nm-vpn-manager.c3
-rw-r--r--src/vpn-manager/nm-vpn-manager.h3
-rw-r--r--src/vpn-manager/nm-vpn-service.c57
-rw-r--r--src/vpn-manager/nm-vpn-service.h3
396 files changed, 1998 insertions, 2407 deletions
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 <string.h>
-#include <glib-object.h>
#include <nm-dbus-interface.h>
#include <nm-connection.h>
@@ -30,6 +29,7 @@
#include <nm-setting-ip6-config.h>
#include <nm-setting-connection.h>
+#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 <glib.h>
+#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 <errno.h>
#include <arpa/inet.h>
-#include <glib.h>
#include <glib-unix.h>
-
+#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 <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
+#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 <glib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
@@ -30,6 +29,7 @@
#include <readline/readline.h>
#include <readline/history.h>
+#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 <glib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
@@ -30,8 +29,7 @@
#include <readline/readline.h>
#include <readline/history.h>
-#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 <glib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
@@ -31,6 +30,7 @@
#include <readline/readline.h>
#include <readline/history.h>
+#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 <errno.h>
#include <readline/readline.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <string.h>
#include <stdlib.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <readline/readline.h>
#include <readline/history.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <unistd.h>
#include <termios.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
+#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 <stdlib.h>
#include <arpa/inet.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <netinet/in.h>
#include <arpa/inet.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
-#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 <glib.h>
-
#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
#include <polkitagent/polkitagent.h>
+#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 <glib/gi18n.h>
#include <NetworkManager.h>
-#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 <glib-object.h>
#include <newt.h>
-#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 <glib/gi18n-lib.h>
-#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 <newt.h>
-#include <glib.h>
+
+#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 <string.h>
#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 <glib.h>
#include <glib/gi18n-lib.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <stdlib.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
+#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 <stdlib.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
+#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 <stdlib.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <stdlib.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
+#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 <glib-object.h>
+#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 <stdlib.h>
#include <string.h>
-#include <glib.h>
#include <glib/gi18n-lib.h>
#include <NetworkManager.h>
+#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 <string.h>
-#include <glib.h>
#include <gmodule.h>
#include <glib/gi18n.h>
@@ -39,6 +38,7 @@
#include <nm-setting-connection.h>
#include <nm-setting-vpn.h>
+#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 <glib.h>
#include <nm-connection.h>
#define NM_VPN_API_SUBJECT_TO_CHANGE
#include <nm-vpn-plugin-ui-interface.h>
+#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 ff7eac8c27..66b0bec801 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,7 +1,8 @@
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-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 <dbus/dbus-shared.h> */
+
+/* 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/include/nm-glib-compat.h b/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 <glib.h>
-#include <glib-object.h>
+#include <gio/gio.h>
#include <string.h>
-
#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 <glib.h>
-
-#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 <glib.h>
+#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 <stdio.h>
#include <unistd.h>
#include <stdlib.h>
-#include <glib.h>
-#include <glib-object.h>
#include <string.h>
#include <errno.h>
+#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/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 @@
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Connection.Active">
+ <annotation name="org.gtk.GDBus.C.Name" value="ActiveConnection"/>
<tp:docstring>
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 @@
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.DHCP4Config">
+ <annotation name="org.gtk.GDBus.C.Name" value="Dhcp4Config"/>
<tp:docstring>
Options and configuration returned by the IPv4 DHCP server.
</tp:docstring>
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 @@
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.DHCP6Config">
+ <annotation name="org.gtk.GDBus.C.Name" value="Dhcp6Config"/>
<tp:docstring>
Options and configuration returned by the IPv6 DHCP server.
</tp:docstring>
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 <glib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
#include <gnutls/gnutls.h>
@@ -31,6 +30,7 @@
#include <gnutls/x509.h>
#include <gnutls/pkcs12.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
#include <prinit.h>
@@ -36,6 +35,7 @@
#include <ciferfam.h>
#include <p12plcy.h>
+#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 <glib-object.h>
#include <glib/gi18n-lib.h>
#include <string.h>
+#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 <gio/gio.h>
+#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 <string.h>
-#include <gio/gio.h>
#include <glib/gi18n-lib.h>
-#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 <string.h>
-#include <gio/gio.h>
+#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 <glib.h>
#include <sys/types.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
#include <stdlib.h>
#include <string.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
+#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 <string.h>
#include <math.h>
#include <netinet/in.h>
-#include <gio/gio.h>
+
+#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 <glib.h>
+#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 <arpa/inet.h>
#include <glib/gi18n-lib.h>
+#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 <string.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include <gio/gio.h>
+#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 <gmodule.h>
#include <glib/gi18n-lib.h>
+#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 <arpa/inet.h>
#include <netinet/in.h>
-#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 <glib.h>
#include <unistd.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <string.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <netinet/in.h>
#include <arpa/inet.h>
+
+#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 <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <glib.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-connection.h>
#include <nm-setting-connection.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
#include <nm-utils.h>
+#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 7067a1100d..613c3577f1 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -23,6 +23,7 @@
#include <string.h>
+#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,
@@ -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-client.c b/libnm-glib/nm-client.c
index 40add09c76..e47a2751b1 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <nm-utils.h>
+#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);
@@ -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);
-
- 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);
- }
+ 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);
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 8a350e783d..b2c992b6e7 100644
--- a/libnm-glib/nm-dbus-helpers-private.h
+++ b/libnm-glib/nm-dbus-helpers-private.h
@@ -21,13 +21,12 @@
#ifndef NM_DBUS_HELPERS_PRIVATE_H
#define NM_DBUS_HELPERS_PRIVATE_H
-#include <gio/gio.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
-DBusGConnection *_nm_dbus_new_connection (GError **error);
+#include "nm-glib.h"
-gboolean _nm_dbus_is_connection_private (DBusGConnection *connection);
+DBusGConnection *_nm_dbus_new_connection (GError **error);
DBusGProxy * _nm_dbus_new_proxy_for_connection (DBusGConnection *connection,
const char *path,
diff --git a/libnm-glib/nm-dbus-helpers.c b/libnm-glib/nm-dbus-helpers.c
index 00e04ab435..44ae13a804 100644
--- a/libnm-glib/nm-dbus-helpers.c
+++ b/libnm-glib/nm-dbus-helpers.c
@@ -21,80 +21,27 @@
#include "config.h"
#include <string.h>
-#include <gio/gio.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include "nm-glib.h"
#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-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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-bond.h>
#include <nm-utils.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-bridge.h>
#include <nm-utils.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-bluetooth.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-wired.h>
#include <nm-setting-pppoe.h>
+#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 <linux/if_infiniband.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-infiniband.h>
#include <nm-utils.h>
+#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 <string.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-gsm.h>
#include <nm-setting-cdma.h>
+#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 <string.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-olpc-mesh.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-team.h>
#include <nm-utils.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-vlan.h>
#include <nm-utils.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
+#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 <string.h>
#include <netinet/ether.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-wimax.h>
+#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 bd5d16374e..b511254150 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -26,6 +26,7 @@
#include <glib/gi18n-lib.h>
#include <gudev/gudev.h>
+#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"
@@ -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-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 <string.h>
-#include <glib.h>
+#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 <glib.h>
-#include <glib-object.h>
+#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..519f6776b7 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 <gio/gio.h>
+#include "nm-glib.h"
#include "nm-object.h"
void _nm_object_ensure_inited (NMObject *object);
@@ -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 fb25c1ac40..b92b0ca61c 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -22,16 +22,15 @@
#include "config.h"
#include <string.h>
-#include <gio/gio.h>
#include <stdlib.h>
#include <stdio.h>
#include <nm-utils.h>
+#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"
@@ -173,25 +172,21 @@ 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");
-
- 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);
-
- 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);
- }
+ priv->properties_proxy = _nm_object_new_proxy (self, NULL, DBUS_INTERFACE_PROPERTIES);
+
+ 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);
}
static gboolean
@@ -273,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
@@ -1439,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-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 <string.h>
-#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <NetworkManager.h>
#include <nm-utils.h>
#include <nm-setting-connection.h>
+#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 80a274f5e3..d2fa2db73e 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -25,12 +25,12 @@
#include <NetworkManager.h>
#include <nm-connection.h>
+#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"
/**
@@ -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);
-
- 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);
- }
+ /* 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);
priv->proxy = _nm_dbus_new_proxy_for_connection (priv->bus,
NM_DBUS_PATH_SETTINGS,
@@ -1215,7 +1212,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 */
@@ -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 04f8dd8b1f..32b8564f0f 100644
--- a/libnm-glib/nm-secret-agent.c
+++ b/libnm-glib/nm-secret-agent.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include "nm-glib-compat.h"
+#include "nm-glib.h"
#include "NetworkManager.h"
#include "nm-secret-agent.h"
#include "nm-glib-enum-types.h"
@@ -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);
-
- 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);
- }
+
+ 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);
+
+ 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);
}
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 <glib.h>
#include <dbus/dbus-glib.h>
#include <string.h>
+#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 f40ea800f2..290ecb4738 100644
--- a/libnm-glib/nm-vpn-plugin.c
+++ b/libnm-glib/nm-vpn-plugin.c
@@ -22,7 +22,7 @@
#include "config.h"
#include <signal.h>
-#include "nm-glib-compat.h"
+#include "nm-glib.h"
#include "nm-vpn-plugin.h"
#include "nm-vpn-enum-types.h"
#include "nm-utils.h"
@@ -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-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 <string.h>
-#include "nm-glib-compat.h"
-
#include <nm-connection.h>
#include <nm-setting-connection.h>
#include <nm-setting-wimax.h>
+#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 <dbus/dbus.h>
-#include <glib.h>
#include <string.h>
+#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 <gio/gio.h>
+#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 <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include <glib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <NetworkManager.h>
+#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 <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include <glib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
@@ -34,6 +33,7 @@
#include <nm-setting-wired.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <glib/gi18n-lib.h>
+#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 <glib.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
#include <gnutls/gnutls.h>
@@ -31,6 +30,7 @@
#include <gnutls/x509.h>
#include <gnutls/pkcs12.h>
+#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 <glib.h>
#include <glib/gi18n-lib.h>
#include <prinit.h>
@@ -36,6 +35,7 @@
#include <ciferfam.h>
#include <p12plcy.h>
+#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 <glib-object.h>
#include <glib/gi18n-lib.h>
#include <dbus/dbus-glib.h>
#include <string.h>
+#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 <glib-object.h>
+#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 <dbus/dbus-glib.h>
#include <glib/gi18n-lib.h>
+#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 <dbus/dbus-glib.h>
#include <glib/gi18n-lib.h>
+#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 <string.h>
+#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 <uuid/uuid.h>
#include <libintl.h>
#include <gmodule.h>
-#include <gio/gio.h>
#include <glib/gi18n-lib.h>
+#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 <string.h>
+#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 <glib.h>
#include <unistd.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
+#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 <glib.h>
#include <dbus/dbus-glib.h>
#include <string.h>
#include <netinet/ether.h>
@@ -30,6 +29,7 @@
#include <sys/resource.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <nm-utils.h>
-#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
-#include <nm-glib-compat.h>
+#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 <glib.h>
#include <string.h>
#include <nm-utils.h>
+#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 <string.h>
-#include "nm-glib-compat.h"
-
#include <nm-connection.h>
#include <nm-setting-connection.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
#include <nm-utils.h>
+#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 <string.h>
+#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 <string.h>
#include <nm-utils.h>
+#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 <string.h>
-#include <gio/gio.h>
-#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 ca779d3a39..2b0809f81b 100644
--- a/libnm/nm-dbus-helpers.h
+++ b/libnm/nm-dbus-helpers.h
@@ -21,18 +21,9 @@
#ifndef __NM_DBUS_HELPERS_PRIVATE_H__
#define __NM_DBUS_HELPERS_PRIVATE_H__
-#include <gio/gio.h>
-
-/* 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-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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-bond.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-bridge.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-bluetooth.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-wired.h>
#include <nm-setting-pppoe.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-infiniband.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-gsm.h>
#include <nm-setting-cdma.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-olpc-mesh.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-team.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-vlan.h>
#include <nm-setting-wired.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
#include <nm-utils.h>
+#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 <string.h>
#include <glib/gi18n-lib.h>
-#include "nm-glib-compat.h"
-
#include <nm-setting-connection.h>
#include <nm-setting-wimax.h>
#include <nm-utils.h>
+#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 <glib/gi18n-lib.h>
#include <gudev/gudev.h>
+#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 <glib/gi18n-lib.h>
#include <nm-utils.h>
+#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 <string.h>
-#include <glib.h>
+#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 <glib.h>
-#include <glib-object.h>
+#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 <gio/gio.h>
+#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 <string.h>
-#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <stdio.h>
#include <nm-utils.h>
+#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 <string.h>
-#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <nm-dbus-interface.h>
#include <nm-utils.h>
#include <nm-setting-connection.h>
+#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 <nm-dbus-interface.h>
#include <nm-connection.h>
+#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 <string.h>
-#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 <stdlib.h>
#include <glib/gi18n-lib.h>
-#include <gio/gio.h>
-#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 <string.h>
-#include "nm-glib-compat.h"
-
#include <nm-connection.h>
#include <nm-setting-connection.h>
#include <nm-setting-wimax.h>
+#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 a28e5112b3..833d7fd004 100644
--- a/libnm/tests/common.c
+++ b/libnm/tests/common.c
@@ -20,10 +20,11 @@
#include "config.h"
-#include <glib.h>
#include <string.h>
+#include "nm-glib.h"
#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/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 <gio/gio.h>
#include <NetworkManager.h>
+#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 <glib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <NetworkManager.h>
-#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 <glib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <NetworkManager.h>
+#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 <glib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
@@ -28,6 +27,7 @@
#include <NetworkManager.h>
#include <nm-secret-agent-old.h>
+#include "nm-glib.h"
#include "common.h"
#include "nm-test-utils.h"
diff --git a/src/Makefile.am b/src/Makefile.am
index cc0a0aecd1..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 \
@@ -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/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index 6292e80c76..c866c5f496 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -21,8 +21,6 @@
#include "config.h"
-#include <glib.h>
-#include <gio/gio.h>
#include <glib/gi18n.h>
#include <errno.h>
#include <fcntl.h>
@@ -35,6 +33,7 @@
#include <linux/if.h>
#include <linux/if_infiniband.h>
+#include "nm-glib.h"
#include "NetworkManagerUtils.h"
#include "nm-platform.h"
#include "nm-utils.h"
@@ -2905,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 2ad132b8ec..5cc34cdf69 100644
--- a/src/NetworkManagerUtils.h
+++ b/src/NetworkManagerUtils.h
@@ -22,10 +22,10 @@
#ifndef __NETWORKMANAGER_UTILS_H__
#define __NETWORKMANAGER_UTILS_H__
-#include <glib.h>
#include <stdio.h>
#include <arpa/inet.h>
+#include "nm-glib.h"
#include "nm-connection.h"
#include "nm-types.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/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 <gudev/gudev.h>
#include <gmodule.h>
+#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 <glib.h>
-#include <glib-object.h>
+#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..a557a0c88f 100644
--- a/src/devices/adsl/nm-device-adsl.c
+++ b/src/devices/adsl/nm-device-adsl.c
@@ -29,17 +29,16 @@
#include <sys/types.h>
#include <unistd.h>
-#include <glib.h>
#include <glib/gi18n.h>
#include <stdlib.h>
#include <string.h>
+#include "nm-glib.h"
#include "nm-device-adsl.h"
#include "nm-device-private.h"
#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/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 <glib-object.h>
-
// 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..39afd091a5 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 <glib.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <string.h>
+#include "nm-glib.h"
#include "nm-core-internal.h"
#include "nm-bt-error.h"
@@ -889,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-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 <glib.h>
-#include <glib-object.h>
-#include <gio/gio.h>
#include <config.h>
+#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..8d41ca3f1b 100644
--- a/src/devices/bluetooth/nm-bluez-manager.c
+++ b/src/devices/bluetooth/nm-bluez-manager.c
@@ -24,8 +24,8 @@
#include <string.h>
#include <stdlib.h>
#include <gmodule.h>
-#include <gio/gio.h>
+#include "nm-glib.h"
#include "nm-logging.h"
#include "nm-bluez-manager.h"
#include "nm-device-factory.h"
@@ -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-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 <glib.h>
-#include <glib-object.h>
+#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..e02e72095c 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 <glib.h>
#include <string.h>
+#include "nm-glib.h"
#include "nm-dbus-interface.h"
#include "nm-bluez4-adapter.h"
#include "nm-bluez-device.h"
@@ -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-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 <glib.h>
-#include <glib-object.h>
+#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 <glib.h>
-#include <glib-object.h>
-
-#include <config.h>
-#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 <glib.h>
-#include <gio/gio.h>
+#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..ceb8d484d6 100644
--- a/src/devices/bluetooth/nm-bluez5-manager.c
+++ b/src/devices/bluetooth/nm-bluez5-manager.c
@@ -25,21 +25,17 @@
#include <signal.h>
#include <string.h>
#include <stdlib.h>
-#include <gio/gio.h>
+#include "nm-glib.h"
#include "nm-logging.h"
#include "nm-bluez-manager.h"
#include "nm-bluez5-manager.h"
#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;
@@ -207,8 +203,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;
@@ -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));
-
- /* Can't handle the signal if its not from the Bluez */
- if (strcmp (BLUEZ_SERVICE, name))
- return;
+ char *owner;
- 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-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 <glib.h>
-#include <glib-object.h>
-
-#include <config.h>
-#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 <glib.h>
+#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..55b8d0aef5 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -24,12 +24,10 @@
#include <string.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
-#include "nm-glib-compat.h"
+#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"
@@ -47,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);
@@ -59,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;
@@ -967,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);
}
@@ -1021,18 +1012,27 @@ static void
nm_device_bt_init (NMDeviceBt *self)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self);
- gboolean mm_running;
-
- 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);
+ GError *error = NULL;
- /* 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
@@ -1113,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);
@@ -1197,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 7f1394248d..f00f618fa9 100644
--- a/src/devices/nm-device-bond.c
+++ b/src/devices/nm-device-bond.c
@@ -20,12 +20,12 @@
#include "config.h"
-#include <glib.h>
#include <glib/gi18n.h>
#include <errno.h>
#include <stdlib.h>
+#include "nm-glib.h"
#include "gsystem-local-alloc.h"
#include "nm-device-bond.h"
#include "nm-logging.h"
@@ -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"
@@ -476,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);
@@ -542,8 +537,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-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 <glib-object.h>
-
#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..cce97875d7 100644
--- a/src/devices/nm-device-bridge.c
+++ b/src/devices/nm-device-bridge.c
@@ -20,18 +20,17 @@
#include "config.h"
-#include <glib.h>
#include <glib/gi18n.h>
#include <stdlib.h>
+#include "nm-glib.h"
#include "gsystem-local-alloc.h"
#include "nm-device-bridge.h"
#include "nm-logging.h"
#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"
@@ -402,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);
@@ -466,8 +462,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-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 <glib-object.h>
-
+#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 <string.h>
-#include <glib.h>
#include <glib/gi18n.h>
#include <nm-connection.h>
+#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 <glib.h>
+#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..8fcf4827fb 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -21,7 +21,6 @@
#include "config.h"
-#include <glib.h>
#include <glib/gi18n.h>
#include <netinet/in.h>
#include <string.h>
@@ -31,7 +30,7 @@
#include <gudev/gudev.h>
-#include "nm-glib-compat.h"
+#include "nm-glib.h"
#include "nm-device-ethernet.h"
#include "nm-device-private.h"
#include "nm-activation-request.h"
@@ -42,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"
@@ -1707,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-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 <glib-object.h>
-
#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 <glib.h>
-#include <glib-object.h>
-
#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..db5b2b6b4d 100644
--- a/src/devices/nm-device-generic.c
+++ b/src/devices/nm-device-generic.c
@@ -24,8 +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"
#include "nm-device-generic-glue.h"
@@ -204,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-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 <glib-object.h>
-
#include "nm-device.h"
G_BEGIN_DECLS
diff --git a/src/devices/nm-device-gre.c b/src/devices/nm-device-gre.c
index b3510d2e25..9cda059603 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"
@@ -137,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);
@@ -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-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 <glib-object.h>
-
#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..98e2f1de09 100644
--- a/src/devices/nm-device-infiniband.c
+++ b/src/devices/nm-device-infiniband.c
@@ -20,17 +20,16 @@
#include "config.h"
-#include <glib.h>
#include <glib/gi18n.h>
#include <linux/if_infiniband.h>
+#include "nm-glib.h"
#include "nm-device-infiniband.h"
#include "nm-logging.h"
#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"
@@ -39,7 +38,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))
@@ -296,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-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 <glib-object.h>
-
#include "nm-device.h"
G_BEGIN_DECLS
diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c
index 0bfe3fe9fc..e2d256671e 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"
@@ -115,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);
@@ -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-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 <glib-object.h>
-
#include "nm-device-generic.h"
G_BEGIN_DECLS
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-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 <glib-object.h>
-
#include "nm-device-generic.h"
G_BEGIN_DECLS
diff --git a/src/devices/nm-device-veth.c b/src/devices/nm-device-veth.c
index 04f03fbbe5..944e9da616 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"
@@ -137,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);
@@ -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-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 <glib-object.h>
-
#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..511656ffe0 100644
--- a/src/devices/nm-device-vlan.c
+++ b/src/devices/nm-device-vlan.c
@@ -20,11 +20,11 @@
#include "config.h"
-#include <glib.h>
#include <glib/gi18n.h>
#include <sys/socket.h>
+#include "nm-glib.h"
#include "nm-device-vlan.h"
#include "nm-manager.h"
#include "nm-logging.h"
@@ -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"
@@ -515,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);
@@ -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-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 <glib-object.h>
-
#include "nm-device.h"
G_BEGIN_DECLS
diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c
index 186e00de00..072d019a62 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"
@@ -157,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);
@@ -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-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 <glib-object.h>
-
#include "nm-device-generic.h"
G_BEGIN_DECLS
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 985b0c65f6..271201444f 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -21,7 +21,6 @@
#include "config.h"
-#include <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus.h>
#include <netinet/in.h>
@@ -36,8 +35,8 @@
#include <fcntl.h>
#include <netlink/route/addr.h>
+#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"
@@ -46,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"
@@ -56,7 +54,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"
@@ -80,7 +77,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))
@@ -200,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;
@@ -514,30 +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)
{
@@ -3446,22 +3418,6 @@ dhcp4_fail (NMDevice *self, gboolean timeout)
}
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,
NMIP4Config *ip4_config,
@@ -3486,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);
@@ -4102,22 +4059,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,
NMIP6Config *ip6_config,
@@ -4137,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) {
@@ -6389,25 +6331,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);
}
@@ -6524,25 +6464,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);
@@ -9158,7 +9096,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);
@@ -9298,7 +9235,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;
@@ -9341,28 +9277,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);
@@ -9372,9 +9296,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);
@@ -9432,9 +9354,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;
@@ -9767,10 +9692,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 469d755ed5..c6d414bfdf 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 <glib-object.h>
-#include <gio/gio.h>
#include <dbus/dbus-glib.h>
#include <netinet/in.h>
+#include "nm-exported-object.h"
#include "nm-dbus-interface.h"
#include "nm-types.h"
#include "nm-connection.h"
@@ -105,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
@@ -119,7 +118,7 @@ typedef enum { /*< skip >*/
} NMDeviceCheckDevAvailableFlags;
typedef struct {
- GObjectClass parent;
+ NMExportedObjectClass parent;
const char *connection_type;
@@ -266,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 23750f3579..38c125db45 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -24,19 +24,17 @@
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
-#include <glib.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <teamdctl.h>
#include <stdlib.h>
+#include "nm-glib.h"
#include "nm-device-team.h"
#include "nm-logging.h"
#include "NetworkManagerUtils.h"
#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"
@@ -332,9 +330,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,
@@ -742,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);
@@ -825,7 +819,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/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 <glib-object.h>
-
#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 <glib-object.h>
+#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..ad401f5e52 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 <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus.h>
#include <netinet/in.h>
@@ -38,6 +37,7 @@
#include <sys/ioctl.h>
#include <errno.h>
+#include "nm-glib.h"
#include "nm-device.h"
#include "nm-device-wifi.h"
#include "nm-device-olpc-mesh.h"
@@ -50,14 +50,12 @@
#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"
/* 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"
@@ -477,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))));
@@ -552,8 +547,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-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 <glib-object.h>
-
#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..0c434bf462 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 <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus.h>
#include <netinet/in.h>
@@ -29,8 +28,7 @@
#include <unistd.h>
#include <errno.h>
-#include "nm-glib-compat.h"
-#include "nm-dbus-manager.h"
+#include "nm-glib.h"
#include "nm-device.h"
#include "nm-device-wifi.h"
#include "nm-device-private.h"
@@ -57,7 +55,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);
@@ -384,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));
}
@@ -986,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;
}
@@ -1028,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;
@@ -1044,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;
}
@@ -1497,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);
@@ -1541,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);
}
@@ -1609,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);
}
}
@@ -2305,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;
}
@@ -2321,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:
@@ -2698,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);
@@ -2928,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));
@@ -3064,8 +3058,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-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 <glib-object.h>
-
#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..7166e1f8bd 100644
--- a/src/devices/wifi/nm-wifi-ap.c
+++ b/src/devices/wifi/nm-wifi-ap.c
@@ -24,16 +24,15 @@
#include <string.h>
#include <stdlib.h>
+#include "nm-glib.h"
#include "nm-wifi-ap.h"
#include "nm-wifi-ap-utils.h"
#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"
-#include "nm-glib-compat.h"
#include "gsystem-local-alloc.h"
#include "nm-access-point-glue.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;
@@ -67,7 +64,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,
@@ -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;
@@ -1074,8 +1046,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 dfc5acee3b..84aff983c2 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 <glib.h>
-#include <glib-object.h>
+#include "nm-exported-object.h"
#include "nm-dbus-interface.h"
#include "nm-connection.h"
@@ -46,11 +45,11 @@
#define NM_AP_LAST_SEEN "last-seen"
typedef struct {
- GObject parent;
+ NMExportedObject parent;
} NMAccessPoint;
typedef struct {
- GObjectClass parent;
+ NMExportedObjectClass parent;
} NMAccessPointClass;
@@ -59,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,
@@ -73,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/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 <glib.h>
#include <string.h>
+#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..bd115b429a 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -21,14 +21,13 @@
#include "config.h"
#include <string.h>
-#include <glib.h>
+#include "nm-glib.h"
#include "nm-device-modem.h"
#include "nm-modem.h"
#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-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 <glib.h>
-#include <glib-object.h>
-
#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 <glib-object.h>
#include "nm-modem.h"
G_BEGIN_DECLS
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/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 <glib-object.h>
#include "nm-modem.h"
#define NM_TYPE_MODEM_MANAGER (nm_modem_manager_get_type ())
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index 3385a6fd3b..24b6b4160b 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -24,9 +24,7 @@
#include <string.h>
#include "nm-modem.h"
#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/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 <glib-object.h>
+#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 <glib-object.h>
+#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 <glib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -29,6 +28,7 @@
#include <stdlib.h>
#include <uuid/uuid.h>
+#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 <glib.h>
-#include <glib-object.h>
-
#include <nm-setting-ip4-config.h>
#include <nm-setting-ip6-config.h>
#include <nm-ip4-config.h>
#include <nm-ip6-config.h>
+#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 <glib.h>
#include <glib/gi18n.h>
#include <string.h>
#include <ctype.h>
#include <arpa/inet.h>
+#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 <glib.h>
-#include <glib-object.h>
-
#include <nm-setting-ip4-config.h>
#include <nm-setting-ip6-config.h>
+#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 <time.h>
#undef _XOPEN_SOURCE
-#include <glib.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
@@ -36,6 +34,7 @@
#include <arpa/inet.h>
#include <ctype.h>
+#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 <glib.h>
-#include <glib-object.h>
-
+#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 <glib.h>
#include <glib/gi18n.h>
#include <string.h>
#include <stdlib.h>
@@ -33,13 +32,13 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#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 <glib.h>
-#include <glib-object.h>
-
#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 <string.h>
#include <signal.h>
-#include <gio/gio.h>
+#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..d675dcfcd4 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 <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus.h>
#include <sys/socket.h>
@@ -30,12 +29,12 @@
#include <errno.h>
#include <unistd.h>
+#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-bus-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"
@@ -43,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;
@@ -162,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)
{
@@ -177,7 +176,7 @@ new_connection_cb (NMDBusManager *mgr,
}
static void
-dis_connection_cb (NMDBusManager *mgr,
+dis_connection_cb (NMBusManager *mgr,
DBusGConnection *connection,
NMDhcpListener *self)
{
@@ -207,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/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 <glib.h>
-#include <glib-object.h>
+#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 <glib.h>
#include <glib/gi18n.h>
#include <sys/socket.h>
#include <sys/wait.h>
@@ -34,6 +33,7 @@
#include <fcntl.h>
#include <stdio.h>
+#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 <glib.h>
-#include <glib-object.h>
+#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 <glib.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
@@ -31,6 +29,7 @@
#include <ctype.h>
#include <net/if_arp.h>
+#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 <glib.h>
-#include <glib-object.h>
-
#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 <glib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <arpa/inet.h>
+#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 <stdlib.h>
-#include <glib.h>
+
#include <nm-ip4-config.h>
#include <nm-ip6-config.h>
+#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/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/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 <glib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
+#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 <glib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <nm-utils.h>
+#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 <arpa/inet.h>
#include <sys/stat.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <glib.h>
-#include <glib-object.h>
-
#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 <linux/fs.h>
-#include <glib.h>
-#include <gio/gio.h>
#include <glib/gi18n.h>
+#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 <glib-object.h>
+#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 <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <glib.h>
+#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 <glib.h>
-#include <glib-object.h>
+#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 <glib-object.h>
-
#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 <arpa/inet.h>
#include <stdlib.h>
+#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 <glib.h>
-#include <glib-object.h>
+#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 <glib.h>
+#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 <glib.h>
#include <arpa/inet.h>
+#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 <sys/stat.h>
#include <locale.h>
-#include <glib.h>
#include <glib/gi18n.h>
#include <glib-unix.h>
#include <gmodule.h>
-#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 <glib.h>
+#include "nm-glib.h"
void nm_main_utils_ensure_root (void);
diff --git a/src/main.c b/src/main.c
index 27babf81ec..a0b6e37553 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,7 +21,6 @@
#include "config.h"
-#include <glib.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
@@ -40,13 +39,14 @@
#include <string.h>
#include <sys/resource.h>
+#include "nm-glib.h"
#include "gsystem-local-alloc.h"
#include "nm-dbus-interface.h"
#include "NetworkManagerUtils.h"
#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-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 <glib.h>
-#include <glib-object.h>
+#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..e52b467136 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -20,14 +20,13 @@
#include "config.h"
-#include <glib.h>
+#include "nm-glib.h"
#include "nm-types.h"
#include "nm-active-connection.h"
#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"
@@ -35,10 +34,9 @@
#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)
+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, \
@@ -46,7 +44,6 @@ G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, G_TYPE_OBJECT)
typedef struct {
NMConnection *connection;
- char *path;
char *specific_object;
NMDevice *device;
@@ -229,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)
@@ -238,12 +235,6 @@ nm_active_connection_set_connection (NMActiveConnection *self,
}
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)
{
return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->specific_object;
@@ -318,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)
{
@@ -567,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));
@@ -793,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:
@@ -831,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);
@@ -875,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;
@@ -899,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;
@@ -1067,8 +1047,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 4db5e6ff56..ccdc563f06 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 <glib-object.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.
@@ -97,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,
@@ -110,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-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-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 <gio/gio.h>
+#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..7570b3cf58 100644
--- a/src/nm-auth-subject.c
+++ b/src/nm-auth-subject.c
@@ -32,11 +32,10 @@
#include <string.h>
#include <stdlib.h>
-#include <gio/gio.h>
-#include "nm-dbus-manager.h"
+#include "nm-glib.h"
+#include "nm-bus-manager.h"
#include "nm-enum-types.h"
-#include "nm-glib-compat.h"
#include "NetworkManagerUtils.h"
#include "gsystem-local-alloc.h"
@@ -181,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-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 <config.h>
-#include <glib.h>
-#include <glib-object.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
+#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..606f86c1ab 100644
--- a/src/nm-auth-utils.c
+++ b/src/nm-auth-utils.c
@@ -21,13 +21,12 @@
#include "config.h"
#include <string.h>
-#include <gio/gio.h>
+#include "nm-glib.h"
#include "gsystem-local-alloc.h"
#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-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 <glib.h>
#include <dbus/dbus-glib.h>
#include <nm-connection.h>
+#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-dbus-manager.c b/src/nm-bus-manager.c
index b8b5325671..a600c225d4 100644
--- a/src/nm-dbus-manager.c
+++ b/src/nm-bus-manager.c
@@ -26,10 +26,9 @@
#include <sys/types.h>
#include <errno.h>
+#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 "nm-bus-manager.h"
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
@@ -51,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;
@@ -72,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);
}
/**************************************************************/
@@ -116,7 +115,7 @@ struct _PrivateServer {
char *address;
DBusServer *server;
GHashTable *connections;
- NMDBusManager *manager;
+ NMBusManager *manager;
};
static DBusHandlerResult
@@ -195,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;
@@ -248,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;
@@ -288,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,
@@ -315,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,
@@ -323,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;
@@ -393,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;
@@ -456,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;
@@ -473,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);
@@ -487,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 ())
@@ -505,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);
}
@@ -517,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);
@@ -529,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;
@@ -549,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);
}
@@ -604,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) {
@@ -627,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);
@@ -645,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,
@@ -689,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,
@@ -729,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);
@@ -743,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.");
@@ -769,9 +768,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);
@@ -791,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.");
@@ -833,60 +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_exported_type (NMDBusManager *self,
- GType object_type,
- const DBusGObjectInfo *info)
+nm_bus_manager_register_object (NMBusManager *self,
+ const char *path,
+ gpointer object)
{
- 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,
- gpointer object)
-{
- NMDBusManagerPrivate *priv = NM_DBUS_MANAGER_GET_PRIVATE (self);
+ NMBusManagerPrivate *priv = NM_BUS_MANAGER_GET_PRIVATE (self);
GHashTableIter iter;
DBusConnection *connection;
@@ -912,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;
@@ -939,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
@@ -954,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 <config.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+#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-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 <glib.h>
-#include <glib-object.h>
+#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 <string.h>
#include <stdio.h>
+#include <glib/gi18n.h>
+
+#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 <gio/gio.h>
-#include <glib/gi18n.h>
-
#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 <glib.h>
-#include <glib-object.h>
+#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 <glib-object.h>
#include <nm-connection.h>
+#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 <libsoup/soup.h>
#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 <glib.h>
-#include <glib-object.h>
-#include <gio/gio.h>
+#include "nm-glib.h"
#include "nm-dbus-interface.h"
#include "nm-types.h"
diff --git a/src/nm-dbus-manager.h b/src/nm-dbus-manager.h
deleted file mode 100644
index c87ee02455..0000000000
--- a/src/nm-dbus-manager.h
+++ /dev/null
@@ -1,133 +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 <config.h>
-#include <glib-object.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-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_exported_type (NMDBusManager *self,
- GType object_type,
- const DBusGObjectInfo *info);
-
-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-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 <sys/wait.h>
#include <string.h>
-#include <glib.h>
+#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 <glib.h>
+#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 <glib-object.h>
+#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..d2d93d31fd 100644
--- a/src/nm-dhcp4-config.c
+++ b/src/nm-dhcp4-config.c
@@ -20,24 +20,21 @@
#include "config.h"
-#include <glib.h>
#include <string.h>
+#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"
#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))
typedef struct {
- char *dbus_path;
- GHashTable *options;
+ GVariant *options;
} NMDhcp4ConfigPrivate;
@@ -56,88 +53,61 @@ 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;
-}
-
-/* Caller owns the list, but not the values in the list */
-GSList *
-nm_dhcp4_config_list_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;
+ if (g_variant_lookup (priv->options, key, "&s", &value))
+ return value;
+ else
+ return NULL;
}
-const char *
-nm_dhcp4_config_get_dbus_path (NMDhcp4Config *self)
+GVariant *
+nm_dhcp4_config_get_options (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)
-{
- 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
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);
+ priv->options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0);
+ g_variant_ref_sink (priv->options);
}
static void
@@ -145,8 +115,7 @@ finalize (GObject *object)
{
NMDhcp4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object);
- g_free (priv->dbus_path);
- g_hash_table_destroy (priv->options);
+ g_variant_unref (priv->options);
G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->finalize (object);
}
@@ -159,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);
@@ -171,9 +144,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;
@@ -186,7 +162,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 227d44817b..080e28deff 100644
--- a/src/nm-dhcp4-config.h
+++ b/src/nm-dhcp4-config.h
@@ -21,10 +21,7 @@
#ifndef __NETWORKMANAGER_DHCP4_CONFIG_H__
#define __NETWORKMANAGER_DHCP4_CONFIG_H__
-#include <glib.h>
-#include <glib-object.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))
@@ -34,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;
@@ -48,16 +45,11 @@ 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);
-
-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 f93e9644c4..6b27c532bd 100644
--- a/src/nm-dhcp6-config.c
+++ b/src/nm-dhcp6-config.c
@@ -20,24 +20,21 @@
#include "config.h"
-#include <glib.h>
#include <string.h>
+#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"
#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))
typedef struct {
- char *dbus_path;
- GHashTable *options;
+ GVariant *options;
} NMDhcp6ConfigPrivate;
@@ -56,88 +53,61 @@ 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;
-}
-
-/* Caller owns the list, but not the values in the list */
-GSList *
-nm_dhcp6_config_list_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;
+ if (g_variant_lookup (priv->options, key, "&s", &value))
+ return value;
+ else
+ return NULL;
}
-const char *
-nm_dhcp6_config_get_dbus_path (NMDhcp6Config *self)
+GVariant *
+nm_dhcp6_config_get_options (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)
-{
- 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
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);
+ priv->options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0);
+ g_variant_ref_sink (priv->options);
}
static void
@@ -145,8 +115,7 @@ finalize (GObject *object)
{
NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
- g_free (priv->dbus_path);
- g_hash_table_destroy (priv->options);
+ g_variant_unref (priv->options);
G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->finalize (object);
}
@@ -159,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);
@@ -171,9 +144,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;
@@ -186,7 +162,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 eaca61b1ce..c018d97f0c 100644
--- a/src/nm-dhcp6-config.h
+++ b/src/nm-dhcp6-config.h
@@ -21,10 +21,7 @@
#ifndef __NETWORKMANAGER_DHCP6_CONFIG_H__
#define __NETWORKMANAGER_DHCP6_CONFIG_H__
-#include <glib.h>
-#include <glib-object.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))
@@ -34,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;
@@ -48,16 +45,11 @@ 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);
-
-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 eede0584ee..d8e6be2f7b 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -21,24 +21,21 @@
#include "config.h"
-#include <glib.h>
-#include <gio/gio.h>
#include <string.h>
#include <errno.h>
+#include "nm-glib.h"
#include "nm-dispatcher.h"
#include "nm-dispatcher-api.h"
#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"
#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"
@@ -223,44 +220,12 @@ dump_ip6_to_props (NMIP6Config *ip6, GVariantBuilder *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;
@@ -277,7 +242,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)
@@ -289,11 +254,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
@@ -487,8 +452,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;
@@ -574,8 +539,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);
@@ -595,21 +558,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,
@@ -624,6 +592,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;
@@ -635,15 +604,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,
@@ -653,6 +622,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 */
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 <glib.h>
#include <stdio.h>
+#include "nm-glib.h"
#include "nm-types.h"
#include "nm-connection.h"
diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c
new file mode 100644
index 0000000000..1023842332
--- /dev/null
+++ b/src/nm-exported-object.c
@@ -0,0 +1,358 @@
+/* -*- 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 <string.h>
+
+#include "nm-exported-object.h"
+#include "nm-dbus-glib-types.h"
+#include "nm-bus-manager.h"
+#include "nm-logging.h"
+
+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;
+
+#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);
+ }
+ }
+}
+
+/**
+ * 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_bus_manager_register_object (nm_bus_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_bus_manager_unregister_object (nm_bus_manager_get (), self);
+}
+
+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: <transform error>}, ", 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);
+
+ 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);
+
+ 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..ed67a6dbc8
--- /dev/null
+++ b/src/nm-exported-object.h
@@ -0,0 +1,60 @@
+/* -*- 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 <dbus/dbus-glib.h>
+
+#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;
+
+ const char *export_path;
+} NMExportedObjectClass;
+
+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-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 <string.h>
-#include <glib.h>
-#include <gio/gio.h>
+#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 <glib-object.h>
+#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..a35d0d7c04 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -20,7 +20,6 @@
#include "config.h"
-#include <glib.h>
#include <glib-unix.h>
#include <getopt.h>
#include <locale.h>
@@ -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"
@@ -504,9 +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);
+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)
@@ -527,18 +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)
+nm_bus_manager_unregister_object (gpointer unused, gpointer object)
{
}
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index e23e364578..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"
@@ -37,13 +36,11 @@
#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))
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;
@@ -2410,7 +2388,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 4415c453ea..bffebe2cd8 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 <glib-object.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 */
@@ -65,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 1cedff5f5d..1206da87c5 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -24,25 +24,22 @@
#include <string.h>
#include <arpa/inet.h>
+#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"
#include "nm-dbus-glib-types.h"
#include "nm-ip6-config-glue.h"
#include "nm-route-manager.h"
#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))
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;
@@ -2215,7 +2193,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 e8cbc0e5f9..98a21e5c8f 100644
--- a/src/nm-ip6-config.h
+++ b/src/nm-ip6-config.h
@@ -21,10 +21,9 @@
#ifndef __NETWORKMANAGER_IP6_CONFIG_H__
#define __NETWORKMANAGER_IP6_CONFIG_H__
-#include <glib-object.h>
#include <netinet/in.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 */
@@ -65,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-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 <systemd/sd-journal.h>
#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 <glib.h>
-#include <glib-object.h>
+#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..7d1d2b3ca5 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -28,14 +28,13 @@
#include <unistd.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
-#include <gio/gio.h>
#include <glib/gi18n.h>
+#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"
+#include "nm-bus-manager.h"
#include "nm-vpn-manager.h"
#include "nm-device.h"
#include "nm-device-generic.h"
@@ -167,7 +166,7 @@ typedef struct {
NMPolicy *policy;
- NMDBusManager *dbus_mgr;
+ NMBusManager *dbus_mgr;
gboolean prop_filter_added;
NMRfkillManager *rfkill_mgr;
@@ -195,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,
@@ -254,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 */
@@ -376,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);
}
@@ -447,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;
@@ -475,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;
@@ -833,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);
@@ -1598,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);
@@ -1720,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);
@@ -1801,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) {
@@ -2051,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;
}
@@ -2067,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);
}
@@ -2538,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;
@@ -2708,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;
@@ -2788,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);
}
@@ -3073,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;
}
@@ -3226,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;
@@ -3495,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;
}
@@ -3991,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.");
@@ -4625,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)
{
@@ -4685,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");
@@ -4752,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,
@@ -4816,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);
@@ -4868,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) {
@@ -4906,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);
@@ -4936,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);
@@ -5043,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) {
@@ -5087,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;
@@ -5299,8 +5286,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 a8e7d7ad32..d8b566851d 100644
--- a/src/nm-manager.h
+++ b/src/nm-manager.h
@@ -22,10 +22,7 @@
#ifndef __NETWORKMANAGER_MANAGER_H__
#define __NETWORKMANAGER_MANAGER_H__
-#include <glib.h>
-#include <glib-object.h>
-
-#include "nm-types.h"
+#include "nm-exported-object.h"
#include "nm-connection.h"
#define NM_TYPE_MANAGER (nm_manager_get_type ())
@@ -64,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-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 <string.h>
-#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 <glib.h>
+#include "nm-glib.h"
G_BEGIN_DECLS
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 69d12d7de0..2f924ee664 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -26,15 +26,14 @@
#include <errno.h>
#include <netdb.h>
-#include <gio/gio.h>
+#include "nm-glib.h"
#include "nm-policy.h"
#include "NetworkManagerUtils.h"
#include "nm-activation-request.h"
#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"
@@ -45,7 +44,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"
@@ -771,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);
@@ -787,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);
@@ -1064,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);
@@ -1687,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-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 <string.h>
-#include <stdio.h>
-
-#include <dbus/dbus-glib.h>
-#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: <transform error>}, ", 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 97a3b2c024..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 <glib-object.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/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 <glib-object.h>
+#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 <glib-object.h>
+#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 <errno.h>
#include <string.h>
#include <sys/stat.h>
-#include <gio/gio.h>
-#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 <glib-object.h>
+#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..175c0c1233 100644
--- a/src/nm-sleep-monitor-systemd.c
+++ b/src/nm-sleep-monitor-systemd.c
@@ -23,11 +23,10 @@
#include <string.h>
#include <sys/stat.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <gio/gunixfdlist.h>
+#include "nm-glib.h"
#include "nm-logging.h"
-#include "nm-dbus-manager.h"
#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
@@ -89,6 +88,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/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 <errno.h>
#include <string.h>
#include <sys/stat.h>
-#include <gio/gio.h>
+#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 <glib-object.h>
+#include "nm-glib.h"
#include "nm-types.h"
G_BEGIN_DECLS
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/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 <glib-object.h>
-#include "nm-glib-compat.h"
#include <netinet/in.h>
#include <linux/if.h>
#include <linux/if_addr.h>
#include <nm-dbus-interface.h>
+#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 <stdlib.h>
#include <syslog.h>
+#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 <unistd.h>
#include <math.h>
-#include <glib.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/family.h>
@@ -37,6 +36,7 @@
#include <linux/nl80211.h>
+#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 <glib.h>
+#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 <unistd.h>
#include <math.h>
-#include <glib.h>
+#include "nm-glib.h"
#include "wifi-utils-private.h"
#include "wifi-utils-wext.h"
#include "nm-logging.h"
@@ -44,7 +44,6 @@
#include <sys/socket.h>
#include <linux/wireless.h>
-
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 <sys/stat.h>
#include <stdio.h>
#include <string.h>
-#include <glib.h>
+#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 <net/ethernet.h>
-#include <glib.h>
+#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 c13672976f..f767c29e31 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -42,10 +42,9 @@
#include <linux/if.h>
#include <linux/if_ppp.h>
+#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"
#include "nm-platform.h"
#include "nm-core-internal.h"
@@ -75,7 +74,6 @@ static void _ppp_kill (NMPPPManager *manager);
typedef struct {
GPid pid;
- char *dbus_path;
char *parent_iface;
@@ -95,7 +93,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,
@@ -123,13 +121,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);
}
@@ -191,68 +183,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 +606,71 @@ 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);
+ 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;
+ 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);
+
+ nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class),
+ &dbus_glib_nm_ppp_manager_object_info);
+}
+
/*******************************************/
@@ -1001,7 +996,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/ppp-manager/nm-ppp-manager.h b/src/ppp-manager/nm-ppp-manager.h
index f8cbda1365..057f40982f 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 <glib.h>
-#include <glib-object.h>
-#include <gio/gio.h>
+#include "nm-exported-object.h"
#include "nm-ppp-status.h"
#include "nm-activation-request.h"
#include "nm-connection.h"
@@ -44,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/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 <netinet/in.h>
#include <arpa/inet.h>
#include <dlfcn.h>
-#include <gio/gio.h>
#define INET6
#include <pppd/eui64.h>
#include <pppd/ipv6cp.h>
+#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 <glib-object.h>
#include <stdlib.h>
#include <netinet/in.h>
+#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..eaf5ff3f2b 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -23,10 +23,10 @@
#include <string.h>
#include <pwd.h>
-#include <glib.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include "nm-glib.h"
#include "nm-dbus-interface.h"
#include "nm-logging.h"
#include "nm-agent-manager.h"
@@ -38,19 +38,18 @@
#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"
-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, \
NMAgentManagerPrivate))
typedef struct {
- NMDBusManager *dbus_mgr;
NMAuthManager *auth_mgr;
/* Auth chains for checking agent permissions */
@@ -264,6 +263,14 @@ find_agent_by_identifier_and_uid (NMAgentManager *self,
}
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,
NMSecretAgentCapabilities capabilities,
@@ -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,15 +352,14 @@ 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,
- 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.");
@@ -1451,19 +1459,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,
DBusGMethodInvocation *context,
@@ -1550,15 +1545,9 @@ 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_dbus_manager_register_object (priv->dbus_mgr, NM_DBUS_PATH_AGENT_MANAGER, object);
-
- g_signal_connect (priv->dbus_mgr,
- NM_DBUS_MANAGER_NAME_OWNER_CHANGED,
- G_CALLBACK (name_owner_changed_cb),
- object);
+ nm_exported_object_export (NM_EXPORTED_OBJECT (object));
g_signal_connect (priv->auth_mgr,
NM_AUTH_MANAGER_SIGNAL_CHANGED,
@@ -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_dbus_manager_unregister_object (priv->dbus_mgr, 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);
}
@@ -1604,9 +1588,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;
@@ -1622,8 +1609,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 ac29df2291..4ece8940e0 100644
--- a/src/settings/nm-agent-manager.h
+++ b/src/settings/nm-agent-manager.h
@@ -21,11 +21,10 @@
#ifndef __NETWORKMANAGER_AGENT_MANAGER_H__
#define __NETWORKMANAGER_AGENT_MANAGER_H__
-#include <glib.h>
-#include <glib-object.h>
#include <nm-connection.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))
@@ -35,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-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 <unistd.h>
#include <string.h>
#include <sys/inotify.h>
-#include <glib.h>
#include <errno.h>
+#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 <glib.h>
-#include <glib-object.h>
#include <sys/inotify.h>
+#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..a2b5da5795 100644
--- a/src/settings/nm-secret-agent.c
+++ b/src/settings/nm-secret-agent.c
@@ -23,15 +23,14 @@
#include <sys/types.h>
#include <pwd.h>
-#include <glib.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#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-glib-compat.h"
#include "nm-logging.h"
#include "nm-auth-subject.h"
#include "nm-simple-connection.h"
@@ -48,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 {
@@ -108,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));
}
@@ -121,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 *
@@ -451,15 +457,35 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self,
callback_data);
}
+static void proxy_cleanup (NMSecretAgent *self);
+
+static void
+name_owner_changed_cb (NMBusManager *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_bus_manager_get (), name_owner_changed_cb, self);
+ g_clear_pointer (&priv->dbus_owner, g_free);
+
+ g_signal_emit (self, signals[DISCONNECTED], 0);
}
}
@@ -473,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);
@@ -484,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);
@@ -498,16 +524,19 @@ 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,
- nm_auth_subject_get_unix_process_dbus_sender (subject),
- 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);
- 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_bus_manager_get (),
+ NM_BUS_MANAGER_NAME_OWNER_CHANGED,
+ G_CALLBACK (name_owner_changed_cb),
+ self);
- g_free (username);
return self;
}
@@ -556,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 f3f4ff89c5..d8712c59ed 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 <glib.h>
-#include <glib-object.h>
#include <nm-connection.h>
+#include "nm-glib.h"
#include "nm-types.h"
#define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ())
@@ -34,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);
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index c25dfac01a..c56a340835 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -26,18 +26,16 @@
#include <nm-dbus-interface.h>
#include <dbus/dbus-glib-lowlevel.h>
+#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"
#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 "nm-glib-compat.h"
#include "gsystem-local-alloc.h"
#define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps"
@@ -113,7 +111,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)
)
@@ -182,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
@@ -250,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)) {
@@ -260,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
@@ -756,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
@@ -822,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",
@@ -856,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
@@ -867,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.
@@ -876,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 {
@@ -892,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));
@@ -1791,10 +1824,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
@@ -2431,9 +2464,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;
@@ -2513,8 +2549,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 <net/ethernet.h>
+#include "nm-exported-object.h"
#include <nm-connection.h>
#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..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"
@@ -156,12 +156,12 @@ 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))
typedef struct {
- NMDBusManager *dbus_mgr;
+ NMBusManager *dbus_mgr;
NMAgentManager *agent_mgr;
@@ -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)
{
@@ -1019,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));
@@ -1089,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)),
@@ -1484,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.");
@@ -2151,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)) {
@@ -2187,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;
}
@@ -2325,11 +2276,13 @@ 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->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 d196efe655..f28d010bdf 100644
--- a/src/settings/nm-settings.h
+++ b/src/settings/nm-settings.h
@@ -28,7 +28,7 @@
#include <nm-connection.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))
@@ -51,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/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 <glib.h>
-#include <glib-object.h>
+
#include <nm-connection.h>
+#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 <errno.h>
#include <gmodule.h>
-#include <glib-object.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <nm-setting-connection.h>
+#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 <glib-object.h>
+#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 <sys/ioctl.h>
#include <unistd.h>
-#include <glib.h>
#include <glib/gi18n.h>
+#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 <glib.h>
#include <nm-connection.h>
+#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 <glib.h>
+#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 8febfe6a01..4b968aa08d 100644
--- a/src/settings/plugins/ifcfg-rh/plugin.c
+++ b/src/settings/plugins/ifcfg-rh/plugin.c
@@ -30,9 +30,7 @@
#include <sys/stat.h>
#include <gmodule.h>
-#include <glib-object.h>
#include <glib/gi18n.h>
-#include <gio/gio.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
@@ -44,6 +42,7 @@
#include <nm-setting-connection.h>
+#include "nm-glib.h"
#include "common.h"
#include "nm-dbus-glib-types.h"
#include "plugin.h"
@@ -59,9 +58,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
@@ -100,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))
@@ -792,12 +790,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,
@@ -899,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
@@ -927,9 +925,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/settings/plugins/ifcfg-rh/plugin.h b/src/settings/plugins/ifcfg-rh/plugin.h
index d37decfd6f..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 <glib-object.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/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 <sys/ioctl.h>
#include <unistd.h>
-#include <glib.h>
#include <glib/gi18n.h>
#include <nm-connection.h>
#include <nm-dbus-interface.h>
@@ -49,6 +48,7 @@
#include <nm-setting-bridge-port.h>
#include <nm-setting-dcb.h>
#include <nm-setting-generic.h>
+#include "nm-glib.h"
#include "nm-core-internal.h"
#include <nm-utils.h>
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 <glib.h>
#include <nm-connection.h>
+#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 <glib.h>
+#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 <glib.h>
#include <stdlib.h>
#include <string.h>
+#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 <glib.h>
#include <nm-connection.h>
+#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 <sys/types.h>
-#include <glib.h>
+
#include <nm-connection.h>
+#include "nm-glib.h"
+
gboolean writer_can_write_connection (NMConnection *connection,
GError **error);
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/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 <glib.h>
+#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 <nm-system-config-interface.h>
#include <nm-logging.h>
#include <nm-config.h>
-#include <gio/gio.h>
+#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 <glib.h>
#include <arpa/inet.h>
#include <nm-setting-ip6-config.h>
#include <nm-setting-ip4-config.h>
+#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 <string.h>
#include <gmodule.h>
-#include <glib.h>
-#include <gio/gio.h>
#include <nm-utils.h>
#include <nm-setting-connection.h>
+#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 <glib-object.h>
+#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/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/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 <stdio.h>
#include <string.h>
-#include <glib.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include <nm-utils.h>
+#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 <glib.h>
+#include "nm-glib.h"
#define WPA_SUPPLICANT_CONF SYSCONFDIR "/wpa_supplicant/wpa_supplicant.conf"
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/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 <glib.h>
+#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 <nm-settings-connection.h>
+#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 <string.h>
#include <gmodule.h>
-#include <glib-object.h>
#include <glib/gi18n.h>
-#include <glib.h>
#include <nm-setting-connection.h>
+#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 <glib-object.h>
+#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 <glib.h>
#include <string.h>
+#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 <glib.h>
+#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 <string.h>
#include <gmodule.h>
-#include <glib.h>
#include <glib/gstdio.h>
-#include <gio/gio.h>
#include <nm-connection.h>
#include <nm-setting.h>
@@ -37,6 +35,7 @@
#include <nm-utils.h>
#include <nm-config.h>
#include <nm-logging.h>
+#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 <glib-object.h>
+#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 <glib.h>
#include <nm-connection.h>
+#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 <glib.h>
#include <stdlib.h>
#include <string.h>
+#include "nm-glib.h"
#include "gsystem-local-alloc.h"
#include "utils.h"
#include <nm-setting-wired.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
-
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 <glib.h>
+#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 <errno.h>
#include <string.h>
-#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 <glib.h>
#include <nm-connection.h>
+#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 <string.h>
#include <stdlib.h>
-#include <glib.h>
#include <dbus/dbus-glib.h>
+#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 <glib-object.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
#include <nm-setting-8021x.h>
+#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 19795bf3b9..56bd5dc46a 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -23,15 +23,15 @@
#include <stdio.h>
#include <string.h>
-#include <glib.h>
+#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"
#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
#define WPAS_DBUS_IFACE_BSS WPAS_DBUS_INTERFACE ".BSS"
@@ -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;
}
@@ -691,7 +693,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,
@@ -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);
@@ -1133,7 +1144,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",
@@ -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/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 <glib-object.h>
+#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 <string.h>
-#include <glib.h>
#include <dbus/dbus.h>
-#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 <glib-object.h>
+#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 <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#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..69e6894347 100644
--- a/src/tests/config/test-config.c
+++ b/src/tests/config/test-config.c
@@ -22,13 +22,13 @@
#include <unistd.h>
-#include <glib.h>
#include <nm-config.h>
+#include "nm-glib.h"
#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 ();
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 <glib.h>
#include <string.h>
+#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 <glib.h>
#include <string.h>
#include <errno.h>
#include <netinet/ether.h>
#include <sys/types.h>
#include <sys/wait.h>
+#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 <glib.h>
#include <string.h>
#include <errno.h>
+#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 <glib.h>
#include <string.h>
#include <arpa/inet.h>
+#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 <glib.h>
#include <string.h>
#include <arpa/inet.h>
+#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 <glib.h>
#include <string.h>
#include <arpa/inet.h>
+#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 <glib.h>
#include <arpa/inet.h>
#include <linux/rtnetlink.h>
+#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 <glib.h>
-#include <glib-object.h>
#include <nm-simple-connection.h>
#include <nm-setting-connection.h>
+#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..680fccbd46 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 <glib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -29,16 +28,15 @@
#include <errno.h>
#include <stdlib.h>
+#include "nm-glib.h"
#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"
#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"
@@ -1362,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);
}
@@ -1499,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);
}
@@ -1548,6 +1546,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);
@@ -1588,6 +1587,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);
@@ -1947,11 +1947,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;
@@ -1998,10 +1998,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
@@ -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);
@@ -2361,8 +2355,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);
}
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 <glib.h>
-#include <glib-object.h>
#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..2a6f48b79c 100644
--- a/src/vpn-manager/nm-vpn-manager.c
+++ b/src/vpn-manager/nm-vpn-manager.c
@@ -22,13 +22,12 @@
#include "config.h"
#include <string.h>
-#include <gio/gio.h>
+#include "nm-glib.h"
#include "nm-vpn-manager.h"
#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"
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 <glib.h>
-#include <glib-object.h>
+#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..56cb6abe74 100644
--- a/src/vpn-manager/nm-vpn-service.c
+++ b/src/vpn-manager/nm-vpn-service.c
@@ -21,18 +21,16 @@
#include "config.h"
-#include <glib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
+#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)
@@ -46,6 +44,7 @@ typedef struct {
GSList *pending;
guint start_timeout;
+ GDBusProxy *proxy;
gboolean service_running;
} NMVpnServicePrivate;
@@ -55,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)
{
@@ -87,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;
@@ -289,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) {
@@ -308,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);
}
/******************************************************************************/
@@ -331,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
@@ -352,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);
}
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 <glib.h>
-#include <glib-object.h>
+#include "nm-glib.h"
#include "nm-device.h"
#include "nm-vpn-connection.h"