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



commit b87ac383bd2652658e3d66421c6bd5ed63cf1c26
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 1f45a726..5629e996 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 c4994693..5eb73973 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 3e2972f7..b8c7dfb7 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 f024b365..10ac9a7f 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 115ad839..1e520801 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]