change callback, widget and variable names for user information window in glade and in the code

This commit is contained in:
Yann Leboulanger 2005-03-01 15:56:02 +00:00
parent 7a2cb8052c
commit e431abd081
4 changed files with 96 additions and 102 deletions

View File

@ -1050,7 +1050,7 @@ class accountpreferences_window:
jid = self.xml.get_widget('jid_entry').get_text()
if self.plugin.connected[self.account]:
self.plugin.windows[self.account]['infos'][jid] = \
vCard_Window(jid.get_text(), self.plugin, self.account)
vCard_Window(jid, self.plugin, self.account)
self.plugin.send('ASK_VCARD', self.account, jid)
else:
warning_Window(_('You must be connected to get your informations'))

View File

@ -34,42 +34,37 @@ GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
class infoUser_Window:
"""Class for user's information window"""
def delete_event(self, widget=None):
def on_user_information_window_destroy(self, widget=None):
"""close window"""
del self.plugin.windows[self.account]['infos'][self.user.jid]
def on_close(self, widget):
def on_close_button_clicked(self, widget):
"""Save user's informations and update the roster on the Jabber server"""
#update: to know if things have changed to send things
# to server only if changes are done
update = 0
#update user.name if it's not ""
entry_name = self.xml.get_widget('entry_name')
newName = entry_name.get_text()
if newName != self.user.name and newName != '':
update = 1
self.user.name = newName
name_entry = self.xml.get_widget('nickname_entry')
new_name = name_entry.get_text()
if new_name != self.user.name and new_name != '':
self.user.name = new_name
for i in self.plugin.roster.get_user_iter(self.user.jid, self.account):
self.plugin.roster.tree.get_model().set_value(i, 1, newName)
if update:
self.plugin.roster.tree.get_model().set_value(i, 1, new_name)
self.plugin.send('UPDUSER', self.account, (self.user.jid, \
self.user.name, self.user.groups))
#log history ?
acct = self.plugin.accounts[self.account]
account_info = self.plugin.accounts[self.account]
oldlog = 1
no_log_for = []
if acct.has_key('no_log_for'):
no_log_for = acct['no_log_for'].split(' ')
if account_info.has_key('no_log_for'):
no_log_for = account_info['no_log_for'].split()
if self.user.jid in no_log_for:
oldlog = 0
log = self.xml.get_widget('chk_log').get_active()
log = self.xml.get_widget('log_checkbutton').get_active()
if not log and not self.user.jid in no_log_for:
no_log_for.append(self.user.jid)
if log and self.user.jid in no_log_for:
no_log_for.remove(self.user.jid)
if oldlog != log:
acct['no_log_for'] = string.join(no_log_for, ' ')
self.plugin.accounts[self.account] = acct
account_info['no_log_for'] = string.join(no_log_for, ' ')
self.plugin.accounts[self.account] = account_info
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'Gtkgui'))
widget.get_toplevel().destroy()
@ -84,35 +79,35 @@ class infoUser_Window:
for i in vcard.keys():
if type(vcard[i]) == type({}):
for j in vcard[i].keys():
self.set_value('entry_'+i+'_'+j, vcard[i][j])
self.set_value(i+'_'+j+'_entry', vcard[i][j])
else:
if i == 'DESC':
self.xml.get_widget('textview_DESC').get_buffer().\
self.xml.get_widget('DESC_textview').get_buffer().\
set_text(vcard[i], 0)
else:
self.set_value('entry_'+i, vcard[i])
self.set_value(i+'_entry', vcard[i])
def __init__(self, user, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Info_user', APP)
self.window = self.xml.get_widget("Info_user")
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'user_information_window', APP)
self.window = self.xml.get_widget('user_information_window')
self.plugin = plugin
self.user = user
self.account = account
self.xml.get_widget('label_name').set_text(user.name)
self.xml.get_widget('label_id').set_text(user.jid)
self.xml.get_widget('label_sub').set_text(user.sub)
self.xml.get_widget('nickname_label').set_text(user.name)
self.xml.get_widget('jid_label').set_text(user.jid)
self.xml.get_widget('subscription_label').set_text(user.sub)
if user.ask:
self.xml.get_widget('label_ask').set_text(user.ask)
self.xml.get_widget('ask_label').set_text(user.ask)
else:
self.xml.get_widget('label_ask').set_text('None')
self.xml.get_widget('entry_name').set_text(user.name)
acct = self.plugin.accounts[account]
self.xml.get_widget('ask_label').set_text('None')
self.xml.get_widget('nickname_entry').set_text(user.name)
account_info = self.plugin.accounts[account]
log = 1
if acct.has_key('no_log_for'):
if user.jid in acct['no_log_for'].split(' '):
if account_info.has_key('no_log_for'):
if user.jid in account_info['no_log_for'].split(' '):
log = 0
self.xml.get_widget('chk_log').set_active(log)
self.xml.get_widget('log_checkbutton').set_active(log)
resources = user.resource + ' (' + str(user.priority) + ')'
if not user.status:
user.status = ''
@ -123,12 +118,11 @@ class infoUser_Window:
if not u.status:
u.status = ''
stats += '\n' + u.show + ' : ' + u.status
self.xml.get_widget('label_resource').set_text(resources)
self.xml.get_widget('label_status').set_text(stats)
self.xml.get_widget('resource_label').set_text(resources)
self.xml.get_widget('status_label').set_text(stats)
plugin.send('ASK_VCARD', account, self.user.jid)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
self.xml.signal_connect('on_close_clicked', self.on_close)
self.xml.signal_autoconnect(self)
class passphrase_Window:
"""Class for Passphrase Window"""

