mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-18 13:33:14 +01:00
storing app window size on close
This commit is contained in:
@@ -81,7 +81,6 @@ class Application(Gtk.Application):
|
||||
self.add_main_option("debug", ord("d"), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, "", None)
|
||||
|
||||
self._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,
|
||||
@@ -608,6 +607,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?"))
|
||||
@@ -622,10 +625,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)
|
||||
|
||||
@@ -947,7 +947,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"/>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
||||
Reference in New Issue
Block a user