diff options
author | fiaxh <git@lightrise.org> | 2022-02-14 14:55:59 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-07-27 20:34:20 +0200 |
commit | 7e7dcedaf31ee35499875491c9f569c575d28435 (patch) | |
tree | 0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/conversation_view.vala | |
parent | f25bfb00969a7e09996da2d5500e6718f4cc0148 (diff) | |
download | dino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip |
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/conversation_view.vala')
-rw-r--r-- | main/src/ui/conversation_view.vala | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/main/src/ui/conversation_view.vala b/main/src/ui/conversation_view.vala index af7e32c1..a51b2381 100644 --- a/main/src/ui/conversation_view.vala +++ b/main/src/ui/conversation_view.vala @@ -7,23 +7,37 @@ using Dino.Entities; namespace Dino.Ui { [GtkTemplate (ui = "/im/dino/Dino/conversation_view.ui")] -public class ConversationView : Gtk.Overlay { +public class ConversationView : Widget { +// [GtkChild] public unowned ScrolledWindow conversation_scrolled; + [GtkChild] public unowned Overlay overlay; [GtkChild] public unowned Revealer goto_end_revealer; [GtkChild] public unowned Button goto_end_button; [GtkChild] public unowned ChatInput.View chat_input; [GtkChild] public unowned ConversationSummary.ConversationView conversation_frame; [GtkChild] public unowned Revealer white_revealer; + public ListView list_view = new ListView(null, null); + + public bool at_current_content = true; + construct { + this.layout_manager = new BinLayout(); white_revealer.notify["child-revealed"].connect_after(on_child_revealed_changed); + +// conversation_scrolled.set_child(list_view); +// list_view.set_factory(get_item_factory()); + +// conversation_scrolled.vadjustment.notify["upper"].connect_after(on_upper_notify); +// conversation_scrolled.vadjustment.notify["value"].connect(on_value_notify); + } public void add_overlay_dialog(Widget widget) { Revealer revealer = new Revealer() { transition_type=RevealerTransitionType.CROSSFADE , transition_duration= 100, visible=true }; - revealer.add(widget); + revealer.set_child(widget); - this.add_overlay(revealer); + overlay.add_overlay(revealer); revealer.reveal_child = true; white_revealer.visible = true; @@ -44,7 +58,22 @@ public class ConversationView : Gtk.Overlay { public override void dispose() { // To prevent a warning when closing Dino // "Can't set a target list on a widget until you've called gtk_drag_dest_set() to make the widget into a drag destination" - Gtk.drag_dest_unset(this); +// Gtk.drag_dest_unset(this); + } + + private void on_upper_notify() { + print("on_upper_notify\n"); + if (at_current_content) { + print("on_upper_notify2\n"); + // scroll down +// conversation_scrolled.vadjustment.value = conversation_scrolled.vadjustment.upper - conversation_scrolled.vadjustment.page_size; +// conversation_scrolled.scroll_child(ScrollType.END, false); + } + } + + private void on_value_notify() { + print("on_value_notify\n"); +// at_current_content = false; } } |