summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-11-21 18:22:08 +0000
committerRichard Hughes <richard@hughsie.com>2014-11-21 18:22:10 +0000
commit84accf28f20f792899edf9cc633507e06e1be4cf (patch)
treea0fd01d14a66c5db3e151d4a09dbfa02152c4bbc
parentfb08d9a0d5ae44e0b176fdd1b9fa399670746fd3 (diff)
downloadgusb-84accf28f20f792899edf9cc633507e06e1be4cf.tar.gz
trivial: Automatically call _get_source() in _device_list_coldplug()
If API users want to use a different GMainLoop they can call g_usb_context_get_source() before the call to g_usb_device_list_coldplug(), but in most cases working is better than not getting hotplug events.
-rw-r--r--gusb/gusb-device-list.c3
-rw-r--r--tools/gusb-main.c3
2 files changed, 3 insertions, 3 deletions
diff --git a/gusb/gusb-device-list.c b/gusb/gusb-device-list.c
index 20dc3b1..6688d00 100644
--- a/gusb/gusb-device-list.c
+++ b/gusb/gusb-device-list.c
@@ -430,6 +430,9 @@ g_usb_device_list_coldplug (GUsbDeviceList *list)
g_usb_strerror (rc));
}
priv->done_coldplug = TRUE;
+
+ /* setup with the default mainloop if not already done */
+ g_usb_context_get_source (priv->context, NULL);
}
/**
diff --git a/tools/gusb-main.c b/tools/gusb-main.c
index 8ebc96a..4aa58ac 100644
--- a/tools/gusb-main.c
+++ b/tools/gusb-main.c
@@ -236,9 +236,6 @@ gusb_cmd_watch (GUsbCmdPrivate *priv, gchar **values, GError **error)
g_usb_device_get_address (device));
}
- /* setup with the default mainloop */
- g_usb_context_get_source (priv->usb_ctx, NULL);
-
loop = g_main_loop_new (NULL, FALSE);
g_signal_connect (list, "device-added",
G_CALLBACK (gusb_device_list_added_cb),