2020-02-21 01:11:23 +00:00
|
|
|
using Gee;
|
|
|
|
using Gdk;
|
|
|
|
using Gtk;
|
|
|
|
|
|
|
|
using Dino.Entities;
|
|
|
|
|
|
|
|
namespace Dino.Ui {
|
|
|
|
|
|
|
|
[GtkTemplate (ui = "/im/dino/Dino/conversation_view.ui")]
|
2020-04-22 13:44:12 +00:00
|
|
|
public class ConversationView : Gtk.Overlay {
|
2020-02-21 01:11:23 +00:00
|
|
|
|
2021-10-11 21:08:50 +00:00
|
|
|
[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;
|
2020-02-21 01:11:23 +00:00
|
|
|
|
2020-04-22 13:44:12 +00:00
|
|
|
construct {
|
|
|
|
white_revealer.notify["child-revealed"].connect_after(on_child_revealed_changed);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void add_overlay_dialog(Widget widget) {
|
|
|
|
Revealer revealer = new Revealer() { transition_type=RevealerTransitionType.CROSSFADE , transition_duration= 100, visible=true };
|
|
|
|
revealer.add(widget);
|
|
|
|
|
|
|
|
this.add_overlay(revealer);
|
|
|
|
|
|
|
|
revealer.reveal_child = true;
|
|
|
|
white_revealer.visible = true;
|
|
|
|
white_revealer.reveal_child = true;
|
|
|
|
widget.destroy.connect(() => {
|
2021-02-11 00:32:39 +00:00
|
|
|
revealer.destroy(); // GTK4: this.remove_overlay(revealer);
|
2020-04-22 13:44:12 +00:00
|
|
|
white_revealer.reveal_child = false;
|
2020-06-23 13:57:50 +00:00
|
|
|
chat_input.do_focus();
|
2020-04-22 13:44:12 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void on_child_revealed_changed() {
|
|
|
|
if (!white_revealer.child_revealed) {
|
|
|
|
white_revealer.visible = false;
|
|
|
|
}
|
|
|
|
}
|
2020-10-27 16:42:22 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2020-02-21 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|