Commit b03c0add authored by Michael Gratton's avatar Michael Gratton 🤞

Convert new convo widgets to use Gtk.Grid instead of Box.

parent 599da42d
......@@ -18,6 +18,9 @@
[GtkTemplate (ui = "/org/gnome/Geary/conversation-email.ui")]
public class ConversationEmail : Gtk.Box {
// This isn't a Gtk.Grid since when added to a Gtk.ListBoxRow the
// hover style isn't applied to it.
/**
* Iterator that returns all message views in an email view.
*/
......@@ -176,7 +179,7 @@ public class ConversationEmail : Gtk.Box {
private SimpleActionGroup message_actions = new SimpleActionGroup();
[GtkChild]
private Gtk.Box action_box;
private Gtk.Grid actions;
[GtkChild]
private Gtk.Button attachments_button;
......@@ -197,10 +200,10 @@ public class ConversationEmail : Gtk.Box {
private Gtk.InfoBar not_saved_infobar;
[GtkChild]
private Gtk.Box sub_messages_box;
private Gtk.Grid sub_messages;
[GtkChild]
private Gtk.Box attachments_box;
private Gtk.Grid attachments;
[GtkChild]
private Gtk.IconView attachments_view;
......@@ -321,10 +324,8 @@ public class ConversationEmail : Gtk.Box {
);
connect_message_view_signals(this.primary_message);
this.primary_message.summary_box.pack_start(
this.action_box, false, false, 0
);
this.primary_message.summary.add(this.actions);
Gtk.Builder builder = new Gtk.Builder.from_resource(
"/org/gnome/Geary/conversation-email-menus.ui"
);
......@@ -338,9 +339,7 @@ public class ConversationEmail : Gtk.Box {
);
this.attachments_menu.attach_to_widget(this, null);
this.primary_message.infobar_box.pack_start(
this.draft_infobar, false, false, 0
);
this.primary_message.infobars.add(this.draft_infobar);
if (is_draft) {
this.draft_infobar.show();
this.draft_infobar.response.connect((infobar, response_id) => {
......@@ -348,31 +347,29 @@ public class ConversationEmail : Gtk.Box {
});
}
this.primary_message.infobar_box.pack_start(
this.not_saved_infobar, false, false, 0
);
this.primary_message.infobars.add(this.not_saved_infobar);
// if (email.from != null && email.from.contains_normalized(current_account_information.email)) {
// // XXX set a RO property?
// get_style_context().add_class("geary_sent");
// }
pack_start(primary_message, true, true, 0);
pack_start(this.primary_message, true, true, 0);
update_email_state();
// Add sub_messages container and message viewers if any
Gee.List<Geary.RFC822.Message> sub_messages = message.get_sub_messages();
if (sub_messages.size > 0) {
this.primary_message.body_box.pack_start(
this.sub_messages_box, false, false, 0
this.primary_message.body.pack_start(
this.sub_messages, false, false, 0
);
}
foreach (Geary.RFC822.Message sub_message in sub_messages) {
ConversationMessage attached_message =
new ConversationMessage(sub_message, contact_store, false);
connect_message_view_signals(attached_message);
this.sub_messages_box.pack_start(attached_message, false, false, 0);
this.sub_messages.add(attached_message);
this._attached_messages.add(attached_message);
}
}
......@@ -653,9 +650,9 @@ public class ConversationEmail : Gtk.Box {
// Show attachment widgets. Would like to do this in the
// ctor but we don't know at that point if any attachments
// will be displayed inline.
attachments_button.show();
attachments_button.set_sensitive(!this.is_collapsed);
primary_message.body_box.pack_start(attachments_box, false, false, 0);
this.attachments_button.show();
this.attachments_button.set_sensitive(!this.is_collapsed);
this.primary_message.body.add(this.attachments);
// Add each displayed attachment to the icon view
foreach (AttachmentInfo attachment_info in displayed_attachments) {
......
......@@ -514,7 +514,7 @@ public class ConversationListBox : Gtk.ListBox {
});
ConversationMessage conversation_message = view.primary_message;
conversation_message.body_box.button_release_event.connect_after((event) => {
conversation_message.body.button_release_event.connect_after((event) => {
// Consume all non-consumed clicks so the row is not
// inadvertently activated after clicking on the
// email body.
......
......@@ -15,7 +15,7 @@
* embeds at least one instance of this class.
*/
[GtkTemplate (ui = "/org/gnome/Geary/conversation-message.ui")]
public class ConversationMessage : Gtk.Box {
public class ConversationMessage : Gtk.Grid {
// Widget used to display sender/recipient email addresses in
// message header Gtk.FlowBox instances.
......@@ -99,11 +99,11 @@ public class ConversationMessage : Gtk.Box {
/** Box containing the preview and full header widgets. */
[GtkChild]
internal Gtk.Box summary_box;
internal Gtk.Grid summary;
/** Box that InfoBar widgets should be added to. */
[GtkChild]
internal Gtk.Box infobar_box;
internal Gtk.Grid infobars;
/** HTML view that displays the message body. */
internal ConversationWebView web_view { get; private set; }
......@@ -129,16 +129,16 @@ public class ConversationMessage : Gtk.Box {
[GtkChild]
private Gtk.Label date;
[GtkChild]
private Gtk.Box to_header;
private Gtk.Grid to_header;
[GtkChild]
private Gtk.Box cc_header;
private Gtk.Grid cc_header;
[GtkChild]
private Gtk.Box bcc_header;
private Gtk.Grid bcc_header;
[GtkChild]
private Gtk.Revealer body_revealer;
[GtkChild]
public Gtk.Box body_box;
public Gtk.Box body; // WebKit.WebView crashes when added to a Grid
[GtkChild]
private Gtk.Popover link_popover;
......@@ -306,8 +306,9 @@ public class ConversationMessage : Gtk.Box {
this.web_view.selection_changed.connect(on_selection_changed);
this.web_view.show();
this.body_box.set_has_tooltip(true); // Used to show link URLs
this.body_box.pack_start(this.web_view, true, true, 0);
this.body.set_has_tooltip(true); // Used to show link URLs
this.body.pack_start(this.web_view, true, true, 0);
}
}
/**
......@@ -564,10 +565,10 @@ public class ConversationMessage : Gtk.Box {
return menu;
}
private void set_header_addresses(Gtk.Box header,
private void set_header_addresses(Gtk.Grid header,
Geary.RFC822.MailboxAddresses? addresses) {
if (addresses != null && addresses.size > 0) {
Gtk.FlowBox box = header.get_children().nth(1).data as Gtk.FlowBox;
Gtk.FlowBox box = header.get_children().nth(0).data as Gtk.FlowBox;
if (box != null) {
set_flowbox_addresses(box, addresses);
}
......@@ -1239,8 +1240,8 @@ public class ConversationMessage : Gtk.Box {
// Use tooltip on the containing box since the web_view
// doesn't want to pay ball.
this.body_box.set_tooltip_text(this.hover_url);
this.body_box.trigger_tooltip_query();
this.body.set_tooltip_text(this.hover_url);
this.body.trigger_tooltip_query();
}
private void on_selection_changed() {
......
......@@ -51,17 +51,17 @@ public class ConversationViewer : Gtk.Stack {
[GtkChild]
private Gtk.Spinner loading_page;
[GtkChild]
private Gtk.Box no_conversations_page;
private Gtk.Grid no_conversations_page;
[GtkChild]
internal Gtk.ScrolledWindow conversation_page;
[GtkChild]
private Gtk.Box multiple_conversations_page;
private Gtk.Grid multiple_conversations_page;
[GtkChild]
private Gtk.Box empty_folder_page;
private Gtk.Grid empty_folder_page;
[GtkChild]
private Gtk.Box empty_search_page;
private Gtk.Grid empty_search_page;
[GtkChild]
private Gtk.Box composer_page;
private Gtk.Grid composer_page;
private ConversationFindBar conversation_find_bar;
......@@ -87,36 +87,28 @@ public class ConversationViewer : Gtk.Stack {
no_conversations.subtitle = _(
"Selecting a conversation from the list will display it here"
);
this.no_conversations_page.pack_start(
no_conversations, true, true, 0
);
this.no_conversations_page.add(no_conversations);
EmptyPlaceholder multi_conversations = new EmptyPlaceholder();
multi_conversations.title = _("Multiple conversations selected");
multi_conversations.subtitle = _(
"Choosing an action will apply to all selected conversations"
);
this.multiple_conversations_page.pack_start(
multi_conversations, true, true, 0
);
this.multiple_conversations_page.add(multi_conversations);
EmptyPlaceholder empty_folder = new EmptyPlaceholder();
empty_folder.title = _("No conversations found");
empty_folder.subtitle = _(
"This folder does not contain any conversations"
);
this.empty_folder_page.pack_start(
empty_folder, true, true, 0
);
this.empty_folder_page.add(empty_folder);
EmptyPlaceholder empty_search = new EmptyPlaceholder();
empty_search.title = _("No conversations found");
empty_search.subtitle = _(
"Your search returned no results, try refining your search terms"
);
this.empty_search_page.pack_start(
empty_search, true, true, 0
);
this.empty_search_page.add(empty_search);
// Setup state machine for search/find states.
Geary.State.Mapping[] mappings = {
......@@ -165,7 +157,7 @@ public class ConversationViewer : Gtk.Stack {
conversation_list_view.select_conversations(prev_selection);
}
});
composer_page.pack_start(box);
this.composer_page.add(box);
set_visible_child(composer_page);
}
......
......@@ -5,23 +5,20 @@
<template class="ConversationEmail" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="geary_email"/>
</style>
</template>
<object class="GtkBox" id="action_box">
<object class="GtkGrid" id="actions">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="attachments_button">
<property name="sensitive">False</property>
......@@ -40,9 +37,8 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -64,9 +60,8 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -87,9 +82,8 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -110,9 +104,8 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
......@@ -126,19 +119,20 @@
<column type="GObject"/>
</columns>
</object>
<object class="GtkBox" id="attachments_box">
<object class="GtkGrid" id="attachments">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -146,6 +140,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">6</property>
<property name="hexpand">True</property>
<property name="selection_mode">multiple</property>
<property name="item_orientation">horizontal</property>
<property name="model">attachments_model</property>
......@@ -172,9 +167,8 @@
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
......@@ -327,13 +321,38 @@
<action-widget response="1">button1</action-widget>
</action-widgets>
</object>
<object class="GtkBox" id="sub_messages_box">
<object class="GtkGrid" id="sub_messages">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</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-submessages"/>
</style>
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="no_conversations_page">
<object class="GtkGrid" id="no_conversations_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
......@@ -47,7 +47,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="multiple_conversations_page">
<object class="GtkGrid" id="multiple_conversations_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
......@@ -61,7 +61,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="empty_folder_page">
<object class="GtkGrid" id="empty_folder_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
......@@ -75,7 +75,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="empty_search_page">
<object class="GtkGrid" id="empty_search_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
......@@ -89,7 +89,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="composer_page">
<object class="GtkGrid" id="composer_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
......
......@@ -7,6 +7,8 @@
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkImage" id="placeholder_image">
<property name="visible">True</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment