enrich with info on how to ban domain and what else is allowed; make Close --> Cancel and Apply --> OK; FIXME: OK cb is not called.. :(
This commit is contained in:
parent
c9d98a9494
commit
a8def93b99
130
src/config.py
130
src/config.py
|
@ -1651,11 +1651,16 @@ class DataFormWindow:
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
def on_data_form_window_destroy(self, widget):
|
def on_cancel_button_clicked(self, widget):
|
||||||
|
self.window.destroy()
|
||||||
|
|
||||||
|
def on_ok_button_clicked(self, widget):
|
||||||
|
'''NOTE: child class should implement this'''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_close_button_clicked(self, widget):
|
def on_data_form_window_destroy(self, widget):
|
||||||
self.window.destroy()
|
'''NOTE: child class should implement this'''
|
||||||
|
pass
|
||||||
|
|
||||||
def on_checkbutton_toggled(self, widget, index):
|
def on_checkbutton_toggled(self, widget, index):
|
||||||
self.config[index]['values'][0] = widget.get_active()
|
self.config[index]['values'][0] = widget.get_active()
|
||||||
|
@ -1715,10 +1720,10 @@ class DataFormWindow:
|
||||||
widget.set_alignment(0.0, 0.5)
|
widget.set_alignment(0.0, 0.5)
|
||||||
max = 4
|
max = 4
|
||||||
elif ctype == 'jid-multi':
|
elif ctype == 'jid-multi':
|
||||||
#TODO
|
#FIXME
|
||||||
widget = gtk.Label('')
|
widget = gtk.Label('')
|
||||||
elif ctype == 'jid-single':
|
elif ctype == 'jid-single':
|
||||||
#TODO
|
#FIXME
|
||||||
widget = gtk.Label('')
|
widget = gtk.Label('')
|
||||||
elif ctype == 'list-multi':
|
elif ctype == 'list-multi':
|
||||||
j = 0
|
j = 0
|
||||||
|
@ -1782,7 +1787,28 @@ class DataFormWindow:
|
||||||
|
|
||||||
class ServiceRegistrationWindow(DataFormWindow):
|
class ServiceRegistrationWindow(DataFormWindow):
|
||||||
'''Class for Service registration window:
|
'''Class for Service registration window:
|
||||||
Window that appears when we want to subscribe to a service'''
|
Window that appears when we want to subscribe to a service
|
||||||
|
if is_form we use DataFormWindow else we use service_registarion_window'''
|
||||||
|
def __init__(self, service, infos, account, is_form):
|
||||||
|
self.service = service
|
||||||
|
self.infos = infos
|
||||||
|
self.account = account
|
||||||
|
self.is_form = is_form
|
||||||
|
if self.is_form:
|
||||||
|
DataFormWindow.__init__(self, account, infos)
|
||||||
|
else:
|
||||||
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'service_registration_window', APP)
|
||||||
|
self.window = self.xml.get_widget('service_registration_window')
|
||||||
|
if infos.has_key('registered'):
|
||||||
|
self.window.set_title(_('Edit %s' % service))
|
||||||
|
else:
|
||||||
|
self.window.set_title(_('Register to %s' % service))
|
||||||
|
self.xml.get_widget('label').set_text(infos['instructions'])
|
||||||
|
self.entries = {}
|
||||||
|
self.draw_table()
|
||||||
|
self.xml.signal_autoconnect(self)
|
||||||
|
self.window.show_all()
|
||||||
|
|
||||||
def on_cancel_button_clicked(self, widget):
|
def on_cancel_button_clicked(self, widget):
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
@ -1813,8 +1839,18 @@ class ServiceRegistrationWindow(DataFormWindow):
|
||||||
table.show_all()
|
table.show_all()
|
||||||
|
|
||||||
def on_ok_button_clicked(self, widget):
|
def on_ok_button_clicked(self, widget):
|
||||||
'''When Ok button is clicked:
|
if self.is_form:
|
||||||
send registration info to the core'''
|
# We pressed OK button of the DataFormWindow
|
||||||
|
if self.infos.has_key('registered'):
|
||||||
|
del self.infos['registered']
|
||||||
|
else:
|
||||||
|
gajim.interface.roster.add_transport_to_roster(self.account,
|
||||||
|
self.service)
|
||||||
|
gajim.connections[self.account].register_agent(self.service, self.infos,
|
||||||
|
True) # True is for is_form
|
||||||
|
else:
|
||||||
|
# we pressed OK of service_registration_window
|
||||||
|
# send registration info to the core
|
||||||
for name in self.entries.keys():
|
for name in self.entries.keys():
|
||||||
self.infos[name] = self.entries[name].get_text().decode('utf-8')
|
self.infos[name] = self.entries[name].get_text().decode('utf-8')
|
||||||
if self.infos.has_key('instructions'):
|
if self.infos.has_key('instructions'):
|
||||||
|
@ -1825,37 +1861,9 @@ class ServiceRegistrationWindow(DataFormWindow):
|
||||||
gajim.interface.roster.add_transport_to_roster(self.account,
|
gajim.interface.roster.add_transport_to_roster(self.account,
|
||||||
self.service)
|
self.service)
|
||||||
gajim.connections[self.account].register_agent(self.service, self.infos)
|
gajim.connections[self.account].register_agent(self.service, self.infos)
|
||||||
|
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_apply_button_clicked(self, widget):
|
|
||||||
# We press apply button of the FormDataWindow
|
|
||||||
if self.infos.has_key('registered'):
|
|
||||||
del self.infos['registered']
|
|
||||||
else:
|
|
||||||
gajim.interface.roster.add_transport_to_roster(self.account,
|
|
||||||
self.service)
|
|
||||||
gajim.connections[self.account].register_agent(self.service, self.infos,
|
|
||||||
True) # True is for is_form
|
|
||||||
self.window.destroy()
|
|
||||||
|
|
||||||
def __init__(self, service, infos, account, is_form):
|
|
||||||
self.service = service
|
|
||||||
self.infos = infos
|
|
||||||
self.account = account
|
|
||||||
if is_form:
|
|
||||||
DataFormWindow.__init__(self, account, infos)
|
|
||||||
else:
|
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'service_registration_window', APP)
|
|
||||||
self.window = self.xml.get_widget('service_registration_window')
|
|
||||||
if infos.has_key('registered'):
|
|
||||||
self.window.set_title(_('Edit %s' % service))
|
|
||||||
else:
|
|
||||||
self.window.set_title(_('Register to %s' % service))
|
|
||||||
self.xml.get_widget('label').set_text(infos['instructions'])
|
|
||||||
self.entries = {}
|
|
||||||
self.draw_table()
|
|
||||||
self.xml.signal_autoconnect(self)
|
|
||||||
self.window.show_all()
|
|
||||||
|
|
||||||
class GroupchatConfigWindow(DataFormWindow):
|
class GroupchatConfigWindow(DataFormWindow):
|
||||||
'''GroupchatConfigWindow class'''
|
'''GroupchatConfigWindow class'''
|
||||||
|
@ -1890,12 +1898,14 @@ class GroupchatConfigWindow(DataFormWindow):
|
||||||
bb.pack_start(add_button)
|
bb.pack_start(add_button)
|
||||||
self.remove_button[affiliation] = gtk.Button(stock = gtk.STOCK_REMOVE)
|
self.remove_button[affiliation] = gtk.Button(stock = gtk.STOCK_REMOVE)
|
||||||
self.remove_button[affiliation].set_sensitive(False)
|
self.remove_button[affiliation].set_sensitive(False)
|
||||||
self.remove_button[affiliation].connect('clicked', self.on_remove_button_clicked, affiliation)
|
self.remove_button[affiliation].connect('clicked',
|
||||||
|
self.on_remove_button_clicked, affiliation)
|
||||||
bb.pack_start(self.remove_button[affiliation])
|
bb.pack_start(self.remove_button[affiliation])
|
||||||
|
|
||||||
liststore = gtk.ListStore(str, str, str, str) # Jid, reason, nick, role
|
liststore = gtk.ListStore(str, str, str, str) # Jid, reason, nick, role
|
||||||
self.affiliation_treeview[affiliation] = gtk.TreeView(liststore)
|
self.affiliation_treeview[affiliation] = gtk.TreeView(liststore)
|
||||||
self.affiliation_treeview[affiliation].connect('cursor-changed', self.on_affiliation_treeview_cursor_changed, affiliation)
|
self.affiliation_treeview[affiliation].connect('cursor-changed',
|
||||||
|
self.on_affiliation_treeview_cursor_changed, affiliation)
|
||||||
renderer = gtk.CellRendererText()
|
renderer = gtk.CellRendererText()
|
||||||
col = gtk.TreeViewColumn(_('JID'), renderer)
|
col = gtk.TreeViewColumn(_('JID'), renderer)
|
||||||
col.add_attribute(renderer, 'text', 0)
|
col.add_attribute(renderer, 'text', 0)
|
||||||
|
@ -1936,16 +1946,41 @@ class GroupchatConfigWindow(DataFormWindow):
|
||||||
def on_add_button_clicked(self, widget, affiliation):
|
def on_add_button_clicked(self, widget, affiliation):
|
||||||
if affiliation == 'outcast':
|
if affiliation == 'outcast':
|
||||||
title = _('Banning...')
|
title = _('Banning...')
|
||||||
prompt = _('Whom do you want to ban? (JID, domain, ...)')
|
#You can move '\n' before user@domain if that line is TOO BIG
|
||||||
|
prompt = _('<b>Whom do you want to ban?</b>' '\n\n'
|
||||||
|
'Can be one of the following:' '\n'
|
||||||
|
'1. user@domain/resource (only that resource matches).' '\n'
|
||||||
|
'2. user@domain (any resource matches).' '\n'
|
||||||
|
'3. domain/resource (only that resource matches).' '\n'
|
||||||
|
'4. domain (the domain itself matches, as does any user@domain,' '\n'
|
||||||
|
'domain/resource, or address containing a subdomain.')
|
||||||
elif affiliation == 'member':
|
elif affiliation == 'member':
|
||||||
title = _('Adding Member')
|
title = _('Adding Member...')
|
||||||
prompt = _('Whom do you want to make a member? (JID, domain, ...)')
|
prompt = _('<b>Whom do you want to make a member?</b>' '\n\n'
|
||||||
|
'Can be one of the following:' '\n'
|
||||||
|
'1. user@domain/resource (only that resource matches).' '\n'
|
||||||
|
'2. user@domain (any resource matches).' '\n'
|
||||||
|
'3. domain/resource (only that resource matches).' '\n'
|
||||||
|
'4. domain (the domain itself matches, as does any user@domain,' '\n'
|
||||||
|
'domain/resource, or address containing a subdomain.')
|
||||||
elif affiliation == 'owner':
|
elif affiliation == 'owner':
|
||||||
title = _('Adding Owner')
|
title = _('Adding Owner...')
|
||||||
prompt = _('Whom do you want to make a owner? (JID, domain, ...)')
|
prompt = _('<b>Whom do you want to make a owner?</b>' '\n\n'
|
||||||
|
'Can be one of the following:' '\n'
|
||||||
|
'1. user@domain/resource (only that resource matches).' '\n'
|
||||||
|
'2. user@domain (any resource matches).' '\n'
|
||||||
|
'3. domain/resource (only that resource matches).' '\n'
|
||||||
|
'4. domain (the domain itself matches, as does any user@domain,' '\n'
|
||||||
|
'domain/resource, or address containing a subdomain.')
|
||||||
else:
|
else:
|
||||||
title = _('Adding Administrator')
|
title = _('Adding Administrator...')
|
||||||
prompt = _('Whom do you want to make an administrator? (JID, domain, ...)')
|
prompt = _('<b>Whom do you want to make an administrator?</b>' '\n\n'
|
||||||
|
'Can be one of the following:' '\n'
|
||||||
|
'1. user@domain/resource (only that resource matches).' '\n'
|
||||||
|
'2. user@domain (any resource matches).' '\n'
|
||||||
|
'3. domain/resource (only that resource matches).' '\n'
|
||||||
|
'4. domain (the domain itself matches, as does any user@domain,' '\n'
|
||||||
|
'domain/resource, or address containing a subdomain.')
|
||||||
|
|
||||||
instance = dialogs.InputDialog(title, prompt)
|
instance = dialogs.InputDialog(title, prompt)
|
||||||
response = instance.get_response()
|
response = instance.get_response()
|
||||||
|
@ -1993,7 +2028,8 @@ class GroupchatConfigWindow(DataFormWindow):
|
||||||
def on_data_form_window_destroy(self, widget):
|
def on_data_form_window_destroy(self, widget):
|
||||||
del gajim.interface.instances[self.account]['gc_config'][self.room_jid]
|
del gajim.interface.instances[self.account]['gc_config'][self.room_jid]
|
||||||
|
|
||||||
def on_apply_button_clicked(self, widget):
|
def on_ok_button_clicked(self, widget):
|
||||||
|
# We pressed OK button of the DataFormWindow
|
||||||
gajim.connections[self.account].send_gc_config(self.room_jid, self.config)
|
gajim.connections[self.account].send_gc_config(self.room_jid, self.config)
|
||||||
for affiliation in ('outcast', 'member', 'owner', 'admin'):
|
for affiliation in ('outcast', 'member', 'owner', 'admin'):
|
||||||
list = {}
|
list = {}
|
||||||
|
|
|
@ -602,7 +602,7 @@ ok_handler = None):
|
||||||
label = xml.get_widget('label')
|
label = xml.get_widget('label')
|
||||||
self.input_entry = xml.get_widget('input_entry')
|
self.input_entry = xml.get_widget('input_entry')
|
||||||
self.dialog.set_title(title)
|
self.dialog.set_title(title)
|
||||||
label.set_text(label_str)
|
label.set_markup(label_str)
|
||||||
if input_str:
|
if input_str:
|
||||||
self.input_entry.set_text(input_str)
|
self.input_entry.set_text(input_str)
|
||||||
self.input_entry.select_region(0, -1) # select all
|
self.input_entry.select_region(0, -1) # select all
|
||||||
|
|
|
@ -11135,7 +11135,7 @@ Static</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<property name="focus_on_map">True</property>
|
<property name="focus_on_map">True</property>
|
||||||
<signal name="destroy" handler="on_data_form_window_destroy" last_modification_time="Wed, 05 Oct 2005 08:52:41 GMT"/>
|
<signal name="destroy" handler="on_data_form_window_destroy" last_modification_time="Thu, 19 Jan 2006 12:55:13 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox68">
|
<widget class="GtkVBox" id="vbox68">
|
||||||
|
@ -11263,34 +11263,33 @@ Static</property>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHButtonBox" id="hbuttonbox17">
|
<widget class="GtkHButtonBox" id="hbuttonbox32">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
<property name="spacing">10</property>
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="close_button">
|
<widget class="GtkButton" id="cancel_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label">gtk-close</property>
|
<property name="label">gtk-cancel</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Wed, 20 Apr 2005 21:21:04 GMT"/>
|
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Thu, 19 Jan 2006 12:47:07 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="apply_button">
|
<widget class="GtkButton" id="ok_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label">gtk-apply</property>
|
<property name="label">gtk-ok</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<signal name="clicked" handler="on_apply_button_clicked" last_modification_time="Wed, 05 Oct 2005 08:56:12 GMT"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -11884,7 +11883,7 @@ Static</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="label" translatable="yes"></property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="use_markup">True</property>
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap">False</property>
|
<property name="wrap">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="selectable">False</property>
|
||||||
|
|
Loading…
Reference in New Issue