[geary/gnumdk/stable: 1/2] Revert "Fix crash when conversation scrolled window child changes."
- From: Cédric Bellegarde <cbellegarde src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/gnumdk/stable: 1/2] Revert "Fix crash when conversation scrolled window child changes."
- Date: Thu, 15 Sep 2022 13:43:23 +0000 (UTC)
commit c7c1b05337044662d674e41280048fa6fe2e0b05
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date: Thu Sep 15 12:23:15 2022 +0200
Revert "Fix crash when conversation scrolled window child changes."
This reverts commit 07966a11561b55c594a0030353911d1bb4c3882d.
.../conversation-viewer/conversation-viewer.vala | 59 +++++-----------------
ui/conversation-viewer.ui | 20 +++++++-
2 files changed, 33 insertions(+), 46 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala
b/src/client/conversation-viewer/conversation-viewer.vala
index 983d6539e..f8782f73c 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -45,8 +45,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
[GtkChild] private unowned Gtk.Grid empty_folder_page;
[GtkChild] private unowned Gtk.Grid empty_search_page;
[GtkChild] private unowned Gtk.Grid composer_page;
-
- private Gtk.ScrolledWindow conversation_scroller;
+ [GtkChild] private unowned Gtk.ScrolledWindow conversation_scroller;
[GtkChild] internal unowned Gtk.SearchBar conversation_find_bar;
@@ -132,9 +131,6 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
this.conversation_find_entry
);
- // 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);
}
@@ -253,10 +249,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
Application.ContactStore contacts,
bool start_mark_timer)
throws GLib.Error {
- // Keep the old ScrolledWindow around long enough for its
- // descendant web views to be kept so their WebProcess can be
- // re-used.
- var old_scroller = remove_current_list();
+ var old_viewport = remove_current_list();
ConversationListBox new_list = new ConversationListBox(
conversation,
@@ -300,9 +293,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
}
yield new_list.load_conversation(scroll_to, query);
-
- // Not strictly necessary, but keeps the compiler happy
- old_scroller.destroy();
+ old_viewport = null;
}
// Add a new conversation list to the UI
@@ -322,46 +313,23 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
}
// Remove any existing conversation list, cancelling its loading
- private Gtk.ScrolledWindow remove_current_list() {
- if (this.find_cancellable != null) {
- this.find_cancellable.cancel();
- this.find_cancellable = null;
+ private Gtk.Widget remove_current_list() {
+ // Remove the viewport that contains the current list
+ Gtk.Widget? scrolled_child = this.conversation_scroller.get_child();
+ if (scrolled_child != null) {
+ conversation_scroller.remove(scrolled_child);
}
+ // Reset the scrollbars to their initial positions
+ this.conversation_scroller.hadjustment.set_value(0);
+ this.conversation_scroller.vadjustment.set_value(0);
+
if (this.current_list != null) {
this.current_list.cancel_conversation_load();
this.conversation_removed(this.current_list);
this.current_list = null;
}
-
- var old_scroller = this.conversation_scroller;
- // XXX GTK+ Bug 778190 workaround
- this.conversation_page.remove(old_scroller);
- new_conversation_scroller();
- return old_scroller;
- }
-
- 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 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();
- scroller.scroll_event.connect(
- on_conversation_scroll
- );
- scroller.get_vscrollbar().button_release_event.connect(
- on_conversation_scroll
- );
- this.conversation_scroller = scroller;
- this.conversation_page.add(scroller);
-
+ return scrolled_child;
}
/**
@@ -490,6 +458,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
}
}
+ [GtkCallback]
private bool on_conversation_scroll() {
if (this.current_list != null) {
this.current_list.mark_visible_read();
diff --git a/ui/conversation-viewer.ui b/ui/conversation-viewer.ui
index d611ee9a5..6e49b5b2c 100644
--- a/ui/conversation-viewer.ui
+++ b/ui/conversation-viewer.ui
@@ -35,6 +35,7 @@
<object class="GtkGrid" id="conversation_page">
<property name="visible">True</property>
<property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkSearchBar" id="conversation_find_bar">
<property name="visible">True</property>
@@ -109,7 +110,24 @@
</packing>
</child>
<child>
- <placeholder/>
+ <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>
+ <signal name="scroll-event" handler="on_conversation_scroll" swapped="no"/>
+ <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>
</object>
<packing>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]