Always prefill language entries with default values
This commit is contained in:
parent
4d2968a0cc
commit
9d8c819521
2 changed files with 16 additions and 4 deletions
|
@ -474,6 +474,9 @@ g_icon_to_string (GIcon *icon)
|
|||
* "custom-PROPERTY": the last value of an enumeration will be the "custom"
|
||||
* value, where the user may enter text freely, which then updates
|
||||
* the property PROPERTY instead. This applies only to enumerations.
|
||||
* Since 0.2.9 the following hints are also supported:
|
||||
* "languages": the widget will be particularly suitable for choosing
|
||||
* multiple language codes, ie. "de,en_GB".
|
||||
*
|
||||
* Any other values for @hint are silently ignored.
|
||||
*
|
||||
|
@ -740,6 +743,17 @@ katze_property_proxy (gpointer object,
|
|||
g_object_get (object, property, &string, NULL);
|
||||
if (!string)
|
||||
string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
|
||||
if (!(string && *string) && _hint == I_("languages"))
|
||||
{
|
||||
gchar* lang = g_strjoinv (",", (gchar**)g_get_language_names ());
|
||||
if (g_str_has_suffix (lang, ",C"))
|
||||
{
|
||||
string = g_strndup (lang, strlen (lang) - 2);
|
||||
g_free (lang);
|
||||
}
|
||||
else
|
||||
string = lang;
|
||||
}
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), string ? string : "");
|
||||
g_signal_connect (widget, "activate",
|
||||
G_CALLBACK (proxy_entry_activate_cb), object);
|
||||
|
|
|
@ -452,9 +452,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
gtk_button_set_label (GTK_BUTTON (button), _("Enable Spell Checking"));
|
||||
gtk_widget_set_tooltip_text (button, _("Enable spell checking while typing"));
|
||||
INDENTED_ADD (button);
|
||||
button = gtk_label_new (_("Spelling dictionaries:"));
|
||||
INDENTED_ADD (button);
|
||||
entry = katze_property_proxy (settings, "spell-checking-languages", NULL);
|
||||
entry = katze_property_proxy (settings, "spell-checking-languages", "languages");
|
||||
/* i18n: The example should be adjusted to contain a good local default */
|
||||
gtk_widget_set_tooltip_text (entry, _("A comma separated list of "
|
||||
"languages to be used for spell checking, for example \"en_GB,de_DE\""));
|
||||
|
@ -529,7 +527,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
SPANNED_ADD (button);
|
||||
label = katze_property_label (settings, "preferred-languages");
|
||||
INDENTED_ADD (label);
|
||||
entry = katze_property_proxy (settings, "preferred-languages", NULL);
|
||||
entry = katze_property_proxy (settings, "preferred-languages", "languages");
|
||||
SPANNED_ADD (entry);
|
||||
|
||||
/* Page "Privacy" */
|
||||
|
|
Loading…
Reference in a new issue