summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-07-29 10:48:07 -0700
committerJohn Stebbins <[email protected]>2019-07-29 10:48:07 -0700
commita75241042529818b5e4483fced9d645f02285585 (patch)
treecb951a8a12d4136ffa7fcbba0d0a0c315c9fdc5d /gtk/src/hb-backend.c
parent31e7ddd4f1517eee701d77d176e8113285598138 (diff)
LinGui: gtk4 port, fix search in language combo box
language search requires key-press handling which changed in gtk4
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r--gtk/src/hb-backend.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 64cc2ba88..e5d4fe54a 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -2014,9 +2014,9 @@ language_opts_set(signal_user_data_t *ud, const gchar *name,
gchar *lang;
if (iso639->native_name[0] != 0)
- lang = g_strdup_printf("<small>%s</small>", iso639->native_name);
+ lang = g_strdup_printf("%s", iso639->native_name);
else
- lang = g_strdup_printf("<small>%s</small>", iso639->eng_name);
+ lang = g_strdup_printf("%s", iso639->eng_name);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
@@ -2027,7 +2027,11 @@ language_opts_set(signal_user_data_t *ud, const gchar *name,
-1);
g_free(lang);
}
+#if !GTK_CHECK_VERSION(3, 90, 0)
+ // This is handled by GtkEventControllerKey in gtk4
+ // Initialized in ghb_combo_init()
g_signal_connect(combo, "key-press-event", combo_search_key_press_cb, ud);
+#endif
}
static void
@@ -3338,6 +3342,19 @@ ghb_combo_init(signal_user_data_t *ud)
init_ui_combo_boxes(ud->builder);
// Populate all the combos
ghb_update_ui_combo_box(ud, NULL, NULL, TRUE);
+
+#if GTK_CHECK_VERSION(3, 90, 0)
+ GtkWidget * combo;
+ GtkEventController * econ;
+
+ // Set key-press handler for subtitle import language combo.
+ // Pressing a key warps to the next language that starts with that key.
+ combo = GHB_WIDGET(ud->builder, "ImportLanguage");
+ econ = gtk_event_controller_key_new();
+ gtk_widget_add_controller(combo, econ);
+ g_signal_connect(econ, "key-pressed",
+ G_CALLBACK(combo_search_key_press_cb), ud);
+#endif
}
void