mention menuitem by name [so refactoring does not break code]; fix sensitivy of history to be disabled for transports
This commit is contained in:
parent
73905ec169
commit
af9edc1f7c
|
@ -750,7 +750,6 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
xm = gtk.glade.XML(GTKGUI_GLADE, 'chat_control_popup_menu', APP)
|
xm = gtk.glade.XML(GTKGUI_GLADE, 'chat_control_popup_menu', APP)
|
||||||
xm.signal_autoconnect(self)
|
xm.signal_autoconnect(self)
|
||||||
self.popup_menu = xm.get_widget('chat_control_popup_menu')
|
|
||||||
|
|
||||||
# Initialize drag-n-drop
|
# Initialize drag-n-drop
|
||||||
self.TARGET_TYPE_URI_LIST = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
|
@ -1171,32 +1170,49 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
def prepare_context_menu(self):
|
def prepare_context_menu(self):
|
||||||
'''sets compact view menuitem active state
|
'''sets compact view menuitem active state
|
||||||
sets active and sensitivity state for toggle_gpg_menuitem'''
|
sets active and sensitivity state for toggle_gpg_menuitem
|
||||||
menu = self.popup_menu
|
sets sensitivity for history_menuitem (False for tranasports)
|
||||||
childs = menu.get_children()
|
and file_transfer_menuitem
|
||||||
# check if gpg capabitlies or else make gpg toggle insensitive
|
and hide()/show() for add_to_roster_menuitem
|
||||||
|
'''
|
||||||
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'chat_control_popup_menu', APP)
|
||||||
|
menu = xm.get_widget('chat_control_popup_menu')
|
||||||
|
|
||||||
|
history_menuitem = xml.get_widget('history_menuitem')
|
||||||
|
toggle_gpg_menuitem = xml.get_widget('toggle_gpg_menuitem')
|
||||||
|
add_to_roster_menuitem = xml.get_widget('add_to_roster_menuitem')
|
||||||
|
send_file_menuitem = xml.get_widget('send_file_menuitem')
|
||||||
|
compact_view_menuitem = xml.get_widget('compact_view_menuitem')
|
||||||
|
|
||||||
contact = self.parent_win.get_active_contact()
|
contact = self.parent_win.get_active_contact()
|
||||||
jid = contact.jid
|
jid = contact.jid
|
||||||
|
|
||||||
|
# history_menuitem
|
||||||
|
if gajim.jid_is_transport(jid):
|
||||||
|
history_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
|
# check if gpg capabitlies or else make gpg toggle insensitive
|
||||||
gpg_btn = self.xml.get_widget('gpg_togglebutton')
|
gpg_btn = self.xml.get_widget('gpg_togglebutton')
|
||||||
isactive = gpg_btn.get_active()
|
isactive = gpg_btn.get_active()
|
||||||
issensitive = gpg_btn.get_property('sensitive')
|
issensitive = gpg_btn.get_property('sensitive')
|
||||||
childs[3].set_active(isactive)
|
toggle_gpg_menuitem.set_active(isactive)
|
||||||
childs[3].set_property('sensitive', issensitive)
|
toggle_gpg_menuitem.set_property('sensitive', issensitive)
|
||||||
|
|
||||||
# If we don't have resource, we can't do file transfer
|
# If we don't have resource, we can't do file transfer
|
||||||
if not contact.resource:
|
if contact.resource:
|
||||||
childs[2].set_sensitive(False)
|
send_file_menuitem.set_sensitive(True)
|
||||||
else:
|
else:
|
||||||
childs[2].set_sensitive(True)
|
send_file_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
# compact_view_menuitem
|
# compact_view_menuitem
|
||||||
childs[4].set_active(self.compact_view_current)
|
compact_view_menuitem.set_active(self.compact_view_current)
|
||||||
|
|
||||||
if _('Not in Roster') in contact.groups: # for add_to_roster_menuitem
|
if _('Not in Roster') in contact.groups: # for add_to_roster_menuitem
|
||||||
childs[5].show()
|
add_to_roster_menuitem.show()
|
||||||
childs[5].set_no_show_all(False)
|
add_to_roster_menuitem.set_no_show_all(False)
|
||||||
else:
|
else:
|
||||||
childs[5].hide()
|
add_to_roster_menuitem.hide()
|
||||||
childs[5].set_no_show_all(True)
|
add_to_roster_menuitem.set_no_show_all(True)
|
||||||
|
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue