From 6f6c8d566858b3947490b79de8a450a80487f497 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Fri, 22 May 2009 16:22:04 +0000 Subject: LinGui: reload subtitles properly when a queue item is edited git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2438 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/callbacks.c | 2 ++ gtk/src/main.c | 4 ++++ gtk/src/subtitlehandler.c | 36 ++++++++++++++++++++++++++++++++---- gtk/src/subtitlehandler.h | 1 + 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index decc4579d..616c9c931 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -740,6 +740,7 @@ ghb_do_scan( jstatus = ghb_settings_get_int(ghb_queue_edit_settings, "job_status"); ghb_settings_to_ui(ud, ghb_queue_edit_settings); ghb_set_audio(ud, ghb_queue_edit_settings); + ghb_reset_subtitles(ud, ghb_queue_edit_settings); if (jstatus == GHB_QUEUE_PENDING) { ghb_value_free(ghb_queue_edit_settings); @@ -2042,6 +2043,7 @@ ghb_backend_events(signal_user_data_t *ud) jstatus = ghb_settings_get_int(ghb_queue_edit_settings, "job_status"); ghb_settings_to_ui(ud, ghb_queue_edit_settings); ghb_set_audio(ud, ghb_queue_edit_settings); + ghb_reset_subtitles(ud, ghb_queue_edit_settings); if (jstatus == GHB_QUEUE_PENDING) { ghb_value_free(ghb_queue_edit_settings); diff --git a/gtk/src/main.c b/gtk/src/main.c index 9e214447d..db5450580 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -342,6 +342,8 @@ bind_audio_tree_model (signal_user_data_t *ud) column = gtk_tree_view_column_new_with_attributes( _("Track"), cell, "text", 0, NULL); gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column)); + gtk_tree_view_column_set_min_width (column, 210); + gtk_tree_view_column_set_max_width (column, 210); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( @@ -357,11 +359,13 @@ bind_audio_tree_model (signal_user_data_t *ud) column = gtk_tree_view_column_new_with_attributes( _("Sample Rate"), cell, "text", 3, NULL); gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column)); + gtk_tree_view_column_set_min_width (column, 120); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _("Mix"), cell, "text", 4, NULL); gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column)); + gtk_tree_view_column_set_min_width (column, 120); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index b3b3a9bbf..6dcded511 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -124,7 +124,7 @@ ghb_set_pref_subtitle(gint titleindex, signal_user_data_t *ud) g_free(lang); if (track >= 0) { - // Add to subtitle list + ghb_settings_set_boolean(subtitle, "SubtitleEnabled", TRUE); ghb_set_subtitle(ud, track, subtitle); } } @@ -753,7 +753,7 @@ ghb_set_subtitle(signal_user_data_t *ud, gint track, GValue *settings) GValue *slist; GValue *subtitle; gint count, ii, tt; - gboolean forced, burned; + gboolean forced, burned, enabled; g_debug("ghb_set_subtitle"); slist = ghb_settings_get_value(ud->settings, "subtitle_list"); @@ -766,6 +766,7 @@ ghb_set_subtitle(signal_user_data_t *ud, gint track, GValue *settings) if (track != tt) continue; + enabled = ghb_settings_get_boolean(settings, "SubtitleEnabled"); forced = ghb_settings_get_boolean(settings, "SubtitleForced"); burned = ghb_settings_get_boolean(settings, "SubtitleBurned"); @@ -774,11 +775,11 @@ ghb_set_subtitle(signal_user_data_t *ud, gint track, GValue *settings) tm = gtk_tree_view_get_model(tv); gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii); - ghb_settings_set_boolean(subtitle, "SubtitleEnabled", TRUE); + ghb_settings_set_boolean(subtitle, "SubtitleEnabled", enabled); ghb_settings_set_boolean(subtitle, "SubtitleForced", forced); ghb_settings_set_boolean(subtitle, "SubtitleBurned", burned); gtk_list_store_set(GTK_LIST_STORE(tm), &ti, - 0, TRUE, + 0, enabled, 2, forced, 3, burned, 6, FALSE, @@ -787,3 +788,30 @@ ghb_set_subtitle(signal_user_data_t *ud, gint track, GValue *settings) } } +void +ghb_reset_subtitles(signal_user_data_t *ud, GValue *settings) +{ + GValue *slist; + GValue *subtitle; + gint count, ii, track; + gint titleindex; + + g_debug("ghb_reset_subtitles"); + ghb_clear_subtitle_list(ud); + titleindex = ghb_settings_combo_int(ud->settings, "title"); + if (titleindex < 0) + return; + + ghb_add_all_subtitles(ud, titleindex); + slist = ghb_settings_get_value(settings, "subtitle_list"); + + count = ghb_array_len(slist); + for (ii = 0; ii < count; ii++) + { + subtitle = ghb_array_get_nth(slist, ii); + track = ghb_settings_get_int(subtitle, "SubtitleTrack"); + + ghb_set_subtitle(ud, track, subtitle); + } +} + diff --git a/gtk/src/subtitlehandler.h b/gtk/src/subtitlehandler.h index eb9ce78e9..e1e9fc912 100644 --- a/gtk/src/subtitlehandler.h +++ b/gtk/src/subtitlehandler.h @@ -35,5 +35,6 @@ GValue* ghb_selected_subtitle_settings(signal_user_data_t *ud); gint ghb_selected_subtitle_row(signal_user_data_t *ud); void ghb_add_subtitle( signal_user_data_t *ud, GValue *settings, gboolean can_delete); +void ghb_reset_subtitles(signal_user_data_t *ud, GValue *settings); #endif // _SUBTITLEHANDLER_H_ -- cgit v1.2.3