Merge branch 'change_password_fix' into 'master'

Disable button if password changing is not supported

See merge request !85
This commit is contained in:
Philipp Hörist 2017-04-19 18:54:20 +02:00
commit 14091642c4
2 changed files with 11 additions and 0 deletions

View File

@ -779,6 +779,7 @@ class Connection(CommonConnection, ConnectionHandlers):
self.music_track_info = 0
self.location_info = {}
self.pubsub_supported = False
self.register_supported = False
self.pubsub_publish_options_supported = False
# Do we auto accept insecure connection
self.connection_auto_accepted = False
@ -2001,6 +2002,8 @@ class Connection(CommonConnection, ConnectionHandlers):
if nbxmpp.NS_VCARD in obj.features:
self.vcard_supported = True
get_action(self.name + '-profile').set_enabled(True)
if nbxmpp.NS_REGISTER in obj.features:
self.register_supported = True
if nbxmpp.NS_PUBSUB in obj.features:
self.pubsub_supported = True
if nbxmpp.NS_PUBSUB_PUBLISH_OPTIONS in obj.features:

View File

@ -1541,6 +1541,7 @@ class AccountsWindow:
self.accounts_treeview = self.xml.get_object('accounts_treeview')
self.remove_button = self.xml.get_object('remove_button')
self.rename_button = self.xml.get_object('rename_button')
self.change_password_button = self.xml.get_object('change_password_button1')
path_to_kbd_input_img = gtkgui_helpers.get_icon_path('gajim-kbd_input')
img = self.xml.get_object('rename_image')
img.set_from_file(path_to_kbd_input_img)
@ -1604,6 +1605,7 @@ class AccountsWindow:
"""
self.remove_button.set_sensitive(False)
self.rename_button.set_sensitive(False)
self.change_password_button.set_sensitive(False)
self.current_account = None
model = self.accounts_treeview.get_model()
model.clear()
@ -1713,9 +1715,15 @@ class AccountsWindow:
if account:
self.remove_button.set_sensitive(True)
self.rename_button.set_sensitive(True)
if account != gajim.ZEROCONF_ACC_NAME:
self.change_password_button.set_sensitive(
gajim.connections[account].register_supported)
else:
self.remove_button.set_sensitive(False)
self.rename_button.set_sensitive(False)
self.change_password_button.set_sensitive(False)
if iter_:
self.current_account = account
if account == gajim.ZEROCONF_ACC_NAME: