MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ghb_update_destination_extension

Function ghb_update_destination_extension

gtk/src/callbacks.c:1947–1994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1945}
1946
1947void
1948ghb_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
1996static void
1997destination_select_title(GtkEntry *entry)

Callers 3

dest_file_changed_cbFunction · 0.85
container_changed_cbFunction · 0.85
use_m4v_changed_cbFunction · 0.85

Calls 4

get_extensionFunction · 0.85
ghb_builder_widgetFunction · 0.85
ghb_ui_updateFunction · 0.85
ghb_string_valueFunction · 0.85

Tested by

no test coverage detected