summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-06-17 09:48:52 -0700
committerJohn Stebbins <[email protected]>2019-06-17 09:51:18 -0700
commit84707dbafd5f6fbf9a37d54a03424a741116147e (patch)
tree048100d5f7ec41c454fd411fee43e0a5564c1cdd /gtk
parentd3dbfba11a60e3e09e44447ab29b69aa6e171921 (diff)
LinGui: add double-click edit to audio and subtitle lists
Fixes https://github.com/HandBrake/HandBrake/issues/2148
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/audiohandler.c26
-rw-r--r--gtk/src/ghb.m42
-rw-r--r--gtk/src/subtitlehandler.c26
3 files changed, 42 insertions, 12 deletions
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))
{
@@ -1475,6 +1471,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)
{
GtkTreeView *tv;
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([
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
+ <signal name="row-activated" handler="audio_row_activated_cb" swapped="no"/>
</object>
</child>
</object>
@@ -5008,6 +5009,7 @@ filter_output([
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2"/>
</child>
+ <signal name="row-activated" handler="subtitle_row_activated_cb" swapped="no"/>
</object>
</child>
</object>
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))
{
@@ -1721,6 +1717,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)
{
GtkTreeView *tv;