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.
This commit is contained in:
Michael Gratton 2020-04-30 09:09:51 +10:00 committed by Michael James Gratton
parent 85adc6b114
commit ce905740dc
5 changed files with 8 additions and 4 deletions

View file

@ -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
)
);
}

View file

@ -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
)
);
}

View file

@ -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(); }

View file

@ -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();
}

View file

@ -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>