diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-08-21 20:11:28 +0200 |
---|---|---|
committer | Victor Toso <me@victortoso.com> | 2020-09-02 06:46:20 +0000 |
commit | 1e75bf32a9bc5bd4abe0085d9707fa843505fb7d (patch) | |
tree | 98693fa92e12ade9237008d80a9eafbaf19a1e87 | |
parent | 9620fedea719bf033a9af58a8d2010d1ab0ad5e5 (diff) | |
download | grilo-1e75bf32a9bc5bd4abe0085d9707fa843505fb7d.tar.gz |
grilo-test-ui: Exit early when looping over sources
That would allow us to add more early exits when debugging, without
making the code more complicated. Also tidy up to not have a "source"
variable that's actually a GList element.
-rw-r--r-- | tools/grilo-test-ui/main.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c index e2335e6..eb6f343 100644 --- a/tools/grilo-test-ui/main.c +++ b/tools/grilo-test-ui/main.c @@ -340,7 +340,7 @@ changes_notification_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) { - GList *sources, *source; + GList *sources, *l; GrlRegistry *registry; ui_state->changes_notification = g_variant_get_boolean (parameter); @@ -348,21 +348,21 @@ changes_notification_cb (GSimpleAction *action, registry = grl_registry_get_default (); sources = grl_registry_get_sources (registry, FALSE); - for (source = sources; source; source = g_list_next (source)) { - if (grl_source_supported_operations (GRL_SOURCE (source->data)) & - GRL_OP_NOTIFY_CHANGE) { - if (ui_state->changes_notification) { - grl_source_notify_change_start (GRL_SOURCE (source->data), NULL); - g_signal_connect (GRL_SOURCE (source->data), - "content-changed", - G_CALLBACK (content_changed_cb), - NULL); - } else { - grl_source_notify_change_stop (GRL_SOURCE (source->data), NULL); - g_signal_handlers_disconnect_by_func (source->data, - content_changed_cb, - NULL); - } + for (l = sources; l != NULL; l = g_list_next (l)) { + GrlSource *source = l->data; + if (!(grl_source_supported_operations (source) & GRL_OP_NOTIFY_CHANGE)) + continue; + if (ui_state->changes_notification) { + grl_source_notify_change_start (GRL_SOURCE (source), NULL); + g_signal_connect (GRL_SOURCE (source), + "content-changed", + G_CALLBACK (content_changed_cb), + NULL); + } else { + grl_source_notify_change_stop (GRL_SOURCE (source), NULL); + g_signal_handlers_disconnect_by_func (source, + content_changed_cb, + NULL); } } g_list_free (sources); |