diff options
Diffstat (limited to 'libmatemixer')
-rw-r--r-- | libmatemixer/matemixer-context.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/libmatemixer/matemixer-context.c b/libmatemixer/matemixer-context.c index 5bdc7a8..ecd617f 100644 --- a/libmatemixer/matemixer-context.c +++ b/libmatemixer/matemixer-context.c @@ -742,15 +742,15 @@ mate_mixer_context_open (MateMixerContext *context) module = NULL; modules = modules->next; } + if (module == NULL) { + /* The selected backend is not available */ + change_state (control, MATE_MIXER_STATE_FAILED); + return FALSE; + } } else { /* The highest priority module is on the top of the list */ module = MATE_MIXER_BACKEND_MODULE (modules->data); } - if (module == NULL) { - /* Most likely the selected backend is not installed */ - change_state (context, MATE_MIXER_STATE_FAILED); - return FALSE; - } if (info == NULL) info = mate_mixer_backend_module_get_info (module); @@ -760,6 +760,8 @@ mate_mixer_context_open (MateMixerContext *context) mate_mixer_backend_set_data (context->priv->backend, &context->priv->backend_data); + g_debug ("Trying to open backend %s", info->name); + /* This transitional state is always present, it will change to MATE_MIXER_STATE_READY * or MATE_MIXER_STATE_FAILED either instantly or asynchronously */ change_state (context, MATE_MIXER_STATE_CONNECTING); @@ -1269,9 +1271,10 @@ on_backend_default_output_stream_notify (MateMixerBackend *backend, static gboolean try_next_backend (MateMixerContext *context) { - const GList *modules; - MateMixerBackendModule *module = NULL; - MateMixerState state; + MateMixerBackendModule *module = NULL; + MateMixerState state; + const GList *modules; + const MateMixerBackendInfo *info = NULL; modules = _mate_mixer_get_modules (); @@ -1293,12 +1296,15 @@ try_next_backend (MateMixerContext *context) return FALSE; } - context->priv->module = g_object_ref (module); - context->priv->backend = - g_object_new (mate_mixer_backend_module_get_info (module)->g_type, NULL); + info = mate_mixer_backend_module_get_info (module); + + control->priv->module = g_object_ref (module); + control->priv->backend = g_object_new (info->g_type, NULL); mate_mixer_backend_set_data (context->priv->backend, &context->priv->backend_data); + g_debug ("Trying to open backend %s", info->name); + /* Try to open this backend and in case of failure keep trying until we find * one that works or reach the end of the list */ if (mate_mixer_backend_open (context->priv->backend) == FALSE) |