2018-07-29 23:50:37 +02:00
|
|
|
# Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org>
|
|
|
|
# Julien Pivotto <roidelapluie AT gmail.com>
|
|
|
|
# Stefan Bethge <stefan AT lanpartei.de>
|
|
|
|
# Stephan Erb <steve-e AT h3c.de>
|
|
|
|
# Copyright (C) 2007-2014 Yann Leboulanger <asterix AT lagaule.org>
|
|
|
|
# Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
|
|
|
|
#
|
|
|
|
# This file is part of Gajim.
|
|
|
|
#
|
|
|
|
# Gajim is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published
|
|
|
|
# by the Free Software Foundation; version 3 only.
|
|
|
|
#
|
|
|
|
# Gajim is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
2007-06-27 11:37:31 +02:00
|
|
|
|
|
|
|
import os
|
2018-07-29 23:50:37 +02:00
|
|
|
|
2015-08-04 16:42:59 +02:00
|
|
|
import gi
|
2017-02-06 22:28:07 +01:00
|
|
|
from gi.repository import Gtk, Gdk
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2017-08-13 13:18:56 +02:00
|
|
|
from gajim.common import app
|
2017-06-13 23:58:06 +02:00
|
|
|
from gajim.common.i18n import Q_
|
2018-07-29 23:50:37 +02:00
|
|
|
from gajim.gtk.util import get_builder
|
2007-06-27 11:37:31 +02:00
|
|
|
|
|
|
|
|
2018-07-29 23:50:37 +02:00
|
|
|
class FeaturesDialog(Gtk.Dialog):
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self):
|
2018-07-29 23:50:37 +02:00
|
|
|
flags = Gtk.DialogFlags.DESTROY_WITH_PARENT
|
|
|
|
super().__init__(_('Features'), None, flags)
|
|
|
|
|
|
|
|
self.connect('key-press-event', self.on_key_press_event)
|
|
|
|
self.set_transient_for(app.interface.roster.window)
|
|
|
|
|
|
|
|
self.builder = get_builder('features_window.ui')
|
|
|
|
content = self.get_content_area()
|
|
|
|
content.add(self.builder.get_object('features_box'))
|
|
|
|
|
|
|
|
treeview = self.builder.get_object('features_treeview')
|
|
|
|
self.desc_label = self.builder.get_object('feature_desc_label')
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
# {name: (available_function, unix_text, windows_text)}
|
|
|
|
self.features = {
|
2018-07-29 23:50:37 +02:00
|
|
|
_('Bonjour / Zeroconf'): (
|
|
|
|
self.zeroconf_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Serverless chatting with autodetected clients in a local network.'),
|
2018-05-23 00:12:43 +02:00
|
|
|
_('Requires python-dbus.'),
|
2018-03-25 18:20:37 +02:00
|
|
|
_('Requires pybonjour and bonjour SDK running (%(url)s)') % {'url': 'https://developer.apple.com/opensource/).'}),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('Command line'): (
|
|
|
|
self.dbus_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('A script to control Gajim via commandline.'),
|
|
|
|
_('Requires python-dbus.'),
|
|
|
|
_('Feature not available under Windows.')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('OpenPGP message encryption'): (
|
|
|
|
self.gpg_available,
|
2017-02-04 23:29:45 +01:00
|
|
|
_('Ability to encrypting chat messages with OpenPGP.'),
|
2018-03-25 16:26:29 +02:00
|
|
|
_('Requires gpg and python-gnupg (%(url)s).') % {'url': 'https://bitbucket.org/vinay.sajip/python-gnupg'},
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Requires gpg.exe in PATH.')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('Password encryption'): (
|
|
|
|
self.some_keyring_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Passwords can be stored securely and not just in plaintext.'),
|
2016-11-20 22:56:26 +01:00
|
|
|
_('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'),
|
2017-01-23 18:06:07 +01:00
|
|
|
_('On Windows the Windows Credential Vault is used.')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('Spell Checker'): (
|
|
|
|
self.speller_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Spellchecking of composed messages.'),
|
2017-11-25 17:37:46 +01:00
|
|
|
_('Requires Gspell'),
|
|
|
|
_('Requires Gspell')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('Automatic status'): (
|
|
|
|
self.idle_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Ability to measure idle time, in order to set auto status.'),
|
|
|
|
_('Requires libxss library.'),
|
|
|
|
_('Requires python2.5.')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('RST Generator'): (
|
|
|
|
self.docutils_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Generate XHTML output from RST code (see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html).'),
|
|
|
|
_('Requires python-docutils.'),
|
|
|
|
_('Requires python-docutils.')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('Audio / Video'): (
|
|
|
|
self.farstream_available,
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Ability to start audio and video chat.'),
|
2014-03-25 21:26:57 +01:00
|
|
|
_('Requires gir1.2-farstream-0.2, gir1.2-gstreamer-1.0, gstreamer1.0-libav and gstreamer1.0-plugins-ugly.'),
|
2011-06-22 20:29:15 +02:00
|
|
|
_('Feature not available under Windows.')),
|
2018-07-29 23:50:37 +02:00
|
|
|
_('UPnP-IGD'): (
|
|
|
|
self.gupnp_igd_available,
|
2011-08-24 11:04:31 +02:00
|
|
|
_('Ability to request your router to forward port for file transfer.'),
|
2017-04-30 18:43:06 +02:00
|
|
|
_('Requires gir1.2-gupnpigd-1.0.'),
|
2011-08-24 11:04:31 +02:00
|
|
|
_('Feature not available under Windows.')),
|
2010-02-08 15:08:40 +01:00
|
|
|
}
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
# name, supported
|
2012-12-23 16:23:43 +01:00
|
|
|
self.model = Gtk.ListStore(str, bool)
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview.set_model(self.model)
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2012-12-23 16:23:43 +01:00
|
|
|
col = Gtk.TreeViewColumn(Q_('?features:Available'))
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview.append_column(col)
|
2012-12-23 16:23:43 +01:00
|
|
|
cell = Gtk.CellRendererToggle()
|
2010-02-08 15:08:40 +01:00
|
|
|
cell.set_property('radio', True)
|
2012-12-28 21:59:53 +01:00
|
|
|
col.pack_start(cell, True)
|
|
|
|
col.add_attribute(cell, 'active', 1)
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2012-12-23 16:23:43 +01:00
|
|
|
col = Gtk.TreeViewColumn(_('Feature'))
|
2010-02-08 15:08:40 +01:00
|
|
|
treeview.append_column(col)
|
2012-12-23 16:23:43 +01:00
|
|
|
cell = Gtk.CellRendererText()
|
2012-12-28 21:59:53 +01:00
|
|
|
col.pack_start(cell, True)
|
2010-02-08 15:08:40 +01:00
|
|
|
col.add_attribute(cell, 'text', 0)
|
2007-07-07 01:51:41 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
# Fill model
|
|
|
|
for feature in self.features:
|
|
|
|
func = self.features[feature][0]
|
|
|
|
rep = func()
|
|
|
|
self.model.append([feature, rep])
|
2009-01-11 10:55:39 +01:00
|
|
|
|
2012-12-23 16:23:43 +01:00
|
|
|
self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
2009-01-11 10:55:39 +01:00
|
|
|
|
2018-07-29 23:50:37 +02:00
|
|
|
self.builder.connect_signals(self)
|
|
|
|
self.show_all()
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2017-02-06 22:28:07 +01:00
|
|
|
def on_key_press_event(self, widget, event):
|
|
|
|
if event.keyval == Gdk.KEY_Escape:
|
2018-07-29 23:50:37 +02:00
|
|
|
self.destroy()
|
2017-02-06 22:28:07 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def on_close_button_clicked(self, widget):
|
2018-07-29 23:50:37 +02:00
|
|
|
self.destroy()
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def on_features_treeview_cursor_changed(self, widget):
|
|
|
|
selection = widget.get_selection()
|
|
|
|
if not selection:
|
|
|
|
return
|
|
|
|
rows = selection.get_selected_rows()[1]
|
|
|
|
if not rows:
|
|
|
|
return
|
|
|
|
path = rows[0]
|
2013-01-01 19:44:25 +01:00
|
|
|
feature = self.model[path][0]
|
2010-02-08 15:08:40 +01:00
|
|
|
text = self.features[feature][1] + '\n'
|
|
|
|
if os.name == 'nt':
|
|
|
|
text = text + self.features[feature][3]
|
|
|
|
else:
|
|
|
|
text = text + self.features[feature][2]
|
|
|
|
self.desc_label.set_text(text)
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def zeroconf_available(self):
|
2018-04-24 19:36:33 +02:00
|
|
|
return app.is_installed('ZEROCONF')
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def dbus_available(self):
|
2017-06-13 23:58:06 +02:00
|
|
|
from gajim.common import dbus_support
|
2010-02-08 15:08:40 +01:00
|
|
|
return dbus_support.supported
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def gpg_available(self):
|
2018-04-24 19:36:33 +02:00
|
|
|
return app.is_installed('GPG')
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def some_keyring_available(self):
|
|
|
|
if os.name == 'nt':
|
2017-01-23 18:06:07 +01:00
|
|
|
return True
|
2010-02-08 15:08:40 +01:00
|
|
|
try:
|
2016-11-20 22:56:26 +01:00
|
|
|
gi.require_version('Secret', '1')
|
2018-09-17 21:11:45 +02:00
|
|
|
from gi.repository import Secret # pylint: disable=unused-variable
|
2016-11-20 22:56:26 +01:00
|
|
|
except (ValueError, ImportError):
|
2010-02-08 15:08:40 +01:00
|
|
|
return False
|
|
|
|
return True
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def speller_available(self):
|
2018-04-24 19:36:33 +02:00
|
|
|
return app.is_installed('GSPELL')
|
2007-06-27 11:37:31 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def idle_available(self):
|
2018-05-21 02:20:30 +02:00
|
|
|
from gajim.common import idle
|
|
|
|
return idle.Monitor.is_available()
|
2007-07-20 01:36:25 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def docutils_available(self):
|
|
|
|
try:
|
2010-12-18 09:11:58 +01:00
|
|
|
__import__('docutils')
|
2010-02-08 15:08:40 +01:00
|
|
|
except Exception:
|
|
|
|
return False
|
|
|
|
return True
|
2007-10-09 19:48:22 +02:00
|
|
|
|
2012-04-01 19:49:52 +02:00
|
|
|
def farstream_available(self):
|
2018-04-24 19:36:33 +02:00
|
|
|
return app.is_installed('FARSTREAM')
|
2011-08-24 11:04:31 +02:00
|
|
|
|
|
|
|
def gupnp_igd_available(self):
|
2018-04-24 19:36:33 +02:00
|
|
|
return app.is_installed('UPNP')
|