[dconf-editor] Add a hint for strings-composed types, notably "ms".
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Add a hint for strings-composed types, notably "ms".
- Date: Sun, 4 Oct 2015 15:56:26 +0000 (UTC)
commit b960755b2fcb49bb9301c88e63b345ad82525a91
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Oct 4 17:55:47 2015 +0200
Add a hint for strings-composed types, notably "ms".
editor/dconf-view.vala | 33 ++++++++++++++++++++++-----------
editor/key-editor.ui | 4 ++--
2 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 1305137..b4151e1 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -45,13 +45,13 @@ private abstract class KeyEditorDialog : Dialog
KeyEditorChildBool _key_editor_child = new KeyEditorChildBool (key.value.get_boolean ());
key_editor_child = (KeyEditorChild) _key_editor_child;
custom_value_grid.add (_key_editor_child);
- break;
+ return;
case "s":
KeyEditorChildString _key_editor_child = new KeyEditorChildString (key.value.get_string ());
key_editor_child = (KeyEditorChild) _key_editor_child;
key_editor_child.child_activated.connect (response_apply_cb);
custom_value_grid.add (_key_editor_child);
- break;
+ return;
case "y":
case "n":
case "q":
@@ -64,7 +64,7 @@ private abstract class KeyEditorDialog : Dialog
key_editor_child = (KeyEditorChild) _key_editor_child;
key_editor_child.child_activated.connect (response_apply_cb);
custom_value_grid.add (_key_editor_child);
- break;
+ return;
default:
KeyEditorChildDefault _key_editor_child = new KeyEditorChildDefault (key.type_string,
key.value);
_key_editor_child.is_valid.connect ((is_valid) => { custom_value_is_valid = is_valid; });
@@ -74,16 +74,27 @@ private abstract class KeyEditorDialog : Dialog
break;
}
- if ("m" in key.type_string) /* warning: "<enum>" has an "m" in it */
+ if ("s" in key.type_string) /* warning: "<flags>" has an "s" in it */
{
- /* Translators: neither the "nothing" keyword nor the "m" type should be translated; a "maybe
type" is a type of variant that is nullable. */
- Label label = new Label ("<i>" + _("Use the keyword “nothing” so set a maybe type (beginning
with “m”) to its null value." + "</i>"));
- label.visible = true;
- label.use_markup = true;
- label.max_width_chars = 55;
- label.wrap = true;
- custom_value_grid.add (label);
+ if ("m" in key.type_string) /* warning: "<enum>" has an "m" in it */
+ /* Translators: neither the "nothing" keyword nor the "m" type should be translated; a
"maybe type" is a type of variant that is nullable. */
+ custom_value_grid.add (warning_label (_("Use the keyword “nothing” so set a maybe type
(beginning with “m”) to its null value. Strings should be surrounded by quotation marks.")));
+ else
+ custom_value_grid.add (warning_label (_("Strings should be surrounded by quotation
marks.")));
}
+ else if ("m" in key.type_string) /* warning: "<enum>" has an "m" in it */
+ /* Translators: neither the "nothing" keyword nor the "m" type should be translated; a "maybe
type" is a type of variant that is nullable. */
+ custom_value_grid.add (warning_label (_("Use the keyword “nothing” so set a maybe type
(beginning with “m”) to its null value.")));
+ }
+ private Label warning_label (string text)
+ {
+ Label label = new Label ("<i>" + text + "</i>");
+ label.visible = true;
+ label.use_markup = true;
+ label.max_width_chars = 59;
+ label.wrap = true;
+ label.halign = Align.START;
+ return label;
}
protected string key_to_description ()
diff --git a/editor/key-editor.ui b/editor/key-editor.ui
index b324d3b..1e0dd72 100644
--- a/editor/key-editor.ui
+++ b/editor/key-editor.ui
@@ -190,8 +190,8 @@
<property name="selectable">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
- <!--<property name="max-width-chars">42</property>
- <property name="width-chars">42</property> -->
+ <property name="max-width-chars">42</property>
+ <property name="width-chars">42</property>
</object>
<packing>
<property name="left-attach">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]