From 84707dbafd5f6fbf9a37d54a03424a741116147e Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Mon, 17 Jun 2019 09:48:52 -0700 Subject: LinGui: add double-click edit to audio and subtitle lists Fixes https://github.com/HandBrake/HandBrake/issues/2148 --- gtk/src/audiohandler.c | 26 ++++++++++++++++++++------ gtk/src/ghb.m4 | 2 ++ gtk/src/subtitlehandler.c | 26 ++++++++++++++++++++------ 3 files changed, 42 insertions(+), 12 deletions(-) (limited to 'gtk') diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 6724b280a..d5ad15c89 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -1428,19 +1428,15 @@ audio_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) ghb_update_summary_info(ud); } -G_MODULE_EXPORT void -audio_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) +static void +audio_edit(GtkTreeView *tv, GtkTreePath *tp, signal_user_data_t *ud) { - GtkTreeView *tv; - GtkTreePath *tp; GtkTreeModel *tm; GtkTreeSelection *ts; GtkTreeIter ti; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); - tp = gtk_tree_path_new_from_string (path); if (gtk_tree_path_get_depth(tp) > 1) return; if (gtk_tree_model_get_iter(tm, &ti, tp)) { @@ -1474,6 +1470,24 @@ audio_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) } } +G_MODULE_EXPORT void +audio_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) +{ + GtkTreeView *tv; + GtkTreePath *tp; + + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); + tp = gtk_tree_path_new_from_string (path); + audio_edit(tv, tp, ud); +} + +G_MODULE_EXPORT void +audio_row_activated_cb(GtkTreeView *tv, GtkTreePath *tp, + GtkTreeViewColumn *col, signal_user_data_t *ud) +{ + audio_edit(tv, tp, ud); +} + G_MODULE_EXPORT void audio_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) { diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4 index 6a7ecc964..e7cd37dad 100644 --- a/gtk/src/ghb.m4 +++ b/gtk/src/ghb.m4 @@ -4196,6 +4196,7 @@ filter_output([ + @@ -5008,6 +5009,7 @@ filter_output([ + diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index dbf80c57b..1afca2131 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -1673,19 +1673,15 @@ void ghb_init_subtitle_defaults_ui(signal_user_data_t *ud) ghb_init_lang_list_model(tv); } -G_MODULE_EXPORT void -subtitle_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) +static void +subtitle_edit(GtkTreeView *tv, GtkTreePath *tp, signal_user_data_t *ud) { - GtkTreeView *tv; - GtkTreePath *tp; GtkTreeModel *tm; GtkTreeSelection *ts; GtkTreeIter ti; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); - tp = gtk_tree_path_new_from_string (path); if (gtk_tree_path_get_depth(tp) > 1) return; if (gtk_tree_model_get_iter(tm, &ti, tp)) { @@ -1720,6 +1716,24 @@ subtitle_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) } } +G_MODULE_EXPORT void +subtitle_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) +{ + GtkTreeView *tv; + GtkTreePath *tp; + + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); + tp = gtk_tree_path_new_from_string (path); + subtitle_edit(tv, tp, ud); +} + +G_MODULE_EXPORT void +subtitle_row_activated_cb(GtkTreeView *tv, GtkTreePath *tp, + GtkTreeViewColumn *col, signal_user_data_t *ud) +{ + subtitle_edit(tv, tp, ud); +} + G_MODULE_EXPORT void subtitle_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) { -- cgit v1.2.3