[Spice-devel] [spice-gtk v1 2/5] win-usb-dev: pass GError to g_udev_client_new()

Victor Toso victortoso at redhat.com
Mon Nov 14 23:26:52 UTC 2016


From: Victor Toso <me at victortoso.com>

Otherwise application will not be able to know the reason for failure.
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/usb-device-manager.c | 2 +-
 src/win-usb-dev.c        | 4 ++--
 src/win-usb-dev.h        | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 6f9ed5d..3d4bd98 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -320,7 +320,7 @@ static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
 
     /* Start listening for usb devices plug / unplug */
 #ifdef USE_GUDEV
-    priv->udev = g_udev_client_new(subsystems);
+    priv->udev = g_udev_client_new(subsystems, err);
     g_signal_connect(G_OBJECT(priv->udev), "uevent",
                      G_CALLBACK(spice_usb_device_manager_uevent_cb), self);
     /* Do coldplug (detection of already connected devices) */
diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
index a857b02..4b95b2d 100644
--- a/src/win-usb-dev.c
+++ b/src/win-usb-dev.c
@@ -106,12 +106,12 @@ GQuark g_udev_client_error_quark(void)
     return g_quark_from_static_string("win-gudev-client-error-quark");
 }
 
-GUdevClient *g_udev_client_new(const gchar* const *subsystems)
+GUdevClient *g_udev_client_new(const gchar* const *subsystems, GError **error)
 {
     if (singleton != NULL)
         return g_object_ref(singleton);
 
-    singleton = g_initable_new(G_UDEV_TYPE_CLIENT, NULL, NULL, NULL);
+    singleton = g_initable_new(G_UDEV_TYPE_CLIENT, NULL, error, NULL);
     return singleton;
 }
 
diff --git a/src/win-usb-dev.h b/src/win-usb-dev.h
index b5c4fce..a9562ab 100644
--- a/src/win-usb-dev.h
+++ b/src/win-usb-dev.h
@@ -79,7 +79,7 @@ struct _GUdevClientClass
 };
 
 GType g_udev_client_get_type(void) G_GNUC_CONST;
-GUdevClient *g_udev_client_new(const gchar* const *subsystems);
+GUdevClient *g_udev_client_new(const gchar* const *subsystems, GError **error);
 GList *g_udev_client_query_by_subsystem(GUdevClient *client, const gchar *subsystem);
 
 GType g_udev_device_get_type(void) G_GNUC_CONST;
-- 
2.9.3



More information about the Spice-devel mailing list