Commit 75eae0ee authored by Christian Kellner's avatar Christian Kellner
Browse files

device: return the object path from _export()

parent 05bdc4d2
......@@ -246,12 +246,13 @@ bolt_device_new_for_udev (BoltManager *mgr,
return dev;
}
gboolean
const char *
bolt_device_export (BoltDevice *device,
GDBusConnection *connection,
GError **error)
{
const char *path;
gboolean ok;
g_return_val_if_fail (BOLT_IS_DEVICE (device), FALSE);
......@@ -259,10 +260,11 @@ bolt_device_export (BoltDevice *device,
g_debug ("Exporting device at: %s", path);
return g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (device),
connection,
path,
error);
ok = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (device),
connection,
path,
error);
return ok ? path : NULL;
}
void
......
......@@ -36,7 +36,7 @@ BoltDevice * bolt_device_new_for_udev (BoltManager *manager,
GError **error);
gboolean bolt_device_export (BoltDevice *device,
const char * bolt_device_export (BoltDevice *device,
GDBusConnection *connection,
GError **error);
......
......@@ -419,7 +419,6 @@ handle_udev_device_added (BoltManager *mgr,
GDBusConnection *bus;
BoltDevice *dev;
const char *opath;
gboolean ok;
dev = bolt_device_new_for_udev (mgr, udev, &err);
if (dev == NULL)
......@@ -435,14 +434,13 @@ handle_udev_device_added (BoltManager *mgr,
if (bus == NULL)
return;
ok = bolt_device_export (dev, bus, &err);
if (!ok)
opath = bolt_device_export (dev, bus, &err);
if (opath == NULL)
{
g_warning ("Could not export device: %s", err->message);
return;
}
opath = bolt_device_get_object_path (dev);
bolt_dbus_manager_emit_device_added (BOLT_DBUS_MANAGER (mgr), opath);
}
......@@ -521,10 +519,10 @@ bolt_manager_export (BoltManager *mgr,
{
g_autoptr(GError) err = NULL;
BoltDevice *dev = g_ptr_array_index (mgr->devices, i);
gboolean ok;
const char *opath;
ok = bolt_device_export (dev, connection, error);
if (!ok)
opath = bolt_device_export (dev, connection, error);
if (opath == NULL)
g_warning ("error exporting device: %s", err->message);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment