storing app window size on close

This commit is contained in:
DYefremov
2020-12-19 12:36:42 +03:00
parent 7fac48c44d
commit 13e6c858d2
2 changed files with 4 additions and 6 deletions

View File

@@ -82,7 +82,6 @@ class Application(Gtk.Application):
self.add_main_option("debug", ord("d"), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, "", None)
handlers = {"on_close_app": self.on_close_app,
"on_resize": self.on_resize,
"on_about_app": self.on_about_app,
"on_settings": self.on_settings,
"on_profile_changed": self.on_profile_changed,
@@ -524,6 +523,10 @@ class Application(Gtk.Application):
event.state |= MOD_MASK
def on_close_app(self, *args):
""" Performing operations before closing the application. """
# Saving the current size of the application window.
self._settings.add("window_size", self._main_window.get_size())
if self._recorder:
if self._recorder.is_record():
msg = "{}\n\n\t{}".format(get_message("Recording in progress!"), get_message("Are you sure?"))
@@ -538,10 +541,6 @@ class Application(Gtk.Application):
else:
GLib.idle_add(self.quit)
def on_resize(self, window):
""" Stores new size properties for app window after resize """
self._settings.add("window_size", window.get_size())
@run_idle
def on_about_app(self, action, value=None):
show_dialog(DialogType.ABOUT, self._main_window)

View File

@@ -1009,7 +1009,6 @@ Author: Dmitriy Yefremov
<property name="icon_name">demon-editor</property>
<property name="gravity">center</property>
<property name="startup_id">DemonEditor</property>
<signal name="check-resize" handler="on_resize" swapped="no"/>
<signal name="delete-event" handler="on_close_app" swapped="no"/>
<signal name="window-state-event" handler="on_main_window_state" swapped="no"/>
<child type="titlebar">