How to use the common.gajim.config.get_per function in common

To help you get started, we’ve selected a few common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sgala / gajim / src / config.py View on Github external
custom_port = gajim.config.get_per('accounts', account, 'custom_port')
		if not custom_port:
			custom_port = 5222
		self.xml.get_widget('custom_port_entry1').set_text(unicode(custom_port))

		# Personal tab
		gpg_key_label = self.xml.get_widget('gpg_key_label1')
		if gajim.config.get('usegpg'):
			self.xml.get_widget('gpg_choose_button1').set_sensitive(True)
			self.init_account_gpg()
		else:
			gpg_key_label.set_text(_('OpenPGP is not usable in this computer'))
			self.xml.get_widget('gpg_choose_button1').set_sensitive(False)

		# General tab
		self.xml.get_widget('autoconnect_checkbutton1').set_active(gajim.config.\
			get_per('accounts', account, 'autoconnect'))
		self.xml.get_widget('autoreconnect_checkbutton1').set_active(gajim.
			config.get_per('accounts', account, 'autoreconnect'))

		list_no_log_for = gajim.config.get_per('accounts', account,
			'no_log_for').split()
		if account in list_no_log_for:
			self.xml.get_widget('log_history_checkbutton1').set_active(False)
		else:
			self.xml.get_widget('log_history_checkbutton1').set_active(True)

		self.xml.get_widget('sync_with_global_status_checkbutton1').set_active(
			gajim.config.get_per('accounts', account, 'sync_with_global_status'))
		self.xml.get_widget('use_ft_proxies_checkbutton1').set_active(
			gajim.config.get_per('accounts', account, 'use_ft_proxies'))
github gajim / gajim / src / gajim.py View on Github external
path = gtkgui_helpers.get_path_to_generic_or_avatar(img,
							jid = jid, suffix = '_notif_size_colored.png')
						title = _('%(nickname)s Signed In') % \
							{'nickname': gajim.get_name_from_jid(account, jid)}
						text = ''
						if status_message:
							text = status_message
						notify.notify(_('Contact Signed In'), jid, account,
							path_to_image = path, title = title, text = text)

				if self.remote_ctrl:
					self.remote_ctrl.raise_signal('ContactPresence',
						(account, array))
				
			elif old_show > 1 and new_show < 2:
				if gajim.config.get_per('soundevents', 'contact_disconnected',
						'enabled'):
					helpers.play_sound('contact_disconnected')
				if not gajim.awaiting_events[account].has_key(jid) and \
					gajim.config.get('notify_on_signout'):
					if helpers.allow_showing_notification(account):
						transport_name = gajim.get_transport_name_from_jid(jid)
						img = None
						if transport_name:
							img = os.path.join(gajim.DATA_DIR, 'iconsets',
								'transports', transport_name, '48x48',
								'offline.png')
						if not img or not os.path.isfile(img):
							iconset = gajim.config.get('iconset')
							img = os.path.join(gajim.DATA_DIR, 'iconsets',
									iconset, '48x48', 'offline.png')
						path = gtkgui_helpers.get_path_to_generic_or_avatar(img,
github gajim / gajim / src / config.py View on Github external
'first_message_received': _('First Message Received'),
			'next_message_received_focused': _('Next Message Received Focused'),
			'next_message_received_unfocused':
				_('Next Message Received Unfocused'),
			'contact_connected': _('Contact Connected'),
			'contact_disconnected': _('Contact Disconnected'),
			'message_sent': _('Message Sent'),
			'muc_message_highlight': _('Group Chat Message Highlight'),
			'muc_message_received': _('Group Chat Message Received'),
			'gmail_received': _('GMail Email Received')
		}

		for sound_event_config_name, sound_ui_name in sounds_dict.items():
			enabled = gajim.config.get_per('soundevents',
				sound_event_config_name, 'enabled')
			path = gajim.config.get_per('soundevents',
				sound_event_config_name, 'path')
			model.append((enabled, sound_ui_name, path, sound_event_config_name))
github gajim / gajim / src / common / connection.py View on Github external
def change_password(self, password, username):
		if not self.connection:
			return
		hostname = gajim.config.get_per('accounts', self.name, 'hostname')
		iq = common.xmpp.Iq(typ = 'set', to = hostname)
		q = iq.setTag(common.xmpp.NS_REGISTER + ' query')
		q.setTagData('username',username)
		q.setTagData('password',password)
		self.connection.send(iq)
github gajim / gajim / src / config.py View on Github external
def fill_proxies_treeview(self):
		model = self.proxies_treeview.get_model()
		model.clear()
		iter = model.append()
		model.set(iter, 0, _('None'))
		for p in gajim.config.get_per('proxies'):
			iter = model.append()
			model.set(iter, 0, p)