View File

@ -1991,7 +1991,7 @@ Nikos Kouremenos (nkour@jabber.org)</property>
<widget class="GtkTable" id="table7">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_rows">1</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">3</property>
@ -5670,7 +5670,7 @@ Custom</property>
</child>
</widget>
<widget class="GtkWindow" id="Info_user">
<widget class="GtkWindow" id="user_information_window">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Information</property>
@ -5684,7 +5684,7 @@ Custom</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Wed, 17 Mar 2004 18:52:36 GMT"/>
<signal name="destroy" handler="on_user_information_window_destroy" last_modification_time="Tue, 01 Mar 2005 15:40:50 GMT"/>
<child>
<widget class="GtkVBox" id="vbox17">
@ -5693,9 +5693,9 @@ Custom</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label_name">
<widget class="GtkLabel" id="nickname_label">
<property name="visible">True</property>
<property name="label" translatable="yes">name</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5736,7 +5736,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label56">
<property name="visible">True</property>
<property name="label" translatable="yes">Jabber ID</property>
<property name="label" translatable="yes">Jabber ID:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5758,9 +5758,9 @@ Custom</property>
</child>
<child>
<widget class="GtkLabel" id="label_id">
<widget class="GtkLabel" id="jid_label">
<property name="visible">True</property>
<property name="label" translatable="yes">id</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5782,9 +5782,9 @@ Custom</property>
</child>
<child>
<widget class="GtkLabel" id="label_status">
<widget class="GtkLabel" id="status_label">
<property name="visible">True</property>
<property name="label" translatable="yes">status</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5808,7 +5808,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label59">
<property name="visible">True</property>
<property name="label" translatable="yes">Status</property>
<property name="label" translatable="yes">Status:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5832,7 +5832,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label58">
<property name="visible">True</property>
<property name="label" translatable="yes">Name</property>
<property name="label" translatable="yes">Nickname:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5854,7 +5854,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_name">
<widget class="GtkEntry" id="nickname_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@ -5877,7 +5877,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label62">
<property name="visible">True</property>
<property name="label" translatable="yes">Resource :</property>
<property name="label" translatable="yes">Resource:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5899,9 +5899,9 @@ Custom</property>
</child>
<child>
<widget class="GtkLabel" id="label_resource">
<widget class="GtkLabel" id="resource_label">
<property name="visible">True</property>
<property name="label" translatable="yes">resource</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5925,7 +5925,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label66">
<property name="visible">True</property>
<property name="label" translatable="yes">Subscription :</property>
<property name="label" translatable="yes">Subscription:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -5947,7 +5947,7 @@ Custom</property>
</child>
<child>
<widget class="GtkCheckButton" id="chk_log">
<widget class="GtkCheckButton" id="log_checkbutton">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -5976,7 +5976,7 @@ Custom</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label_sub">
<widget class="GtkLabel" id="subscription_label">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
@ -6000,7 +6000,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label172">
<property name="visible">True</property>
<property name="label" translatable="yes">Ask :</property>
<property name="label" translatable="yes">Ask:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -6019,7 +6019,7 @@ Custom</property>
</child>
<child>
<widget class="GtkLabel" id="label_ask">
<widget class="GtkLabel" id="ask_label">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
@ -6058,7 +6058,7 @@ Custom</property>
<child>
<widget class="GtkLabel" id="label54">
<property name="visible">True</property>
<property name="label" translatable="yes">General</property>
<property name="label" translatable="yes">Jabber</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -6229,7 +6229,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_FN">
<widget class="GtkEntry" id="FN_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6250,28 +6250,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_BDAY">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry_EMAIL_USERID">
<widget class="GtkEntry" id="EMAIL_USERID_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6292,7 +6271,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_URL">
<widget class="GtkEntry" id="URL_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6313,7 +6292,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_TEL_NUMBER">
<widget class="GtkEntry" id="TEL_NUMBER_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6334,7 +6313,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_NICKNAME">
<widget class="GtkEntry" id="NICKNAME_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6353,6 +6332,27 @@ Custom</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="BDAY_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@ -6534,7 +6534,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry9">
<widget class="GtkEntry" id="ADR_STREET_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6555,7 +6555,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ADR_EXTADR">
<widget class="GtkEntry" id="ADR_EXTADR_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6576,7 +6576,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ADR_LOCALITY">
<widget class="GtkEntry" id="ADR_LOCALITY_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6597,7 +6597,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ADR_REGION">
<widget class="GtkEntry" id="ADR_REGION_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6618,7 +6618,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ADR_PCODE">
<widget class="GtkEntry" id="ADR_PCODE_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6639,7 +6639,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ADR_CTRY">
<widget class="GtkEntry" id="ADR_CTRY_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6791,7 +6791,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ORG_ORGNAME">
<widget class="GtkEntry" id="ORG_ORGNAME_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6812,7 +6812,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ORG_ORGUNIT">
<widget class="GtkEntry" id="ORG_ORGUNIT_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6833,7 +6833,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_TITLE">
<widget class="GtkEntry" id="TITLE_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6854,7 +6854,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry_ROLE">
<widget class="GtkEntry" id="ROLE_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -6900,7 +6900,7 @@ Custom</property>
</child>
<child>
<widget class="GtkTextView" id="textview_DESC">
<widget class="GtkTextView" id="DESC_textview">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -6908,7 +6908,7 @@ Custom</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">False</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
@ -6958,7 +6958,7 @@ Custom</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="button13">
<widget class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -6966,7 +6966,7 @@ Custom</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sat, 10 Jan 2004 02:34:46 GMT"/>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Tue, 01 Mar 2005 15:03:12 GMT"/>
</widget>
</child>
</widget>
@ -6980,7 +6980,7 @@ Custom</property>
</child>
</widget>
<widget class="GtkWindow" id="jid">
<widget class="GtkWindow" id="vcard">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Personal Details</property>

View File

@ -1709,7 +1709,7 @@ class roster_Window:
infos['jid'] = self.plugin.accounts[account]["name"] + \
'@' + self.plugin.accounts[account]["hostname"]
self.plugin.windows['accountPreference'] = \
accountPreference_Window(self.plugin, infos)
accountpreferences_window(self.plugin, infos)
def mk_menu_account(self, event, iter):
"""Make account's popup menu"""