[gnome-boxes/wip/snapshot-config-changes: 9/12] properties-toolbar, config-editor: Rename "Save" to "Apply"




commit 635665e393039716c96c7ee081451d22bdc4c78a
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Oct 12 12:09:48 2020 +0200

    properties-toolbar, config-editor: Rename "Save" to "Apply"
    
    "Apply" makes more semantic sense in the context of modifying a VM's
    configuration.

 data/ui/properties-toolbar.ui |  6 +++---
 src/config-editor.vala        | 22 +++++++++++-----------
 src/properties-toolbar.vala   |  8 ++++----
 src/properties-window.vala    |  2 +-
 4 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/data/ui/properties-toolbar.ui b/data/ui/properties-toolbar.ui
index 4f44b770..db48dca5 100644
--- a/data/ui/properties-toolbar.ui
+++ b/data/ui/properties-toolbar.ui
@@ -136,13 +136,13 @@
         </child>
 
         <child>
-          <object class="GtkButton" id="save_button">
+          <object class="GtkButton" id="apply_config_button">
             <property name="visible">True</property>
             <property name="sensitive">False</property>
             <property name="valign">center</property>
             <property name="use-underline">True</property>
-            <property name="label" translatable="yes">_Save</property>
-            <signal name="clicked" handler="on_config_editor_save_clicked"/>
+            <property name="label" translatable="yes">_Apply</property>
+            <signal name="clicked" handler="on_config_editor_apply_config_clicked"/>
             <style>
               <class name="text-button"/>
             </style>
diff --git a/src/config-editor.vala b/src/config-editor.vala
index f072a7ad..c981f0fc 100644
--- a/src/config-editor.vala
+++ b/src/config-editor.vala
@@ -6,16 +6,16 @@
     private const string BOXES_NS_URI = "https://wiki.gnome.org/Apps/Boxes/edited";;
     private const string MANUALLY_EDITED_XML = "<edited>%u</edited>";
 
-    private Gtk.Button save_button;
+    private Gtk.Button apply_config_button;
     [GtkChild]
     private Gtk.SourceView view;
 
     private LibvirtMachine machine;
     private string domain_xml;
 
-    public void setup (LibvirtMachine machine, Gtk.Button save_button) {
+    public void setup (LibvirtMachine machine, Gtk.Button apply_config_button) {
         this.machine = machine;
-        this.save_button = save_button;
+        this.apply_config_button = apply_config_button;
 
         var buffer = new Gtk.SourceBuffer (null);
         buffer.language = Gtk.SourceLanguageManager.get_default ().get_language ("xml");
@@ -50,11 +50,11 @@ private void add_metadata (GVirConfig.Domain config, long snapshot_timestamp) {
         try {
             config.set_custom_xml (edited_xml, "edited", BOXES_NS_URI);
         } catch (GLib.Error error) {
-            warning ("Failed to save custom XML: %s", error.message);
+            warning ("Failed to apply custom XML: %s", error.message);
         }
     }
 
-    public async void save () {
+    public async void apply () {
         var xml = view.buffer.text;
         if (machine.domain_config.to_xml () == xml) {
             debug ("Nothing changed in the VM configuration");
@@ -64,7 +64,7 @@ public async void save () {
 
         var snapshot_timestamp = yield create_snapshot ();
         if (snapshot_timestamp == 0) {
-            warning ("Failed to save changes!");
+            warning ("Failed to apply changes!");
 
             return;
         }
@@ -73,7 +73,7 @@ public async void save () {
         try {
             custom_config = new GVirConfig.Domain.from_xml (xml);
         } catch (GLib.Error error) {
-            warning ("Failed to save changes!\n");
+            warning ("Failed to apply changes!\n");
         }
 
         add_metadata (custom_config, snapshot_timestamp);
@@ -82,8 +82,8 @@ public async void save () {
             machine.domain.set_config (custom_config);
             domain_xml = custom_config.to_xml ();
         } catch (GLib.Error error) {
-            warning ("Failed to save custom VM configuration: %s", error.message);
-            var msg = _("Boxes failed to save VM configuration changes: %s");
+            warning ("Failed to apply custom VM configuration: %s", error.message);
+            var msg = _("Boxes failed to apply VM configuration changes: %s");
             App.app.main_window.notificationbar.display_error (msg);
 
             return;
@@ -96,11 +96,11 @@ public async void save () {
             });
         }
 
-        setup (machine, save_button);
+        setup (machine, apply_config_button);
     }
 
     private void on_config_changed () {
         var config_changed = (view.buffer.text != domain_xml);
-        save_button.sensitive = config_changed;
+        apply_config_button.sensitive = config_changed;
     }
 }
diff --git a/src/properties-toolbar.vala b/src/properties-toolbar.vala
index 06bd639a..87574075 100644
--- a/src/properties-toolbar.vala
+++ b/src/properties-toolbar.vala
@@ -19,7 +19,7 @@
     [GtkChild]
     public Gtk.HeaderBar config_editor;
     [GtkChild]
-    public Gtk.Button save_button;
+    public Gtk.Button apply_config_button;
 
     [GtkChild]
     public Gtk.Button troubleshooting_back_button;
@@ -63,9 +63,9 @@ private void on_copy_clipboard_clicked () requires (page == PropsWindowPage.TROU
     }
 
     [GtkCallback]
-    private void on_config_editor_save_clicked () {
-        props_window.config_editor.save ();
-        save_button.sensitive = false;
+    private void on_config_editor_apply_config_clicked () {
+        props_window.config_editor.apply ();
+        apply_config_button.sensitive = false;
     }
 
     [GtkCallback]
diff --git a/src/properties-window.vala b/src/properties-window.vala
index fd435c7b..1a16b148 100644
--- a/src/properties-window.vala
+++ b/src/properties-window.vala
@@ -70,7 +70,7 @@ public void show_troubleshoot_log (string log) {
 
     public void show_editor_view (LibvirtMachine machine) {
         page = PropsWindowPage.TEXT_EDITOR;
-        config_editor.setup (machine, topbar.save_button);
+        config_editor.setup (machine, topbar.apply_config_button);
 
         topbar.config_editor.set_title (machine.name);
     }


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