From 56d61f15701f73b858e2701008c38805acf5fc8e Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 12 Jun 2007 22:45:30 +0000 Subject: [PATCH] The preferences dialog state (height, width, x, y) is now saved. --- glade/preferences_dialog.glade | 17 +++++++++++++++-- src/dialogs.py | 14 +++++++++++++- src/pref.py | 4 ++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index fd26e17a1..db8031c13 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -7,7 +7,6 @@ 5 Deluge Preferences GTK_WIN_POS_CENTER_ON_PARENT - 550 GDK_WINDOW_TYPE_HINT_DIALOG True True @@ -54,6 +53,7 @@ True Ask where to save each download True + 0 True @@ -66,6 +66,7 @@ True Save all downloads to: True + 0 True radio_ask_save @@ -188,6 +189,7 @@ Compact allocation will only allocate as much storage as it needs to keep the pieces downloaded so far. Use compact storage allocation True + 0 True @@ -230,6 +232,7 @@ True Queue torrents to bottom when they begin seeding True + 0 True @@ -242,6 +245,7 @@ True Stop seeding torrents when their share ratio reaches: True + 0 True @@ -618,6 +622,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Test Active Port + 0 @@ -673,6 +678,7 @@ Distributed hash table may improve the amount of active connections. Enable Mainline DHT True + 0 True @@ -751,6 +757,7 @@ False UPnP True + 0 True True @@ -764,6 +771,7 @@ False NAT-PMP True + 0 True True @@ -778,6 +786,7 @@ False UT PeX True + 0 True True @@ -885,6 +894,7 @@ Forced True Prefer to encrypt the entire stream True + 0 True @@ -999,6 +1009,7 @@ Full Stream True Enable system tray icon True + 0 True True @@ -1012,6 +1023,7 @@ Full Stream True Minimize to tray on close True + 0 True @@ -1033,6 +1045,7 @@ Full Stream True Password protect system tray True + 0 True @@ -1061,7 +1074,6 @@ Full Stream True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False - * 16 @@ -1200,6 +1212,7 @@ Full Stream True gtk-cancel True + 0 diff --git a/src/dialogs.py b/src/dialogs.py index 134c09de8..49f78459a 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -43,6 +43,7 @@ class PreferencesDlg: 'tray_toggle': self.tray_toggle, 'on_btn_testport_clicked': self.TestPort, }) + self.dialog.connect("configure-event", self.window_configure_event) self.parent = parent self.preferences = preferences @@ -76,6 +77,12 @@ class PreferencesDlg: self.glade.get_widget("chk_dht").set_active(self.preferences.get("enable_dht", bool, default=True)) self.glade.get_widget("spin_dht").set_value(self.preferences.get("dht_connections", int, default=80)) self.glade.get_widget("spin_gui").set_value(self.preferences.get("gui_update_interval", float, default=1.0)) + + # Load geometry settings for window + self.dialog.resize(self.preferences.get("pref_window_width"), self.preferences.get("pref_window_height")) + if self.preferences.get("pref_window_x_pos") > 0 or self.preferences.get("pref_window_y_pos") > 0: + self.dialog.move(self.preferences.get("pref_window_x_pos"), self.preferences.get("pref_window_y_pos")) + except KeyError: pass # Now, show the dialog @@ -118,7 +125,12 @@ class PreferencesDlg: self.glade.get_widget("chk_min_on_close").set_sensitive(True) else: self.glade.get_widget("chk_min_on_close").set_sensitive(False) - + + def window_configure_event(self, widget, event): + self.preferences.set("pref_window_x_pos", event.x) + self.preferences.set("pref_window_y_pos", event.y) + self.preferences.set("pref_window_width", event.width) + self.preferences.set("pref_window_height", event.height) diff --git a/src/pref.py b/src/pref.py index b37bd7075..90cbbdb38 100644 --- a/src/pref.py +++ b/src/pref.py @@ -63,6 +63,10 @@ DEFAULT_PREFS = { "max_upload_rate_bps" : -1.0, "max_uploads" : 2, "pref_rc4" : True, + "pref_window_height" : 550, + "pref_window_width" : 1, + "pref_window_x_pos" : -1, + "pref_window_y_pos" : -1, "queue_seeds_to_bottom" : False, "show_dl" : True, "show_eta" : True,