Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
e4a51256 by Daniel Brötzmann at 2021-02-18T19:13:59+01:00
ChatList: Add chatstate icon
- - - - -
4 changed files:
- gajim/data/gui/chat_list_row.ui
- gajim/data/style/gajim.css
- gajim/gtk/chat_list.py
- gajim/gtk/chat_list_stack.py
Changes:
=====================================
gajim/data/gui/chat_list_row.ui
=====================================
@@ -95,17 +95,18 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="unread_label">
+ <object class="GtkImage" id="chatstate_image">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
+ <property name="valign">end</property>
+ <property
name="icon-name">content-loading-symbolic</property>
<style>
- <class name="unread-counter"/>
+ <class name="chatstate-icon"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -126,6 +127,21 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="unread_label">
+ <property name="can-focus">False</property>
+ <property name="no-show-all">True</property>
+ <style>
+ <class name="unread-counter"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
=====================================
gajim/data/style/gajim.css
=====================================
@@ -165,7 +165,26 @@
.chatlist-row overlay > box {
padding: 6px;
}
-
+@keyframes composing {
+ 0% {
+ -gtk-icon-transform: translate(0px, 0px);
+ }
+ 10% {
+ -gtk-icon-transform: translate(0px, -3px) rotate(20deg);
+ }
+ 30% {
+ -gtk-icon-transform: translate(0px, -3px) rotate(-20deg);
+ }
+ 40% {
+ -gtk-icon-transform: translate(0px, 0px);
+ }
+}
+.chatstate-icon {
+ animation-name: composing;
+ animation-duration: 2.0s;
+ animation-timing-function: ease-in-out;
+ animation-iteration-count: infinite;
+}
.unread-counter {
background-color: rgb(22, 100, 169);
color: rgb(242, 242, 242);
=====================================
gajim/gtk/chat_list.py
=====================================
@@ -152,6 +152,8 @@ def process_event(self, event):
self._on_presence_received(event)
elif event.name == 'message-sent':
self._on_message_sent(event)
+ elif event.name == 'chatstate-received':
+ self._on_chatstate_received(event)
else:
log.warning('Unhandled Event: %s', event.name)
@@ -202,6 +204,15 @@ def _on_presence_received(self, event):
row = self._chats.get((event.account, event.jid))
row.update_avatar()
+ def _on_chatstate_received(self, event):
+ row = self._chats.get((event.account, event.jid))
+ if event.contact.is_gc_contact:
+ chatstate = event.contact.chatstate
+ else:
+ chatstate = app.contacts.get_combined_chatstate(
+ row.account, row.jid)
+ row.set_chatstate(chatstate)
+
@staticmethod
def _add_unread(row, properties):
if properties.is_carbon_message and properties.carbon.is_sent:
@@ -329,6 +340,12 @@ def update_name(self):
self._ui.name_label.set_text(name)
+ def set_chatstate(self, chatstate):
+ if chatstate == 'composing':
+ self._ui.chatstate_image.show()
+ else:
+ self._ui.chatstate_image.hide()
+
@property
def unread_count(self):
return self._unread_count
=====================================
gajim/gtk/chat_list_stack.py
=====================================
@@ -13,6 +13,7 @@
'gc-message-received',
'presence-received',
'message-sent',
+ 'chatstate-received',
]
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e4a5125627706d7aa87750f81ef78909e1856b1b
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e4a5125627706d7aa87750f81ef78909e1856b1b
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