* any later version.
*
*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gstdio.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)
{
init_settings_from_dict(ud->settings, hidden, dict);
init_ui_from_dict(ud, internal, dict);
init_ui_from_dict(ud, hidden, dict);
+
+ if (dict != NULL)
+ {
+ GValue *val;
+ gboolean dd;
+
+ val = ghb_dict_lookup(dict, "PictureDecombDeinterlace");
+ if (val != NULL)
+ {
+ dd = ghb_value_boolean(val);
+ ghb_ui_update(ud, "PictureDeinterlaceDecomb", ghb_boolean_value(!dd));
+ }
+ }
}
void
return plist;
}
+gboolean
+ghb_lock_file(const gchar *name)
+{
+#if !defined(_WIN32)
+ gchar *config, *path;
+ int fd, lock = 0;
+
+ config = ghb_get_user_config_dir(NULL);
+ path = g_strdup_printf ("%s/%s", config, name);
+ fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
+ if (fd >= 0)
+ lock = lockf(fd, F_TLOCK, 0);
+ if (lock)
+ close(fd);
+ g_free(config);
+ g_free(path);
+ return !lock;
+#else
+ return 1;
+#endif
+}
+
static void
remove_plist(const gchar *name)
{
ghb_ui_update(ud, "hbfd", ghb_int64_value(0));
}
gval = ghb_settings_get_value(ud->settings, "default_source");
- ghb_settings_set_value (ud->settings, "source", gval);
+ ghb_settings_set_value (ud->settings, "scan_source", gval);
str = ghb_settings_get_string(ud->settings, "destination_dir");
ghb_ui_update(ud, "dest_dir", ghb_string_value(str));
{
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;
2, def ? 2 : 0,
3, color,
4, description,
+ 5, type == PRESETS_BUILTIN ? 0 : 1,
-1);
if (def && piter)
{
presets_list_update_item(
signal_user_data_t *ud,
gint *indices,
- gint len)
+ gint len,
+ gboolean recurse)
{
GtkTreeView *treeview;
GtkTreeStore *store;
2, def ? 2 : 0,
3, color,
4, description,
+ 5, type == PRESETS_BUILTIN ? 0 : 1,
-1);
- if (folder)
+ if (recurse && folder)
{
ghb_presets_list_init(ud, indices, len);
}
2, def ? 2 : 0,
3, color,
4, description,
+ 5, type == PRESETS_BUILTIN ? 0 : 1,
-1);
if (folder)
{
value_map_t deint_xlat[] =
{
- {"0", "none"},
+ {"0", "off"},
{"1", "custom"},
{"2", "fast"},
{"3", "slow"},
value_map_t denoise_xlat[] =
{
- {"0", "none"},
+ {"0", "off"},
{"1", "custom"},
{"2", "weak"},
{"3", "medium"},
value_map_t detel_xlat[] =
{
- {"0", "none"},
+ {"0", "off"},
{"1", "custom"},
{"2", "default"},
{NULL, NULL}
value_map_t decomb_xlat[] =
{
- {"0", "none"},
+ {"0", "off"},
{"1", "custom"},
{"2", "default"},
{NULL, NULL}
{
if (strcmp(str, ghb_language_table[ii].iso639_2) == 0)
{
- gval = ghb_string_value_new(ghb_language_table[ii].eng_name);
+ const gchar *lang;
+
+ if (ghb_language_table[ii].native_name[0] != 0)
+ lang = ghb_language_table[ii].native_name;
+ else
+ lang = ghb_language_table[ii].eng_name;
+
+ gval = ghb_string_value_new(lang);
g_free(str);
return gval;
}
str = ghb_value_string(mac_val);
for (ii = 0; ghb_language_table[ii].eng_name; ii++)
{
- if (strcmp(str, ghb_language_table[ii].eng_name) == 0)
+ if ((strcmp(str, ghb_language_table[ii].eng_name) == 0) ||
+ (strcmp(str, ghb_language_table[ii].native_name) == 0))
{
gval = ghb_string_value_new(ghb_language_table[ii].iso639_2);
g_free(str);
const GValue *gval;
vquality = ghb_value_double(preset_dict_get_value(dict, "VideoQualitySlider"));
- if (vquality < 1.0)
+ if (vquality > 0.0 && vquality < 1.0)
{
gint vcodec;
ghb_dict_insert(dict, g_strdup("Default"),
ghb_boolean_value_new(FALSE));
}
- presets_list_update_item(ud, indices, len);
+ presets_list_update_item(ud, indices, len, FALSE);
}
else
{
ghb_dict_insert(dict, g_strdup("PresetDescription"),
ghb_value_dup(preset_dict_get_value(
ud->settings, "PresetDescription")));
+ presets_list_update_item(ud, indices, len, FALSE);
g_free(indices);
+ store_presets();
return;
}
else
g_debug("update_subtitle_presets");
const GValue *subtitle_list, *subtitle;
GValue *slist, *dict;
- gint count, ii;
+ gint count, ii, source;
subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
slist = ghb_array_value_new(8);
for (ii = 0; ii < count; ii++)
{
subtitle = ghb_array_get_nth(subtitle_list, ii);
- dict = ghb_value_dup(subtitle);
- ghb_array_append(slist, dict);
+ source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ if (source != SRTSUB)
+ {
+ dict = ghb_value_dup(subtitle);
+ ghb_array_append(slist, dict);
+ }
}
- ghb_settings_set_value(ud->settings, "SubtitleList", slist);
+ 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)
{
- gint *indices, len;
- GtkWidget *normal, *folder;
- gboolean fold;
+ GtkMenu *menu;
- normal = GHB_WIDGET(ud->builder, "preset_type_normal");
- folder = GHB_WIDGET(ud->builder, "preset_type_folder");
- indices = ghb_preset_indices_from_path(presetsPlist, path, &len);
- if (indices)
+ 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("Import 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')
{
- fold = ghb_presets_get_folder(presetsPlist, indices, len);
- if (fold)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(folder),
- TRUE);
- else
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(normal),
- TRUE);
- gtk_widget_set_sensitive(folder, fold);
- gtk_widget_set_sensitive(normal, !fold);
- g_free(indices);
+ exportDir = g_strdup(".");
}
- else
+ 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)
{
- gtk_widget_set_sensitive(folder, TRUE);
- gtk_widget_set_sensitive(normal, TRUE);
+ 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
-presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+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_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GtkWidget *dialog;
GtkEntry *entry;
GtkTextView *desc;
GtkResponseType response;
- GValue *preset;
+ GValue *preset, *dict;
const gchar *name = "";
+ const gchar *description = "";
gint count, *indices, len;
g_debug("presets_save_clicked_cb ()");
name = g_value_get_string(ghb_array_get_nth(preset, count-1));
else
count = 1;
- // Clear the description
+
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (dict != NULL)
+ {
+ description = g_value_get_string(
+ ghb_dict_lookup(dict, "PresetDescription"));
+ ghb_ui_update(ud, "PresetDescription", ghb_string_value(description));
+ }
+
desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription"));
dialog = GHB_WIDGET(ud->builder, "preset_save_dialog");
entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName"));
gtk_entry_set_text(entry, name);
- enforce_preset_type(ud, preset);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);
if (response == GTK_RESPONSE_OK)
const gchar *name = gtk_entry_get_text(entry);
GValue *dest;
- if (ghb_settings_get_boolean(ud->settings, "preset_type_folder"))
+ if (count > MAX_NESTED_PRESET-1)
+ count = MAX_NESTED_PRESET-1;
+
+ dest = ghb_array_value_new(MAX_NESTED_PRESET);
+ if (indices != NULL)
{
- if (count > MAX_NESTED_PRESET-1)
+ gint ptype;
+
+ ptype = ghb_presets_get_type(presetsPlist, indices, len);
+ if (ptype == PRESETS_CUSTOM)
{
- count = MAX_NESTED_PRESET-1;
+ ghb_array_copy(dest, preset, count-1);
}
}
+ ghb_array_append(dest, ghb_string_value_new(name));
+ ghb_widget_to_setting(ud->settings, GTK_WIDGET(desc));
+ folder_save(ud, dest);
+ ghb_value_free(dest);
+ }
+ if (indices != NULL)
+ g_free(indices);
+}
+
+G_MODULE_EXPORT void
+presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+ GtkWidget *dialog;
+ GtkEntry *entry;
+ GtkTextView *desc;
+ GtkResponseType response;
+ GValue *preset;
+ const gchar *name = "";
+ gint count, *indices, len;
+
+ g_debug("presets_save_clicked_cb ()");
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+
+ count = ghb_array_len(preset);
+ if (count > 0)
+ name = g_value_get_string(ghb_array_get_nth(preset, count-1));
+ else
+ count = 1;
+
+ desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription"));
+ dialog = GHB_WIDGET(ud->builder, "preset_save_dialog");
+ entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName"));
+ gtk_entry_set_text(entry, name);
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_hide(dialog);
+ if (response == GTK_RESPONSE_OK)
+ {
+ // save the preset
+ const gchar *name = gtk_entry_get_text(entry);
+ GValue *dest;
+
dest = ghb_array_value_new(MAX_NESTED_PRESET);
indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
if (indices)
{
ghb_array_copy(dest, preset, count-1);
}
+ g_free(indices);
}
ghb_array_append(dest, ghb_string_value_new(name));
ghb_widget_to_setting(ud->settings, GTK_WIDGET(desc));
- if (ghb_settings_get_boolean(ud->settings, "preset_type_folder"))
- {
- folder_save(ud, dest);
- }
- else
- {
- // Construct the audio settings presets from the current audio list
- update_audio_presets(ud);
- update_subtitle_presets(ud);
- settings_save(ud, dest);
- }
+
+ // 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);
}
}
}
G_MODULE_EXPORT void
-preset_name_changed_cb(GtkWidget *entry, signal_user_data_t *ud)
-{
- gchar *name;
- GValue *preset, *dest;
- gint count;
-
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
- name = ghb_widget_string(entry);
- dest = ghb_value_dup(preset);
- count = ghb_array_len(dest);
- ghb_array_replace(dest, count-1, ghb_string_value_new(name));
- enforce_preset_type(ud, dest);
- ghb_value_free(dest);
-}
-
-G_MODULE_EXPORT void
presets_restore_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GValue *preset;
dstpath = gtk_tree_model_get_path (dstmodel, &iter);
dst_indices = gtk_tree_path_get_indices(dstpath);
dst_len = gtk_tree_path_get_depth(dstpath);
- presets_list_update_item(ud, dst_indices, dst_len);
+ presets_list_update_item(ud, dst_indices, dst_len, TRUE);
gtk_tree_path_free(dstpath);
store_presets();
}
}
+void
+ghb_refresh_preset(signal_user_data_t *ud)
+{
+ ghb_title_info_t tinfo;
+ GValue *preset;
+ gint *indices, len;
+
+ g_debug("ghb_refresh_preset ()");
+ preset = ghb_settings_get_value(ud->settings, "preset_selection");
+ indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
+ if (indices)
+ {
+ gboolean folder;
+
+ folder = ghb_presets_get_folder(presetsPlist, indices, len);
+ if (!folder)
+ {
+ ud->dont_clear_presets = TRUE;
+ // Temporarily set the video_quality range to (0,100)
+ // This is needed so the video_quality value does not get
+ // truncated when set. The range will be readjusted below
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
+ gtk_range_set_range (GTK_RANGE(qp), 0, 100);
+ gtk_scale_set_digits(GTK_SCALE(qp), 3);
+ // Clear the audio list prior to changing the preset. Existing
+ // audio can cause the container extension to be automatically
+ // changed when it shouldn't be
+ ghb_clear_audio_list(ud);
+ ghb_set_preset_from_indices(ud, indices, len);
+ 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))
+ {
+ preset_update_title_deps(ud, &tinfo);
+ }
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+ ud->dont_clear_presets = FALSE;
+
+ gdouble vqmin, vqmax, step, page;
+ gint digits;
+ gboolean inverted;
+
+ ghb_vquality_range(ud, &vqmin, &vqmax, &step,
+ &page, &digits, &inverted);
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
+ gtk_range_set_increments (GTK_RANGE(qp), step, page);
+ gtk_scale_set_digits(GTK_SCALE(qp), digits);
+ gtk_range_set_inverted (GTK_RANGE(qp), inverted);
+
+ gchar *text;
+ gint crop[4];
+ GtkWidget *crop_widget;
+ crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+ crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+ crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+ crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ crop_widget = GHB_WIDGET (ud->builder, "crop_values");
+ text = g_strdup_printf("%d:%d:%d:%d",
+ crop[0], crop[1], crop[2], crop[3]);
+ gtk_label_set_text (GTK_LABEL(crop_widget), text);
+ g_free(text);
+ }
+ }
+}
+
G_MODULE_EXPORT void
presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud)
{
// changed when it shouldn't be
ghb_clear_audio_list(ud);
ghb_set_preset_from_indices(ud, indices, len);
- gtk_tree_path_free(treepath);
gint titleindex;
titleindex = ghb_settings_combo_int(ud->settings, "title");
ghb_set_pref_audio(titleindex, ud);
gtk_label_set_text (GTK_LABEL(crop_widget), text);
g_free(text);
}
+ gtk_tree_path_free(treepath);
gtk_widget_set_sensitive(widget, TRUE);
}
else
g_debug("No selection??? Perhaps unselected.");
gtk_widget_set_sensitive(widget, FALSE);
}
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ gint start, end;
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
+ gtk_widget_set_sensitive(widget, TRUE);
+ if (start == end)
+ {
+ ud->dont_clear_presets = TRUE;
+ ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE));
+ ud->dont_clear_presets = FALSE;
+ gtk_widget_set_sensitive(widget, FALSE);
+ }
+ }
}
void
}
}
+G_MODULE_EXPORT void
+preset_edited_cb(
+ GtkCellRendererText *cell,
+ gchar *path,
+ gchar *text,
+ signal_user_data_t *ud)
+{
+ GtkTreePath *treepath;
+ GtkTreeStore *store;
+ GtkTreeView *treeview;
+ GtkTreeIter iter;
+ gint *indices, len, count;
+ GValue *dict;
+ GValue *preset, *dest;
+
+ g_debug("preset_edited_cb ()");
+ g_debug("path (%s)", path);
+ g_debug("text (%s)", text);
+
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ dest = ghb_array_value_new(MAX_NESTED_PRESET);
+ count = ghb_array_len(preset);
+ ghb_array_copy(dest, preset, count-1);
+ ghb_array_append(dest, ghb_string_value_new(text));
+ indices = ghb_preset_indices_from_path(presetsPlist, dest, &len);
+ ghb_value_free(dest);
+ if (indices != NULL)
+ {
+ // Already exists
+ g_free(indices);
+ return;
+ }
+
+ treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
+ treepath = gtk_tree_path_new_from_string (path);
+ indices = gtk_tree_path_get_indices(treepath);
+ len = gtk_tree_path_get_depth(treepath);
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
+ gtk_tree_store_set(store, &iter, 0, text, -1);
+
+ dict = presets_get_dict(presetsPlist, indices, len);
+ ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(text));
+ store_presets();
+ gtk_tree_path_free (treepath);
+}
+