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.
This commit is contained in:
parent
ca3452b840
commit
07966a1156
2 changed files with 25 additions and 28 deletions
|
|
@ -42,7 +42,6 @@ public class ConversationViewer : Gtk.Stack {
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
private Gtk.Grid composer_page;
|
private Gtk.Grid composer_page;
|
||||||
|
|
||||||
[GtkChild]
|
|
||||||
private Gtk.ScrolledWindow conversation_scroller;
|
private Gtk.ScrolledWindow conversation_scroller;
|
||||||
|
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
|
|
@ -97,6 +96,9 @@ public class ConversationViewer : Gtk.Stack {
|
||||||
);
|
);
|
||||||
this.empty_search_page.add(empty_search);
|
this.empty_search_page.add(empty_search);
|
||||||
|
|
||||||
|
// XXX GTK+ Bug 778190 workaround
|
||||||
|
new_conversation_scroller();
|
||||||
|
|
||||||
// XXX Do this in Glade when possible.
|
// XXX Do this in Glade when possible.
|
||||||
this.conversation_find_bar.connect_entry(this.conversation_find_entry);
|
this.conversation_find_bar.connect_entry(this.conversation_find_entry);
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +194,7 @@ public class ConversationViewer : Gtk.Stack {
|
||||||
account.information,
|
account.information,
|
||||||
location.special_folder_type == Geary.SpecialFolderType.DRAFTS,
|
location.special_folder_type == Geary.SpecialFolderType.DRAFTS,
|
||||||
((MainWindow) get_ancestor(typeof(MainWindow))).application.config,
|
((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
|
// 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
|
// Remove any existing conversation list, cancelling its loading
|
||||||
private void remove_current_list() {
|
private void remove_current_list() {
|
||||||
// Remove the viewport that contains the current list
|
// XXX GTK+ Bug 778190 workaround
|
||||||
Gtk.Widget? scrolled_child = this.conversation_scroller.get_child();
|
this.conversation_scroller.destroy();
|
||||||
if (scrolled_child != null) {
|
new_conversation_scroller();
|
||||||
scrolled_child.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the scrollbars to their initial positions
|
|
||||||
this.conversation_scroller.hadjustment.set_value(0);
|
|
||||||
this.conversation_scroller.vadjustment.set_value(0);
|
|
||||||
|
|
||||||
// Notify that the current list was removed
|
// Notify that the current list was removed
|
||||||
if (this.current_list != null) {
|
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.
|
* Sets the currently visible page of the stack.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
<object class="GtkGrid" id="conversation_page">
|
<object class="GtkGrid" id="conversation_page">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchBar" id="conversation_find_bar">
|
<object class="GtkSearchBar" id="conversation_find_bar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
@ -119,23 +120,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow" id="conversation_scroller">
|
<placeholder/>
|
||||||
<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>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue