[geary/mjog/email-plugins: 55/61] Application.FolderContext: Move info bar impl to common location
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/email-plugins: 55/61] Application.FolderContext: Move info bar impl to common location
- Date: Mon, 30 Mar 2020 10:08:13 +0000 (UTC)
commit 6b483a83ddc614cb82f6ae45cbcbc8a320bd3105
Author: Michael Gratton <mike vee net>
Date: Sun Mar 22 18:03:47 2020 +1100
Application.FolderContext: Move info bar impl to common location
Move the context's info bar implementatio to Components.InfoBar so it
can be re-used.
.../application/application-folder-context.vala | 41 +++-------------------
src/client/components/components-info-bar.vala | 22 ++++++++++++
2 files changed, 27 insertions(+), 36 deletions(-)
---
diff --git a/src/client/application/application-folder-context.vala
b/src/client/application/application-folder-context.vala
index ab23bc83..395046eb 100644
--- a/src/client/application/application-folder-context.vala
+++ b/src/client/application/application-folder-context.vala
@@ -12,39 +12,6 @@ internal class Application.FolderContext :
Geary.BaseObject, Plugin.FolderContext {
- private class PluginInfoBar : Components.InfoBar {
-
-
- private Plugin.InfoBar plugin;
-
-
- public PluginInfoBar(Plugin.InfoBar plugin,
- string action_group_name) {
- base(plugin.status, plugin.description);
- this.show_close_button = plugin.show_close_button;
- this.plugin = plugin;
-
- var plugin_primary = plugin.primary_button;
- if (plugin_primary != null) {
- var gtk_primary = new Gtk.Button.with_label(plugin_primary.label);
- gtk_primary.set_action_name(
- action_group_name + "." + plugin_primary.action.name
- );
- if (plugin_primary.action_target != null) {
- gtk_primary.set_action_target_value(
- plugin_primary.action_target
- );
- }
-
- get_action_area().add(gtk_primary);
- }
-
- show_all();
- }
-
- }
-
-
private unowned Client application;
private FolderStoreFactory folders_factory;
private Plugin.FolderStore folders;
@@ -66,14 +33,16 @@ internal class Application.FolderContext :
}
public void add_folder_info_bar(Plugin.Folder selected,
- Plugin.InfoBar infobar,
+ Plugin.InfoBar info_bar,
uint priority) {
Geary.Folder? folder = this.folders_factory.get_engine_folder(selected);
if (folder != null) {
foreach (MainWindow main in this.application.get_main_windows()) {
if (main.selected_folder == folder) {
main.conversation_list_info_bars.add(
- new PluginInfoBar(infobar, this.action_group_name)
+ new Components.InfoBar.for_plugin(
+ info_bar, this.action_group_name
+ )
);
}
}
@@ -81,7 +50,7 @@ internal class Application.FolderContext :
}
public void remove_folder_info_bar(Plugin.Folder selected,
- Plugin.InfoBar infobar) {
+ Plugin.InfoBar info_bar) {
Geary.Folder? folder = this.folders_factory.get_engine_folder(selected);
if (folder != null) {
foreach (MainWindow main in this.application.get_main_windows()) {
diff --git a/src/client/components/components-info-bar.vala b/src/client/components/components-info-bar.vala
index 0944cff8..6e3506c0 100644
--- a/src/client/components/components-info-bar.vala
+++ b/src/client/components/components-info-bar.vala
@@ -72,4 +72,26 @@ public class Components.InfoBar : Gtk.InfoBar {
show_all();
}
+ public InfoBar.for_plugin(Plugin.InfoBar plugin,
+ string action_group_name) {
+ this(plugin.status, plugin.description);
+ this.show_close_button = plugin.show_close_button;
+
+ var plugin_primary = plugin.primary_button;
+ if (plugin_primary != null) {
+ var gtk_primary = new Gtk.Button.with_label(plugin_primary.label);
+ gtk_primary.set_action_name(
+ action_group_name + "." + plugin_primary.action.name
+ );
+ if (plugin_primary.action_target != null) {
+ gtk_primary.set_action_target_value(
+ plugin_primary.action_target
+ );
+ }
+ get_action_area().add(gtk_primary);
+ }
+
+ show_all();
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]