diff options
author | Ignacio Casal Quinteiro <icq@gnome.org> | 2014-12-24 12:13:40 +0100 |
---|---|---|
committer | Ignacio Casal Quinteiro <icq@gnome.org> | 2014-12-24 12:13:40 +0100 |
commit | c44f3d68f8f97186bc8607e51c9c606bccb3c832 (patch) | |
tree | 2239d0104c429ad195ac5186f26a3f4d009b83f8 /gusb | |
parent | 3acaaf42869829cfba772bbd9dda569698a9d252 (diff) | |
download | gusb-c44f3d68f8f97186bc8607e51c9c606bccb3c832.tar.gz |
context: properly notify the debug-level property
Diffstat (limited to 'gusb')
-rw-r--r-- | gusb/gusb-context.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c index 2619fa6..c495303 100644 --- a/gusb/gusb-context.c +++ b/gusb/gusb-context.c @@ -584,21 +584,27 @@ g_usb_context_set_debug (GUsbContext *context, GLogLevelFlags flags) { GUsbContextPrivate *priv; + int debug_level; g_return_if_fail (G_USB_IS_CONTEXT (context)); priv = context->priv; if (flags & (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO)) - priv->debug_level = 3; + debug_level = 3; else if (flags & (G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING)) - priv->debug_level = 2; + debug_level = 2; else if (flags & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR)) - priv->debug_level = 1; + debug_level = 1; else - priv->debug_level = 0; + debug_level = 0; - libusb_set_debug (priv->ctx, priv->debug_level); + if (debug_level != priv->debug_level) { + priv->debug_level = debug_level; + libusb_set_debug (priv->ctx, debug_level); + + g_object_notify (G_OBJECT (context), "debug-level"); + } } /** |