| 1945 | } |
| 1946 | |
| 1947 | void |
| 1948 | ghb_update_destination_extension(signal_user_data_t *ud) |
| 1949 | { |
| 1950 | static const char *containers[] = {".mkv", ".mp4", ".m4v", ".webm", ".error", NULL}; |
| 1951 | gchar *filename; |
| 1952 | const gchar *extension; |
| 1953 | gint ii; |
| 1954 | GtkEditable *entry; |
| 1955 | static gboolean busy = FALSE; |
| 1956 | |
| 1957 | ghb_log_func(); |
| 1958 | // Since this function modifies the thing that triggers it's |
| 1959 | // invocation, check to see if busy to prevent accidental infinite |
| 1960 | // recursion. |
| 1961 | if (busy) |
| 1962 | return; |
| 1963 | busy = TRUE; |
| 1964 | extension = get_extension(ud, ud->settings); |
| 1965 | entry = GTK_EDITABLE(ghb_builder_widget("dest_file")); |
| 1966 | filename = g_strdup(gtk_editable_get_text(entry)); |
| 1967 | for (ii = 0; containers[ii] != NULL; ii++) |
| 1968 | { |
| 1969 | if (g_str_has_suffix(filename, containers[ii])) |
| 1970 | { |
| 1971 | gchar *pos; |
| 1972 | gchar *new_name; |
| 1973 | |
| 1974 | pos = g_strrstr( filename, "." ); |
| 1975 | if (pos == NULL) |
| 1976 | { |
| 1977 | // No period? shouldn't happen |
| 1978 | break; |
| 1979 | } |
| 1980 | *pos = 0; |
| 1981 | if (strcmp(extension, &pos[1]) == 0) |
| 1982 | { |
| 1983 | // Extension is already correct |
| 1984 | break; |
| 1985 | } |
| 1986 | new_name = g_strjoin(".", filename, extension, NULL); |
| 1987 | ghb_ui_update("dest_file", ghb_string_value(new_name)); |
| 1988 | g_free(new_name); |
| 1989 | break; |
| 1990 | } |
| 1991 | } |
| 1992 | g_free(filename); |
| 1993 | busy = FALSE; |
| 1994 | } |
| 1995 | |
| 1996 | static void |
| 1997 | destination_select_title(GtkEntry *entry) |
no test coverage detected