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


Commits:
48ac0694 by wurstsalat at 2024-10-27T00:16:39+02:00
refactor: MessageInputTextView: Use style scheme

- - - - -


3 changed files:

- gajim/data/style/default-dark.css
- gajim/data/style/default.css
- gajim/gtk/message_input.py


Changes:

=====================================
gajim/data/style/default-dark.css
=====================================
@@ -5,7 +5,7 @@ .gajim-incoming-nickname {
 .gajim-outgoing-nickname {
     color: rgb(40, 140, 210);
 }
-.gajim-conversation-text text {
+.gajim-conversation-text {
     color: inherit;
 }
 .gajim-status-message {


=====================================
gajim/data/style/default.css
=====================================
@@ -5,7 +5,7 @@ .gajim-incoming-nickname {
 .gajim-outgoing-nickname {
     color: rgb(50, 90, 140);
 }
-.gajim-conversation-text text {
+.gajim-conversation-text {
     color: inherit;
 }
 .gajim-status-message {


=====================================
gajim/gtk/message_input.py
=====================================
@@ -364,6 +364,11 @@ def switch_contact(self, contact: ChatContactT) -> None:
             buf.create_tag('emphasis', style=Pango.Style.ITALIC)
             buf.create_tag('strike', strikethrough=True)
             buf.create_tag('pre', family='monospace')
+
+            style_scheme = self._get_style_scheme(buf)
+            if style_scheme is not None:
+                buf.set_style_scheme(style_scheme)
+
             self._text_buffers[contact] = buf
 
             self._init_spell_checker(contact)
@@ -388,6 +393,12 @@ def switch_contact(self, contact: ChatContactT) -> None:
     def _on_buffer_changed(self, _text_buffer: GtkSource.Buffer) -> None:
         self.emit('buffer-changed')
 
+    def _get_style_scheme(self, buf: GtkSource.Buffer) -> 
GtkSource.StyleScheme | None:
+        style_scheme_manager = GtkSource.StyleSchemeManager.get_default()
+        if app.css_config.prefer_dark:
+            return style_scheme_manager.get_scheme('Adwaita-dark')
+        return style_scheme_manager.get_scheme('Adwaita')
+
     def _init_spell_checker(self, contact: ChatContactT) -> None:
         if not app.is_installed('SPELLING'):
             return



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

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