| 571 | } |
| 572 | |
| 573 | static GhbValue* |
| 574 | subtitle_get_selected_settings(signal_user_data_t *ud, int *index) |
| 575 | { |
| 576 | GtkTreeView *tv; |
| 577 | GtkTreeSelection *ts; |
| 578 | GtkTreeModel *tm; |
| 579 | GtkTreeIter iter; |
| 580 | GhbValue *subsettings = NULL; |
| 581 | |
| 582 | tv = GTK_TREE_VIEW(ghb_builder_widget("subtitle_list_view")); |
| 583 | ts = gtk_tree_view_get_selection(tv); |
| 584 | if (gtk_tree_selection_get_selected(ts, &tm, &iter)) |
| 585 | { |
| 586 | GhbValue *subtitle_list, *subtitle_search; |
| 587 | gboolean search; |
| 588 | gint row, *indices; |
| 589 | GtkTreePath *tp; |
| 590 | |
| 591 | // Get the row number |
| 592 | tp = gtk_tree_model_get_path(tm, &iter); |
| 593 | indices = gtk_tree_path_get_indices(tp); |
| 594 | row = indices[0]; |
| 595 | gtk_tree_path_free(tp); |
| 596 | |
| 597 | subtitle_search = ghb_get_job_subtitle_search(ud->settings); |
| 598 | search = ghb_dict_get_bool(subtitle_search, "Enable"); |
| 599 | if (search) |
| 600 | { |
| 601 | if (row == 0) |
| 602 | { |
| 603 | if (index != NULL) |
| 604 | *index = -1; |
| 605 | return subtitle_search; |
| 606 | } |
| 607 | row--; |
| 608 | } |
| 609 | |
| 610 | subtitle_list = ghb_get_job_subtitle_list(ud->settings); |
| 611 | if (row < 0 || row >= ghb_array_len(subtitle_list)) |
| 612 | return NULL; |
| 613 | |
| 614 | subsettings = ghb_array_get(subtitle_list, row); |
| 615 | if (index != NULL) |
| 616 | *index = row; |
| 617 | } |
| 618 | return subsettings; |
| 619 | } |
| 620 | |
| 621 | static void |
| 622 | subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings) |
no test coverage detected