ConversationMessage: Convert to use InfoBarStack
Remove stock infobars from ConversationEmail and ConversationMessage builder files. Use common ComponentsInfobar for remote image loading infobar. Use Components.InfoBarStack in ConversationMessage for plugin support.
This commit is contained in:
parent
a7c06a3fc5
commit
28e6b669f6
5 changed files with 71 additions and 280 deletions
|
|
@ -252,12 +252,6 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
|
|||
[GtkChild]
|
||||
private Gtk.MenuButton email_menubutton;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.InfoBar draft_infobar;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.InfoBar not_saved_infobar;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.Grid sub_messages;
|
||||
|
||||
|
|
@ -307,19 +301,8 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
|
|||
this.contacts,
|
||||
this.config
|
||||
);
|
||||
connect_message_view_signals(this.primary_message);
|
||||
|
||||
this.primary_message.summary.add(this.actions);
|
||||
this.primary_message.infobars.add(this.draft_infobar);
|
||||
if (is_draft) {
|
||||
this.draft_infobar.show();
|
||||
this.draft_infobar.response.connect((infobar, response_id) => {
|
||||
if (response_id == 1) {
|
||||
activate_email_action(ConversationListBox.ACTION_EDIT);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.primary_message.infobars.add(this.not_saved_infobar);
|
||||
connect_message_view_signals(this.primary_message);
|
||||
|
||||
// Wire up the rest of the UI
|
||||
|
||||
|
|
@ -753,11 +736,6 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
|
|||
this.unstar_button.hide();
|
||||
}
|
||||
|
||||
if (this.email.email_flags != null &&
|
||||
this.email.email_flags.is_outbox_sent()) {
|
||||
this.not_saved_infobar.show();
|
||||
}
|
||||
|
||||
update_email_menu();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
|
|||
|
||||
/** Box that InfoBar widgets should be added to. */
|
||||
[GtkChild]
|
||||
internal Gtk.Grid infobars;
|
||||
internal Components.InfoBarStack info_bars;
|
||||
|
||||
/** HTML view that displays the message body. */
|
||||
internal ConversationWebView web_view { get; private set; }
|
||||
|
|
@ -369,8 +369,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
|
|||
[GtkChild]
|
||||
private Gtk.ProgressBar body_progress;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.InfoBar remote_images_infobar;
|
||||
private Gtk.InfoBar? remote_images_info_bar = null;
|
||||
|
||||
private Gtk.Widget? body_placeholder = null;
|
||||
|
||||
|
|
@ -564,9 +563,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
|
|||
this.web_view.mouse_target_changed.connect(on_mouse_target_changed);
|
||||
this.web_view.notify["is-loading"].connect(on_is_loading_notify);
|
||||
this.web_view.resource_load_started.connect(on_resource_load_started);
|
||||
this.web_view.remote_image_load_blocked.connect(() => {
|
||||
this.remote_images_infobar.show();
|
||||
});
|
||||
this.web_view.remote_image_load_blocked.connect(on_remote_images_blocked);
|
||||
this.web_view.selection_changed.connect(on_selection_changed);
|
||||
this.web_view.set_hexpand(true);
|
||||
this.web_view.set_vexpand(true);
|
||||
|
|
@ -1055,7 +1052,10 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
|
|||
|
||||
private void show_images(bool update_email_flag) {
|
||||
start_progress_loading();
|
||||
this.remote_images_infobar.hide();
|
||||
if (this.remote_images_info_bar != null) {
|
||||
this.info_bars.remove(this.remote_images_info_bar);
|
||||
this.remote_images_info_bar = null;
|
||||
}
|
||||
this.load_remote_resources = true;
|
||||
this.remote_resources_requested = 0;
|
||||
this.remote_resources_loaded = 0;
|
||||
|
|
@ -1298,7 +1298,29 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
|
|||
set_action_enabled(ACTION_COPY_SELECTION, has_selection);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
private void on_remote_images_blocked() {
|
||||
this.remote_images_info_bar = new Components.InfoBar(
|
||||
// Translators: Info bar status message
|
||||
_("Remote images not shown"),
|
||||
// Translators: Info bar description
|
||||
_("Only show remote images from senders you trust.")
|
||||
);
|
||||
var show = this.remote_images_info_bar.add_button(
|
||||
// Translators: Info bar button label
|
||||
_("Show"), 1
|
||||
);
|
||||
this.remote_images_info_bar.add_button(
|
||||
// Translators: Info bar button label
|
||||
_("Always show from sender"), 2
|
||||
);
|
||||
this.remote_images_info_bar.response.connect(on_remote_images_response);
|
||||
var buttons = this.remote_images_info_bar.get_action_area() as Gtk.ButtonBox;
|
||||
if (buttons != null) {
|
||||
buttons.set_child_non_homogeneous(show, true);
|
||||
}
|
||||
this.info_bars.add(this.remote_images_info_bar);
|
||||
}
|
||||
|
||||
private void on_remote_images_response(Gtk.InfoBar info_bar, int response_id) {
|
||||
switch (response_id) {
|
||||
case 1:
|
||||
|
|
@ -1315,7 +1337,8 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
this.remote_images_infobar.hide();
|
||||
this.info_bars.remove(this.remote_images_info_bar);
|
||||
this.remote_images_info_bar = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<template class="ConversationEmail" parent="GtkBox">
|
||||
|
|
@ -109,141 +109,6 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkInfoBar" id="draft_infobar">
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="message_type">warning</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="label" translatable="yes">Edit Draft</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Draft message</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">This message has not yet been sent.</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="1">button3</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkInfoBar" id="not_saved_infobar">
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="message_type">warning</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">16</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Message not saved</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">This message was sent, but has not been saved to your account.</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkGrid" id="sub_messages">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<template class="ConversationMessage" parent="GtkGrid">
|
||||
|
|
@ -478,114 +478,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="infobars">
|
||||
<property name="visible">True</property>
|
||||
<object class="ComponentsInfoBarStack" id="info_bars">
|
||||
<property name="visible">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkInfoBar" id="remote_images_infobar">
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="message_type">warning</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<signal name="response" handler="on_remote_images_response" swapped="no"/>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">Show Images</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label" translatable="yes">Always Show From Sender</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="non_homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remote images not shown</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Only show remote images from senders you trust.</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="1">button1</action-widget>
|
||||
<action-widget response="2">button2</action-widget>
|
||||
</action-widgets>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="shadow_type">none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
|
@ -602,6 +498,33 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<style>
|
||||
<class name="geary-message-body"/>
|
||||
</style>
|
||||
|
|
|
|||
10
ui/geary.css
10
ui/geary.css
|
|
@ -45,10 +45,8 @@
|
|||
border-right: 0;
|
||||
}
|
||||
|
||||
/* MainWindowInfoBarSet */
|
||||
|
||||
.geary-info-bar-frame > border {
|
||||
border-top-width: 0;
|
||||
.geary-info-bar-stack > border {
|
||||
border-width: 0;
|
||||
border-left-width: 0;
|
||||
border-right-width: 0;
|
||||
}
|
||||
|
|
@ -112,6 +110,10 @@ row.geary-folder-popover-list-row > label {
|
|||
|
||||
/* ConversationMessage */
|
||||
|
||||
.geary-message infobar box {
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
grid.geary-message-summary {
|
||||
border-top: 4px solid transparent;
|
||||
padding: 12px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue