diff options
author | Dan Winship <danw@redhat.com> | 2015-03-27 10:32:05 -0400 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-04-03 16:58:41 -0400 |
commit | 5a1b6b4bbdabe52f4abc35e539ba1460aea44167 (patch) | |
tree | 9e85461e8e89450e81aceef8d82c772736a26315 /src | |
parent | 473cfec01c5cc4d39fe77d4a7914f836170d126b (diff) | |
download | NetworkManager-5a1b6b4bbdabe52f4abc35e539ba1460aea44167.tar.gz |
core: port NMManager's aipd proxy to GDBus
Diffstat (limited to 'src')
-rw-r--r-- | src/nm-manager.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 7f9574170f..704296d3cb 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -190,7 +190,7 @@ typedef struct { NMVpnManager *vpn_manager; - DBusGProxy *aipd_proxy; + GDBusProxy *aipd_proxy; NMSleepMonitor *sleep_monitor; GSList *auth_chains; @@ -801,7 +801,7 @@ device_removed_cb (NMDevice *device, gpointer user_data) } static void -aipd_handle_event (DBusGProxy *proxy, +aipd_handle_event (GDBusProxy *proxy, const char *event, const char *iface, const char *address, @@ -812,11 +812,6 @@ aipd_handle_event (DBusGProxy *proxy, GSList *iter; gboolean handled = FALSE; - if (!event || !iface) { - nm_log_warn (LOGD_AUTOIP4, "incomplete message received from avahi-autoipd"); - return; - } - if ( (strcmp (event, "BIND") != 0) && (strcmp (event, "CONFLICT") != 0) && (strcmp (event, "UNBIND") != 0) @@ -4870,9 +4865,9 @@ static void nm_manager_init (NMManager *manager) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - DBusGConnection *g_connection; guint i; GFile *file; + GError *error = NULL; /* Initialize rfkill structures and states */ memset (priv->radio_states, 0, sizeof (priv->radio_states)); @@ -4913,30 +4908,22 @@ nm_manager_init (NMManager *manager) priv->vpn_manager = g_object_ref (nm_vpn_manager_get ()); - g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr); - /* avahi-autoipd stuff */ - priv->aipd_proxy = dbus_g_proxy_new_for_name (g_connection, - NM_AUTOIP_DBUS_SERVICE, - "/", - NM_AUTOIP_DBUS_IFACE); + priv->aipd_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + NM_AUTOIP_DBUS_SERVICE, + "/", + NM_AUTOIP_DBUS_IFACE, + NULL, &error); if (priv->aipd_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->aipd_proxy, - "Event", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - - dbus_g_proxy_connect_signal (priv->aipd_proxy, "Event", - G_CALLBACK (aipd_handle_event), - manager, - NULL); - } else - nm_log_warn (LOGD_AUTOIP4, "could not initialize avahi-autoipd D-Bus proxy"); + _nm_dbus_signal_connect (priv->aipd_proxy, "Event", G_VARIANT_TYPE ("(sss)"), + G_CALLBACK (aipd_handle_event), manager); + } else { + nm_log_warn (LOGD_AUTOIP4, "could not initialize avahi-autoipd D-Bus proxy: %s", + error->message); + g_clear_error (&error); + } /* sleep/wake handling */ priv->sleep_monitor = g_object_ref (nm_sleep_monitor_get ()); |