[msitools: 1/2] wixl: Add support for ProgressText element




commit 9e64ef5dbf15e3ceafed7f7bc8c02db31abbfe97
Author: Hendrik Eckardt <hendrik eckardt gdata-adan de>
Date:   Mon Jan 31 12:28:48 2022 +0100

    wixl: Add support for ProgressText element

 tools/wixl/builder.vala |  7 +++++++
 tools/wixl/msi.vala     | 22 ++++++++++++++++++++++
 tools/wixl/wix.vala     | 15 +++++++++++++++
 3 files changed, 44 insertions(+)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 26e172d..c037f2b 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -1751,6 +1751,13 @@ namespace Wixl {
             db.table_event_mapping.add (dialog, control,
                     subscribe.Event, subscribe.Attribute);
         }
+
+        public override void visit_progress_text (WixProgressText progress_text) throws GLib.Error {
+            return_if_fail (progress_text.children.length () == 1);
+            var text = progress_text.children.first ().data as WixText;
+
+            db.table_action_text.add (progress_text.Action, text.Text.strip(), progress_text.Template);
+        }
     }
 
 } // Wixl
diff --git a/tools/wixl/msi.vala b/tools/wixl/msi.vala
index 0da92ee..4ff0560 100644
--- a/tools/wixl/msi.vala
+++ b/tools/wixl/msi.vala
@@ -1003,6 +1003,25 @@ namespace Wixl {
         }
     }
 
+    /* https://docs.microsoft.com/en-us/windows/win32/msi/actiontext-table */
+    class MsiTableActionText : MsiTable {
+        static construct {
+            name = "ActionText";
+            sql_create = "CREATE TABLE `ActionText` (`Action` CHAR(72) NOT NULL, `Description` CHAR(255) 
LOCALIZABLE, `Template` CHAR(255) LOCALIZABLE PRIMARY KEY `Action`)";
+            sql_insert = "INSERT INTO `ActionText` (`Action`, `Description`, `Template`) VALUES (?, ?, ?)";
+        }
+
+        public void add (string Action, string? Description, string? Template) throws GLib.Error {
+            var rec = new Libmsi.Record (3);
+            if (!rec.set_string (1, Action) ||
+                (Description != null && !rec.set_string (2, Description)) ||
+                (Template != null && !rec.set_string (3, Template)))
+                throw new Wixl.Error.FAILED ("failed to add record");
+
+            records.append (rec);
+        }
+    }
+
 
     class MsiSummaryInfo: Object {
         public Libmsi.SummaryInfo properties;
@@ -1101,6 +1120,7 @@ namespace Wixl {
         public MsiTableLaunchCondition table_launch_condition;
         public MsiTableAppSearch table_app_search;
         public MsiTableCustomAction table_custom_action;
+        public MsiTableActionText table_action_text;
         public MsiTableRegLocator table_reg_locator;
         public MsiTableCreateFolder table_create_folder;
         public MsiTableSignature table_signature;
@@ -1183,6 +1203,7 @@ namespace Wixl {
             table_app_search = new MsiTableAppSearch ();
             table_signature = new MsiTableSignature ();
             table_custom_action = new MsiTableCustomAction ();
+            table_action_text = new MsiTableActionText ();
             table_reg_locator = new MsiTableRegLocator ();
             table_create_folder = new MsiTableCreateFolder ();
             table_file_hash = new MsiTableFileHash ();
@@ -1215,6 +1236,7 @@ namespace Wixl {
                     table_app_search,
                     table_signature,
                     table_custom_action,
+                    table_action_text,
                     table_reg_locator,
                     table_create_folder,
                     table_file_hash,
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala
index ab66821..f015f3f 100644
--- a/tools/wixl/wix.vala
+++ b/tools/wixl/wix.vala
@@ -77,6 +77,7 @@ namespace Wixl {
         public abstract void visit_publish (WixPublish publish) throws GLib.Error;
         public abstract void visit_radio_button (WixRadioButton radio) throws GLib.Error;
         public abstract void visit_subscribe (WixSubscribe subscribe) throws GLib.Error;
+        public abstract void visit_progress_text (WixProgressText progress_text) throws GLib.Error;
     }
 
     public abstract class WixNode: Object {
@@ -1217,6 +1218,7 @@ namespace Wixl {
                 typeof (WixUIText),
                 typeof (WixAdminUISequence),
                 typeof (WixInstallUISequence),
+                typeof (WixProgressText),
             });
         }
     }
@@ -1458,6 +1460,19 @@ namespace Wixl {
         }
     }
 
+    public class WixProgressText: WixElement {
+        static construct {
+            name = "ProgressText";
+        }
+
+        public string Action { get; set; }
+        public string Template { get; set; }
+
+        public override void accept (WixNodeVisitor visitor) throws GLib.Error {
+            visitor.visit_progress_text (this);
+        }
+    }
+
     class WixRoot: WixElement {
         static construct {
             name = "Wix";


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