Display/Hide queue activity log pane Choose buffer to display. Queue logs use 1 of 2 available buffers queue_activity_buffer - live buffer, updated as encode proceeds extra_activity_buffer - non-live buffer, populated from log file If showing non-live buffer, read log file into buffer
| 887 | // extra_activity_buffer - non-live buffer, populated from log file |
| 888 | // If showing non-live buffer, read log file into buffer |
| 889 | void ghb_queue_select_log (signal_user_data_t * ud) |
| 890 | { |
| 891 | GtkListBox * lb; |
| 892 | GtkListBoxRow * row; |
| 893 | GtkTextBuffer * current; |
| 894 | gint index; |
| 895 | GhbValue * queueDict, *uiDict; |
| 896 | |
| 897 | lb = GTK_LIST_BOX(ghb_builder_widget("queue_list")); |
| 898 | row = gtk_list_box_get_selected_row(lb); |
| 899 | if (row != NULL) |
| 900 | { |
| 901 | // There is a queue list row selected |
| 902 | GtkTextView * tv; |
| 903 | int status; |
| 904 | const char * log_path; |
| 905 | |
| 906 | index = gtk_list_box_row_get_index(row); |
| 907 | if (index < 0 || index >= ghb_array_len(ud->queue)) |
| 908 | { // Should never happen |
| 909 | return; |
| 910 | } |
| 911 | queueDict = ghb_array_get(ud->queue, index); |
| 912 | uiDict = ghb_dict_get(queueDict, "uiSettings"); |
| 913 | // Get the current buffer that is displayed in the queue log |
| 914 | tv = GTK_TEXT_VIEW(ghb_builder_widget("queue_activity_view")); |
| 915 | current = gtk_text_view_get_buffer(tv); |
| 916 | |
| 917 | status = ghb_dict_get_int(uiDict, "job_status"); |
| 918 | log_path = ghb_dict_get_string(uiDict, "ActivityFilename"); |
| 919 | if (status != GHB_QUEUE_PENDING && log_path != NULL) |
| 920 | { |
| 921 | ghb_ui_update("queue_activity_location", |
| 922 | ghb_string_value(log_path)); |
| 923 | } |
| 924 | else |
| 925 | { |
| 926 | ghb_ui_update("queue_activity_location", ghb_string_value("")); |
| 927 | } |
| 928 | if (status == GHB_QUEUE_RUNNING) |
| 929 | { |
| 930 | // Selected encode is running, enable display of log and |
| 931 | // show the live buffer |
| 932 | if (ud->queue_activity_buffer != current) |
| 933 | { |
| 934 | gtk_text_view_set_buffer(tv, ud->queue_activity_buffer); |
| 935 | } |
| 936 | } |
| 937 | else |
| 938 | { |
| 939 | // Selected encode is pending/finished/canceled/failed |
| 940 | // use non-live buffer (aka extra) to display log |
| 941 | if (ud->extra_activity_buffer != current) |
| 942 | { |
| 943 | gtk_text_view_set_buffer(tv, ud->extra_activity_buffer); |
| 944 | } |
| 945 | log_path = ghb_dict_get_string(uiDict, "ActivityFilename"); |
| 946 | if (status != GHB_QUEUE_PENDING && log_path != NULL) |
no test coverage detected