bugfix in subscription request window, also use self.window than widget.get_toplevel() to be faster and cleaner. Pref window catches Escape

This commit is contained in:
Nikos Kouremenos 2005-04-08 01:20:43 +00:00
parent 317f0e0db3
commit 3db4808088
4 changed files with 640 additions and 23 deletions

View File

@ -42,11 +42,15 @@ class Preferences_window:
return True # do NOT destroy the window
def on_close_button_clicked(self, widget):
self.window.hide()
self.window.hide()
def on_preferences_window_show(self, widget):
self.notebook.set_current_page(0)
def on_preferences_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
self.window.hide()
def on_checkbutton_toggled(self, widget, config_name, \
change_sensitivity_widgets = None):
if widget.get_active():
@ -857,7 +861,7 @@ class Account_modification_window:
def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def on_checkbutton_toggled(self, widget, widgets):
"""set or unset sensitivity of widgets when widget is toggled"""
@ -1045,7 +1049,7 @@ class Account_modification_window:
self.plugin.windows['accounts'].init_accounts()
#refresh roster
self.plugin.roster.draw_roster()
widget.get_toplevel().destroy()
self.window.destroy()
return
#if it's a new account
if name in self.plugin.accounts.keys():
@ -1082,7 +1086,7 @@ class Account_modification_window:
self.plugin.windows['accounts'].init_accounts()
#refresh roster
self.plugin.roster.draw_roster()
widget.get_toplevel().destroy()
self.window.destroy()
def on_change_password_button_clicked(self, widget):
dialog = Change_password_dialog(self.plugin, self.account)
@ -1230,7 +1234,7 @@ class Accounts_window:
del self.plugin.windows['accounts']
def on_close_button_clicked(self, widget):
widget.get_toplevel().destroy()
self.window.destroy()
def init_accounts(self):
"""initialize listStore with existing accounts"""
@ -1325,7 +1329,7 @@ class Service_registration_window:
Window that appears when we want to subscribe to a service"""
def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def draw_table(self):
"""Draw the table in the window"""
@ -1355,7 +1359,7 @@ class Service_registration_window:
self.plugin.roster.contacts[self.account][self.service] = [user1]
self.plugin.roster.add_user_to_roster(self.service, self.account)
self.plugin.send('REG_AGENT', self.account, self.service)
widget.get_toplevel().destroy()
self.window.destroy()
def __init__(self, service, infos, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'service_registration_window', APP)
@ -1563,7 +1567,7 @@ class Service_discovery_window:
def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def browse(self, jid):
"""Send a request to the core to know the available services"""
@ -1733,7 +1737,7 @@ class Service_discovery_window:
return
service = model.get_value(iter, 1)
self.plugin.send('REG_AGENT_INFO', self.account, service)
widget.get_toplevel().destroy()
self.window.destroy()
def on_services_treeview_cursor_changed(self, widget):
"""When we select a row :

View File

@ -39,12 +39,12 @@ class vcard_information_window:
def on_vcard_information_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
widget.destroy()
self.window.destroy()
def on_close_button_clicked(self, widget):
"""Save user's informations and update the roster on the Jabber server"""
if self.vcard:
widget.get_toplevel().destroy()
self.window.destroy()
return
#update user.name if it's not ""
name_entry = self.xml.get_widget('nickname_entry')
@ -73,7 +73,7 @@ class vcard_information_window:
self.plugin.accounts[self.account] = account_info
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'Gtkgui'))
widget.get_toplevel().destroy()
self.window.destroy()
def set_value(self, entry_name, value):
try:
@ -490,7 +490,7 @@ class Add_new_contact_window:
def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def on_subscribe_button_clicked(self, widget):
"""When Subscribe button is clicked"""
@ -510,7 +510,7 @@ class Add_new_contact_window:
nickname)
if self.xml.get_widget('auto_authorize_checkbutton').get_active():
self.plugin.send('AUTH', self.account, jid)
widget.get_toplevel().destroy()
self.window.destroy()
def fill_jid(self):
protocol_combobox = self.xml.get_widget('protocol_combobox')
@ -633,6 +633,7 @@ class Error_dialog:
class subscription_request_window:
def __init__(self, plugin, jid, text, account):
xml = gtk.glade.XML(GTKGUI_GLADE, 'subscription_request_window', APP)
self.window = xml.get_widget('subscription_request_window')
self.plugin = plugin
self.jid = jid
self.account = account
@ -646,19 +647,19 @@ class subscription_request_window:
window that appears when a user wants to add us to his/her roster"""
def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def on_authorize_button_clicked(self, widget):
"""Accept the request"""
self.plugin.send('AUTH', self.account, self.jid)
widget.get_toplevel().destroy()
self.window.destroy()
if not self.plugin.roster.contacts[self.account].has_key(self.jid):
Add_new_contact_window(self.plugin, self.account, self.jid)
def on_deny_button_clicked(self, widget):
"""refuse the request"""
self.plugin.send('DENY', self.account, self.jid)
widget.get_toplevel().destroy()
self.window.destroy()
class Join_groupchat_window:
def __init__(self, plugin, account, server='', room = ''):
@ -705,7 +706,7 @@ class Join_groupchat_window:
def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def on_join_button_clicked(self, widget):
"""When Join button is clicked"""
@ -725,7 +726,7 @@ class Join_groupchat_window:
self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \
password))
widget.get_toplevel().destroy()
self.window.destroy()
class New_message_dialog:
def __init__(self, plugin, account):
@ -755,7 +756,7 @@ class New_message_dialog:
def on_cancel_button_clicked(self, widget):
"""When Cancel button is clicked"""
widget.get_toplevel().destroy()
self.window.destroy()
def on_chat_button_clicked(self, widget):
"""When Chat button is clicked"""
@ -779,7 +780,7 @@ class New_message_dialog:
self.plugin.windows[self.account]['chats'][jid].window.present()
#FIXME: PROBLEM WITH FOCUS
widget.get_toplevel().destroy()
self.window.destroy()
class Change_password_dialog:
def __init__(self, plugin, account):
@ -850,6 +851,9 @@ class Popup_window:
xml.signal_autoconnect(self)
close_button.connect('clicked', self.on_close_button_clicked, window_height)
#FIXME: don't steal focus. not sure how to do ti
# set_focus_on_map(False) [pygtk26 only doesn't solve it!]
self.window.show_all()
gobject.timeout_add(5000, self.on_timeout, window_height)

File diff suppressed because it is too large Load Diff

View File

@ -401,6 +401,13 @@ class plugin:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
not self.config['autopopup']:
#DOES NOT ALWAYS WORK WHY?
#I control nkour@lagaule in jabber
# have nkour@lagaul in nkour@jabber.org
#go online from psi in lagaule
#gajim doesn't give a shit
# WHY? same with offline
# new message works
instance = Popup_window(self, 'Contact Online', jid )
self.roster.popup_windows.append(instance)
elif old_show > 1 and statuss.index(user1.show) < 2 and \
@ -927,7 +934,7 @@ class plugin:
#2:autoaway and use sleeper
#3:autoxa and use sleeper
self.send('ASK_ROSTER', a, self.queueIN)
#in pygtk2.4 FIXME: (nk) WHAT DO YOU MEAN?
iconset = self.config['iconset']
if not iconset:
iconset = 'sun'