disable bookmark button / menuitem when room is already bookmarked. Fixes #4156

This commit is contained in:
Yann Leboulanger 2008-11-03 06:08:10 +00:00
parent 3d7ef26ddb
commit e706e86c2e
1 changed files with 16 additions and 5 deletions

View File

@ -194,8 +194,14 @@ class GroupchatControl(ChatControlBase):
self.handlers[id] = widget self.handlers[id] = widget
widget = self.xml.get_widget('bookmark_button') widget = self.xml.get_widget('bookmark_button')
id = widget.connect('clicked', self._on_bookmark_room_menuitem_activate) for bm in gajim.connections[self.account].bookmarks:
self.handlers[id] = widget if bm['jid'] == self.contact.jid:
widget.set_sensitive(False)
break
else:
id = widget.connect('clicked',
self._on_bookmark_room_menuitem_activate)
self.handlers[id] = widget
widget = self.xml.get_widget('list_treeview') widget = self.xml.get_widget('list_treeview')
id = widget.connect('row_expanded', self.on_list_treeview_row_expanded) id = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
@ -271,9 +277,14 @@ class GroupchatControl(ChatControlBase):
xm = gtkgui_helpers.get_glade('gc_control_popup_menu.glade') xm = gtkgui_helpers.get_glade('gc_control_popup_menu.glade')
self.bookmark_room_menuitem = xm.get_widget('bookmark_room_menuitem') self.bookmark_room_menuitem = xm.get_widget('bookmark_room_menuitem')
id = self.bookmark_room_menuitem.connect('activate', for bm in gajim.connections[self.account].bookmarks:
self._on_bookmark_room_menuitem_activate) if bm['jid'] == self.room_jid:
self.handlers[id] = self.bookmark_room_menuitem self.bookmark_room_menuitem.set_sensitive(False)
break
else:
id = self.bookmark_room_menuitem.connect('activate',
self._on_bookmark_room_menuitem_activate)
self.handlers[id] = self.bookmark_room_menuitem
self.change_nick_menuitem = xm.get_widget('change_nick_menuitem') self.change_nick_menuitem = xm.get_widget('change_nick_menuitem')
id = self.change_nick_menuitem.connect('activate', id = self.change_nick_menuitem.connect('activate',