gboolean go_charmap_sel_set_encoding(GOCharmapSel *cs, const char *enc) { struct cb_find_entry cl; CharsetInfo const *ci; g_return_val_if_fail(GO_IS_CHARMAP_SEL(cs), FALSE); g_return_val_if_fail(enc != NULL, FALSE); ci = g_hash_table_lookup(encoding_hash, enc); if (!ci) return FALSE; enc = ci->to_utf8_iconv_name; if (!enc) return FALSE; cl.enc = enc; cl.found = FALSE; cl.i = 0; cl.path = NULL; gtk_container_foreach(GTK_CONTAINER(cs->encodings_menu), (GtkCallback) cb_find_entry, &cl); if (!cl.found) return FALSE; go_option_menu_set_history(cs->encodings, cl.path); g_slist_free(cl.path); return TRUE; }
gboolean go_locale_sel_set_locale (GOLocaleSel *ls, const char *locale) { struct cb_find_entry cl; LocaleInfo const *ci; g_return_val_if_fail (GO_IS_LOCALE_SEL (ls), FALSE); g_return_val_if_fail (locale != NULL, FALSE); ci = g_hash_table_lookup (locale_hash, locale); if (!ci) return FALSE; locale = ci->actual_locale; if (!locale) return FALSE; cl.locale = locale; cl.found = FALSE; cl.i = 0; cl.path = NULL; gtk_container_foreach (GTK_CONTAINER (ls->locales_menu), (GtkCallback)cb_find_entry, &cl); if (!cl.found) return FALSE; go_option_menu_set_history (ls->locales, cl.path); g_slist_free (cl.path); return TRUE; }
static void set_menu_to_default(GOCharmapSel *cs, gint item) { GSList sel = { GINT_TO_POINTER(item - 1), NULL }; g_return_if_fail(cs != NULL && GO_IS_CHARMAP_SEL(cs)); go_option_menu_set_history(cs->encodings, &sel); }
static void set_menu_to_default (GOLocaleSel *ls, gint item) { GSList sel = { GINT_TO_POINTER (item - 1), NULL}; g_return_if_fail (ls != NULL && GO_IS_LOCALE_SEL (ls)); go_option_menu_set_history (ls->locales, &sel); }