preferences window is created on the fly like every other window (well apart from FT [TODO for that]); this is good as we do not want such window to sit in memory; also fix some border width and spacing in prefs window
This commit is contained in:
parent
9ec5e798b1
commit
11d9f5398d
|
@ -205,8 +205,6 @@ class AdvancedConfigurationWindow:
|
|||
self.check_for_restart()
|
||||
|
||||
def on_advanced_configuration_window_destroy(self, widget):
|
||||
# update ui of preferences window to get possible changes we did
|
||||
gajim.interface.instances['preferences'].update_preferences_window()
|
||||
del gajim.interface.instances['advanced_config']
|
||||
|
||||
def on_advanced_close_button_clicked(self, widget):
|
||||
|
|
|
@ -52,12 +52,12 @@ GTKGUI_GLADE = 'gtkgui.glade'
|
|||
class PreferencesWindow:
|
||||
'''Class for Preferences window'''
|
||||
|
||||
def on_preferences_window_delete_event(self, widget, event):
|
||||
self.window.hide()
|
||||
return True # do NOT destroy the window
|
||||
def on_preferences_window_destroy(self, widget):
|
||||
'''close window'''
|
||||
del gajim.interface.instances['preferences']
|
||||
|
||||
def on_close_button_clicked(self, widget):
|
||||
self.window.hide()
|
||||
self.window.destroy()
|
||||
|
||||
def __init__(self):
|
||||
'''Initialize Preferences window'''
|
||||
|
@ -169,6 +169,15 @@ class PreferencesWindow:
|
|||
model = gtk.ListStore(str)
|
||||
theme_combobox.set_model(model)
|
||||
|
||||
i = 0
|
||||
for config_theme in gajim.config.get_per('themes'):
|
||||
theme = config_theme.replace('_', ' ')
|
||||
model.append([theme])
|
||||
if gajim.config.get('roster_theme') == config_theme:
|
||||
theme_combobox.set_active(i)
|
||||
i += 1
|
||||
self.on_theme_combobox_changed(theme_combobox)
|
||||
|
||||
#use speller
|
||||
if os.name == 'nt':
|
||||
self.xml.get_widget('speller_checkbutton').set_no_show_all(True)
|
||||
|
@ -409,6 +418,20 @@ class PreferencesWindow:
|
|||
st = gajim.config.get('send_os_info')
|
||||
self.xml.get_widget('send_os_info_checkbutton').set_active(st)
|
||||
|
||||
# Notify user of new gmail e-mail messages,
|
||||
# only show checkbox if user has a gtalk account
|
||||
notify_gmail_checkbutton = self.xml.get_widget('notify_gmail_checkbutton')
|
||||
notify_gmail_checkbutton.set_no_show_all(True)
|
||||
for account in gajim.config.get_per('accounts'):
|
||||
jid = gajim.get_jid_from_account(account)
|
||||
if gajim.get_server_from_jid(jid) == 'gmail.com':
|
||||
st = gajim.config.get('notify_on_new_gmail_email')
|
||||
notify_gmail_checkbutton.set_active(st)
|
||||
notify_gmail_checkbutton.show()
|
||||
break
|
||||
else:
|
||||
notify_gmail_checkbutton.hide()
|
||||
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
self.sound_tree.get_model().connect('row-changed',
|
||||
|
@ -420,39 +443,8 @@ class PreferencesWindow:
|
|||
|
||||
self.theme_preferences = None
|
||||
|
||||
def on_preferences_window_show(self, widget):
|
||||
self.update_preferences_window()
|
||||
self.notebook.set_current_page(0)
|
||||
|
||||
def update_preferences_window(self):
|
||||
st = gajim.config.get('print_ichat_every_foo_minutes')
|
||||
text = _('Every %s _minutes') % st
|
||||
self.xml.get_widget('time_sometimes_radiobutton').set_label(text)
|
||||
|
||||
#Themes
|
||||
theme_combobox = self.xml.get_widget('theme_combobox')
|
||||
model = theme_combobox.get_model()
|
||||
model.clear()
|
||||
i = 0
|
||||
for config_theme in gajim.config.get_per('themes'):
|
||||
theme = config_theme.replace('_', ' ')
|
||||
model.append([theme])
|
||||
if gajim.config.get('roster_theme') == config_theme:
|
||||
theme_combobox.set_active(i)
|
||||
i += 1
|
||||
self.on_theme_combobox_changed(theme_combobox)
|
||||
|
||||
# Notify user of new gmail e-mail messages,
|
||||
# only show checkbox if user has a gtalk account
|
||||
self.xml.get_widget('notify_gmail_checkbutton').hide()
|
||||
for account in gajim.config.get_per('accounts'):
|
||||
jid = gajim.get_jid_from_account(account)
|
||||
if gajim.get_server_from_jid(jid) == 'gmail.com':
|
||||
st = gajim.config.get('notify_on_new_gmail_email')
|
||||
self.xml.get_widget('notify_gmail_checkbutton').set_active(st)
|
||||
self.xml.get_widget('notify_gmail_checkbutton').show()
|
||||
|
||||
#FIXME: move code from __init__ here
|
||||
self.window.show_all()
|
||||
|
||||
def on_preferences_window_key_press_event(self, widget, event):
|
||||
if event.keyval == gtk.keysyms.Escape:
|
||||
|
|
|
@ -1675,7 +1675,6 @@ class Interface:
|
|||
|
||||
# get instances for windows/dialogs that will show_all()/hide()
|
||||
self.instances['file_transfers'] = dialogs.FileTransfersWindow()
|
||||
self.instances['preferences'] = config.PreferencesWindow()
|
||||
|
||||
for account in gajim.connections:
|
||||
self.instances[account]['xml_console'] = dialogs.XMLConsoleWindow(
|
||||
|
|
|
@ -3282,19 +3282,17 @@ Agent JID - node</property>
|
|||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<signal name="show" handler="on_preferences_window_show" last_modification_time="Tue, 29 Mar 2005 23:33:03 GMT"/>
|
||||
<signal name="delete_event" handler="on_preferences_window_delete_event" last_modification_time="Tue, 29 Mar 2005 23:38:24 GMT"/>
|
||||
<signal name="key_press_event" handler="on_preferences_window_key_press_event" last_modification_time="Fri, 08 Apr 2005 01:08:08 GMT"/>
|
||||
<signal name="destroy" handler="on_preferences_window_destroy" last_modification_time="Sun, 05 Mar 2006 11:50:52 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox13">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="preferences_notebook">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
|
@ -6515,7 +6513,6 @@ Custom</property>
|
|||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox7">
|
||||
<property name="border_width">4</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">15</property>
|
||||
|
|
|
@ -1957,10 +1957,10 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
|||
self.tree.set_cursor(path)
|
||||
|
||||
def on_preferences_menuitem_activate(self, widget):
|
||||
if gajim.interface.instances['preferences'].window.get_property('visible'):
|
||||
if gajim.interface.instances.has_key('preferences'):
|
||||
gajim.interface.instances['preferences'].window.present()
|
||||
else:
|
||||
gajim.interface.instances['preferences'].window.show_all()
|
||||
gajim.interface.instances['preferences'] = config.PreferencesWindow()
|
||||
|
||||
def on_add_new_contact(self, widget, account):
|
||||
dialogs.AddNewContactWindow(account)
|
||||
|
|
Loading…
Reference in New Issue