only show pref dialog once

This commit is contained in:
Marcos Pinto 2007-09-02 03:07:26 +00:00
parent 4cc1e0e96b
commit ba3ff0877f
2 changed files with 462 additions and 446 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,8 @@ import pref
PREFS_FILENAME = "prefs.state"
class PreferencesDlg:
def __init__(self, preferences, active_port, plugins, plugin_tab=False):
def __init__(self, preferences, active_port, plugins, plugin_tab=False, is_showing_dlg=[False]):
self.is_showing_dlg = is_showing_dlg
self.glade = gtk.glade.XML(common.get_glade_file("preferences_dialog.glade"), domain='deluge')
self.dialog = self.glade.get_widget("pref_dialog")
if plugin_tab:
@ -74,6 +75,10 @@ class PreferencesDlg:
self.plugins = plugins
def show(self, interface, window):
if self.is_showing_dlg[0]:
return
self.is_showing_dlg[0] = True
# Load settings into dialog
try:
self.glade.get_widget("combo_file_manager").set_active(self.preferences.get("file_manager"))
@ -187,6 +192,9 @@ class PreferencesDlg:
def ok_clicked(self, source, interface):
self.dialog.hide()
self.is_showing_dlg[0] = False
return True
self.preferences.set("file_manager", self.glade.get_widget("combo_file_manager").get_active())
self.preferences.set("open_folder_stock", self.glade.get_widget("radio_open_folder_stock").get_active())
self.preferences.set("open_folder_location", self.glade.get_widget("txt_open_folder_location").get_text())
@ -255,9 +263,15 @@ class PreferencesDlg:
def cancel_clicked(self, source):
self.dialog.hide()
self.is_showing_dlg[0] = False
return True
def close_clicked(self, source):
def close_clicked(self, source, *args):
self.dialog.hide()
self.is_showing_dlg[0] = False
return True
def old_clicked(self, path):
return self.plugin_clicked(self.view.get_selection(), self.store, path, False)