Commit 07966a11 authored by Michael Gratton's avatar Michael Gratton 🤞

Fix crash when conversation scrolled window child changes.

This is a workaround for GTK+ Bug 778190.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer): Replace the whole conversation scrolled window
  when changing the conversation, not just the viewport.

* ui/conversation-viewer.ui: Remove the ScrolledWindow for now since we
  are constructing it manually.
parent ca3452b8
......@@ -42,7 +42,6 @@ public class ConversationViewer : Gtk.Stack {
[GtkChild]
private Gtk.Grid composer_page;
[GtkChild]
private Gtk.ScrolledWindow conversation_scroller;
[GtkChild]
......@@ -97,6 +96,9 @@ public class ConversationViewer : Gtk.Stack {
);
this.empty_search_page.add(empty_search);
// XXX GTK+ Bug 778190 workaround
new_conversation_scroller();
// XXX Do this in Glade when possible.
this.conversation_find_bar.connect_entry(this.conversation_find_entry);
}
......@@ -192,7 +194,7 @@ public class ConversationViewer : Gtk.Stack {
account.information,
location.special_folder_type == Geary.SpecialFolderType.DRAFTS,
((MainWindow) get_ancestor(typeof(MainWindow))).application.config,
conversation_scroller.get_vadjustment()
this.conversation_scroller.get_vadjustment()
);
// Need to fire this signal early so the the controller
......@@ -250,15 +252,9 @@ public class ConversationViewer : Gtk.Stack {
// Remove any existing conversation list, cancelling its loading
private void remove_current_list() {
// Remove the viewport that contains the current list
Gtk.Widget? scrolled_child = this.conversation_scroller.get_child();
if (scrolled_child != null) {
scrolled_child.destroy();
}
// Reset the scrollbars to their initial positions
this.conversation_scroller.hadjustment.set_value(0);
this.conversation_scroller.vadjustment.set_value(0);
// XXX GTK+ Bug 778190 workaround
this.conversation_scroller.destroy();
new_conversation_scroller();
// Notify that the current list was removed
if (this.current_list != null) {
......@@ -267,6 +263,22 @@ public class ConversationViewer : Gtk.Stack {
}
}
private void new_conversation_scroller() {
// XXX Work around for GTK+ Bug 778190: Instead of replacing
// the Viewport that contains the current list, replace the
// complete ScrolledWindow. Need to put remove this method and
// put the settings back into conversation-viewer.ui when we
// can rely on it being fixed again.
Gtk.ScrolledWindow scroller = new Gtk.ScrolledWindow(null, null);
scroller.get_style_context().add_class("geary-conversation-scroller");
scroller.hscrollbar_policy = Gtk.PolicyType.NEVER;
scroller.set_hexpand(true);
scroller.set_vexpand(true);
scroller.show();
this.conversation_scroller = scroller;
this.conversation_page.add(scroller);
}
/**
* Sets the currently visible page of the stack.
*/
......
......@@ -39,6 +39,7 @@
<object class="GtkGrid" id="conversation_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="conversation_find_bar">
<property name="visible">True</property>
......@@ -119,23 +120,7 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="conversation_scroller">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<child>
<placeholder/>
</child>
<style>
<class name=".geary-conversation-scroller"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
<placeholder/>
</child>
</object>
<packing>
......
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