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

Commits:

2 changed files:

Changes:

  • gajim/features_window.py
    ... ... @@ -57,10 +57,6 @@ class FeaturesWindow:
    57 57
                     _('Ability to encrypting chat messages with OpenPGP.'),
    
    58 58
                     _('Requires gpg and python-gnupg (http://code.google.com/p/python-gnupg/).'),
    
    59 59
                     _('Requires gpg.exe in PATH.')),
    
    60
    -            _('Network-Watcher'): (self.network_watcher_available,
    
    61
    -                _('Autodetection of network status.'),
    
    62
    -                _('Requires gnome-network-manager'),
    
    63
    -                _('Feature not available under Windows.')),
    
    64 60
                 _('Password encryption'): (self.some_keyring_available,
    
    65 61
                     _('Passwords can be stored securely and not just in plaintext.'),
    
    66 62
                     _('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'),
    
    ... ... @@ -157,10 +153,6 @@ class FeaturesWindow:
    157 153
         def gpg_available(self):
    
    158 154
             return app.HAVE_GPG
    
    159 155
     
    
    160
    -    def network_watcher_available(self):
    
    161
    -        from gajim import network_watcher
    
    162
    -        return network_watcher.supported
    
    163
    -
    
    164 156
         def some_keyring_available(self):
    
    165 157
             if os.name == 'nt':
    
    166 158
                 return True
    

  • gajim/gui_interface.py
    ... ... @@ -44,6 +44,7 @@ import hashlib
    44 44
     from gi.repository import Gtk
    
    45 45
     from gi.repository import GdkPixbuf
    
    46 46
     from gi.repository import GLib
    
    47
    +from gi.repository import Gio
    
    47 48
     
    
    48 49
     try:
    
    49 50
         from PIL import Image
    
    ... ... @@ -2558,6 +2559,23 @@ class Interface:
    2558 2559
             view.updateNamespace({'gajim': app})
    
    2559 2560
             app.ipython_window = window
    
    2560 2561
     
    
    2562
    +    def network_status_changed(self, monitor, connected):
    
    2563
    +        if connected == self.network_state:
    
    2564
    +            # This callback gets called a lot from GTK with the
    
    2565
    +            # same state, not only on change.
    
    2566
    +            return
    
    2567
    +        self.network_state = connected
    
    2568
    +        if connected:
    
    2569
    +            for connection in app.connections.values():
    
    2570
    +                if connection.connected <= 0:
    
    2571
    +                    log.info('Connect %s', connection.name)
    
    2572
    +                    connection.reconnect()
    
    2573
    +        else:
    
    2574
    +            for connection in app.connections.values():
    
    2575
    +                if connection.connected > 1:
    
    2576
    +                    log.info('Disconnect %s', connection.name)
    
    2577
    +                    connection.disconnectedReconnCB()
    
    2578
    +
    
    2561 2579
         def run(self, application):
    
    2562 2580
             if app.config.get('trayicon') != 'never':
    
    2563 2581
                 self.show_systray()
    
    ... ... @@ -2779,8 +2797,6 @@ class Interface:
    2779 2797
     
    
    2780 2798
             self.remote_ctrl = None
    
    2781 2799
     
    
    2782
    -        from gajim import network_watcher
    
    2783
    -
    
    2784 2800
             if dbus_support.supported:
    
    2785 2801
                 from gajim import upower_listener
    
    2786 2802
                 from gajim import logind_listener
    
    ... ... @@ -2882,6 +2898,11 @@ class Interface:
    2882 2898
     
    
    2883 2899
             self.music_track_changed_signal = None
    
    2884 2900
     
    
    2901
    +        self.network_monitor = Gio.NetworkMonitor.get_default()
    
    2902
    +        self.network_monitor.connect('network-changed',
    
    2903
    +                                     self.network_status_changed)
    
    2904
    +        self.network_state = self.network_monitor.get_network_available()
    
    2905
    +
    
    2885 2906
     
    
    2886 2907
     class PassphraseRequest:
    
    2887 2908
         def __init__(self, keyid):