| 2419 | } |
| 2420 | |
| 2421 | G_MODULE_EXPORT void |
| 2422 | queue_start_action_cb (GSimpleAction *action, GVariant *param, |
| 2423 | signal_user_data_t *ud) |
| 2424 | { |
| 2425 | GhbValue *queueDict, *uiDict; |
| 2426 | gboolean running = FALSE; |
| 2427 | gint count, ii; |
| 2428 | gint status; |
| 2429 | gint state; |
| 2430 | |
| 2431 | ghb_power_manager_reset(); |
| 2432 | state = ghb_get_queue_state(); |
| 2433 | if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING | |
| 2434 | GHB_STATE_SCANNING | GHB_STATE_MUXING)) |
| 2435 | { |
| 2436 | ghb_stop_encode_dialog_show(ud); |
| 2437 | return; |
| 2438 | } |
| 2439 | |
| 2440 | count = ghb_array_len(ud->queue); |
| 2441 | for (ii = 0; ii < count; ii++) |
| 2442 | { |
| 2443 | queueDict = ghb_array_get(ud->queue, ii); |
| 2444 | uiDict = ghb_dict_get(queueDict, "uiSettings"); |
| 2445 | status = ghb_dict_get_int(uiDict, "job_status"); |
| 2446 | if ((status == GHB_QUEUE_RUNNING) || |
| 2447 | (status == GHB_QUEUE_PENDING)) |
| 2448 | { |
| 2449 | running = TRUE; |
| 2450 | break; |
| 2451 | } |
| 2452 | } |
| 2453 | if (!running) |
| 2454 | { |
| 2455 | // The queue has no running or pending jobs. |
| 2456 | // Add current settings to the queue, then run. |
| 2457 | if (!ghb_add_title_to_queue(ud, ud->settings, 0)) |
| 2458 | { |
| 2459 | return; |
| 2460 | } |
| 2461 | ghb_queue_selection_init(ud); |
| 2462 | // Validation of settings may have changed audio list |
| 2463 | ghb_audio_list_refresh_all(ud); |
| 2464 | } |
| 2465 | if (state == GHB_STATE_IDLE) |
| 2466 | { |
| 2467 | // Add the first pending queue item and start |
| 2468 | ghb_start_next_job(ud); |
| 2469 | } |
| 2470 | } |
| 2471 | |
| 2472 | G_MODULE_EXPORT void |
| 2473 | queue_pause_action_cb (GSimpleAction *action, GVariant *param, gpointer data) |
no test coverage detected