Philipp Hörist pushed to branch master at gajim / gajim

Commits:

3 changed files:

Changes:

  • gajim/data/gui/features_window.ui
    1 1
     <?xml version="1.0" encoding="UTF-8"?>
    
    2 2
     <!-- Generated with glade 3.22.1 -->
    
    3 3
     <interface>
    
    4
    -  <requires lib="gtk+" version="3.12"/>
    
    4
    +  <requires lib="gtk+" version="3.20"/>
    
    5 5
       <object class="GtkBox" id="features_box">
    
    6
    -    <property name="width_request">300</property>
    
    7
    -    <property name="height_request">530</property>
    
    6
    +    <property name="width_request">400</property>
    
    7
    +    <property name="height_request">500</property>
    
    8 8
         <property name="visible">True</property>
    
    9 9
         <property name="can_focus">False</property>
    
    10 10
         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
    
    11
    -    <property name="margin_left">18</property>
    
    12
    -    <property name="margin_right">18</property>
    
    13
    -    <property name="margin_top">18</property>
    
    14
    -    <property name="margin_bottom">18</property>
    
    11
    +    <property name="border_width">18</property>
    
    15 12
         <property name="orientation">vertical</property>
    
    16 13
         <property name="spacing">6</property>
    
    17 14
         <child>
    
    ... ... @@ -19,9 +16,12 @@
    19 16
             <property name="visible">True</property>
    
    20 17
             <property name="can_focus">False</property>
    
    21 18
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
    
    22
    -        <property name="label" translatable="yes">&lt;b&gt;List of possible features in Gajim:&lt;/b&gt;</property>
    
    19
    +        <property name="label" translatable="yes">Listing of available features</property>
    
    23 20
             <property name="use_markup">True</property>
    
    24
    -        <property name="xalign">0</property>
    
    21
    +        <style>
    
    22
    +          <class name="bold"/>
    
    23
    +          <class name="dim-label"/>
    
    24
    +        </style>
    
    25 25
           </object>
    
    26 26
           <packing>
    
    27 27
             <property name="expand">False</property>
    
    ... ... @@ -41,9 +41,10 @@
    41 41
                 <property name="visible">True</property>
    
    42 42
                 <property name="can_focus">True</property>
    
    43 43
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
    
    44
    +            <property name="enable_grid_lines">horizontal</property>
    
    44 45
                 <signal name="cursor-changed" handler="on_features_treeview_cursor_changed" swapped="no"/>
    
    45 46
                 <child internal-child="selection">
    
    46
    -              <object class="GtkTreeSelection" id="treeview-selection1"/>
    
    47
    +              <object class="GtkTreeSelection"/>
    
    47 48
                 </child>
    
    48 49
               </object>
    
    49 50
             </child>
    
    ... ... @@ -55,35 +56,97 @@
    55 56
           </packing>
    
    56 57
         </child>
    
    57 58
         <child>
    
    58
    -      <object class="GtkFrame">
    
    59
    +      <object class="GtkBox">
    
    59 60
             <property name="visible">True</property>
    
    60 61
             <property name="can_focus">False</property>
    
    61
    -        <property name="border_width">3</property>
    
    62
    -        <property name="label_xalign">0</property>
    
    63
    -        <property name="shadow_type">none</property>
    
    62
    +        <property name="orientation">vertical</property>
    
    63
    +        <property name="spacing">6</property>
    
    64
    +        <child>
    
    65
    +          <object class="GtkLabel">
    
    66
    +            <property name="visible">True</property>
    
    67
    +            <property name="can_focus">False</property>
    
    68
    +            <property name="halign">start</property>
    
    69
    +            <property name="label" translatable="yes">Description</property>
    
    70
    +            <property name="use_markup">True</property>
    
    71
    +            <style>
    
    72
    +              <class name="bold"/>
    
    73
    +              <class name="dim-label"/>
    
    74
    +              <class name="margin-top6"/>
    
    75
    +            </style>
    
    76
    +          </object>
    
    77
    +          <packing>
    
    78
    +            <property name="expand">False</property>
    
    79
    +            <property name="fill">True</property>
    
    80
    +            <property name="position">0</property>
    
    81
    +          </packing>
    
    82
    +        </child>
    
    64 83
             <child>
    
    65 84
               <object class="GtkLabel" id="feature_desc_label">
    
    66 85
                 <property name="visible">True</property>
    
    67 86
                 <property name="can_focus">False</property>
    
    68
    -            <property name="margin_left">12</property>
    
    87
    +            <property name="halign">start</property>
    
    69 88
                 <property name="wrap">True</property>
    
    70 89
                 <property name="selectable">True</property>
    
    71 90
                 <property name="xalign">0</property>
    
    72 91
               </object>
    
    92
    +          <packing>
    
    93
    +            <property name="expand">False</property>
    
    94
    +            <property name="fill">True</property>
    
    95
    +            <property name="position">1</property>
    
    96
    +          </packing>
    
    73 97
             </child>
    
    74
    -        <child type="label">
    
    98
    +      </object>
    
    99
    +      <packing>
    
    100
    +        <property name="expand">False</property>
    
    101
    +        <property name="fill">True</property>
    
    102
    +        <property name="position">2</property>
    
    103
    +      </packing>
    
    104
    +    </child>
    
    105
    +    <child>
    
    106
    +      <object class="GtkBox">
    
    107
    +        <property name="visible">True</property>
    
    108
    +        <property name="can_focus">False</property>
    
    109
    +        <property name="orientation">vertical</property>
    
    110
    +        <property name="spacing">6</property>
    
    111
    +        <child>
    
    75 112
               <object class="GtkLabel">
    
    76 113
                 <property name="visible">True</property>
    
    77 114
                 <property name="can_focus">False</property>
    
    78
    -            <property name="label" translatable="yes">&lt;b&gt;Description&lt;/b&gt;</property>
    
    115
    +            <property name="halign">start</property>
    
    116
    +            <property name="label" translatable="yes">Requirements</property>
    
    79 117
                 <property name="use_markup">True</property>
    
    118
    +            <style>
    
    119
    +              <class name="bold"/>
    
    120
    +              <class name="dim-label"/>
    
    121
    +              <class name="margin-top6"/>
    
    122
    +            </style>
    
    80 123
               </object>
    
    124
    +          <packing>
    
    125
    +            <property name="expand">False</property>
    
    126
    +            <property name="fill">True</property>
    
    127
    +            <property name="position">0</property>
    
    128
    +          </packing>
    
    129
    +        </child>
    
    130
    +        <child>
    
    131
    +          <object class="GtkLabel" id="feature_req_label">
    
    132
    +            <property name="visible">True</property>
    
    133
    +            <property name="can_focus">False</property>
    
    134
    +            <property name="halign">start</property>
    
    135
    +            <property name="wrap">True</property>
    
    136
    +            <property name="selectable">True</property>
    
    137
    +            <property name="xalign">0</property>
    
    138
    +          </object>
    
    139
    +          <packing>
    
    140
    +            <property name="expand">False</property>
    
    141
    +            <property name="fill">True</property>
    
    142
    +            <property name="position">1</property>
    
    143
    +          </packing>
    
    81 144
             </child>
    
    82 145
           </object>
    
    83 146
           <packing>
    
    84 147
             <property name="expand">False</property>
    
    85 148
             <property name="fill">True</property>
    
    86
    -        <property name="position">2</property>
    
    149
    +        <property name="position">3</property>
    
    87 150
           </packing>
    
    88 151
         </child>
    
    89 152
       </object>
    

  • gajim/data/style/gajim.css
    ... ... @@ -88,6 +88,13 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_
    88 88
     #ServerInfoGrid > list > label { padding:10px; color: @insensitive_fg_color; font-weight: bold; }
    
    89 89
     #ServerInfoGrid > list > row.activatable:active { box-shadow: none; }
    
    90 90
     
    
    91
    +/* Features Info */
    
    92
    +#FeaturesInfoGrid > list { border: 1px solid; border-color: @borders; }
    
    93
    +#FeaturesInfoGrid > list > row:first-child { border-top: 1px solid; border-color: @borders; }
    
    94
    +#FeaturesInfoGrid > list > row { padding: 10px 20px 10px 10px; }
    
    95
    +#FeaturesInfoGrid > list > label { padding:10px; color: @insensitive_fg_color; font-weight: bold; }
    
    96
    +#FeaturesInfoGrid > list > row.activatable:active { box-shadow: none; }
    
    97
    +
    
    91 98
     /* OptionsBox */
    
    92 99
     #OptionsBox > row { border-bottom: 1px solid; border-color: @theme_unfocused_bg_color; }
    
    93 100
     #OptionsBox > row:last-child { border-bottom: 0px}
    

  • gajim/gtk/features.py
    ... ... @@ -20,142 +20,148 @@
    20 20
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    21 21
     
    
    22 22
     import os
    
    23
    +from collections import namedtuple
    
    23 24
     
    
    24 25
     import gi
    
    25
    -from gi.repository import Gtk, Gdk
    
    26
    +from gi.repository import Gtk
    
    26 27
     
    
    27 28
     from gajim.common import app
    
    28
    -from gajim.common.i18n import Q_
    
    29 29
     from gajim.common.i18n import _
    
    30 30
     
    
    31
    -from gajim.gtk.util import get_builder
    
    32
    -
    
    33 31
     
    
    34 32
     class FeaturesDialog(Gtk.Dialog):
    
    35 33
         def __init__(self):
    
    36 34
             flags = Gtk.DialogFlags.DESTROY_WITH_PARENT
    
    37 35
             super().__init__(_('Features'), None, flags)
    
    38 36
     
    
    39
    -        self.connect('key-press-event', self.on_key_press_event)
    
    40 37
             self.set_transient_for(app.interface.roster.window)
    
    38
    +        self.set_resizable(False)
    
    41 39
     
    
    42
    -        self.builder = get_builder('features_window.ui')
    
    43
    -        content = self.get_content_area()
    
    44
    -        content.add(self.builder.get_object('features_box'))
    
    45
    -
    
    46
    -        treeview = self.builder.get_object('features_treeview')
    
    47
    -        self.desc_label = self.builder.get_object('feature_desc_label')
    
    48
    -
    
    49
    -        # {name: (available_function, unix_text, windows_text)}
    
    50
    -        self.features = {
    
    51
    -            _('Bonjour / Zeroconf'): (
    
    52
    -                self.zeroconf_available,
    
    53
    -                _('Serverless chatting with autodetected clients in a local network.'),
    
    54
    -                _('Requires python-dbus.'),
    
    55
    -                _('Requires pybonjour and bonjour SDK running (%(url)s)') % {'url': 'https://developer.apple.com/opensource/).'}),
    
    56
    -            _('Command line'): (
    
    57
    -                self.dbus_available,
    
    58
    -                _('A script to control Gajim via commandline.'),
    
    59
    -                _('Requires python-dbus.'),
    
    60
    -                _('Feature not available under Windows.')),
    
    61
    -            _('OpenPGP message encryption'): (
    
    62
    -                self.gpg_available,
    
    63
    -                _('Ability to encrypting chat messages with OpenPGP.'),
    
    64
    -                _('Requires gpg and python-gnupg (%(url)s).') % {'url': 'https://bitbucket.org/vinay.sajip/python-gnupg'},
    
    65
    -                _('Requires gpg.exe in PATH.')),
    
    66
    -            _('Password encryption'): (
    
    67
    -                self.some_keyring_available,
    
    68
    -                _('Passwords can be stored securely and not just in plaintext.'),
    
    69
    -                _('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'),
    
    70
    -                _('On Windows the Windows Credential Vault is used.')),
    
    71
    -            _('Spell Checker'): (
    
    72
    -                self.speller_available,
    
    73
    -                _('Spellchecking of composed messages.'),
    
    74
    -                _('Requires Gspell'),
    
    75
    -                _('Requires Gspell')),
    
    76
    -            _('Automatic status'): (
    
    77
    -                self.idle_available,
    
    78
    -                _('Ability to measure idle time, in order to set auto status.'),
    
    79
    -                _('Requires libxss library.'),
    
    80
    -                _('Requires python2.5.')),
    
    81
    -            _('RST Generator'): (
    
    82
    -                self.docutils_available,
    
    83
    -                _('Generate XHTML output from RST code (see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html).'),
    
    84
    -                _('Requires python-docutils.'),
    
    85
    -                _('Requires python-docutils.')),
    
    86
    -            _('Audio / Video'): (
    
    87
    -                self.farstream_available,
    
    88
    -                _('Ability to start audio and video chat.'),
    
    89
    -                _('Requires gir1.2-farstream-0.2, gir1.2-gstreamer-1.0, gstreamer1.0-libav and gstreamer1.0-plugins-ugly.'),
    
    90
    -                _('Feature not available under Windows.')),
    
    91
    -            _('UPnP-IGD'): (
    
    92
    -                self.gupnp_igd_available,
    
    93
    -                _('Ability to request your router to forward port for file transfer.'),
    
    94
    -                _('Requires gir1.2-gupnpigd-1.0.'),
    
    95
    -                _('Feature not available under Windows.')),
    
    96
    -        }
    
    97
    -
    
    98
    -        # name, supported
    
    99
    -        self.model = Gtk.ListStore(str, bool)
    
    100
    -        treeview.set_model(self.model)
    
    101
    -
    
    102
    -        col = Gtk.TreeViewColumn(Q_('?features:Available'))
    
    103
    -        treeview.append_column(col)
    
    104
    -        cell = Gtk.CellRendererToggle()
    
    105
    -        cell.set_property('radio', True)
    
    106
    -        col.pack_start(cell, True)
    
    107
    -        col.add_attribute(cell, 'active', 1)
    
    108
    -
    
    109
    -        col = Gtk.TreeViewColumn(_('Feature'))
    
    110
    -        treeview.append_column(col)
    
    111
    -        cell = Gtk.CellRendererText()
    
    112
    -        col.pack_start(cell, True)
    
    113
    -        col.add_attribute(cell, 'text', 0)
    
    114
    -
    
    115
    -        # Fill model
    
    116
    -        for feature in self.features:
    
    117
    -            func = self.features[feature][0]
    
    118
    -            rep = func()
    
    119
    -            self.model.append([feature, rep])
    
    120
    -
    
    121
    -        self.model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
    
    122
    -
    
    123
    -        self.builder.connect_signals(self)
    
    124
    -        self.show_all()
    
    40
    +        grid = Gtk.Grid()
    
    41
    +        grid.set_name('FeaturesInfoGrid')
    
    42
    +        grid.set_row_spacing(10)
    
    43
    +        grid.set_hexpand(True)
    
    125 44
     
    
    126
    -    def on_key_press_event(self, widget, event):
    
    127
    -        if event.keyval == Gdk.KEY_Escape:
    
    128
    -            self.destroy()
    
    45
    +        self.feature_listbox = Gtk.ListBox()
    
    46
    +        self.feature_listbox.set_selection_mode(Gtk.SelectionMode.NONE)
    
    47
    +        self.feature_listbox.set_header_func(self.header_func, _('Features'))
    
    129 48
     
    
    130
    -    def on_close_button_clicked(self, widget):
    
    131
    -        self.destroy()
    
    132
    -
    
    133
    -    def on_features_treeview_cursor_changed(self, widget):
    
    134
    -        selection = widget.get_selection()
    
    135
    -        if not selection:
    
    136
    -            return
    
    137
    -        rows = selection.get_selected_rows()[1]
    
    138
    -        if not rows:
    
    139
    -            return
    
    140
    -        path = rows[0]
    
    141
    -        feature = self.model[path][0]
    
    142
    -        text = self.features[feature][1] + '\n'
    
    143
    -        if os.name == 'nt':
    
    144
    -            text = text + self.features[feature][3]
    
    49
    +        grid.attach(self.feature_listbox, 0, 0, 1, 1)
    
    50
    +
    
    51
    +        box = self.get_content_area()
    
    52
    +        box.pack_start(grid, True, True, 0)
    
    53
    +        box.set_property('margin', 12)
    
    54
    +        box.set_spacing(18)
    
    55
    +
    
    56
    +        self.connect('response', self.on_response)
    
    57
    +
    
    58
    +        for feature in self.get_features():
    
    59
    +            self.add_feature(feature)
    
    60
    +
    
    61
    +        self.show_all()
    
    62
    +
    
    63
    +    @staticmethod
    
    64
    +    def header_func(row, before, user_data):
    
    65
    +        if before:
    
    66
    +            row.set_header(None)
    
    145 67
             else:
    
    146
    -            text = text + self.features[feature][2]
    
    147
    -        self.desc_label.set_text(text)
    
    68
    +            label = Gtk.Label(label=user_data)
    
    69
    +            label.set_halign(Gtk.Align.START)
    
    70
    +            row.set_header(label)
    
    71
    +
    
    72
    +    def on_response(self, dialog, response):
    
    73
    +        if response == Gtk.ResponseType.OK:
    
    74
    +            self.destroy()
    
    148 75
     
    
    149
    -    def zeroconf_available(self):
    
    150
    -        return app.is_installed('ZEROCONF')
    
    76
    +    def add_feature(self, feature):
    
    77
    +        item = FeatureItem(feature)
    
    78
    +        self.feature_listbox.add(item)
    
    79
    +        item.get_parent().set_tooltip_text(item.tooltip)
    
    80
    +
    
    81
    +    def get_features(self):
    
    82
    +        Feature = namedtuple('Feature',
    
    83
    +                             ['name', 'available', 'tooltip',
    
    84
    +                             'dependency_u', 'dependency_w', 'enabled'])
    
    85
    +
    
    86
    +        spell_check_enabled = app.config.get('use_speller')
    
    87
    +
    
    88
    +        auto_status = [app.config.get('autoaway'), app.config.get('autoxa')]
    
    89
    +        auto_status_enabled = bool(any(auto_status))
    
    90
    +
    
    91
    +        return [
    
    92
    +            Feature(_('Audio / Video'),
    
    93
    +                    app.is_installed('FARSTREAM'),
    
    94
    +                    _('Enables Gajim to provide Audio and Video chats'),
    
    95
    +                    _('Requires: gir1.2-farstream-0.2, gir1.2-gstreamer-1.0, '
    
    96
    +                      'gstreamer1.0-libav, gstreamer1.0-plugins-ugly'),
    
    97
    +                    _('Feature not available under Windows'),
    
    98
    +                    None),
    
    99
    +            Feature(_('Automatic Status'),
    
    100
    +                    self.idle_available(),
    
    101
    +                    _('Enables Gajim to measure your computer\'s idle time in '
    
    102
    +                      'order to set your Status automatically'),
    
    103
    +                    _('Requires: libxss'),
    
    104
    +                    _('No additional requirements'),
    
    105
    +                    auto_status_enabled),
    
    106
    +            Feature(_('Bonjour / Zeroconf (Serverless Chat)'),
    
    107
    +                    app.is_installed('ZEROCONF'),
    
    108
    +                    _('Enables Gajim to automatically detected clients in a '
    
    109
    +                      'local network for serverless chats'),
    
    110
    +                    _('Requires: python-dbus'),
    
    111
    +                    _('Requires: pybonjour and bonjour SDK running (%(url)s)')
    
    112
    +                    % {'url': 'https://developer.apple.com/opensource/)'},
    
    113
    +                    None),
    
    114
    +            Feature(_('Command line Control'),
    
    115
    +                    self.dbus_available(),
    
    116
    +                    _('Enables you to control Gajim with via commandline'),
    
    117
    +                    _('Requires: python-dbus'),
    
    118
    +                    _('Feature not available under Windows'),
    
    119
    +                    None),
    
    120
    +            Feature(_('OpenPGP Message Encryption'),
    
    121
    +                    app.is_installed('GPG'),
    
    122
    +                    _('Enables Gajim to encrypt chat messages with OpenPGP'),
    
    123
    +                    _('Requires: gpg and python-gnupg (%(url)s)')
    
    124
    +                    % {'url': 'https://bitbucket.org/vinay.sajip/python-gnupg'},
    
    125
    +                    _('Requires: gpg.exe in your PATH environment variable'),
    
    126
    +                    None),
    
    127
    +            Feature(_('RST XHTML Generator'),
    
    128
    +                    self.docutils_available(),
    
    129
    +                    _('Enables Gajim to generate XHTML output from RST '
    
    130
    +                      'code (%(url)s)') % {'url':
    
    131
    +                      'http://docutils.sourceforge.net/docs/ref/rst/'
    
    132
    +                      'restructuredtext.html'},
    
    133
    +                    _('Requires: python-docutils'),
    
    134
    +                    _('Requires: python-docutils'),
    
    135
    +                    None),
    
    136
    +            Feature(_('Secure Password Storage'),
    
    137
    +                    self.some_keyring_available(),
    
    138
    +                    _('Enables Gajim to store Passwords securely instead of '
    
    139
    +                      'storing them in plaintext'),
    
    140
    +                    _('Requires: libsecret and a provider (such as GNOME '
    
    141
    +                      'Keyring and KSecretService)'),
    
    142
    +                    _('Windows Credential Vault is used for secure password '
    
    143
    +                      'storage'),
    
    144
    +                    None),
    
    145
    +            Feature(_('Spell Checker'),
    
    146
    +                    app.is_installed('GSPELL'),
    
    147
    +                    _('Enables Gajim to spell check your messages while '
    
    148
    +                      'composing'),
    
    149
    +                    _('Requires: Gspell'),
    
    150
    +                    _('Requires: Gspell'),
    
    151
    +                    spell_check_enabled),
    
    152
    +            Feature(_('UPnP-IGD Port Forwarding'),
    
    153
    +                    app.is_installed('UPNP'),
    
    154
    +                    _('Enables Gajim to request your router to forward ports '
    
    155
    +                      'for file transfers'),
    
    156
    +                    _('Requires: gir1.2-gupnpigd-1.0'),
    
    157
    +                    _('Feature not available under Windows'),
    
    158
    +                    None)
    
    159
    +        ]
    
    151 160
     
    
    152 161
         def dbus_available(self):
    
    153 162
             from gajim.common import dbus_support
    
    154 163
             return dbus_support.supported
    
    155 164
     
    
    156
    -    def gpg_available(self):
    
    157
    -        return app.is_installed('GPG')
    
    158
    -
    
    159 165
         def some_keyring_available(self):
    
    160 166
             if os.name == 'nt':
    
    161 167
                 return True
    
    ... ... @@ -166,9 +172,6 @@ class FeaturesDialog(Gtk.Dialog):
    166 172
                 return False
    
    167 173
             return True
    
    168 174
     
    
    169
    -    def speller_available(self):
    
    170
    -        return app.is_installed('GSPELL')
    
    171
    -
    
    172 175
         def idle_available(self):
    
    173 176
             from gajim.common import idle
    
    174 177
             return idle.Monitor.is_available()
    
    ... ... @@ -180,8 +183,66 @@ class FeaturesDialog(Gtk.Dialog):
    180 183
                 return False
    
    181 184
             return True
    
    182 185
     
    
    183
    -    def farstream_available(self):
    
    184
    -        return app.is_installed('FARSTREAM')
    
    185 186
     
    
    186
    -    def gupnp_igd_available(self):
    
    187
    -        return app.is_installed('UPNP')
    187
    +class FeatureItem(Gtk.Grid):
    
    188
    +    def __init__(self, feature):
    
    189
    +        super().__init__()
    
    190
    +        self.set_column_spacing(12)
    
    191
    +
    
    192
    +        self.tooltip = feature.tooltip
    
    193
    +        self.feature_dependency_u_text = feature.dependency_u
    
    194
    +        self.feature_dependency_w_text = feature.dependency_w
    
    195
    +
    
    196
    +        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
    
    197
    +        self.feature_label = Gtk.Label(label=feature.name)
    
    198
    +        self.feature_label.set_halign(Gtk.Align.START)
    
    199
    +        self.box.pack_start(self.feature_label, True, True, 0)
    
    200
    +
    
    201
    +        self.feature_dependency_u = Gtk.Label(label=feature.dependency_u)
    
    202
    +        self.feature_dependency_u.get_style_context().add_class('dim-label')
    
    203
    +        self.feature_dependency_w = Gtk.Label(label=feature.dependency_w)
    
    204
    +        self.feature_dependency_w.get_style_context().add_class('dim-label')
    
    205
    +
    
    206
    +        if not feature.available:
    
    207
    +            self.feature_dependency_u.set_halign(Gtk.Align.START)
    
    208
    +            self.feature_dependency_u.set_alignment(0.0, 0.0)
    
    209
    +            self.feature_dependency_u.set_line_wrap(True)
    
    210
    +            self.feature_dependency_u.set_max_width_chars(50)
    
    211
    +            self.feature_dependency_u.set_selectable(True)
    
    212
    +            self.feature_dependency_w.set_halign(Gtk.Align.START)
    
    213
    +            self.feature_dependency_w.set_alignment(0.0, 0.0)
    
    214
    +            self.feature_dependency_w.set_line_wrap(True)
    
    215
    +            self.feature_dependency_w.set_max_width_chars(50)
    
    216
    +            self.feature_dependency_w.set_selectable(True)
    
    217
    +
    
    218
    +            if os.name == 'nt':
    
    219
    +                self.box.pack_start(self.feature_dependency_w, True, True, 0)
    
    220
    +            else:
    
    221
    +                self.box.pack_start(self.feature_dependency_u, True, True, 0)
    
    222
    +
    
    223
    +        self.icon = Gtk.Image()
    
    224
    +        self.label_disabled = Gtk.Label(label='Disabled in Preferences')
    
    225
    +        self.label_disabled.get_style_context().add_class('dim-label')
    
    226
    +        self.set_feature(feature.available, feature.enabled)
    
    227
    +
    
    228
    +        self.add(self.icon)
    
    229
    +        self.add(self.box)
    
    230
    +
    
    231
    +    def set_feature(self, available, enabled):
    
    232
    +        self.icon.get_style_context().remove_class('error-color')
    
    233
    +        self.icon.get_style_context().remove_class('warning-color')
    
    234
    +        self.icon.get_style_context().remove_class('success-color')
    
    235
    +
    
    236
    +        if not available:
    
    237
    +            self.icon.set_from_icon_name('window-close-symbolic',
    
    238
    +                                         Gtk.IconSize.MENU)
    
    239
    +            self.icon.get_style_context().add_class('error-color')
    
    240
    +        elif enabled is False:
    
    241
    +            self.icon.set_from_icon_name('dialog-warning-symbolic',
    
    242
    +                                         Gtk.IconSize.MENU)
    
    243
    +            self.box.pack_start(self.label_disabled, True, True, 0)
    
    244
    +            self.icon.get_style_context().add_class('warning-color')
    
    245
    +        else:
    
    246
    +            self.icon.set_from_icon_name('emblem-ok-symbolic',
    
    247
    +                                         Gtk.IconSize.MENU)
    
    248
    +            self.icon.get_style_context().add_class('success-color')