[Xfce4-commits] <midori:master> Always prefill language entries with default values
Christian Dywan
noreply at xfce.org
Sun Oct 10 22:56:02 CEST 2010
Updating branch refs/heads/master
to 9d8c8195212312a275efdf8b87b253568b3681aa (commit)
from 4d2968a0cc709efa43bcf2a2b4439b293b61775b (commit)
commit 9d8c8195212312a275efdf8b87b253568b3681aa
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Oct 10 22:41:15 2010 +0200
Always prefill language entries with default values
katze/katze-utils.c | 14 ++++++++++++++
midori/midori-preferences.c | 6 ++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 7a50682..feb970c 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -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);
diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c
index d620125..5f591ac 100644
--- a/midori/midori-preferences.c
+++ b/midori/midori-preferences.c
@@ -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" */
More information about the Xfce4-commits
mailing list