remember window size across invocations

This commit is contained in:
Josh Holtrop 2016-06-23 14:11:31 -04:00
parent ff430fd127
commit 77963428f1

View File

@ -10,6 +10,10 @@ class MainWindow(Gtk.Window):
super().__init__(title = "Simple SVN Browser v%s" % VERSION)
self.cache_file = CacheFile()
if (self.cache_file["width"] is not None and
self.cache_file["height"] is not None):
self.set_default_size(self.cache_file["width"],
self.cache_file["height"])
top_hbox = Gtk.Box()
address_entry = Gtk.Entry(text = url)
@ -31,8 +35,16 @@ class MainWindow(Gtk.Window):
self.add(vbox)
self.connect("delete-event", Gtk.main_quit)
self.connect("delete-event", self.__close)
self.show_all()
def run(self):
Gtk.main()
def __close(self, *more):
size = self.get_size()
self.cache_file["width"] = size[0]
self.cache_file["height"] = size[1]
self.cache_file.write()
Gtk.main_quit()
return True