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


Commits:
da4e245a by lovetox at 2022-01-23T09:24:32+01:00
Interface: Move more code into Application

- - - - -
20d651f8 by lovetox at 2022-01-23T11:58:20+01:00
Update README.md

- - - - -


5 changed files:

- README.md
- gajim/common/application.py
- gajim/common/dbus/logind.py
- gajim/gtk/application.py
- gajim/gui_interface.py


Changes:

=====================================
README.md
=====================================
@@ -34,6 +34,10 @@ ### Compile-time Requirements
 - python3-setuptools
 - gettext
 
+### Running Tests
+
+`python -m unittest discover -s test`
+
 ### Installation Procedure
 
 #### Packages


=====================================
gajim/common/application.py
=====================================
@@ -74,6 +74,9 @@ def _init_core(self) -> None:
         if sys.platform in ('win32', 'darwin'):
             GLib.timeout_add_seconds(20, self._check_for_updates)
 
+        for account in app.settings.get_active_accounts():
+            app.connections[account] = Client(account)
+
     @property
     def _log(self) -> logging.Logger:
         return app.log('gajim.application')


=====================================
gajim/common/dbus/logind.py
=====================================
@@ -145,5 +145,10 @@ def _on_vanish_logind(self, _connection, name, 
*_user_data):
 
 
 def enable():
+    # Module should be rewritten
+    # Its not useful to know when the computer goes to sleep.
+    # Because of stream management we don’t need to do anything in that case.
+    # It would be useful to know when the computer powers off, in this case
+    # Gajim is shutdown and we should correctly disconnect.
     return
     # LogindListener.get()


=====================================
gajim/gtk/application.py
=====================================
@@ -62,6 +62,8 @@
 from gajim.common.application import CoreApplication
 from gajim.common.const import GAJIM_FAQ_URI
 from gajim.common.const import GAJIM_WIKI_URI
+from gajim.common.dbus import logind
+from gajim.common.dbus import music_track
 from gajim.common.events import ApplicationEvent
 from gajim.common.exceptions import GajimGeneralException
 from gajim.common.helpers import load_json
@@ -235,6 +237,9 @@ def _startup(self, _application: GajimApplication) -> None:
         from gajim.gui.status_icon import StatusIcon
         self.systray = StatusIcon()
 
+        if sys.platform not in ('win32', 'darwin'):
+            music_track.enable()
+
         self.add_actions()
         self._load_shortcuts()
         menus.build_accounts_menu()


=====================================
gajim/gui_interface.py
=====================================
@@ -61,8 +61,6 @@
 from gajim.common import helpers
 from gajim.common import passwords
 
-from gajim.common.dbus import logind
-from gajim.common.dbus import music_track
 from gajim.common.events import AccountEnabled
 from gajim.common.events import AccountDisabled
 from gajim.common.events import FileCompleted
@@ -125,12 +123,9 @@ def __init__(self):
         self._create_core_handlers_list()
         self._register_core_handlers()
 
-        for account in app.settings.get_accounts():
-            if app.settings.get_account_setting(account, 'active'):
-                client = Client(account)
-                app.connections[account] = client
-                app.ged.register_event_handler(
-                    'muc-added', ged.CORE, self._on_muc_added)
+        app.ged.register_event_handler('muc-added',
+                                       ged.CORE,
+                                       self._on_muc_added)
 
         self.instances = {}
 
@@ -145,10 +140,6 @@ def __init__(self):
             app.nicks[acc] = app.settings.get_account_setting(acc, 'name')
             app.block_signed_in_notifications[acc] = True
 
-        if sys.platform not in ('win32', 'darwin'):
-            logind.enable()
-            music_track.enable()
-
     def _create_core_handlers_list(self) -> None:
         # pylint: disable=line-too-long
         self.handlers = {



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/5ff99a655c405606ddba6a6ef7c4e387edb2af9c...20d651f8c2cf2bd235d8145f07394d3d053506f0

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/5ff99a655c405606ddba6a6ef7c4e387edb2af9c...20d651f8c2cf2bd235d8145f07394d3d053506f0
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to