Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
a75d9d7f by wurstsalat at 2025-08-24T18:38:53+02:00
cq: Icons: Improve custom icons test

- - - - -


1 changed file:

- test/gtk/ui_test_custom_icons.py


Changes:

=====================================
test/gtk/ui_test_custom_icons.py
=====================================
@@ -2,9 +2,12 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
+from typing import Any
+
 import os
 from pathlib import Path
 
+from gi.repository import Adw
 from gi.repository import Gtk
 
 from gajim.gtk.widgets import GajimAppWindow
@@ -29,8 +32,26 @@ def __init__(self):
             default_height=600,
         )
 
-        scrolled_window = 
Gtk.ScrolledWindow(hscrollbar_policy=Gtk.PolicyType.NEVER)
-        self.set_child(scrolled_window)
+        box = Gtk.Box(spacing=18, orientation=Gtk.Orientation.VERTICAL)
+        self.set_child(box)
+
+        switch = Gtk.Switch()
+        switch.connect("notify::active", self._on_theme_switched)
+
+        theme_box = Gtk.Box(spacing=12, halign=Gtk.Align.CENTER)
+        theme_box.append(Gtk.Label(label="Light"))
+        theme_box.append(switch)
+        theme_box.append(Gtk.Label(label="dark"))
+        box.append(theme_box)
+
+        self._adw_style_manager = Adw.StyleManager.get_default()
+        color_scheme = self._adw_style_manager.get_color_scheme()
+        switch.set_active(color_scheme == Adw.ColorScheme.FORCE_DARK)
+
+        scrolled_window = Gtk.ScrolledWindow(
+            hscrollbar_policy=Gtk.PolicyType.NEVER, vexpand=True
+        )
+        box.append(scrolled_window)
         flow_box = Gtk.FlowBox(
             halign=Gtk.Align.CENTER,
             valign=Gtk.Align.CENTER,
@@ -52,6 +73,12 @@ def __init__(self):
                 image.set_pixel_size(48)
                 flow_box.append(image)
 
+    def _on_theme_switched(self, switch: Gtk.Switch, args: Any) -> None:
+        if switch.get_active():
+            
self._adw_style_manager.set_color_scheme(Adw.ColorScheme.FORCE_DARK)
+        else:
+            
self._adw_style_manager.set_color_scheme(Adw.ColorScheme.FORCE_LIGHT)
+
 
 util.init_settings()
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a75d9d7f1117c0813ebeac1c52c5d65c16237bd9

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a75d9d7f1117c0813ebeac1c52c5d65c16237bd9
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