aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/file_send_overlay.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-14 14:55:59 +0100
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commit7e7dcedaf31ee35499875491c9f569c575d28435 (patch)
tree0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/file_send_overlay.vala
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/file_send_overlay.vala')
-rw-r--r--main/src/ui/file_send_overlay.vala46
1 files changed, 29 insertions, 17 deletions
diff --git a/main/src/ui/file_send_overlay.vala b/main/src/ui/file_send_overlay.vala
index 369d291a..ceb78818 100644
--- a/main/src/ui/file_send_overlay.vala
+++ b/main/src/ui/file_send_overlay.vala
@@ -6,33 +6,41 @@ using Dino.Entities;
namespace Dino.Ui {
-[GtkTemplate (ui = "/im/dino/Dino/file_send_overlay.ui")]
-public class FileSendOverlay : Gtk.EventBox {
+public class FileSendOverlay {
public signal void close();
public signal void send_file();
- [GtkChild] public unowned Button close_button;
- [GtkChild] public unowned Button send_button;
- [GtkChild] public unowned SizingBin file_widget_insert;
- [GtkChild] public unowned Label info_label;
+ public Box main_box;
+ public Button close_button;
+ public Button send_button;
+ public SizingBin file_widget_insert;
+ public Label info_label;
private bool can_send = true;
public FileSendOverlay(File file, FileInfo file_info) {
+ Builder builder = new Builder.from_resource("/im/dino/Dino/file_send_overlay.ui");
+ main_box = (Box) builder.get_object("main_box");
+ close_button = (Button) builder.get_object("close_button");
+ send_button = (Button) builder.get_object("send_button");
+ file_widget_insert = (SizingBin) builder.get_object("file_widget_insert");
+ info_label = (Label) builder.get_object("info_label");
+
close_button.clicked.connect(() => {
- this.close();
- this.destroy();
+ main_box.unparent();
+ main_box.destroy();
});
send_button.clicked.connect(() => {
send_file();
this.close();
- this.destroy();
+ main_box.unparent();
+ main_box.destroy();
});
load_file_widget.begin(file, file_info);
- this.realize.connect(() => {
+ main_box.realize.connect(() => {
if (can_send) {
send_button.grab_focus();
} else {
@@ -40,12 +48,12 @@ public class FileSendOverlay : Gtk.EventBox {
}
});
- this.key_release_event.connect((event) => {
- if (event.keyval == Gdk.Key.Escape) {
- this.destroy();
- }
- return false;
- });
+// this.key_release_event.connect((event) => {
+// if (event.keyval == Gdk.Key.Escape) {
+// this.destroy();
+// }
+// return false;
+// });
}
private async void load_file_widget(File file, FileInfo file_info) {
@@ -78,7 +86,7 @@ public class FileSendOverlay : Gtk.EventBox {
widget = default_widget;
}
- file_widget_insert.add(widget);
+ widget.set_parent(file_widget_insert);
}
public void set_file_too_large() {
@@ -87,6 +95,10 @@ public class FileSendOverlay : Gtk.EventBox {
send_button.sensitive = false;
can_send = false;
}
+
+ public Widget get_widget() {
+ return main_box;
+ }
}
}