Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
-
e4a51256
by Daniel Brötzmann at 2021-02-18T19:13:59+01:00
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:
| ... | ... | @@ -95,17 +95,18 @@ |
| 95 | 95 |
</packing>
|
| 96 | 96 |
</child>
|
| 97 | 97 |
<child>
|
| 98 |
- <object class="GtkLabel" id="unread_label">
|
|
| 98 |
+ <object class="GtkImage" id="chatstate_image">
|
|
| 99 | 99 |
<property name="can-focus">False</property>
|
| 100 | 100 |
<property name="no-show-all">True</property>
|
| 101 |
+ <property name="valign">end</property>
|
|
| 102 |
+ <property name="icon-name">content-loading-symbolic</property>
|
|
| 101 | 103 |
<style>
|
| 102 |
- <class name="unread-counter"/>
|
|
| 104 |
+ <class name="chatstate-icon"/>
|
|
| 103 | 105 |
</style>
|
| 104 | 106 |
</object>
|
| 105 | 107 |
<packing>
|
| 106 | 108 |
<property name="expand">False</property>
|
| 107 | 109 |
<property name="fill">True</property>
|
| 108 |
- <property name="pack-type">end</property>
|
|
| 109 | 110 |
<property name="position">1</property>
|
| 110 | 111 |
</packing>
|
| 111 | 112 |
</child>
|
| ... | ... | @@ -126,6 +127,21 @@ |
| 126 | 127 |
<property name="position">2</property>
|
| 127 | 128 |
</packing>
|
| 128 | 129 |
</child>
|
| 130 |
+ <child>
|
|
| 131 |
+ <object class="GtkLabel" id="unread_label">
|
|
| 132 |
+ <property name="can-focus">False</property>
|
|
| 133 |
+ <property name="no-show-all">True</property>
|
|
| 134 |
+ <style>
|
|
| 135 |
+ <class name="unread-counter"/>
|
|
| 136 |
+ </style>
|
|
| 137 |
+ </object>
|
|
| 138 |
+ <packing>
|
|
| 139 |
+ <property name="expand">False</property>
|
|
| 140 |
+ <property name="fill">True</property>
|
|
| 141 |
+ <property name="pack-type">end</property>
|
|
| 142 |
+ <property name="position">3</property>
|
|
| 143 |
+ </packing>
|
|
| 144 |
+ </child>
|
|
| 129 | 145 |
</object>
|
| 130 | 146 |
<packing>
|
| 131 | 147 |
<property name="expand">False</property>
|
| ... | ... | @@ -165,7 +165,26 @@ |
| 165 | 165 |
.chatlist-row overlay > box {
|
| 166 | 166 |
padding: 6px;
|
| 167 | 167 |
}
|
| 168 |
- |
|
| 168 |
+@keyframes composing {
|
|
| 169 |
+ 0% {
|
|
| 170 |
+ -gtk-icon-transform: translate(0px, 0px);
|
|
| 171 |
+ }
|
|
| 172 |
+ 10% {
|
|
| 173 |
+ -gtk-icon-transform: translate(0px, -3px) rotate(20deg);
|
|
| 174 |
+ }
|
|
| 175 |
+ 30% {
|
|
| 176 |
+ -gtk-icon-transform: translate(0px, -3px) rotate(-20deg);
|
|
| 177 |
+ }
|
|
| 178 |
+ 40% {
|
|
| 179 |
+ -gtk-icon-transform: translate(0px, 0px);
|
|
| 180 |
+ }
|
|
| 181 |
+}
|
|
| 182 |
+.chatstate-icon {
|
|
| 183 |
+ animation-name: composing;
|
|
| 184 |
+ animation-duration: 2.0s;
|
|
| 185 |
+ animation-timing-function: ease-in-out;
|
|
| 186 |
+ animation-iteration-count: infinite;
|
|
| 187 |
+}
|
|
| 169 | 188 |
.unread-counter {
|
| 170 | 189 |
background-color: rgb(22, 100, 169);
|
| 171 | 190 |
color: rgb(242, 242, 242);
|
| ... | ... | @@ -152,6 +152,8 @@ def process_event(self, event): |
| 152 | 152 |
self._on_presence_received(event)
|
| 153 | 153 |
elif event.name == 'message-sent':
|
| 154 | 154 |
self._on_message_sent(event)
|
| 155 |
+ elif event.name == 'chatstate-received':
|
|
| 156 |
+ self._on_chatstate_received(event)
|
|
| 155 | 157 |
else:
|
| 156 | 158 |
log.warning('Unhandled Event: %s', event.name)
|
| 157 | 159 |
|
| ... | ... | @@ -202,6 +204,15 @@ def _on_presence_received(self, event): |
| 202 | 204 |
row = self._chats.get((event.account, event.jid))
|
| 203 | 205 |
row.update_avatar()
|
| 204 | 206 |
|
| 207 |
+ def _on_chatstate_received(self, event):
|
|
| 208 |
+ row = self._chats.get((event.account, event.jid))
|
|
| 209 |
+ if event.contact.is_gc_contact:
|
|
| 210 |
+ chatstate = event.contact.chatstate
|
|
| 211 |
+ else:
|
|
| 212 |
+ chatstate = app.contacts.get_combined_chatstate(
|
|
| 213 |
+ row.account, row.jid)
|
|
| 214 |
+ row.set_chatstate(chatstate)
|
|
| 215 |
+ |
|
| 205 | 216 |
@staticmethod
|
| 206 | 217 |
def _add_unread(row, properties):
|
| 207 | 218 |
if properties.is_carbon_message and properties.carbon.is_sent:
|
| ... | ... | @@ -329,6 +340,12 @@ def update_name(self): |
| 329 | 340 |
|
| 330 | 341 |
self._ui.name_label.set_text(name)
|
| 331 | 342 |
|
| 343 |
+ def set_chatstate(self, chatstate):
|
|
| 344 |
+ if chatstate == 'composing':
|
|
| 345 |
+ self._ui.chatstate_image.show()
|
|
| 346 |
+ else:
|
|
| 347 |
+ self._ui.chatstate_image.hide()
|
|
| 348 |
+ |
|
| 332 | 349 |
@property
|
| 333 | 350 |
def unread_count(self):
|
| 334 | 351 |
return self._unread_count
|
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 |
'gc-message-received',
|
| 14 | 14 |
'presence-received',
|
| 15 | 15 |
'message-sent',
|
| 16 |
+ 'chatstate-received',
|
|
| 16 | 17 |
]
|
| 17 | 18 |
|
| 18 | 19 |
|