fixes in glade, and some other stuff

This commit is contained in:
Nikos Kouremenos 2005-03-23 13:25:48 +00:00
parent baa8aab741
commit a425908513
5 changed files with 117 additions and 78 deletions

View file

@ -9,7 +9,7 @@ url="http://www.gajim.org"
license="GPL" license="GPL"
depends=(pygtk) depends=(pygtk)
source=($url/downloads/$pkgname-$pkgver.tar.bz2) source=($url/downloads/$pkgname-$pkgver.tar.bz2)
md5sums=(217c5e7f2f1523a5fde4219d238698a6) md5sums=(8175a3ccf93093f23865baebe4fa82f8)
build() { build() {
cd $startdir/src/$pkgname-$pkgver cd $startdir/src/$pkgname-$pkgver

View file

@ -3,8 +3,8 @@
## Gajim Team: ## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org> ## - Yann Le Boulanger <asterix@lagaule.org>
## - Vincent Hanquez <tab@snarc.org> ## - Vincent Hanquez <tab@snarc.org>
## - Nikos Kouremenos <nkour@jabber.org> ## - Nikos Kouremenos <kourem@gmail.com>
## - Alex Podaras <bigpod@jabber.org> ## - Alex Podaras <bigpod@gmail.com>
## ##
## Copyright (C) 2003-2005 Gajim Team ## Copyright (C) 2003-2005 Gajim Team
## ##
@ -1483,8 +1483,8 @@ class agent_registration_window:
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
class agent_browser_window: class Service_discovery_window:
"""Class for bowser agent window : """Class for Service Discovery Window :
to know the agents on the selected server""" to know the agents on the selected server"""
def on_agent_browser_window_destroy(self, widget): def on_agent_browser_window_destroy(self, widget):
"""close window""" """close window"""
@ -1595,8 +1595,8 @@ class agent_browser_window:
if plugin.connected[account] < 2: if plugin.connected[account] < 2:
Error_dialog(_("You must be connected to view Agents")) Error_dialog(_("You must be connected to view Agents"))
return return
xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP) xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
self.window = xml.get_widget('agent_browser_window') self.window = xml.get_widget('service_discovery_window')
self.agents_treeview = xml.get_widget('agents_treeview') self.agents_treeview = xml.get_widget('agents_treeview')
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account

View file

@ -429,9 +429,9 @@ class Add_contact_window:
widget.get_toplevel().destroy() widget.get_toplevel().destroy()
def fill_jid(self): def fill_jid(self):
agent_combobox = self.xml.get_widget('agent_combobox') protocol_combobox = self.xml.get_widget('protocol_combobox')
model = agent_combobox.get_model() model = protocol_combobox.get_model()
index = agent_combobox.get_active() index = protocol_combobox.get_active()
jid = self.xml.get_widget('uid_entry').get_text() jid = self.xml.get_widget('uid_entry').get_text()
if index > 0: if index > 0:
jid = jid.replace('@', '%') jid = jid.replace('@', '%')
@ -440,13 +440,13 @@ class Add_contact_window:
jid += '@' + agent jid += '@' + agent
self.xml.get_widget('jid_entry').set_text(jid) self.xml.get_widget('jid_entry').set_text(jid)
def on_agent_combobox_changed(self, widget): def on_protocol_combobox_changed(self, widget):
self.fill_jid() self.fill_jid()
def guess_agent(self): def guess_agent(self):
uid = self.xml.get_widget('uid_entry').get_text() uid = self.xml.get_widget('uid_entry').get_text()
agent_combobox = self.xml.get_widget('agent_combobox') protocol_combobox = self.xml.get_widget('protocol_combobox')
model = agent_combobox.get_model() model = protocol_combobox.get_model()
#If login contains only numbers, it's probably an ICQ number #If login contains only numbers, it's probably an ICQ number
try: try:
@ -455,9 +455,9 @@ class Add_contact_window:
pass pass
else: else:
if 'ICQ' in self.agents: if 'ICQ' in self.agents:
agent_combobox.set_active(self.agents.index('ICQ')) protocol_combobox.set_active(self.agents.index('ICQ'))
return return
agent_combobox.set_active(0) protocol_combobox.set_active(0)
def set_nickname(self): def set_nickname(self):
uid = self.xml.get_widget('uid_entry').get_text() uid = self.xml.get_widget('uid_entry').get_text()
@ -502,16 +502,16 @@ class Add_contact_window:
name = a name = a
iter = liststore.append([name, a]) iter = liststore.append([name, a])
self.agents.append(name) self.agents.append(name)
agent_combobox = self.xml.get_widget('agent_combobox') protocol_combobox = self.xml.get_widget('protocol_combobox')
agent_combobox.set_model(liststore) protocol_combobox.set_model(liststore)
agent_combobox.set_active(0) protocol_combobox.set_active(0)
self.fill_jid() self.fill_jid()
if jid: if jid:
self.xml.get_widget('jid_entry').set_text(jid) self.xml.get_widget('jid_entry').set_text(jid)
jid_splited = jid.split('@') jid_splited = jid.split('@')
self.xml.get_widget('uid_entry').set_text(jid_splited[0]) self.xml.get_widget('uid_entry').set_text(jid_splited[0])
if jid_splited[1] in jid_agents: if jid_splited[1] in jid_agents:
agent_combobox.set_active(jid_agents.index(jid_splited[1])+1) protocol_combobox.set_active(jid_agents.index(jid_splited[1])+1)
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
class About_dialog: class About_dialog:

View file

@ -47,7 +47,7 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image464"> <widget class="GtkImage" id="image481">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-new</property> <property name="stock">gtk-new</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -67,7 +67,7 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image465"> <widget class="GtkImage" id="image482">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-connect</property> <property name="stock">gtk-connect</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -93,7 +93,7 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image466"> <widget class="GtkImage" id="image483">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-add</property> <property name="stock">gtk-add</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -131,7 +131,7 @@
<signal name="activate" handler="on_about_menuitem_activate" last_modification_time="Tue, 01 Mar 2005 22:56:45 GMT"/> <signal name="activate" handler="on_about_menuitem_activate" last_modification_time="Tue, 01 Mar 2005 22:56:45 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image467"> <widget class="GtkImage" id="image484">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-about</property> <property name="stock">gtk-about</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -159,7 +159,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image468"> <widget class="GtkImage" id="image485">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-quit</property> <property name="stock">gtk-quit</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -194,7 +194,7 @@
<accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image469"> <widget class="GtkImage" id="image486">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-select-color</property> <property name="stock">gtk-select-color</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -208,13 +208,13 @@
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="browse_agents_menuitem"> <widget class="GtkImageMenuItem" id="service_disco_menuitem">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">_Browse Agents</property> <property name="label" translatable="yes">_Service Discovery</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image470"> <widget class="GtkImage" id="image487">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-find</property> <property name="stock">gtk-find</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -242,7 +242,7 @@
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image471"> <widget class="GtkImage" id="image488">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-preferences</property> <property name="stock">gtk-preferences</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -561,7 +561,7 @@
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
</packing> </packing>
</child> </child>
@ -1580,7 +1580,7 @@
<widget class="GtkWindow" id="add_contact_window"> <widget class="GtkWindow" id="add_contact_window">
<property name="border_width">4</property> <property name="border_width">4</property>
<property name="width_request">317</property> <property name="width_request">317</property>
<property name="height_request">260</property> <property name="height_request">277</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes">Add New Contact</property> <property name="title" translatable="yes">Add New Contact</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
@ -1603,7 +1603,7 @@
<child> <child>
<widget class="GtkTable" id="table21"> <widget class="GtkTable" id="table21">
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">5</property> <property name="n_rows">6</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">5</property> <property name="row_spacing">5</property>
@ -1636,7 +1636,7 @@
<child> <child>
<widget class="GtkLabel" id="label186"> <widget class="GtkLabel" id="label186">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Agent:</property> <property name="label" translatable="yes">Protocol:</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -1728,10 +1728,10 @@
</child> </child>
<child> <child>
<widget class="GtkComboBox" id="agent_combobox"> <widget class="GtkComboBox" id="protocol_combobox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="items" translatable="yes"></property> <property name="items" translatable="yes"></property>
<signal name="changed" handler="on_agent_combobox_changed" last_modification_time="Mon, 28 Feb 2005 22:56:52 GMT"/> <signal name="changed" handler="on_protocol_combobox_changed" last_modification_time="Wed, 23 Mar 2005 13:13:12 GMT"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -1743,27 +1743,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkEntry" id="jid_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">True</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> <child>
<widget class="GtkEntry" id="nickname_entry"> <widget class="GtkEntry" id="nickname_entry">
<property name="visible">True</property> <property name="visible">True</property>
@ -1785,6 +1764,27 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkEntry" id="jid_entry">
<property name="visible">True</property>
<property name="sensitive">False</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">True</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> <child>
<widget class="GtkCheckButton" id="auto_authorize_checkbutton"> <widget class="GtkCheckButton" id="auto_authorize_checkbutton">
<property name="visible">True</property> <property name="visible">True</property>
@ -1800,12 +1800,51 @@
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label223">
<property name="visible">True</property>
<property name="label" translatable="yes">Group:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property> <property name="top_attach">4</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">5</property>
<property name="x_options">fill</property> <property name="x_options">fill</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkComboBoxEntry" id="comboboxentry1">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">10</property> <property name="padding">10</property>
@ -2206,12 +2245,12 @@
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="agent_browser_window"> <widget class="GtkWindow" id="service_discovery_window">
<property name="border_width">4</property> <property name="border_width">4</property>
<property name="width_request">400</property> <property name="width_request">400</property>
<property name="height_request">250</property> <property name="height_request">250</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes">Agents browser</property> <property name="title" translatable="yes">Service Discovery</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property> <property name="modal">False</property>

View file

@ -207,19 +207,19 @@ class roster_window:
model.set_value(iter, 1, name) model.set_value(iter, 1, name)
def make_menu(self): def make_menu(self):
"""create the browse agents, add contact & join groupchat sub menus""" """create the main_window's menus"""
# try to avoid WIDGET_REALIZED_FOR_EVENT failed which freezes gajim # try to avoid WIDGET_REALIZED_FOR_EVENT failed which freezes gajim
new_message_menuitem = self.xml.get_widget('new_message_menuitem') new_message_menuitem = self.xml.get_widget('new_message_menuitem')
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem') join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
add_contact_menuitem = self.xml.get_widget('add_contact_menuitem') add_contact_menuitem = self.xml.get_widget('add_contact_menuitem')
browse_agents_menuitem = self.xml.get_widget('browse_agents_menuitem') service_disco_menuitem = self.xml.get_widget('service_disco_menuitem')
if self.add_contact_handler_id: if self.add_contact_handler_id:
add_contact_menuitem.handler_disconnect(self.add_contact_handler_id) add_contact_menuitem.handler_disconnect(self.add_contact_handler_id)
self.add_contact_handler_id = None self.add_contact_handler_id = None
if self.browse_agents_handler_id: if self.service_disco_handler_id:
browse_agents_menuitem.handler_disconnect(\ service_disco_menuitem.handler_disconnect(\
self.browse_agents_handler_id) self.service_disco_handler_id)
self.browse_agents_handler_id = None self.service_disco_handler_id = None
if self.join_gc_handler_id: if self.join_gc_handler_id:
join_gc_menuitem.handler_disconnect(self.join_gc_handler_id) join_gc_menuitem.handler_disconnect(self.join_gc_handler_id)
self.join_gc_handler_id = None self.join_gc_handler_id = None
@ -230,8 +230,8 @@ class roster_window:
#remove the existing submenus #remove the existing submenus
if add_contact_menuitem.get_submenu(): if add_contact_menuitem.get_submenu():
add_contact_menuitem.remove_submenu() add_contact_menuitem.remove_submenu()
if browse_agents_menuitem.get_submenu(): if service_disco_menuitem.get_submenu():
browse_agents_menuitem.remove_submenu() service_disco_menuitem.remove_submenu()
if join_gc_menuitem.get_submenu(): if join_gc_menuitem.get_submenu():
join_gc_menuitem.remove_submenu() join_gc_menuitem.remove_submenu()
if new_message_menuitem.get_submenu(): if new_message_menuitem.get_submenu():
@ -240,12 +240,12 @@ class roster_window:
new_message_menuitem.set_sensitive(True) new_message_menuitem.set_sensitive(True)
join_gc_menuitem.set_sensitive(True) join_gc_menuitem.set_sensitive(True)
add_contact_menuitem.set_sensitive(True) add_contact_menuitem.set_sensitive(True)
browse_agents_menuitem.set_sensitive(True) service_disco_menuitem.set_sensitive(True)
else: else:
new_message_menuitem.set_sensitive(False) new_message_menuitem.set_sensitive(False)
join_gc_menuitem.set_sensitive(False) join_gc_menuitem.set_sensitive(False)
add_contact_menuitem.set_sensitive(False) add_contact_menuitem.set_sensitive(False)
browse_agents_menuitem.set_sensitive(False) service_disco_menuitem.set_sensitive(False)
if len(self.plugin.accounts.keys()) >= 2: # 2 or more accounts? make submenus if len(self.plugin.accounts.keys()) >= 2: # 2 or more accounts? make submenus
#add #add
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
@ -257,11 +257,11 @@ class roster_window:
sub_menu.show_all() sub_menu.show_all()
#agents #agents
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
browse_agents_menuitem.set_submenu(sub_menu) service_disco_menuitem.set_submenu(sub_menu)
for account in self.plugin.accounts.keys(): for account in self.plugin.accounts.keys():
item = gtk.MenuItem(_('using ') + account + _(' account')) item = gtk.MenuItem(_('using ') + account + _(' account'))
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_browse_agents, account) item.connect('activate', self.on_service_disco_menuitem_activate, account)
sub_menu.show_all() sub_menu.show_all()
#join gc #join gc
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
@ -285,9 +285,9 @@ class roster_window:
self.add_contact_handler_id = add_contact_menuitem.connect(\ self.add_contact_handler_id = add_contact_menuitem.connect(\
'activate', self.on_add_contact, self.plugin.accounts.keys()[0]) 'activate', self.on_add_contact, self.plugin.accounts.keys()[0])
#agents #agents
if not self.browse_agents_handler_id: if not self.service_disco_handler_id:
self.browse_agents_handler_id = browse_agents_menuitem.connect(\ self.service_disco_handler_id = service_disco_menuitem.connect(\
'activate', self.on_browse_agents, self.plugin.accounts.keys()[0]) 'activate', self.on_service_disco_menuitem_activate, self.plugin.accounts.keys()[0])
#join_gc #join_gc
if not self.join_gc_handler_id: if not self.join_gc_handler_id:
self.join_gc_handler_id = join_gc_menuitem.connect(\ self.join_gc_handler_id = join_gc_menuitem.connect(\
@ -565,7 +565,7 @@ class roster_window:
item.connect("activate", self.on_edit_account, account) item.connect("activate", self.on_edit_account, account)
item = gtk.MenuItem(_("_Browse agents")) item = gtk.MenuItem(_("_Browse agents"))
menu.append(item) menu.append(item)
item.connect("activate", self.on_browse_agents, account) item.connect("activate", self.on_service_disco_menuitem_activate, account)
item = gtk.MenuItem(_("_Add contact")) item = gtk.MenuItem(_("_Add contact"))
menu.append(item) menu.append(item)
item.connect("activate", self.on_add_contact, account) item.connect("activate", self.on_add_contact, account)
@ -1083,12 +1083,12 @@ class roster_window:
user.groups)) user.groups))
model.set_value(iter, 5, False) model.set_value(iter, 5, False)
def on_browse_agents(self, widget, account): def on_service_disco_menuitem_activate(self, widget, account):
"""When browse agent is selected : """When Service Discovery is selected:
Call browse class""" Call browse class"""
if not self.plugin.windows[account].has_key('browser'): if not self.plugin.windows[account].has_key('browser'):
self.plugin.windows[account]['browser'] = \ self.plugin.windows[account]['browser'] = \
agent_browser_window(self.plugin, account) Service_discovery_window(self.plugin, account)
def mkpixbufs(self): def mkpixbufs(self):
"""initialise pixbufs array""" """initialise pixbufs array"""
@ -1254,7 +1254,7 @@ class roster_window:
self.plugin = plugin self.plugin = plugin
self.nb_unread = 0 self.nb_unread = 0
self.add_contact_handler_id = False self.add_contact_handler_id = False
self.browse_agents_handler_id = False self.service_disco_handler_id = False
self.join_gc_handler_id = False self.join_gc_handler_id = False
self.new_message_menuitem_handler_id = False self.new_message_menuitem_handler_id = False
self.regroup = 0 self.regroup = 0