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

Commits:

1 changed file:

Changes:

  • gajim/application.py
    ... ... @@ -138,6 +138,21 @@ class GajimApplication(Gtk.Application):
    138 138
                 GLib.OptionArg.NONE,
    
    139 139
                 _('Start a new chat'))
    
    140 140
     
    
    141
    +        self.add_main_option(
    
    142
    +            'simulate-network-lost',
    
    143
    +            0,
    
    144
    +            GLib.OptionFlags.NONE,
    
    145
    +            GLib.OptionArg.NONE,
    
    146
    +            _('Simulate loss of connectivity'))
    
    147
    +
    
    148
    +        self.add_main_option(
    
    149
    +            'simulate-network-connected',
    
    150
    +            0,
    
    151
    +            GLib.OptionFlags.NONE,
    
    152
    +            GLib.OptionArg.NONE,
    
    153
    +            _('Simulate regaining connectivity'))
    
    154
    +
    
    155
    +
    
    141 156
             self.add_main_option_entries(self._get_remaining_entry())
    
    142 157
     
    
    143 158
             self.connect('handle-local-options', self._handle_local_options)
    
    ... ... @@ -255,10 +270,11 @@ class GajimApplication(Gtk.Application):
    255 270
             # Parse all options that should be executed on a remote instance
    
    256 271
             options = command_line.get_options_dict()
    
    257 272
     
    
    258
    -        remote_commands = ['ipython',
    
    259
    -                           'show-next-pending-event',
    
    260
    -                           'start-chat',
    
    261
    -                           ]
    
    273
    +        remote_commands = [
    
    274
    +            'ipython',
    
    275
    +            'show-next-pending-event',
    
    276
    +            'start-chat',
    
    277
    +        ]
    
    262 278
     
    
    263 279
             remaining = options.lookup_value(GLib.OPTION_REMAINING,
    
    264 280
                                              GLib.VariantType.new('as'))
    
    ... ... @@ -268,6 +284,14 @@ class GajimApplication(Gtk.Application):
    268 284
                     self.activate_action(cmd)
    
    269 285
                     return 0
    
    270 286
     
    
    287
    +        if options.contains('simulate-network-lost'):
    
    288
    +            app.interface.network_status_changed(None, False)
    
    289
    +            return 0
    
    290
    +
    
    291
    +        if options.contains('simulate-network-connected'):
    
    292
    +            app.interface.network_status_changed(None, True)
    
    293
    +            return 0
    
    294
    +
    
    271 295
             if remaining is not None:
    
    272 296
                 self._open_uris(remaining.unpack())
    
    273 297
                 return 0