aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/unified_window.vala31
1 files changed, 30 insertions, 1 deletions
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala
index 15218e17..8bcb2c57 100644
--- a/main/src/ui/unified_window.vala
+++ b/main/src/ui/unified_window.vala
@@ -21,10 +21,15 @@ public class UnifiedWindow : Window {
private StreamInteractor stream_interactor;
private Conversation? conversation;
+ private Application app;
public UnifiedWindow(Application application, StreamInteractor stream_interactor) {
- Object(application : application, default_width : 1200, default_height : 700);
+ Object(application : application);
this.stream_interactor = stream_interactor;
+ this.app = application;
+
+ restore_window_size();
+
this.get_style_context().add_class("dino-main");
setup_headerbar();
@@ -120,6 +125,30 @@ public class UnifiedWindow : Window {
}
}
+ private void restore_window_size() {
+ default_width = app.settings.current_width;
+ default_height = app.settings.current_height;
+ if (app.settings.is_maximized) this.maximize();
+ if (app.settings.position_x != -1 && app.settings.position_y != -1) {
+ move(app.settings.position_x, app.settings.position_y);
+ }
+
+ delete_event.connect(() => {
+ int x, y;
+ get_position(out x, out y);
+ app.settings.position_x = x;
+ app.settings.position_y = y;
+
+ int width, height;
+ get_size(out width, out height);
+ app.settings.current_width = width;
+ app.settings.current_height = height;
+
+ app.settings.is_maximized = is_maximized;
+ return false;
+ });
+ }
+
private bool on_focus_in_event() {
stream_interactor.get_module(ChatInteraction.IDENTITY).on_window_focus_in(conversation);
urgency_hint = false;