Skip to content

Commit

Permalink
added saving main window size
Browse files Browse the repository at this point in the history
  • Loading branch information
DYefremov committed Nov 30, 2022
1 parent 5a2e65a commit 2d6428d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions usr/lib/tvdemon/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def __init__(self, **kwargs):
self.builder.add_from_file(glade_file)
self.window = self.builder.get_object("main_window")
self.window.connect("delete-event", self.on_close_app)
self.window.resize(*self.settings.get_value("main-window-size"))
# The window used to display stream information
self.info_window = self.builder.get_object("stream_info_window")

Expand Down Expand Up @@ -1567,6 +1568,11 @@ def show_info_message(self, msg, message_type=Gtk.MessageType.INFO):
self.info_message_label.set_text(msg)

def on_close_app(self, window=None, event=None):
# Saving main window size.
width, height = self.window.get_size()
w_size = GLib.Variant.new_tuple(GLib.Variant.new_int32(width), GLib.Variant.new_int32(height))
self.settings.set_value("main-window-size", w_size)
# Saving favorites list.
self.on_favorites_store()

def on_close_info_window_button_clicked(self, widget):
Expand Down
5 changes: 5 additions & 0 deletions usr/share/glib-2.0/schemas/org.x.tvdemon.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@
<summary>Format: name:::type:::url(or path):::username:::password:::epg</summary>
<description></description>
</key>
<key type="(ii)" name="main-window-size">
<default>(700, 500)</default>
<summary>Main app window size</summary>
<description></description>
</key>
</schema>
</schemalist>

0 comments on commit 2d6428d

Please sign in to comment.