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

Function preset_write_response

gtk/src/presets.c:2197–2249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2195}
2196
2197static void
2198preset_write_response (GtkDialog *dialog, GtkResponseType response,
2199 preset_write_data *data)
2200{
2201 signal_user_data_t *ud = ghb_ud();
2202 int index = 0;
2203
2204 if (GTK_IS_DIALOG(dialog))
2205 gtk_window_destroy(GTK_WINDOW(dialog));
2206
2207 if (response == GTK_RESPONSE_ACCEPT)
2208 {
2209 hb_preset_index_t *folder_path = data->folder_path;
2210 GhbValue *preset = data->preset;
2211 const char *preset_name = ghb_dict_get_string(preset, "PresetName");
2212 char *existing_path = g_strdup_printf("/%s/%s", GHB_IMPORT_FOLDER, preset_name);
2213 hb_preset_index_t *existing_index = hb_preset_search_index(existing_path, 0, HB_PRESET_TYPE_CUSTOM);
2214 if (existing_index->depth > 0)
2215 {
2216 int depth = existing_index->depth;
2217 index = existing_index->index[depth - 1];
2218 GhbValue *array = hb_presets_get_folder_children(folder_path);
2219 ghb_array_remove(array, index);
2220 ghb_array_insert(array, index, preset);
2221 }
2222 else
2223 {
2224 index = hb_preset_append(folder_path, preset);
2225 }
2226
2227 store_presets();
2228
2229 // Re-init the UI preset list
2230 ghb_presets_list_reinit(ud);
2231 ghb_presets_menu_reinit(ud);
2232 if (index < 0 || folder_path->depth < 0)
2233 {
2234 ghb_select_default_preset(ud);
2235 }
2236 else
2237 {
2238 hb_preset_index_t path;
2239 path.index[1] = index;
2240 path.index[0] = folder_path->index[0];
2241 path.depth = 2;
2242 select_preset2(ud, &path);
2243 }
2244 g_free(existing_index);
2245 g_free(existing_path);
2246 }
2247 g_free(data->folder_path);
2248 g_free(data);
2249}
2250
2251G_MODULE_EXPORT void
2252preset_import_action_cb(GSimpleAction *action, GVariant *param,

Callers 1

Calls 10

ghb_udFunction · 0.85
ghb_dict_get_stringFunction · 0.85
hb_preset_search_indexFunction · 0.85
hb_preset_appendFunction · 0.85
store_presetsFunction · 0.85
ghb_presets_list_reinitFunction · 0.85
ghb_presets_menu_reinitFunction · 0.85
select_preset2Function · 0.85

Tested by

no test coverage detected