Author: asterix Date: 2007-02-14 17:48:25 +0100 (Wed, 14 Feb 2007) New Revision: 7979
Modified: trunk/src/common/connection.py trunk/src/common/connection_handlers.py trunk/src/config.py trunk/src/gajim.py Log: use new dataform widget in groupchat config window
Modified: trunk/src/common/connection.py =================================================================== --- trunk/src/common/connection.py 2007-02-14 10:56:22 UTC (rev 7978) +++ trunk/src/common/connection.py 2007-02-14 16:48:25 UTC (rev 7979) @@ -1232,11 +1232,12 @@ item.setAttr('affiliation', affiliation) self.connection.send(iq)
- def send_gc_config(self, room_jid, config): + def send_gc_config(self, room_jid, form): iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS =\ common.xmpp.NS_MUC_OWNER) query = iq.getTag('query') - self.build_data_from_dict(query, config) + form.setAttr('type', 'submit') + query.addChild(node = form) self.connection.send(iq)
def gpg_passphrase(self, passphrase):
Modified: trunk/src/common/connection_handlers.py =================================================================== --- trunk/src/common/connection_handlers.py 2007-02-14 10:56:22 UTC (rev 7978) +++ trunk/src/common/connection_handlers.py 2007-02-14 16:48:25 UTC (rev 7979) @@ -1849,8 +1849,7 @@ node = q if not node: return - dic = self.parse_data_form(node) - self.dispatch('GC_CONFIG', (helpers.get_full_jid_from_iq(iq_obj), dic)) + self.dispatch('GC_CONFIG', (helpers.get_full_jid_from_iq(iq_obj), node))
def _MucAdminCB(self, con, iq_obj): gajim.log.debug('MucAdminCB')
Modified: trunk/src/config.py =================================================================== --- trunk/src/config.py 2007-02-14 10:56:22 UTC (rev 7978) +++ trunk/src/config.py 2007-02-14 16:48:25 UTC (rev 7979) @@ -28,6 +28,7 @@ import cell_renderer_image import message_control import chat_control +import dataforms_widget
try: import gtkspell @@ -41,6 +42,7 @@ from common import passwords from common import zeroconf from common import dbus_support +from common import dataforms
from common.exceptions import GajimGeneralException
@@ -2297,11 +2299,12 @@ self.window.destroy()
-class GroupchatConfigWindow(DataFormWindow): +class GroupchatConfigWindow: '''GroupchatConfigWindow class''' - def __init__(self, account, room_jid, config = None): - DataFormWindow.__init__(self, account, config) + def __init__(self, account, room_jid, form = None): + self.account = account self.room_jid = room_jid + self.form = form self.remove_button = {} self.affiliation_treeview = {} self.list_init = {} # list at the beginning @@ -2310,9 +2313,25 @@ 'owner': _('Owner List'), 'admin':_('Administrator List')}
- # Draw the edit affiliation list things + self.xml = gtkgui_helpers.get_glade('data_form_window.glade', 'data_form_window') + self.window = self.xml.get_widget('data_form_window') + self.window.set_transient_for(gajim.interface.roster.window) + + if self.form: + config_vbox = self.xml.get_widget('config_vbox') + dataform = dataforms.ExtendForm(node = self.form) + self.data_form_widget = dataforms_widget.DataFormWidget(dataform) + # hide scrollbar of this data_form_widget, we already have in this + # widget + sw = self.data_form_widget.xml.get_widget('single_form_scrolledwindow') + sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) + + self.data_form_widget.show() + config_vbox.pack_start(self.data_form_widget) + + # Draw the edit affiliation list things add_on_vbox = self.xml.get_widget('add_on_vbox') - + for affiliation in ('outcast', 'member', 'owner', 'admin'): self.list_init[affiliation] = {} hbox = gtk.HBox(spacing = 5) @@ -2369,8 +2388,12 @@ gajim.connections[self.account].get_affiliation_list(self.room_jid, affiliation)
- add_on_vbox.show_all() + self.xml.signal_autoconnect(self) + self.window.show_all()
+ def on_cancel_button_clicked(self, widget): + self.window.destroy() + def on_cell_edited(self, cell, path, new_text): model = self.affiliation_treeview['outcast'].get_model() new_text = new_text.decode('utf-8') @@ -2448,9 +2471,9 @@
def on_ok_button_clicked(self, widget): # We pressed OK button of the DataFormWindow - if self.config: - gajim.connections[self.account].send_gc_config(self.room_jid, - self.config) + if self.form: + form = self.data_form_widget.data_form + gajim.connections[self.account].send_gc_config(self.room_jid, form) for affiliation in ('outcast', 'member', 'owner', 'admin'): list = {} actual_jid_list = []
Modified: trunk/src/gajim.py =================================================================== --- trunk/src/gajim.py 2007-02-14 10:56:22 UTC (rev 7978) +++ trunk/src/gajim.py 2007-02-14 16:48:25 UTC (rev 7979) @@ -1119,7 +1119,7 @@ gc_control.print_conversation(text)
def handle_event_gc_config(self, account, array): - #('GC_CONFIG', account, (jid, config)) config is a dict + #('GC_CONFIG', account, (jid, form)) config is a dict room_jid = array[0].split('/')[0] if room_jid in gajim.automatic_rooms[account]: # use default configuration