| 166 | } |
| 167 | |
| 168 | static void |
| 169 | subtitle_refresh_list_ui_from_settings(signal_user_data_t *ud, GhbValue *settings) |
| 170 | { |
| 171 | GtkTreeView *tv; |
| 172 | GtkTreeModel *tm; |
| 173 | GtkTreeIter ti; |
| 174 | GhbValue *subtitle_list, *subtitle_search; |
| 175 | GhbValue *subsettings; |
| 176 | gint ii, count, tm_count; |
| 177 | gboolean search; |
| 178 | |
| 179 | tv = GTK_TREE_VIEW(ghb_builder_widget("subtitle_list_view")); |
| 180 | tm = gtk_tree_view_get_model(tv); |
| 181 | |
| 182 | tm_count = gtk_tree_model_iter_n_children(tm, NULL); |
| 183 | |
| 184 | subtitle_list = ghb_get_job_subtitle_list(settings); |
| 185 | subtitle_search = ghb_get_job_subtitle_search(settings); |
| 186 | search = ghb_dict_get_bool(subtitle_search, "Enable"); |
| 187 | count = ghb_array_len(subtitle_list); |
| 188 | if (count + search != tm_count) |
| 189 | { |
| 190 | clear_subtitle_list_ui(); |
| 191 | for (ii = 0; ii < count + search; ii++) |
| 192 | { |
| 193 | gtk_tree_store_append(GTK_TREE_STORE(tm), &ti, NULL); |
| 194 | } |
| 195 | } |
| 196 | // Enable or Disable FAS action if other subtitle actions are enabled |
| 197 | GAction *action = GHB_ACTION("subtitle-add"); |
| 198 | if (g_action_get_enabled(action)) |
| 199 | { |
| 200 | action = GHB_ACTION("subtitle-add-fas"); |
| 201 | g_simple_action_set_enabled(G_SIMPLE_ACTION(action), !search); |
| 202 | } |
| 203 | if (search) |
| 204 | { |
| 205 | |
| 206 | gtk_tree_model_iter_nth_child(tm, &ti, NULL, 0); |
| 207 | subtitle_refresh_list_row_ui(tm, &ti, ud->settings, subtitle_search); |
| 208 | } |
| 209 | for (ii = 0; ii < count; ii++) |
| 210 | { |
| 211 | gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii + search); |
| 212 | subsettings = ghb_array_get(subtitle_list, ii); |
| 213 | subtitle_refresh_list_row_ui(tm, &ti, ud->settings, subsettings); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | static void |
| 218 | subtitle_refresh_list_ui(signal_user_data_t *ud) |
no test coverage detected