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


Commits:
fa083f04 by Philipp Hörist at 2024-09-13T23:58:22+02:00
refactor: StatusIcon: Simplify finding correct icon

- - - - -
a41dd3da by Philipp Hörist at 2024-09-14T00:01:59+02:00
cq: Update pyright excludes

- - - - -


2 changed files:

- gajim/gtk/status_icon.py
- pyproject.toml


Changes:

=====================================
gajim/gtk/status_icon.py
=====================================
@@ -291,14 +291,15 @@ def _build_menu(self, button: int, event_time: int) -> 
None:
 class AppIndicatorIcon(GtkMenuBackend):
     def __init__(self) -> None:
         GtkMenuBackend.__init__(self)
-
         assert AppIndicator is not None
+
+        icon_name, _ = self._get_icon_details()
         self._status_icon = AppIndicator.Indicator.new(
             'Gajim',
-            'org.gajim.Gajim',
+            icon_name,
             AppIndicator.IndicatorCategory.COMMUNICATIONS)
-        if not app.is_flatpak():
-            
self._status_icon.set_icon_theme_path(str(configpaths.get('ICONS')))
+
+        self._status_icon.set_icon_theme_path(str(configpaths.get('ICONS')))
         self._status_icon.set_status(AppIndicator.IndicatorStatus.ACTIVE)
         self._status_icon.set_menu(self._ui.systray_context_menu)
         self._status_icon.set_secondary_activate_target(
@@ -306,6 +307,13 @@ def __init__(self) -> None:
 
         self.update_state(init=True)
 
+    def _get_icon_details(self) -> tuple[str, str]:
+        if app.is_flatpak():
+            return app.get_default_app_id(), 'online'
+
+        show = get_global_show()
+        return get_icon_name(show), show
+
     def update_state(self, init: bool = False) -> None:
         if not app.settings.get('show_trayicon'):
             self._status_icon.set_status(AppIndicator.IndicatorStatus.PASSIVE)
@@ -320,12 +328,7 @@ def update_state(self, init: bool = False) -> None:
             self._status_icon.set_icon_full(icon_name, _('Pending Event'))
             return
 
-        if app.is_flatpak():
-            self._status_icon.set_icon_full('org.gajim.Gajim', 'online')
-            return
-
-        show = get_global_show()
-        icon_name = get_icon_name(show)
+        icon_name, show = self._get_icon_details()
         self._status_icon.set_icon_full(icon_name, show)
 
     def is_visible(self) -> bool:


=====================================
pyproject.toml
=====================================
@@ -96,9 +96,11 @@ reportMissingModuleSource = "none"
 
 exclude = [
   "**/__pycache__",
+  ".flatpak-builder",
   ".git",
   ".venv",
   "build",
+  "debian_build",
   "gajim/__init__.py",
   "gajim/common/app.py",
   "gajim/common/client.py",



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/e3f9da7f17ea2722ea50962a21dd296e3665480d...a41dd3dabb078b24ad485eab4543ed576c593a34

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/e3f9da7f17ea2722ea50962a21dd296e3665480d...a41dd3dabb078b24ad485eab4543ed576c593a34
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to