[dconf-editor] Escape GAction strings.



commit 7605c6cf2a9392aa6d7b50d54d1e8d231acaa893
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Jun 27 03:49:53 2016 +0200

    Escape GAction strings.

 editor/dconf-model.vala      |    2 +-
 editor/dconf-window.vala     |    2 +-
 editor/key-list-box-row.vala |   22 +++++++++++-----------
 editor/registry-view.vala    |    4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 1036c6c..77906be 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -393,7 +393,7 @@ public class GSettingsKey : Key
     public string range_type             { get; construct; }
     public Variant range_content         { get; construct; }
 
-    public override string descriptor { owned get { return schema_id + " " + name; } }
+    public override string descriptor { owned get { return @"$schema_id $name"; } }
 
     private GLib.Settings settings;
 
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 86c6e50..5c8171b 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -161,7 +161,7 @@ class DConfWindow : ApplicationWindow
         pathbar.set_path (current_path);
 
         GLib.Menu menu = new GLib.Menu ();
-        menu.append (_("Copy current path"), "app.copy(\"" + current_path + "\")");   // TODO protection 
against some chars in text? 1/2
+        menu.append (_("Copy current path"), "app.copy(\"" + current_path.escape ("") + "\")");
 
         if (current_path.has_suffix ("/"))
         {
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 29524c7..5402217 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -331,7 +331,7 @@ private class ContextPopover : Popover
     public void new_action (string action_action, button_action action)
     {
         set_group ("options");
-        string group_dot_action = "options." + action_action;
+        string group_dot_action = @"options.$action_action";
 
         SimpleAction simple_action = new SimpleAction (action_action, null);
         simple_action.activate.connect (() => { action (); });
@@ -357,7 +357,7 @@ private class ContextPopover : Popover
     public void new_copy_action (string text)
     {
         /* Translators: "copy to clipboard" action in the right-click menu on the list of keys */
-        current_section.append (_("Copy"), "app.copy(\"" + text + "\")");   // TODO protection against some 
chars in text? 2/2
+        current_section.append (_("Copy"), "app.copy(\"" + text.escape ("") + "\")");
     }
 
     public void set_group (string group_name)
@@ -461,20 +461,20 @@ private class ContextPopover : Popover
 
             if (complete_menu)
                 /* Translators: "no change" option in the right-click menu on a key when on delayed mode */
-                current_section.append (_("No change"), group_dot_action + "(@mm" + type_string + " 
nothing)");
+                current_section.append (_("No change"), @"$group_dot_action(@mm$type_string nothing)");
 
             if (key.has_schema)
-                new_multi_default_action (group_dot_action + "(@mm" + type_string + " just nothing)");
+                new_multi_default_action (@"$group_dot_action(@mm$type_string just nothing)");
             else if (complete_menu)
                 /* Translators: "erase key" option in the right-click menu on a key without schema when on 
delayed mode */
-                current_section.append (_("Erase key"), group_dot_action + "(@mm" + type_string + " just 
nothing)");
+                current_section.append (_("Erase key"), @"$group_dot_action(@mm$type_string just nothing)");
         }
 
         switch (key.type_string)
         {
             case "b":
-                current_section.append (Key.cool_boolean_text_value (true), group_dot_action + "(@mmb 
true)");
-                current_section.append (Key.cool_boolean_text_value (false), group_dot_action + "(@mmb 
false)");
+                current_section.append (Key.cool_boolean_text_value (true), @"$group_dot_action(@mmb true)");
+                current_section.append (Key.cool_boolean_text_value (false), @"$group_dot_action(@mmb 
false)");
                 break;
             case "<enum>":      // defined by the schema
                 Variant range = ((GSettingsKey) key).range_content;
@@ -482,12 +482,12 @@ private class ContextPopover : Popover
                 if (size == 0)      // TODO special case also 1?
                     assert_not_reached ();
                 for (uint index = 0; index < size; index++)
-                    current_section.append (range.get_child_value (index).print (false), group_dot_action + 
"(@mms '" + range.get_child_value (index).get_string () + "')");        // TODO use int settings.get_enum ()
+                    current_section.append (range.get_child_value (index).print (false), 
@"$group_dot_action(@mms '" + range.get_child_value (index).get_string () + "')");        // TODO use int 
settings.get_enum ()
                 break;
             case "mb":
-                current_section.append (Key.cool_boolean_text_value (null), group_dot_action + "(@mmmb just 
just nothing)");
-                current_section.append (Key.cool_boolean_text_value (true), group_dot_action + "(@mmmb 
true)");
-                current_section.append (Key.cool_boolean_text_value (false), group_dot_action + "(@mmmb 
false)");
+                current_section.append (Key.cool_boolean_text_value (null), @"$group_dot_action(@mmmb just 
just nothing)");
+                current_section.append (Key.cool_boolean_text_value (true), @"$group_dot_action(@mmmb 
true)");
+                current_section.append (Key.cool_boolean_text_value (false), @"$group_dot_action(@mmmb 
false)");
                 break;
         }
 
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index c22b6fd..480f5e2 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -352,12 +352,12 @@ class RegistryView : Grid
     }
     private static Widget warning_label (string text)
     {
-        Label label = new Label ("<i>" + text + "</i>");
+        Label label = new Label (text);
         label.visible = true;
-        label.use_markup = true;
         label.max_width_chars = 59;
         label.wrap = true;
         label.halign = Align.START;
+        label.get_style_context ().add_class ("italic-label");
         return (Widget) label;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]