Save and restore the main window's vpane position.

This commit is contained in:
Andrew Resch 2007-09-23 00:50:42 +00:00
parent 56e78f0cc6
commit d80debfbea
2 changed files with 11 additions and 1 deletions

View File

@ -64,6 +64,7 @@ DEFAULT_PREFS = {
"window_y_pos": 0,
"window_width": 640,
"window_height": 480,
"window_pane_position": -1,
"tray_download_speed_list" : [5.0, 10.0, 30.0, 80.0, 300.0],
"tray_upload_speed_list" : [5.0, 10.0, 30.0, 80.0, 300.0]
}

View File

@ -58,6 +58,7 @@ class MainWindow:
self.window = self.main_glade.get_widget("main_window")
self.window.set_icon(deluge.common.get_logo(32))
self.vpaned = self.main_glade.get_widget("vpaned")
# Load the window state
self.load_window_geometry()
@ -68,6 +69,7 @@ class MainWindow:
# Connect events
self.window.connect("window-state-event", self.window_state_event)
self.window.connect("configure-event", self.window_configure_event)
self.vpaned.connect("notify::position", self.vpaned_position_event)
# Initialize various components of the gtkui
self.menubar = MenuBar(self)
@ -123,7 +125,9 @@ class MainWindow:
self.window.resize(w, h)
if self.config["window_maximized"] == True:
self.window.maximize()
self.vpaned.set_position(
self.config["window_height"] - self.config["window_pane_position"])
def window_configure_event(self, widget, event):
if self.config["window_maximized"] == False:
self.config.set("window_x_pos", self.window.get_position()[0])
@ -147,3 +151,8 @@ class MainWindow:
# Force UI update as we don't update it while minimized
self.update()
return False
def vpaned_position_event(self, obj, param):
self.config.set("window_pane_position",
self.config["window_height"] - self.vpaned.get_position())