diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py
index 0f574b8a8..9a59a1e93 100644
--- a/plugins/gtkgui/config.py
+++ b/plugins/gtkgui/config.py
@@ -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, self.plugin, self.account)
+ vCard_Window(jid.get_text(), self.plugin, self.account)
self.plugin.send('ASK_VCARD', self.account, jid)
else:
warning_Window(_('You must be connected to get your informations'))
@@ -1126,49 +1126,58 @@ class accountpreferences_window:
self.init_account(infos)
self.xml.get_widget('new_account_checkbutton').set_sensitive(False)
-class accounts_Window:
+class accounts_window:
"""Class for accounts window : lists of accounts"""
- def delete_event(self, widget):
+ def on_accounts_window_delete_event(self, widget, event):
"""close window"""
+ print 'delete'
del self.plugin.windows['accounts']
- def on_close(self, widget):
+ def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
+ print 'destroy'
widget.get_toplevel().destroy()
def init_accounts(self):
"""initialize listStore with existing accounts"""
- self.xml.get_widget("modify_button").set_sensitive(False)
- self.xml.get_widget("delete_button").set_sensitive(False)
+ self.xml.get_widget('modify_button').set_sensitive(False)
+ self.xml.get_widget('delete_button').set_sensitive(False)
model = self.accounts_treeview.get_model()
model.clear()
for account in self.plugin.accounts:
activ = 1
- if self.plugin.accounts[account].has_key("active"):
- activ = self.plugin.accounts[account]["active"]
+ if self.plugin.accounts[account].has_key('active'):
+ activ = self.plugin.accounts[account]['active']
iter = model.append()
model.set(iter, 0, account, 1, \
- self.plugin.accounts[account]["hostname"], 2, activ)
+ self.plugin.accounts[account]['hostname'], 2, activ)
def on_row_activated(self, widget):
"""Activate delete and modify buttons when a row is selected"""
self.xml.get_widget("modify_button").set_sensitive(True)
self.xml.get_widget("delete_button").set_sensitive(True)
- def on_new_clicked(self, widget):
+ def on_new_button_clicked(self, widget):
"""When new button is clicked : open an account information window"""
if not self.plugin.windows.has_key('accountPreference'):
self.plugin.windows['accountPreference'] = \
accountpreferences_window(self.plugin)
- def on_delete_clicked(self, widget):
+ def on_delete_button_clicked(self, widget):
"""When delete button is clicked :
Remove an account from the listStore and from the config file"""
sel = self.accounts_treeview.get_selection()
(model, iter) = sel.get_selected()
account = model.get_value(iter, 0)
- window = confirm_Window(_("Are you sure you want to remove this account (%s) ?") % account)
- if window.wait() == gtk.RESPONSE_OK:
+
+ dlg = gtk.MessageDialog(None,
+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,
+ _("Are you sure you want to remove\nthis account (%s) ?") % account)
+ response = dlg.run()
+ dlg.hide()
+
+ if response == gtk.RESPONSE_YES:
if self.plugin.connected[account]:
self.plugin.send('STATUS', account, ('offline', 'offline'))
del self.plugin.accounts[account]
@@ -1182,7 +1191,7 @@ class accounts_Window:
self.plugin.roster.draw_roster()
self.init_accounts()
- def on_modify_clicked(self, widget):
+ def on_modify_button_clicked(self, widget):
"""When modify button is clicked :
open the account information window for this account"""
if not self.plugin.windows.has_key('accountPreference'):
@@ -1226,12 +1235,7 @@ class accounts_Window:
renderer.connect('toggled', self.on_toggled, model)
self.accounts_treeview.insert_column_with_attributes(-1, _('Active'), \
renderer, active=2)
- self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
- self.xml.signal_connect('on_row_activated', self.on_row_activated)
- self.xml.signal_connect('on_new_clicked', self.on_new_clicked)
- self.xml.signal_connect('on_delete_clicked', self.on_delete_clicked)
- self.xml.signal_connect('on_modify_clicked', self.on_modify_clicked)
- self.xml.signal_connect('on_close_clicked', self.on_close)
+ self.xml.signal_autoconnect(self)
self.init_accounts()
@@ -1286,14 +1290,18 @@ class agentRegistration_Window:
self.xml.signal_connect('on_button_ok_clicked', self.on_ok)
-class agent_browser_window:
+class browseAgent_Window:
"""Class for bowser agent window :
to know the agents on the selected server"""
- def on_agent_browser_window_destroy(self, widget):
+ def delete_event(self, widget):
"""close window"""
del self.plugin.windows[self.account]['browser']
- def on_close_button_clicked(self, widget):
+ def on_cancel(self, widget):
+ """When Cancel button is clicked"""
+ widget.get_toplevel().destroy()
+
+ def on_close(self, widget):
"""When Close button is clicked"""
widget.get_toplevel().destroy()
@@ -1304,14 +1312,14 @@ class agent_browser_window:
def agents(self, agents):
"""When list of available agent arrive :
Fill the treeview with it"""
- model = self.agents_treeview.get_model()
+ model = self.treeview.get_model()
for agent in agents:
iter = model.append(None, (agent['name'], agent['jid']))
self.agent_infos[agent['jid']] = {'features' : []}
def agent_info(self, agent, identities, features, items):
"""When we recieve informations about an agent"""
- model = self.agents_treeview.get_model()
+ model = self.treeview.get_model()
iter = model.get_iter_root()
expand = 0
while (iter):
@@ -1336,24 +1344,23 @@ class agent_browser_window:
model.append(iter, (item['name'], item['jid']))
self.agent_infos[item['jid']] = {'identities': [item]}
if expand:
- self.agents_treeview.expand_row((model.get_path(iter)), False)
+ self.treeview.expand_row((model.get_path(iter)), False)
- def on_refresh_button_clicked(self, widget):
+ def on_refresh(self, widget):
"""When refresh button is clicked :
refresh list : clear and rerequest it"""
- self.agents_treeview.get_model().clear()
+ self.treeview.get_model().clear()
self.browse()
- def on_agents_treeview_row_activated(self, widget, path, col=0):
+ def on_row_activated(self, widget, path, col=0):
"""When a row is activated :
Register or join the selected agent"""
- #TODO
pass
def on_join_button_clicked(self, widget):
"""When we want to join a conference :
Ask specific informations about the selected agent and close the window"""
- model, iter = self.agents_treeview.get_selection().get_selected()
+ model, iter = self.treeview.get_selection().get_selected()
if not iter:
return
service = model.get_value(iter, 1)
@@ -1368,17 +1375,17 @@ class agent_browser_window:
def on_register_button_clicked(self, widget):
"""When we want to register an agent :
Ask specific informations about the selected agent and close the window"""
- model, iter = self.agents_treeview.get_selection().get_selected()
+ model, iter = self.treeview.get_selection().get_selected()
if not iter :
return
service = model.get_value(iter, 1)
self.plugin.send('REG_AGENT_INFO', self.account, service)
widget.get_toplevel().destroy()
- def on_agents_treeview_cursor_changed(self, widget):
+ def on_cursor_changed(self, widget):
"""When we select a row :
activate buttons if needed"""
- model, iter = self.agents_treeview.get_selection().get_selected()
+ model, iter = self.treeview.get_selection().get_selected()
jid = model.get_value(iter, 1)
self.register_button.set_sensitive(False)
if self.agent_infos[jid].has_key('features'):
@@ -1395,29 +1402,35 @@ class agent_browser_window:
if not plugin.connected[account]:
warning_Window(_("You must be connected to view Agents"))
return
- xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP)
- self.window = xml.get_widget('agent_browser_window')
- self.agents_treeview = xml.get_widget('agents_treeview')
+ xml = gtk.glade.XML(GTKGUI_GLADE, 'browser', APP)
+ self.window = xml.get_widget('browser')
+ self.treeview = xml.get_widget('treeview')
self.plugin = plugin
self.account = account
self.agent_infos = {}
model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
- self.agents_treeview.set_model(model)
+ self.treeview.set_model(model)
#columns
renderer = gtk.CellRendererText()
renderer.set_data('column', 0)
- self.agents_treeview.insert_column_with_attributes(-1, 'Name', \
- renderer, text=0)
+ self.treeview.insert_column_with_attributes(-1, 'Name', renderer, text=0)
renderer = gtk.CellRendererText()
renderer.set_data('column', 1)
- self.agents_treeview.insert_column_with_attributes(-1, 'Service', \
+ self.treeview.insert_column_with_attributes(-1, 'Service', \
renderer, text=1)
self.register_button = xml.get_widget('register_button')
self.register_button.set_sensitive(False)
self.join_button = xml.get_widget('join_button')
self.join_button.set_sensitive(False)
- xml.signal_autoconnect(self)
+
+ xml.signal_connect('gtk_widget_destroy', self.delete_event)
+ xml.signal_connect('on_refresh_clicked', self.on_refresh)
+ xml.signal_connect('on_row_activated', self.on_row_activated)
+ xml.signal_connect('on_join_button_clicked', self.on_join_button_clicked)
+ xml.signal_connect('on_register_button_clicked', self.on_register_button_clicked)
+ xml.signal_connect('on_cursor_changed', self.on_cursor_changed)
+ xml.signal_connect('on_close_clicked', self.on_close)
self.browse()
class join_gc:
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index 4e33c4ea0..5e43cd23f 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -671,7 +671,7 @@
False
GDK_WINDOW_TYPE_HINT_NORMAL
GDK_GRAVITY_NORTH_WEST
-
+
@@ -747,20 +747,7 @@
True
GTK_RELIEF_NORMAL
True
-
-
-
-
-
-
- True
- True
- True
- gtk-delete
- True
- GTK_RELIEF_NORMAL
- True
-
+
@@ -771,10 +758,10 @@
True
GTK_RELIEF_NORMAL
True
-
+
-
+
True
0.5
0.5
@@ -786,13 +773,13 @@
0
-
+
True
False
2
-
+
True
gtk-refresh
4
@@ -809,7 +796,7 @@
-
+
True
_Modify
True
@@ -835,6 +822,19 @@
+
+
+ True
+ True
+ True
+ gtk-delete
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
True
@@ -844,7 +844,7 @@
True
GTK_RELIEF_NORMAL
True
-
+
@@ -2548,92 +2548,6 @@ on the server as a vCard
-
- 5
- True
- Sure ?
- GTK_WINDOW_TOPLEVEL
- GTK_WIN_POS_NONE
- False
- True
- False
- True
- False
- False
- GDK_WINDOW_TYPE_HINT_DIALOG
- GDK_GRAVITY_NORTH_WEST
- True
-
-
-
- True
- False
- 0
-
-
-
- True
- GTK_BUTTONBOX_END
-
-
-
- True
- True
- True
- gtk-cancel
- True
- GTK_RELIEF_NORMAL
- True
- -6
-
-
-
-
-
- True
- True
- True
- gtk-ok
- True
- GTK_RELIEF_NORMAL
- True
- -5
-
-
-
-
- 5
- False
- True
- GTK_PACK_END
-
-
-
-
-
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- True
- False
- 0.5
- 0.5
- 0
- 0
- okbutton
-
-
- 10
- True
- True
-
-
-
-
-
-
5
True
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index c864d50d6..8d5b70317 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -2029,7 +2029,7 @@ class roster_Window:
"""When accounts is seleted :
call the accounts class to modify accounts"""
if not self.plugin.windows.has_key('accounts'):
- self.plugin.windows['accounts'] = accounts_Window(self.plugin)
+ self.plugin.windows['accounts'] = accounts_window(self.plugin)
def close_all(self, dic):
"""close all the windows in the given dictionary"""