#include "settings.h"
#include "callbacks.h"
#include "audiohandler.h"
+#include "subtitlehandler.h"
#include "hb-backend.h"
#include "plist.h"
#include "resources.h"
}
}
+static void
+presets_customize(GValue *presets)
+{
+ gint count, ii;
+
+ count = ghb_array_len(presets);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *dict;
+ gboolean folder;
+ gint ptype;
+
+ dict = ghb_array_get_nth(presets, ii);
+
+ ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
+ if (ptype != PRESETS_CUSTOM)
+ {
+ ghb_dict_insert(dict, g_strdup("Type"),
+ ghb_int64_value_new(PRESETS_CUSTOM));
+ }
+ folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
+ if (folder)
+ {
+ GValue *nested;
+
+ nested = ghb_dict_lookup(dict, "ChildrenArray");
+ presets_customize(nested);
+ }
+ }
+}
+
static gint*
presets_find_default2(GValue *presets, gint *len)
{
// pointer will break strict-aliasing rules"
while (g_hash_table_iter_next(
&iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
+ {
const GValue *value = NULL;
if (dict)
value = ghb_dict_lookup(dict, key);
if (value == NULL)
value = gval;
ghb_settings_set_value(ud->settings, key, value);
- }
+ }
internal = plist_get_dict(internalPlist, "Preferences");
ghb_dict_iter_init(&iter, internal);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
// pointer will break strict-aliasing rules"
while (g_hash_table_iter_next(
&iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value))
- {
- value = ghb_settings_get_value(settings, key);
- if (value != NULL)
- {
+ {
+ value = ghb_settings_get_value(settings, key);
+ if (value != NULL)
+ {
ghb_dict_insert(pref_dict, g_strdup(key), ghb_value_dup(value));
- }
+ }
}
store_prefs();
prefs_modified = FALSE;
prefsPlist = ghb_dict_value_new();
dict = plist_get_dict(prefsPlist, "Preferences");
internal = plist_get_dict(internalPlist, "Preferences");
- if (dict == NULL && internal)
- {
+ if (dict == NULL && internal)
+ {
dict = ghb_dict_value_new();
ghb_dict_insert(prefsPlist, g_strdup("Preferences"), dict);
- // Get defaults from internal defaults
+ // Get defaults from internal defaults
ghb_dict_iter_init(&iter, internal);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
// pointer will break strict-aliasing rules"
while (g_hash_table_iter_next(
&iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
+ {
ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(gval));
- }
- const gchar *dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
+ }
+
+ const gchar *dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+ if (dir == NULL)
+ {
+ dir = ".";
+ }
+ ghb_dict_insert(dict,
+ g_strdup("ExportDirectory"), ghb_value_dup(ghb_string_value(dir)));
+
+ dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
if (dir == NULL)
{
dir = ".";
}
ghb_dict_insert(dict,
g_strdup("destination_dir"), ghb_value_dup(ghb_string_value(dir)));
+
+ ghb_dict_insert(dict,
+ g_strdup("SrtDir"), ghb_value_dup(ghb_string_value(dir)));
#if defined(_WIN32)
gchar *source;
g_free(source);
#endif
store_prefs();
- }
+ }
// Read legacy default_preset preference and update accordingly
path = ghb_dict_lookup(dict, "default_preset");
if (path)
static value_map_t acodec_xlat[] =
{
{"AAC (faac)", "faac"},
+ {"AAC (CoreAudio)", "faac"},
{"AC3 Passthru", "ac3"},
{"MP3 (lame)", "lame"},
{"Vorbis (vorbis)", "vorbis"},
value_map_t container_xlat[] =
{
{"MP4 file", "mp4"},
- {"M4V file", "m4v"},
+ {"M4V file", "mp4"},
{"MKV file", "mkv"},
{"AVI file", "mkv"},
{"OGM file", "mkv"},
gval = export_value_xlat2(denoise_xlat, lin_val, G_TYPE_INT);
if (gval)
ghb_dict_insert(dict, g_strdup(key), gval);
- key = "Subtitles";
- lin_val = ghb_dict_lookup(dict, key);
- gval = export_subtitle_xlat2(lin_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
+
+ GValue *slist;
+ GValue *sdict;
+ gint count, ii;
+
+ slist = ghb_dict_lookup(dict, "SubtitleList");
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ sdict = ghb_array_get_nth(slist, ii);
+ key = "SubtitleLanguage";
+ lin_val = ghb_dict_lookup(sdict, key);
+ gval = export_subtitle_xlat2(lin_val);
+ if (gval)
+ ghb_dict_insert(sdict, g_strdup(key), gval);
+ }
GValue *alist;
GValue *adict;
- gint count, ii;
alist = ghb_dict_lookup(dict, "AudioList");
count = ghb_array_len(alist);
return gval;
}
}
- //g_warning("Can't map value: (%s)", str);
g_free(str);
}
else
{
- g_warning("Bad key: (%s)", key);
- return NULL;
+ gint ii;
+ gchar *str;
+ GValue *sval;
+
+ str = ghb_value_string(mac_val);
+ for (ii = 0; value_map[ii].mac_val; ii++)
+ {
+ if (strcmp(str, value_map[ii].mac_val) == 0)
+ {
+ sval = ghb_string_value_new(value_map[ii].lin_val);
+ g_free(str);
+ gval = ghb_value_new(G_VALUE_TYPE(mac_val));
+ if (!g_value_transform(sval, gval))
+ {
+ g_warning("can't transform");
+ ghb_value_free(gval);
+ ghb_value_free(sval);
+ return NULL;
+ }
+ ghb_value_free(sval);
+ return gval;
+ }
+ }
+ g_free(str);
}
return NULL;
}
gval = import_value_xlat2(defaults, denoise_xlat, key, mac_val);
if (gval)
ghb_dict_insert(dict, g_strdup(key), gval);
- key = "Subtitles";
- mac_val = ghb_dict_lookup(dict, key);
- gval = import_subtitle_xlat2(mac_val);
- if (gval)
- ghb_dict_insert(dict, g_strdup(key), gval);
+
+
+ GValue *sdeflist;
+ GValue *sdefaults;
+ GValue *slist;
+ GValue *sdict;
+ gint count, ii;
+
+ sdeflist = ghb_dict_lookup(defaults, "SubtitleList");
+ if (sdeflist)
+ {
+ slist = ghb_dict_lookup(dict, "SubtitleList");
+ if (slist)
+ {
+ sdefaults = ghb_array_get_nth(sdeflist, 0);
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ sdict = ghb_array_get_nth(slist, ii);
+ key = "SubtitleLanguage";
+ mac_val = ghb_dict_lookup(sdict, key);
+ gval = import_subtitle_xlat2(mac_val);
+ if (gval)
+ ghb_dict_insert(sdict, g_strdup(key), gval);
+ }
+
+ }
+ else
+ {
+ key = "Subtitles";
+ mac_val = ghb_dict_lookup(dict, key);
+ slist = ghb_array_value_new(8);
+ ghb_dict_insert(dict, g_strdup("SubtitleList"), slist);
+ if (mac_val)
+ {
+ gchar *lang;
+
+ gval = import_subtitle_xlat2(mac_val);
+ lang = ghb_value_string(gval);
+ if (lang && strcasecmp(lang, "none") != 0 && !slist)
+ {
+ sdict = ghb_dict_value_new();
+ ghb_array_append(slist, sdict);
+ ghb_dict_insert(sdict, g_strdup("SubtitleLanguage"), gval);
+ gval = ghb_dict_lookup(dict, "SubtitlesForced");
+ if (gval != NULL)
+ {
+ ghb_dict_insert(sdict, g_strdup("SubtitleForced"),
+ ghb_value_dup(gval));
+ }
+ else
+ {
+ ghb_dict_insert(sdict, g_strdup("SubtitleForced"),
+ ghb_boolean_value_new(FALSE));
+ }
+ ghb_dict_insert(sdict, g_strdup("SubtitleBurned"),
+ ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(sdict, g_strdup("SubtitleDefaultTrack"),
+ ghb_boolean_value_new(FALSE));
+ }
+ else
+ {
+ ghb_value_free(gval);
+ }
+ if (lang)
+ g_free(lang);
+ }
+ }
+ }
+ ghb_dict_remove(dict, "Subtitles");
+ ghb_dict_remove(dict, "SubtitlesForced");
+
GValue *alist;
GValue *adict;
GValue *adefaults;
GValue *adeflist;
- gint count, ii;
- adeflist = ghb_dict_lookup(dict, "AudioList");
+ adeflist = ghb_dict_lookup(defaults, "AudioList");
if (adeflist)
{
adefaults = ghb_array_get_nth(adeflist, 0);
gval = import_value_xlat2(adefaults, mix_xlat, key, mac_val);
if (gval)
ghb_dict_insert(adict, g_strdup(key), gval);
+
+ mac_val = ghb_dict_lookup(adict, "AudioTrackDRCSlider");
+ if (mac_val != NULL)
+ {
+ gdouble drc;
+ drc = ghb_value_double(mac_val);
+ if (drc < 1.0 && drc > 0.0)
+ {
+ ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
+ ghb_double_value_new(0.0));
+ }
+ }
}
}
}
{
gboolean uses_max;
gint uses_pic;
- gint par, par_width, par_height;
+ gint par;
gint vqtype;
g_debug("import_xlat_preset ()");
preset_dict_get_value(dict, "UsesPictureSettings"));
par = ghb_value_int(preset_dict_get_value(dict, "PicturePAR"));
vqtype = ghb_value_int(preset_dict_get_value(dict, "VideoQualityType"));
- par_width = ghb_value_int(preset_dict_get_value(dict, "PicturePARWidth"));
- par_height = ghb_value_int(preset_dict_get_value(dict, "PicturePARHeight"));
- ghb_dict_insert(dict, g_strdup("par_width"),
- ghb_int_value_new(par_width));
- ghb_dict_insert(dict, g_strdup("par_height"),
- ghb_int_value_new(par_height));
if (uses_max || uses_pic == 2)
{
vquality = 51. - vquality * 51.;
} break;
- case HB_VCODEC_XVID:
case HB_VCODEC_FFMPEG:
{
vquality = 31. - vquality * 30.;
export_xlat_preset(GValue *dict)
{
gboolean autoscale, target, br, constant;
- gint par_width, par_height;
g_debug("export_xlat_prest ()");
autoscale = ghb_value_boolean(preset_dict_get_value(dict, "autoscale"));
preset_dict_get_value(dict, "vquality_type_bitrate"));
constant = ghb_value_boolean(
preset_dict_get_value(dict, "vquality_type_constant"));
- par_width = ghb_value_int(
- preset_dict_get_value(dict, "par_width"));
- par_height = ghb_value_int(
- preset_dict_get_value(dict, "par_height"));
if (autoscale)
ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
ghb_dict_insert(dict, g_strdup("VideoQualityType"),
ghb_int_value_new(2));
}
- ghb_dict_insert(dict, g_strdup("PicturePARWidth"),
- ghb_int_value_new(par_width));
- ghb_dict_insert(dict, g_strdup("PicturePARHeight"),
- ghb_int_value_new(par_height));
+
+ GValue *alist, *adict;
+ gint count, ii;
+
+ alist = ghb_dict_lookup(dict, "AudioList");
+ count = ghb_array_len(alist);
+ for (ii = 0; ii < count; ii++)
+ {
+ gdouble drc;
+
+ adict = ghb_array_get_nth(alist, ii);
+ drc = ghb_value_double(
+ preset_dict_get_value(adict, "AudioTrackDRCSlider"));
+ if (drc < 1.0 && drc > 0.0)
+ {
+ ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
+ ghb_double_value_new(0.0));
+ }
+ }
+
ghb_dict_remove(dict, "UsesMaxPictureSettings");
ghb_dict_remove(dict, "autoscale");
ghb_dict_remove(dict, "vquality_type_target");
ghb_dict_remove(dict, "vquality_type_bitrate");
ghb_dict_remove(dict, "vquality_type_constant");
- ghb_dict_remove(dict, "par_width");
- ghb_dict_remove(dict, "par_height");
export_value_xlat(dict);
}
if (std_presets == NULL) return;
remove_std_presets(ud);
- indices = presets_find_default(presetsPlist, &len);
+ indices = presets_find_default(presetsPlist, &len);
if (indices)
{
presets_clear_default(std_presets);
std_dict = ghb_array_get_nth(std_presets, ii);
copy_dict = ghb_value_dup(std_dict);
+ ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
+ ghb_int64_value_new(hb_get_build(NULL)));
ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
presets_list_insert(ud, &indices, 1);
}
return FALSE;
}
+static void
+replace_standard_presets()
+{
+ GValue *std_presets;
+ int *indices, len;
+ gint count, ii;
+
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ gint ptype;
+
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
+ if (ptype == PRESETS_BUILTIN)
+ {
+ gint indices = 0;
+ ghb_presets_remove(presetsPlist, &indices, 1);
+ }
+ }
+
+ std_presets = ghb_resource_get("standard-presets");
+ if (std_presets == NULL) return;
+
+ indices = presets_find_default(presetsPlist, &len);
+ if (indices)
+ {
+ presets_clear_default(std_presets);
+ g_free(indices);
+ }
+ // Merge the keyfile contents into our presets
+ count = ghb_array_len(std_presets);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *std_dict;
+ GValue *copy_dict;
+ gint indices = 0;
+
+ std_dict = ghb_array_get_nth(std_presets, ii);
+ copy_dict = ghb_value_dup(std_dict);
+ ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
+ ghb_int64_value_new(hb_get_build(NULL)));
+ ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
+ }
+ import_xlat_presets(presetsPlist);
+ store_presets();
+}
+
+static void
+update_standard_presets(signal_user_data_t *ud)
+{
+ gint count, ii;
+
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ const GValue *gval;
+ gint64 build;
+ gint type;
+
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ gval = ghb_dict_lookup(dict, "Type");
+ if (gval == NULL)
+ {
+ // Old preset that doesn't have a Type
+ replace_standard_presets();
+ return;
+ }
+
+ type = ghb_value_int(gval);
+ if (type == 0)
+ {
+ gval = ghb_dict_lookup(dict, "PresetBuildNumber");
+ if (gval == NULL)
+ {
+ // Old preset that doesn't have a build number
+ replace_standard_presets();
+ return;
+ }
+
+ build = ghb_value_int64(gval);
+ if (build != hb_get_build(NULL))
+ {
+ // Build number does not match
+ replace_standard_presets();
+ return;
+ }
+ }
+ }
+ return;
+}
+
void
-ghb_presets_load()
+ghb_presets_load(signal_user_data_t *ud)
{
presetsPlist = load_plist("presets");
if (presetsPlist == NULL)
import_xlat_presets(presetsPlist);
store_presets();
}
+ update_standard_presets(ud);
import_xlat_presets(presetsPlist);
}
current_preset = dict;
autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
ghb_settings_set_int64(ud->settings, "Type", PRESETS_CUSTOM);
+ ghb_settings_set_int64(ud->settings, "PresetBuildNumber", hb_get_build(NULL));
internal = plist_get_dict(internalPlist, "Presets");
ghb_dict_iter_init(&iter, internal);
ghb_settings_set_value(ud->settings, "AudioList", audio_list);
}
+static void
+update_subtitle_presets(signal_user_data_t *ud)
+{
+ g_debug("update_subtitle_presets");
+ const GValue *subtitle_list, *subtitle;
+ GValue *slist, *dict;
+ gint count, ii, source;
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ slist = ghb_array_value_new(8);
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ subtitle = ghb_array_get_nth(subtitle_list, ii);
+ source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ if (source != SRTSUB)
+ {
+ dict = ghb_value_dup(subtitle);
+ ghb_array_append(slist, dict);
+ }
+ }
+ ghb_settings_take_value(ud->settings, "SubtitleList", slist);
+}
+
void
enforce_preset_type(signal_user_data_t *ud, const GValue *path)
{
}
G_MODULE_EXPORT void
+presets_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+ GtkMenu *menu;
+
+ menu = GTK_MENU(GHB_WIDGET(ud->builder, "presets_menu"));
+ gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 1,
+ gtk_get_current_event_time());
+}
+
+G_MODULE_EXPORT void
+preset_import_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+ GtkWidget *dialog;
+ GtkResponseType response;
+ gchar *exportDir;
+ gchar *filename;
+ GtkFileFilter *filter;
+
+ g_debug("preset_import_clicked_cb ()");
+
+ dialog = gtk_file_chooser_dialog_new("Export Preset", NULL,
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ filter = gtk_file_filter_new();
+ gtk_file_filter_set_name(filter, "All (*)");
+ gtk_file_filter_add_pattern(filter, "*");
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
+
+ filter = gtk_file_filter_new();
+ gtk_file_filter_set_name(filter, "Presets (*.plist)");
+ gtk_file_filter_add_pattern(filter, "*.plist");
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
+ gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ if (exportDir == NULL || exportDir[0] == '\0')
+ {
+ exportDir = g_strdup(".");
+ }
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), exportDir);
+ g_free(exportDir);
+
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ GValue *dict, *array;
+ gchar *dir;
+ gint count, ii;
+
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ // import the preset
+ if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
+ {
+ gtk_widget_destroy(dialog);
+ g_free(filename);
+ return;
+ }
+ array = ghb_plist_parse_file(filename);
+ g_free(filename);
+
+ import_xlat_presets(array);
+ presets_clear_default(array);
+ presets_customize(array);
+
+ count = ghb_array_len(array);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *path, *name;
+ gint *indices, len;
+ gint index = 1;
+
+ dict = ghb_array_get_nth(array, ii);
+ path = ghb_array_value_new(1);
+ name = ghb_value_dup(ghb_dict_lookup(dict, "PresetName"));
+ ghb_array_append(path, name);
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ // Modify the preset name till we make it unique
+ while (indices != NULL)
+ {
+ gchar *str = ghb_value_string(name);
+
+ ghb_value_free(path);
+ g_free(indices);
+
+ str = g_strdup_printf("%s %d", str, index);
+ path = ghb_array_value_new(1);
+ name = ghb_string_value_new(str);
+ ghb_array_append(path, name);
+ g_free(str);
+
+ index++;
+ indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
+ }
+ ghb_dict_insert(dict, g_strdup("PresetName"), ghb_value_dup(name));
+ indices = presets_find_pos(path, PRESETS_CUSTOM, &len);
+ ghb_presets_insert(presetsPlist, ghb_value_dup(dict), indices, len);
+ presets_list_insert(ud, indices, len);
+ ghb_value_free(path);
+ }
+ ghb_value_free(array);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ dir = g_path_get_dirname(filename);
+ if (strcmp(dir, exportDir) != 0)
+ {
+ ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
+ ghb_pref_save(ud->settings, "ExportDirectory");
+ }
+ g_free(exportDir);
+ g_free(dir);
+ }
+ gtk_widget_destroy(dialog);
+}
+
+G_MODULE_EXPORT void
+preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+ GtkWidget *dialog;
+ GtkResponseType response;
+ GValue *preset;
+ const gchar *name = "";
+ gint count, *indices, len;
+ gchar *exportDir;
+ gchar *filename;
+
+ g_debug("preset_export_clicked_cb ()");
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ if (preset == NULL)
+ return;
+
+ count = ghb_array_len(preset);
+ if (count <= 0)
+ return;
+
+ name = g_value_get_string(ghb_array_get_nth(preset, count-1));
+
+ dialog = gtk_file_chooser_dialog_new("Export Preset", NULL,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ if (exportDir == NULL || exportDir[0] == '\0')
+ {
+ exportDir = g_strdup(".");
+ }
+ filename = g_strdup_printf("%s.plist", name);
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), exportDir);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
+ g_free(filename);
+ g_free(exportDir);
+
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ if (indices == NULL)
+ return;
+
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ GValue *export, *dict, *array;
+ FILE *file;
+ gchar *dir;
+
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ // export the preset
+ dict = presets_get_dict(presetsPlist, indices, len);
+
+ export = ghb_value_dup(dict);
+ array = ghb_array_value_new(1);
+ ghb_array_append(array, export);
+ presets_clear_default(array);
+ presets_customize(array);
+ export_xlat_presets(array);
+
+ file = g_fopen(filename, "w");
+ if (file != NULL)
+ {
+ ghb_plist_write(file, array);
+ fclose(file);
+ }
+ ghb_value_free(array);
+
+ exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ dir = g_path_get_dirname(filename);
+ if (strcmp(dir, exportDir) != 0)
+ {
+ ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
+ ghb_pref_save(ud->settings, "ExportDirectory");
+ }
+ g_free(exportDir);
+ g_free(dir);
+ g_free(filename);
+ }
+ gtk_widget_destroy(dialog);
+ g_free(indices);
+}
+
+G_MODULE_EXPORT void
presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GtkWidget *dialog;
{
// Construct the audio settings presets from the current audio list
update_audio_presets(ud);
+ update_subtitle_presets(ud);
settings_save(ud, dest);
}
ghb_value_free(dest);
gboolean src_folder, dst_folder;
GValue *preset;
gint tree_depth, ii;
+ GtkWidget *widget;
+
+ widget = gtk_drag_get_source_widget(ctx);
+ if (widget == NULL || widget != GTK_WIDGET(tv))
+ return TRUE;
// Get the type of the object being dragged
srctv = GTK_TREE_VIEW(gtk_drag_get_source_widget(ctx));
gint titleindex;
titleindex = ghb_settings_combo_int(ud->settings, "title");
ghb_set_pref_audio(titleindex, ud);
+ ghb_set_pref_subtitle(titleindex, ud);
ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
if (ghb_get_title_info (&tinfo, titleindex))
{