| 1431 | } |
| 1432 | |
| 1433 | static void |
| 1434 | subtitle_update_pref_lang(signal_user_data_t *ud, const iso639_lang_t *lang) |
| 1435 | { |
| 1436 | GtkLabel *label; |
| 1437 | GtkWidget *button; |
| 1438 | gchar *str; |
| 1439 | const char * name = _("None"); |
| 1440 | const char * code = "und"; |
| 1441 | |
| 1442 | label = GTK_LABEL(ghb_builder_widget("subtitle_preferred_language")); |
| 1443 | if (lang != NULL) |
| 1444 | { |
| 1445 | code = lang->iso639_2; |
| 1446 | if (strncmp(code, "und", 4)) |
| 1447 | { |
| 1448 | name = lang->native_name && lang->native_name[0] ? |
| 1449 | lang->native_name : lang->eng_name; |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 | str = g_strdup_printf(_("Preferred Language: %s"), name); |
| 1454 | gtk_label_set_text(label, str); |
| 1455 | g_free(str); |
| 1456 | |
| 1457 | ghb_dict_set_string(ud->settings, "PreferredLanguage", code); |
| 1458 | |
| 1459 | // If there is no preferred language, disable options that require |
| 1460 | // a preferred language to be set. |
| 1461 | gboolean sensitive = !(lang == NULL || !strncmp(code, "und", 4)); |
| 1462 | button = ghb_builder_widget("SubtitleAddForeignAudioSubtitle"); |
| 1463 | if (sensitive) |
| 1464 | { |
| 1465 | str = g_strdup_printf( |
| 1466 | _("Add %s subtitle track if default audio is not %s"), name, name); |
| 1467 | } |
| 1468 | else |
| 1469 | { |
| 1470 | str = g_strdup_printf( |
| 1471 | _("Add subtitle track if default audio is not your preferred language")); |
| 1472 | } |
| 1473 | gtk_check_button_set_label(GTK_CHECK_BUTTON(button), str); |
| 1474 | g_free(str); |
| 1475 | |
| 1476 | gtk_widget_set_sensitive(button, sensitive); |
| 1477 | button = ghb_builder_widget("SubtitleAddForeignAudioSearch"); |
| 1478 | gtk_widget_set_sensitive(button, sensitive); |
| 1479 | } |
| 1480 | |
| 1481 | void |
| 1482 | ghb_subtitle_set_pref_lang(GhbValue *settings) |
no test coverage detected