github sgala / gajim / src / config.py View on Github external
spinbutton = self.xml.get_widget('priority_spinbutton1')
		if gajim.config.get('enable_negative_priority'):
			spinbutton.set_range(-128, 127)
		else:
			spinbutton.set_range(0, 127)
		spinbutton.set_value(gajim.config.get_per('accounts', account,
			'priority'))

		# Connection tab
		usessl = gajim.config.get_per('accounts', account, 'usessl')
		self.xml.get_widget('use_ssl_checkbutton1').set_active(usessl)

		self.xml.get_widget('send_keepalive_checkbutton1').set_active(
			gajim.config.get_per('accounts', account, 'keep_alives_enabled'))

		use_custom_host = gajim.config.get_per('accounts', account,
			'use_custom_host')
		self.xml.get_widget('custom_host_port_checkbutton1').set_active(
			use_custom_host)
		custom_host = gajim.config.get_per('accounts', account, 'custom_host')
		if not custom_host:
			custom_host = gajim.config.get_per('accounts', account, 'hostname')
		self.xml.get_widget('custom_host_entry1').set_text(custom_host)
		custom_port = gajim.config.get_per('accounts', account, 'custom_port')
		if not custom_port:
			custom_port = 5222
		self.xml.get_widget('custom_port_entry1').set_text(unicode(custom_port))

		# Personal tab
		gpg_key_label = self.xml.get_widget('gpg_key_label1')
		if gajim.config.get('usegpg'):
			self.xml.get_widget('gpg_choose_button1').set_sensitive(True)
github gajim / gajim / src / config.py View on Github external
def init_normal_account(self):
		account = self.current_account
		# Account tab
		jid = gajim.config.get_per('accounts', account, 'name') \
			+ '@' + gajim.config.get_per('accounts', account, 'hostname')
		self.xml.get_widget('jid_entry1').set_text(jid)
		savepass = gajim.config.get_per('accounts', account, 'savepass')
		self.xml.get_widget('save_password_checkbutton1').set_active(savepass)
		password_entry = self.xml.get_widget('password_entry1')
		if savepass:
			passstr = passwords.get_password(account) or ''
			password_entry.set_sensitive(True)
		else:
			passstr = ''
			password_entry.set_sensitive(False)
		password_entry.set_text(passstr)

		self.xml.get_widget('resource_entry1').set_text(gajim.config.get_per(
			'accounts', account, 'resource'))
		self.xml.get_widget('adjust_priority_with_status_checkbutton1').\
			set_active(gajim.config.get_per('accounts', account,
github gajim / gajim / src / config.py View on Github external
self.xml.get_widget('jid_entry1').set_text(jid)
		savepass = gajim.config.get_per('accounts', account, 'savepass')
		self.xml.get_widget('save_password_checkbutton1').set_active(savepass)
		password_entry = self.xml.get_widget('password_entry1')
		if savepass:
			passstr = passwords.get_password(account) or ''
			password_entry.set_sensitive(True)
		else:
			passstr = ''
			password_entry.set_sensitive(False)
		password_entry.set_text(passstr)

		self.xml.get_widget('resource_entry1').set_text(gajim.config.get_per(
			'accounts', account, 'resource'))
		self.xml.get_widget('adjust_priority_with_status_checkbutton1').\
			set_active(gajim.config.get_per('accounts', account,
			'adjust_priority_with_status'))
		spinbutton = self.xml.get_widget('priority_spinbutton1')
		if gajim.config.get('enable_negative_priority'):
			spinbutton.set_range(-128, 127)
		else:
			spinbutton.set_range(0, 127)
		spinbutton.set_value(gajim.config.get_per('accounts', account,
			'priority'))

		# Connection tab
		usessl = gajim.config.get_per('accounts', account, 'usessl')
		self.xml.get_widget('use_ssl_checkbutton1').set_active(usessl)

		self.xml.get_widget('send_keepalive_checkbutton1').set_active(
			gajim.config.get_per('accounts', account, 'keep_alives_enabled'))
github sgala / gajim / src / config.py View on Github external
'message_sent': _('Message Sent'),
			'muc_message_highlight': _('Group Chat Message Highlight'),
			'muc_message_received': _('Group Chat Message Received')
		}

		# In case of a GMail account we provide a sound notification option
		for account in gajim.config.get_per('accounts'):
			jid = gajim.get_jid_from_account(account)
			if gajim.get_server_from_jid(jid) in gajim.gmail_domains:
				sounds_dict['gmail_received'] = _('GMail Email Received')
				break
		
		for sound_event_config_name, sound_ui_name in sounds_dict.items():
			enabled = gajim.config.get_per('soundevents',
				sound_event_config_name, 'enabled')
			path = gajim.config.get_per('soundevents',
				sound_event_config_name, 'path')
			model.append((enabled, sound_ui_name, path, sound_event_config_name))
github sgala / gajim / src / config.py View on Github external
def fill_msg_treeview(self):
		self.xml.get_widget('delete_msg_button').set_sensitive(False)
		model = self.msg_tree.get_model()
		model.clear()
		preset_status = []
		for msg_name in gajim.config.get_per('statusmsg'):
			preset_status.append(msg_name)
		preset_status.sort()
		for msg_name in preset_status:
			msg_text = gajim.config.get_per('statusmsg', msg_name, 'message')
			msg_text = helpers.from_one_line(msg_text)
			iter = model.append()
			model.set(iter, 0, msg_name, 1, msg_text)