Philipp Hörist pushed to branch mute-chat-notifications at gajim / gajim


Commits:
46d2d222 by Philipp Hörist at 2023-04-02T15:31:53+02:00
new: Add chat list row mute icon

- - - - -


3 changed files:

- gajim/data/gui/chat_list_row.ui
- gajim/gtk/builder.pyi
- gajim/gtk/chat_list_row.py


Changes:

=====================================
gajim/data/gui/chat_list_row.ui
=====================================
@@ -113,6 +113,19 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkImage" id="mute_image">
+                    <property name="can-focus">False</property>
+                    <property name="no-show-all">True</property>
+                    <property 
name="icon-name">audio-volume-muted-symbolic</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack-type">end</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
                 <child>
                   <object class="GtkLabel" id="timestamp_label">
                     <property name="visible">True</property>
@@ -127,7 +140,7 @@
                     <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="pack-type">end</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
               </object>


=====================================
gajim/gtk/builder.pyi
=====================================
@@ -6,6 +6,7 @@ from gi.repository import Atk
 from gi.repository import Gtk
 from gi.repository import GtkSource
 
+
 class Builder(Gtk.Builder):
     ...
 
@@ -211,6 +212,7 @@ class ChatListRowBuilder(Builder):
     group_chat_indicator: Gtk.Image
     name_label: Gtk.Label
     chatstate_image: Gtk.Image
+    mute_image: Gtk.Image
     timestamp_label: Gtk.Label
     nick_label: Gtk.Label
     message_icon: Gtk.Image


=====================================
gajim/gtk/chat_list_row.py
=====================================
@@ -108,6 +108,13 @@ def __init__(self,
         self.connect('state-flags-changed', self._on_state_flags_changed)
         self.connect('destroy', self._on_destroy)
 
+        app.settings.connect_signal(
+            'mute_until',
+            self._on_mute_setting_changed,
+            self.contact.account,
+            self.contact.jid)
+        self._on_mute_setting_changed()
+
         # Drag and Drop
         entries = [Gtk.TargetEntry.new(
             'CHAT_LIST_ITEM',
@@ -376,6 +383,9 @@ def _get_unread_string(count: int) -> str:
             return str(count)
         return '999+'
 
+    def _on_mute_setting_changed(self, *args: Any) -> None:
+        self._ui.mute_image.set_visible(self.contact.is_muted)
+
     def _on_draft_update(self,
                          _draft_storage: DraftStorage,
                          _signal_name: str,
@@ -409,6 +419,7 @@ def _on_state_flags_changed(self,
             self._ui.revealer.set_reveal_child(False)
 
     def _on_destroy(self, _row: ChatListRow) -> None:
+        app.settings.disconnect_signals(self)
         self.contact.disconnect_all_from_obj(self)
         if isinstance(self.contact, GroupchatParticipant):
             self.contact.room.disconnect_all_from_obj(self)



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

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