summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-07-12 14:06:18 -0700
committerJohn Stebbins <[email protected]>2019-09-10 09:09:52 -0700
commited346b4659a7c353cc3f0aee745344e84c051e27 (patch)
tree7bb4b8f073704d4d42a20fd18e2d7dd29a1c48cf /gtk/src/hb-backend.c
parent53d6226c58e9f7bba23f1746bad1d8b61ec6338d (diff)
Create separate fake iso639 "any" entry
Allows us to distinguish a selection of "any" which means match any language from "und" which means the language is not known. Fixes https://github.com/HandBrake/HandBrake/issues/731
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r--gtk/src/hb-backend.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 9f842ee89..e54b8964f 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -2000,16 +2000,16 @@ language_opts_set(signal_user_data_t *ud, const gchar *name,
(void)data; // Silence "unused variable" warning
GtkTreeIter iter;
GtkListStore *store;
- gint ii;
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
const iso639_lang_t *iso639;
- for (iso639 = lang_get_next(NULL), ii = 0; iso639 != NULL;
- iso639 = lang_get_next(iso639), ii++)
+ for (iso639 = lang_get_next(NULL); iso639 != NULL;
+ iso639 = lang_get_next(iso639))
{
- gchar *lang;
+ int index = lang_lookup_index(iso639->iso639_1);
+ gchar * lang;
if (iso639->native_name[0] != 0)
lang = g_strdup_printf("%s", iso639->native_name);
@@ -2021,7 +2021,7 @@ language_opts_set(signal_user_data_t *ud, const gchar *name,
0, lang,
1, TRUE,
2, iso639->iso639_2,
- 3, (gdouble)ii,
+ 3, (gdouble)index,
-1);
g_free(lang);
}
@@ -3050,22 +3050,17 @@ void ghb_init_lang_list(GtkTreeView *tv, signal_user_data_t *ud)
{
GtkTreeIter iter;
GtkTreeStore * ts;
- int ii;
ghb_init_lang_list_model(tv);
ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv));
const iso639_lang_t *iso639;
- for (iso639 = lang_get_next(NULL), ii = 0; iso639 != NULL;
- iso639 = lang_get_next(iso639), ii++)
+ for (iso639 = lang_get_any(); iso639 != NULL;
+ iso639 = lang_get_next(iso639))
{
+ int index = lang_lookup_index(iso639->iso639_2);
const char * lang;
- if (ii == 0)
- {
- lang = _("Any");
- }
- else if (iso639->native_name != NULL &&
- iso639->native_name[0] != 0)
+ if (iso639->native_name != NULL && iso639->native_name[0] != 0)
{
lang = iso639->native_name;
}
@@ -3074,7 +3069,7 @@ void ghb_init_lang_list(GtkTreeView *tv, signal_user_data_t *ud)
lang = iso639->eng_name;
}
gtk_tree_store_append(ts, &iter, NULL);
- gtk_tree_store_set(ts, &iter, 0, lang, 1, ii, -1);
+ gtk_tree_store_set(ts, &iter, 0, lang, 1, index, -1);
}
}