From d3df9a69f2917a016fe747f74393d0877abebde0 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Sat, 24 Sep 2016 10:09:58 -0400 Subject: [PATCH] gui/ocarina: Add a --sync option Passing this option tells Ocarina that it should only process synchronous idle tasks, such as library or playlist updates. This effectively disables album art fetching (and any async jobs we add in the future). Implements #91: Add --no-fetch option Signed-off-by: Anna Schumaker --- gui/ocarina.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gui/ocarina.c b/gui/ocarina.c index aeb170e4..ae140ff0 100644 --- a/gui/ocarina.c +++ b/gui/ocarina.c @@ -16,12 +16,13 @@ #define OCARINA_FLAGS (G_APPLICATION_HANDLES_COMMAND_LINE) static const GOptionEntry ocarina_options[] = { - { "next", 'n', 0, G_OPTION_ARG_NONE, NULL, "Play next track", NULL }, - { "pause", 'P', 0, G_OPTION_ARG_NONE, NULL, "Pause playback", NULL }, - { "play", 'p', 0, G_OPTION_ARG_NONE, NULL, "Start playback", NULL }, - { "previous", 'N', 0, G_OPTION_ARG_NONE, NULL, "Play previous track", NULL }, - { "toggle", 't', 0, G_OPTION_ARG_NONE, NULL, "Toggle playback state", NULL }, - { "version", 'v', 0, G_OPTION_ARG_NONE, NULL, "Print version and exit", NULL }, + { "next", 'n', 0, G_OPTION_ARG_NONE, NULL, "Play next track", NULL }, + { "pause", 'P', 0, G_OPTION_ARG_NONE, NULL, "Pause playback", NULL }, + { "play", 'p', 0, G_OPTION_ARG_NONE, NULL, "Start playback", NULL }, + { "previous", 'N', 0, G_OPTION_ARG_NONE, NULL, "Play previous track", NULL }, + { "sync", 's', 0, G_OPTION_ARG_NONE, NULL, "Don't run background tasks", NULL }, + { "toggle", 't', 0, G_OPTION_ARG_NONE, NULL, "Toggle playback state", NULL }, + { "version", 'v', 0, G_OPTION_ARG_NONE, NULL, "Print version and exit", NULL }, { NULL }, }; @@ -59,6 +60,8 @@ static void __ocarina_activate(GApplication *application, gpointer data) static int __ocarina_local_options(GApplication *application, GVariantDict *options, gpointer data) { + if (g_variant_dict_contains(options, "sync")) + init_data.idle_sync = IDLE_SYNC; if (!g_variant_dict_contains(options, "version")) return -1; g_printf("Ocarina %s\n", get_version());