[geary/mjog/mail-merge-plugin: 8/28] Plugins: Actually implement info bar plugin priority



commit 5fe0fbcc80c98afdd3077302a983e645b05bd605
Author: Michael Gratton <mike vee net>
Date:   Thu Apr 30 09:09:51 2020 +1000

    Plugins: Actually implement info bar plugin priority
    
    Now that InfoBarStack supports a priority queue, use that for folder
    and email stacks, and set the required priority property when
    constructing info bars for plugins, so that the highest priority
    info bar is always shown.

 src/client/application/application-email-plugin-context.vala  | 2 +-
 src/client/application/application-folder-plugin-context.vala | 2 +-
 src/client/application/application-main-window.vala           | 2 +-
 src/client/components/components-info-bar.vala                | 5 ++++-
 ui/conversation-message.ui                                    | 1 +
 5 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/application-email-plugin-context.vala 
b/src/client/application/application-email-plugin-context.vala
index 1f45a726a..5629e9967 100644
--- a/src/client/application/application-email-plugin-context.vala
+++ b/src/client/application/application-email-plugin-context.vala
@@ -42,7 +42,7 @@ internal class Application.EmailPluginContext :
                     main.conversation_viewer.current_list.add_email_info_bar(
                         id,
                         new Components.InfoBar.for_plugin(
-                            info_bar, this.action_group_name
+                            info_bar, this.action_group_name, (int) priority
                         )
                     );
                 }
diff --git a/src/client/application/application-folder-plugin-context.vala 
b/src/client/application/application-folder-plugin-context.vala
index c49946935..5eb739737 100644
--- a/src/client/application/application-folder-plugin-context.vala
+++ b/src/client/application/application-folder-plugin-context.vala
@@ -41,7 +41,7 @@ internal class Application.FolderPluginContext :
                 if (main.selected_folder == folder) {
                     main.conversation_list_info_bars.add(
                         new Components.InfoBar.for_plugin(
-                            info_bar, this.action_group_name
+                            info_bar, this.action_group_name, (int) priority
                         )
                     );
                 }
diff --git a/src/client/application/application-main-window.vala 
b/src/client/application/application-main-window.vala
index 6e38b87f6..86cd97aae 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -283,7 +283,7 @@ public class Application.MainWindow :
     public ConversationViewer conversation_viewer { get; private set; }
 
     public Components.InfoBarStack conversation_list_info_bars {
-        get; private set; default = new Components.InfoBarStack(SINGLE);
+        get; private set; default = new Components.InfoBarStack(PRIORITY_QUEUE);
     }
 
     public StatusBar status_bar { get; private set; default = new StatusBar(); }
diff --git a/src/client/components/components-info-bar.vala b/src/client/components/components-info-bar.vala
index f024b3655..10ac9a7f4 100644
--- a/src/client/components/components-info-bar.vala
+++ b/src/client/components/components-info-bar.vala
@@ -73,7 +73,8 @@ public class Components.InfoBar : Gtk.InfoBar {
     }
 
     public InfoBar.for_plugin(Plugin.InfoBar plugin,
-                              string action_group_name) {
+                              string action_group_name,
+                              int priority) {
         this(plugin.status, plugin.description);
         this.show_close_button = plugin.show_close_button;
 
@@ -87,6 +88,8 @@ public class Components.InfoBar : Gtk.InfoBar {
             add_plugin_button(plugin.primary_button, action_group_name);
         }
 
+        set_data<int>(InfoBarStack.PRIORITY_QUEUE_KEY, priority);
+
         show_all();
     }
 
diff --git a/ui/conversation-message.ui b/ui/conversation-message.ui
index 115ad839e..1e5208019 100644
--- a/ui/conversation-message.ui
+++ b/ui/conversation-message.ui
@@ -482,6 +482,7 @@
                 <property name="visible">False</property>
                 <property name="can_focus">False</property>
                 <property name="shadow_type">none</property>
+                <property name="algorithm">priority-queue</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>


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