[geary/mjog/mail-merge-plugin: 3/9] Plugin.InfoBar: Enable plugins to dynamically update info bar labels
- From: Michael Gratton <mjog src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [geary/mjog/mail-merge-plugin: 3/9] Plugin.InfoBar: Enable plugins to dynamically update info bar labels
 
- Date: Sat, 15 Aug 2020 01:04:20 +0000 (UTC)
 
commit 8dd148440567b9560c92244ee9e1ca21a19a283e
Author: Michael Gratton <mike vee net>
Date:   Fri Aug 14 15:09:11 2020 +1000
    Plugin.InfoBar: Enable plugins to dynamically update info bar labels
    
    Make status and description properties publicly settable, keep tabs
    on changes in `Component.InfoBar` and update GTK labels as needed.
 src/client/components/components-info-bar.vala | 7 +++++++
 src/client/plugin/plugin-info-bar.vala         | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/client/components/components-info-bar.vala b/src/client/components/components-info-bar.vala
index e3bc6516b..a6e1d4b6b 100644
--- a/src/client/components/components-info-bar.vala
+++ b/src/client/components/components-info-bar.vala
@@ -82,6 +82,13 @@ public class Components.InfoBar : Gtk.InfoBar {
         this.plugin = plugin;
         this.show_close_button = plugin.show_close_button;
 
+        plugin.notify["status"].connect(
+            () => { this.status.label = plugin.status; }
+        );
+        plugin.notify["description"].connect(
+            () => { this.description.label = plugin.description; }
+        );
+
         var secondaries = plugin.secondary_buttons.bidir_list_iterator();
         bool has_prev = secondaries.last();
         while (has_prev) {
diff --git a/src/client/plugin/plugin-info-bar.vala b/src/client/plugin/plugin-info-bar.vala
index 00696ace7..a0ccfcf09 100644
--- a/src/client/plugin/plugin-info-bar.vala
+++ b/src/client/plugin/plugin-info-bar.vala
@@ -23,7 +23,7 @@ public class Plugin.InfoBar : Geary.BaseObject {
      *
      * This should ideally be less than 20 characters long.
      */
-    public string status { get; private set; }
+    public string status { get; set; }
 
     /**
      * An optional, longer human-readable explanation of the status.
@@ -31,7 +31,7 @@ public class Plugin.InfoBar : Geary.BaseObject {
      * This provides additional information and context for {@link
      * status}.
      */
-    public string? description { get; private set; }
+    public string? description { get; set; }
 
     /** Determines if a close button is displayed by the info bar. */
     public bool show_close_button { get; set; default = false; }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]