}
else if (type == GTK_TYPE_TEXT_VIEW)
{
+ static int text_view_busy = 0;
GtkTextBuffer *buffer = gtk_text_view_get_buffer(
GTK_TEXT_VIEW(widget));
- gtk_text_buffer_set_text (buffer, str, -1);
+ if (!text_view_busy)
+ {
+ text_view_busy = 1;
+ gtk_text_buffer_set_text (buffer, str, -1);
+ text_view_busy = 0;
+ }
}
else if (type == GTK_TYPE_LABEL)
{
#include "presets.h"
#include "preview.h"
#include "hb-backend.h"
+#include "x264handler.h"
int ghb_get_video_encoder(GhbValue *settings)
{
new_opts = hb_x264_param_unparse(
preset, tunes, opts, profile, level, w, h);
if (new_opts)
- ghb_ui_update(ud, "x264Option", ghb_string_value(new_opts));
+ ghb_update_x264Option(ud, new_opts);
else
- ghb_ui_update(ud, "x264Option", ghb_string_value(""));
+ ghb_update_x264Option(ud, "");
GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "VideoOptionExtra"));
gchar *sopts;
sopts = sanitize_x264opts(ud, options);
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
+ ghb_update_x264Option(ud, sopts);
ghb_x264_parse_options(ud, sopts);
GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "VideoOptionExtra"));
if (len > 0) result[len - 1] = 0;
gchar *sopts;
sopts = sanitize_x264opts(ud, result);
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
+ ghb_update_x264Option(ud, sopts);
ghb_x264_parse_options(ud, sopts);
g_free(sopts);
g_free(result);
{
ud->x264_priv = ghb_settings_new();
}
+
+gboolean
+ghb_background_refresh_x264Option(signal_user_data_t *ud)
+{
+ const char *opt;
+ opt = ghb_settings_get_const_string(ud->settings, "x264Option");
+
+ GtkWidget *widget;
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
+ gchar *str;
+
+ widget = GHB_WIDGET(ud->builder, "x264Option");
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
+ gtk_text_buffer_get_bounds(buffer, &start, &end);
+ str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+
+ // If the value has changed, then update it
+ if (opt != NULL)
+ {
+ if (str == NULL || strcmp(str, opt))
+ {
+ ud->dont_clear_presets = 1;
+ ghb_ui_update(ud, "x264Option", ghb_string_value(opt));
+ ud->dont_clear_presets = 0;
+ }
+ }
+ free(str);
+ return FALSE;
+}
+
+void ghb_update_x264Option(signal_user_data_t *ud, const char *opt)
+{
+ ghb_settings_set_string(ud->settings, "x264Option", opt);
+ g_idle_add((GSourceFunc)ghb_background_refresh_x264Option, ud);
+}