[gnome-boxes/some-assistant-refactoring: 4/5] assistant: Split InstallationSummary into its own files




commit 67668c3a8f14530dcc8f64b958b705878761d5b6
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Apr 13 15:32:06 2021 +0200

    assistant: Split InstallationSummary into its own files

 data/gnome-boxes.gresource.xml                     |  2 +-
 .../installation-summary.ui}                       |  2 +-
 data/ui/assistant/pages/review-page.ui             |  2 +-
 src/assistant/installation-summary.vala            | 37 +++++++++++++++++++
 src/assistant/review-page.vala                     | 41 +---------------------
 src/meson.build                                    |  1 +
 6 files changed, 42 insertions(+), 43 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 8a7d7d1e..ac4ebe0f 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -42,8 +42,8 @@
     <file preprocess="xml-stripblanks">ui/troubleshoot-log.ui</file>
     <file preprocess="xml-stripblanks">ui/troubleshoot-view.ui</file>
     <file preprocess="xml-stripblanks">ui/unattended-setup-box.ui</file>
-    <file preprocess="xml-stripblanks">ui/wizard-summary.ui</file>
     <!-- VM Creation Assistant -->
+    <file preprocess="xml-stripblanks">ui/assistant/installation-summary.ui</file>
     <file preprocess="xml-stripblanks">ui/assistant/downloadable-entry.ui</file>
     <file preprocess="xml-stripblanks">ui/assistant/media-entry.ui</file>
     <file preprocess="xml-stripblanks">ui/assistant/vm-assistant.ui</file>
diff --git a/data/ui/wizard-summary.ui b/data/ui/assistant/installation-summary.ui
similarity index 83%
rename from data/ui/wizard-summary.ui
rename to data/ui/assistant/installation-summary.ui
index 78c94d2e..3510473c 100644
--- a/data/ui/wizard-summary.ui
+++ b/data/ui/assistant/installation-summary.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.9 -->
-  <template class="BoxesWizardSummary" parent="GtkGrid">
+  <template class="BoxesInstallationSummary" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="row-spacing">10</property>
     <property name="column-spacing">20</property>
diff --git a/data/ui/assistant/pages/review-page.ui b/data/ui/assistant/pages/review-page.ui
index a668ceed..9e71a475 100644
--- a/data/ui/assistant/pages/review-page.ui
+++ b/data/ui/assistant/pages/review-page.ui
@@ -87,7 +87,7 @@ Check your BIOS settings to enable them.</property>
       <object class="GtkStack" id="customization_stack">
         <property name="visible">True</property>
         <child>
-          <object class="BoxesWizardSummary" id="summary"/>
+          <object class="BoxesInstallationSummary" id="summary"/>
         </child>
         <child>
           <object class="GtkGrid" id="customization_grid">
diff --git a/src/assistant/installation-summary.vala b/src/assistant/installation-summary.vala
new file mode 100644
index 00000000..d1a57fbe
--- /dev/null
+++ b/src/assistant/installation-summary.vala
@@ -0,0 +1,37 @@
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/assistant/installation-summary.ui")]
+private class Boxes.InstallationSummary: Gtk.Grid {
+    public delegate void CustomizeFunc ();
+
+    private int current_row;
+
+    construct {
+        current_row = 0;
+    }
+
+    public void add_property (string name, string? value) {
+        if (value == null)
+            return;
+
+        var label_name = new Gtk.Label (name);
+        label_name.get_style_context ().add_class ("dim-label");
+        label_name.halign = Gtk.Align.END;
+        attach (label_name, 0, current_row, 1, 1);
+
+        var label_value = new Gtk.Label (value);
+        label_value.set_ellipsize (Pango.EllipsizeMode.END);
+        label_value.set_max_width_chars (32);
+        label_value.halign = Gtk.Align.START;
+        attach (label_value, 1, current_row, 1, 1);
+
+        current_row += 1;
+        show_all ();
+    }
+
+    public void clear () {
+        foreach (var child in get_children ()) {
+            remove (child);
+        }
+
+        current_row = 0;
+    }
+}
diff --git a/src/assistant/review-page.vala b/src/assistant/review-page.vala
index 5dd5a116..b65e633b 100644
--- a/src/assistant/review-page.vala
+++ b/src/assistant/review-page.vala
@@ -3,7 +3,7 @@
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/assistant/pages/review-page.ui")]
 private class Boxes.AssistantReviewPage : AssistantPage {
     [GtkChild]
-    private unowned WizardSummary summary;
+    private unowned InstallationSummary summary;
     [GtkChild]
     private unowned InfoBar nokvm_infobar;
     [GtkChild]
@@ -135,42 +135,3 @@ public override async void next () {
         cancellable.reset ();
     }
 }
-
-
-[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-summary.ui")]
-private class Boxes.WizardSummary: Gtk.Grid {
-    public delegate void CustomizeFunc ();
-
-    private int current_row;
-
-    construct {
-        current_row = 0;
-    }
-
-    public void add_property (string name, string? value) {
-        if (value == null)
-            return;
-
-        var label_name = new Gtk.Label (name);
-        label_name.get_style_context ().add_class ("dim-label");
-        label_name.halign = Gtk.Align.END;
-        attach (label_name, 0, current_row, 1, 1);
-
-        var label_value = new Gtk.Label (value);
-        label_value.set_ellipsize (Pango.EllipsizeMode.END);
-        label_value.set_max_width_chars (32);
-        label_value.halign = Gtk.Align.START;
-        attach (label_value, 1, current_row, 1, 1);
-
-        current_row += 1;
-        show_all ();
-    }
-
-    public void clear () {
-        foreach (var child in get_children ()) {
-            remove (child);
-        }
-
-        current_row = 0;
-    }
-}
diff --git a/src/meson.build b/src/meson.build
index 449c5ae8..afe1e858 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -114,6 +114,7 @@ vala_sources = [
   'troubleshoot-log.vala',
   'snapshot-list-row.vala',
   'snapshots-property.vala',
+  'assistant/installation-summary.vala',
   'assistant/downloadable-entry.vala',
   'assistant/media-entry.vala',
   'assistant/rhel-download-dialog.vala',


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