Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
-
146a12fd
by wurstsalat at 2021-09-10T17:40:06+02:00
-
6ec7078f
by wurstsalat at 2021-09-10T18:05:59+02:00
-
1665a2dd
by wurstsalat at 2021-09-10T18:36:24+02:00
10 changed files:
- gajim/common/modules/contacts.py
- gajim/common/modules/discovery.py
- gajim/data/gui/xml_console.ui
- gajim/gtk/avatar.py
- gajim/gtk/chat_list.py
- gajim/gtk/contact_info.py
- gajim/gtk/groupchat_info.py
- gajim/gtk/roster.py
- gajim/gtk/tooltips.py
- gajim/gtk/xml_console.py
Changes:
| ... | ... | @@ -248,11 +248,37 @@ def get_avatar(self, |
| 248 | 248 |
|
| 249 | 249 |
show = self.show if add_show else None
|
| 250 | 250 |
|
| 251 |
+ transport_icon = None
|
|
| 252 |
+ if self.is_gateway:
|
|
| 253 |
+ show = None
|
|
| 254 |
+ disco_info = app.storage.cache.get_last_disco_info(self._jid)
|
|
| 255 |
+ if disco_info.gateway_type == 'sms':
|
|
| 256 |
+ transport_icon = 'gajim-agent-sms'
|
|
| 257 |
+ if disco_info.gateway_type == 'irc':
|
|
| 258 |
+ transport_icon = 'gajim-agent-irc'
|
|
| 259 |
+ else:
|
|
| 260 |
+ for resource_contact in self.iter_resources():
|
|
| 261 |
+ if resource_contact.identity_type == 'sms':
|
|
| 262 |
+ transport_icon = 'gajim-agent-sms'
|
|
| 263 |
+ break
|
|
| 264 |
+ |
|
| 251 | 265 |
if pixbuf:
|
| 252 | 266 |
return app.interface.avatar_storage.get_pixbuf(
|
| 253 |
- self, size, scale, show, default=default, style=style)
|
|
| 267 |
+ self,
|
|
| 268 |
+ size,
|
|
| 269 |
+ scale,
|
|
| 270 |
+ show,
|
|
| 271 |
+ default=default,
|
|
| 272 |
+ transport_icon=transport_icon,
|
|
| 273 |
+ style=style)
|
|
| 254 | 274 |
return app.interface.avatar_storage.get_surface(
|
| 255 |
- self, size, scale, show, default=default, style=style)
|
|
| 275 |
+ self,
|
|
| 276 |
+ size,
|
|
| 277 |
+ scale,
|
|
| 278 |
+ show,
|
|
| 279 |
+ default=default,
|
|
| 280 |
+ transport_icon=transport_icon,
|
|
| 281 |
+ style=style)
|
|
| 256 | 282 |
|
| 257 | 283 |
def update_presence(self, presence_data):
|
| 258 | 284 |
for contact in self._resources.values():
|
| ... | ... | @@ -281,14 +307,11 @@ def is_in_roster(self): |
| 281 | 307 |
return item is not None
|
| 282 | 308 |
|
| 283 | 309 |
@property
|
| 284 |
- def is_transport(self):
|
|
| 310 |
+ def is_gateway(self):
|
|
| 285 | 311 |
disco_info = app.storage.cache.get_last_disco_info(self._jid)
|
| 286 | 312 |
if disco_info is None:
|
| 287 | 313 |
return False
|
| 288 |
- for identity in disco_info.identities:
|
|
| 289 |
- if identity.category == 'gateway':
|
|
| 290 |
- return True
|
|
| 291 |
- return False
|
|
| 314 |
+ return disco_info.is_gateway
|
|
| 292 | 315 |
|
| 293 | 316 |
@property
|
| 294 | 317 |
def ask(self):
|
| ... | ... | @@ -329,6 +352,18 @@ def supports(self, requested_feature): |
| 329 | 352 |
return False
|
| 330 | 353 |
return CommonContact.supports(self, requested_feature)
|
| 331 | 354 |
|
| 355 |
+ @property
|
|
| 356 |
+ def identity_type(self):
|
|
| 357 |
+ disco_info = app.storage.cache.get_last_disco_info(self._jid)
|
|
| 358 |
+ if disco_info is None:
|
|
| 359 |
+ return None
|
|
| 360 |
+ |
|
| 361 |
+ for identity in disco_info.identities:
|
|
| 362 |
+ if identity.type is not None:
|
|
| 363 |
+ return identity.type
|
|
| 364 |
+ |
|
| 365 |
+ return None
|
|
| 366 |
+ |
|
| 332 | 367 |
@property
|
| 333 | 368 |
def is_available(self):
|
| 334 | 369 |
return self._presence.available
|
| ... | ... | @@ -399,11 +434,19 @@ def avatar_sha(self): |
| 399 | 434 |
return app.storage.cache.get_muc(self._jid, 'avatar')
|
| 400 | 435 |
|
| 401 | 436 |
def get_avatar(self, size, scale):
|
| 437 |
+ transport_icon = None
|
|
| 438 |
+ disco_info = self.get_disco()
|
|
| 439 |
+ if disco_info is not None:
|
|
| 440 |
+ for identity in disco_info.identities:
|
|
| 441 |
+ if identity.type == 'irc':
|
|
| 442 |
+ transport_icon = 'gajim-agent-irc'
|
|
| 443 |
+ break
|
|
| 402 | 444 |
return app.interface.avatar_storage.get_muc_surface(
|
| 403 | 445 |
self._account,
|
| 404 | 446 |
self._jid,
|
| 405 | 447 |
size,
|
| 406 |
- scale)
|
|
| 448 |
+ scale,
|
|
| 449 |
+ transport_icon=transport_icon)
|
|
| 407 | 450 |
|
| 408 | 451 |
def _on_user_signal(self, contact, signal_name, *args):
|
| 409 | 452 |
self.notify(signal_name, contact, *args)
|
| ... | ... | @@ -241,19 +241,16 @@ def disco_muc(self, |
| 241 | 241 |
def disco_contact(self, contact):
|
| 242 | 242 |
_task = yield
|
| 243 | 243 |
|
| 244 |
- fjid = contact.get_full_jid()
|
|
| 245 |
- |
|
| 246 |
- result = yield self.disco_info(fjid)
|
|
| 244 |
+ result = yield self.disco_info(contact.jid)
|
|
| 247 | 245 |
if is_error(result):
|
| 248 | 246 |
raise result
|
| 249 | 247 |
|
| 250 |
- self._log.info('Disco Info received: %s', fjid)
|
|
| 248 |
+ self._log.info('Disco Info received: %s', contact.jid)
|
|
| 251 | 249 |
|
| 252 | 250 |
app.storage.cache.set_last_disco_info(result.jid,
|
| 253 | 251 |
result,
|
| 254 | 252 |
cache_only=True)
|
| 255 | 253 |
|
| 256 |
- |
|
| 257 | 254 |
contact = self._con.get_module('Contacts').get_contact(result.jid)
|
| 258 | 255 |
contact.notify('caps-update')
|
| 259 | 256 |
|
| 1 | 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-<!-- Generated with glade 3.36.0 -->
|
|
| 2 |
+<!-- Generated with glade 3.38.2 -->
|
|
| 3 | 3 |
<interface>
|
| 4 | 4 |
<requires lib="gtk+" version="3.22"/>
|
| 5 | 5 |
<object class="GtkHeaderBar" id="headerbar">
|
| 6 | 6 |
<property name="visible">True</property>
|
| 7 |
- <property name="can_focus">False</property>
|
|
| 7 |
+ <property name="can-focus">False</property>
|
|
| 8 | 8 |
<property name="title" translatable="yes">XML Console</property>
|
| 9 |
- <property name="show_close_button">True</property>
|
|
| 9 |
+ <property name="show-close-button">True</property>
|
|
| 10 | 10 |
<child>
|
| 11 | 11 |
<object class="GtkImage">
|
| 12 | 12 |
<property name="visible">True</property>
|
| 13 |
- <property name="can_focus">False</property>
|
|
| 14 |
- <property name="icon_name">utilities-terminal-symbolic</property>
|
|
| 13 |
+ <property name="can-focus">False</property>
|
|
| 14 |
+ <property name="icon-name">utilities-terminal-symbolic</property>
|
|
| 15 | 15 |
</object>
|
| 16 | 16 |
</child>
|
| 17 | 17 |
<child>
|
| 18 | 18 |
<object class="GtkToggleButton" id="search_toggle">
|
| 19 | 19 |
<property name="visible">True</property>
|
| 20 |
- <property name="can_focus">True</property>
|
|
| 21 |
- <property name="receives_default">True</property>
|
|
| 22 |
- <property name="margin_start">6</property>
|
|
| 20 |
+ <property name="can-focus">True</property>
|
|
| 21 |
+ <property name="receives-default">True</property>
|
|
| 22 |
+ <property name="margin-start">6</property>
|
|
| 23 | 23 |
<signal name="toggled" handler="_on_search_toggled" swapped="no"/>
|
| 24 | 24 |
<child>
|
| 25 | 25 |
<object class="GtkImage">
|
| 26 | 26 |
<property name="visible">True</property>
|
| 27 |
- <property name="can_focus">False</property>
|
|
| 28 |
- <property name="icon_name">system-search-symbolic</property>
|
|
| 27 |
+ <property name="can-focus">False</property>
|
|
| 28 |
+ <property name="icon-name">system-search-symbolic</property>
|
|
| 29 | 29 |
</object>
|
| 30 | 30 |
</child>
|
| 31 | 31 |
</object>
|
| ... | ... | @@ -35,22 +35,22 @@ |
| 35 | 35 |
</child>
|
| 36 | 36 |
</object>
|
| 37 | 37 |
<object class="GtkPopover" id="popover">
|
| 38 |
- <property name="can_focus">False</property>
|
|
| 38 |
+ <property name="can-focus">False</property>
|
|
| 39 | 39 |
<property name="valign">start</property>
|
| 40 | 40 |
<child>
|
| 41 | 41 |
<object class="GtkListBox">
|
| 42 | 42 |
<property name="visible">True</property>
|
| 43 |
- <property name="can_focus">False</property>
|
|
| 44 |
- <property name="selection_mode">none</property>
|
|
| 43 |
+ <property name="can-focus">False</property>
|
|
| 44 |
+ <property name="selection-mode">none</property>
|
|
| 45 | 45 |
<signal name="row-activated" handler="_on_row_activated" swapped="no"/>
|
| 46 | 46 |
<child>
|
| 47 | 47 |
<object class="GtkListBoxRow">
|
| 48 | 48 |
<property name="visible">True</property>
|
| 49 |
- <property name="can_focus">True</property>
|
|
| 49 |
+ <property name="can-focus">True</property>
|
|
| 50 | 50 |
<child>
|
| 51 | 51 |
<object class="GtkLabel">
|
| 52 | 52 |
<property name="visible">True</property>
|
| 53 |
- <property name="can_focus">False</property>
|
|
| 53 |
+ <property name="can-focus">False</property>
|
|
| 54 | 54 |
<property name="label">Message</property>
|
| 55 | 55 |
</object>
|
| 56 | 56 |
</child>
|
| ... | ... | @@ -59,11 +59,11 @@ |
| 59 | 59 |
<child>
|
| 60 | 60 |
<object class="GtkListBoxRow">
|
| 61 | 61 |
<property name="visible">True</property>
|
| 62 |
- <property name="can_focus">True</property>
|
|
| 62 |
+ <property name="can-focus">True</property>
|
|
| 63 | 63 |
<child>
|
| 64 | 64 |
<object class="GtkLabel">
|
| 65 | 65 |
<property name="visible">True</property>
|
| 66 |
- <property name="can_focus">False</property>
|
|
| 66 |
+ <property name="can-focus">False</property>
|
|
| 67 | 67 |
<property name="label">Presence</property>
|
| 68 | 68 |
</object>
|
| 69 | 69 |
</child>
|
| ... | ... | @@ -72,16 +72,29 @@ |
| 72 | 72 |
<child>
|
| 73 | 73 |
<object class="GtkListBoxRow">
|
| 74 | 74 |
<property name="visible">True</property>
|
| 75 |
- <property name="can_focus">True</property>
|
|
| 75 |
+ <property name="can-focus">True</property>
|
|
| 76 | 76 |
<child>
|
| 77 | 77 |
<object class="GtkLabel">
|
| 78 | 78 |
<property name="visible">True</property>
|
| 79 |
- <property name="can_focus">False</property>
|
|
| 79 |
+ <property name="can-focus">False</property>
|
|
| 80 | 80 |
<property name="label">Iq</property>
|
| 81 | 81 |
</object>
|
| 82 | 82 |
</child>
|
| 83 | 83 |
</object>
|
| 84 | 84 |
</child>
|
| 85 |
+ <child>
|
|
| 86 |
+ <object class="GtkListBoxRow">
|
|
| 87 |
+ <property name="visible">True</property>
|
|
| 88 |
+ <property name="can-focus">True</property>
|
|
| 89 |
+ <child>
|
|
| 90 |
+ <object class="GtkLabel">
|
|
| 91 |
+ <property name="visible">True</property>
|
|
| 92 |
+ <property name="can-focus">False</property>
|
|
| 93 |
+ <property name="label">Disco Info</property>
|
|
| 94 |
+ </object>
|
|
| 95 |
+ </child>
|
|
| 96 |
+ </object>
|
|
| 97 |
+ </child>
|
|
| 85 | 98 |
</object>
|
| 86 | 99 |
</child>
|
| 87 | 100 |
<style>
|
| ... | ... | @@ -90,45 +103,45 @@ |
| 90 | 103 |
</object>
|
| 91 | 104 |
<object class="GtkBox" id="box">
|
| 92 | 105 |
<property name="visible">True</property>
|
| 93 |
- <property name="can_focus">False</property>
|
|
| 106 |
+ <property name="can-focus">False</property>
|
|
| 94 | 107 |
<property name="orientation">vertical</property>
|
| 95 | 108 |
<child>
|
| 96 | 109 |
<object class="GtkPaned" id="paned">
|
| 97 | 110 |
<property name="visible">True</property>
|
| 98 |
- <property name="can_focus">True</property>
|
|
| 111 |
+ <property name="can-focus">True</property>
|
|
| 99 | 112 |
<property name="vexpand">True</property>
|
| 100 | 113 |
<property name="orientation">vertical</property>
|
| 101 | 114 |
<child>
|
| 102 | 115 |
<object class="GtkBox">
|
| 103 | 116 |
<property name="visible">True</property>
|
| 104 |
- <property name="can_focus">False</property>
|
|
| 117 |
+ <property name="can-focus">False</property>
|
|
| 105 | 118 |
<property name="orientation">vertical</property>
|
| 106 | 119 |
<child>
|
| 107 | 120 |
<object class="GtkRevealer" id="search_revealer">
|
| 108 | 121 |
<property name="visible">True</property>
|
| 109 |
- <property name="can_focus">False</property>
|
|
| 110 |
- <property name="transition_type">none</property>
|
|
| 111 |
- <property name="transition_duration">100</property>
|
|
| 122 |
+ <property name="can-focus">False</property>
|
|
| 123 |
+ <property name="transition-type">none</property>
|
|
| 124 |
+ <property name="transition-duration">100</property>
|
|
| 112 | 125 |
<child>
|
| 113 | 126 |
<object class="GtkToolbar">
|
| 114 | 127 |
<property name="visible">True</property>
|
| 115 |
- <property name="can_focus">False</property>
|
|
| 128 |
+ <property name="can-focus">False</property>
|
|
| 116 | 129 |
<property name="halign">center</property>
|
| 117 |
- <property name="show_arrow">False</property>
|
|
| 130 |
+ <property name="show-arrow">False</property>
|
|
| 118 | 131 |
<property name="icon_size">2</property>
|
| 119 | 132 |
<child>
|
| 120 | 133 |
<object class="GtkToolItem">
|
| 121 | 134 |
<property name="visible">True</property>
|
| 122 |
- <property name="can_focus">False</property>
|
|
| 123 |
- <property name="margin_end">6</property>
|
|
| 135 |
+ <property name="can-focus">False</property>
|
|
| 136 |
+ <property name="margin-end">6</property>
|
|
| 124 | 137 |
<child>
|
| 125 | 138 |
<object class="GtkSearchEntry" id="search_entry">
|
| 126 | 139 |
<property name="visible">True</property>
|
| 127 |
- <property name="can_focus">True</property>
|
|
| 128 |
- <property name="primary_icon_name">edit-find-symbolic</property>
|
|
| 129 |
- <property name="primary_icon_activatable">False</property>
|
|
| 130 |
- <property name="primary_icon_sensitive">False</property>
|
|
| 131 |
- <property name="placeholder_text" translatable="yes">Start Search...</property>
|
|
| 140 |
+ <property name="can-focus">True</property>
|
|
| 141 |
+ <property name="primary-icon-name">edit-find-symbolic</property>
|
|
| 142 |
+ <property name="primary-icon-activatable">False</property>
|
|
| 143 |
+ <property name="primary-icon-sensitive">False</property>
|
|
| 144 |
+ <property name="placeholder-text" translatable="yes">Start Search...</property>
|
|
| 132 | 145 |
<signal name="activate" handler="_on_search_activate" swapped="no"/>
|
| 133 | 146 |
</object>
|
| 134 | 147 |
</child>
|
| ... | ... | @@ -141,9 +154,9 @@ |
| 141 | 154 |
<child>
|
| 142 | 155 |
<object class="GtkToolButton" id="search_forward">
|
| 143 | 156 |
<property name="visible">True</property>
|
| 144 |
- <property name="can_focus">False</property>
|
|
| 145 |
- <property name="use_underline">True</property>
|
|
| 146 |
- <property name="icon_name">go-down-symbolic</property>
|
|
| 157 |
+ <property name="can-focus">False</property>
|
|
| 158 |
+ <property name="use-underline">True</property>
|
|
| 159 |
+ <property name="icon-name">go-down-symbolic</property>
|
|
| 147 | 160 |
<signal name="clicked" handler="_on_search_clicked" swapped="no"/>
|
| 148 | 161 |
</object>
|
| 149 | 162 |
<packing>
|
| ... | ... | @@ -154,9 +167,9 @@ |
| 154 | 167 |
<child>
|
| 155 | 168 |
<object class="GtkToolButton" id="search_backward">
|
| 156 | 169 |
<property name="visible">True</property>
|
| 157 |
- <property name="can_focus">False</property>
|
|
| 158 |
- <property name="use_underline">True</property>
|
|
| 159 |
- <property name="icon_name">go-up-symbolic</property>
|
|
| 170 |
+ <property name="can-focus">False</property>
|
|
| 171 |
+ <property name="use-underline">True</property>
|
|
| 172 |
+ <property name="icon-name">go-up-symbolic</property>
|
|
| 160 | 173 |
<signal name="clicked" handler="_on_search_clicked" swapped="no"/>
|
| 161 | 174 |
</object>
|
| 162 | 175 |
<packing>
|
| ... | ... | @@ -175,19 +188,19 @@ |
| 175 | 188 |
</child>
|
| 176 | 189 |
<child>
|
| 177 | 190 |
<object class="GtkScrolledWindow" id="scrolled">
|
| 178 |
- <property name="height_request">400</property>
|
|
| 191 |
+ <property name="height-request">400</property>
|
|
| 179 | 192 |
<property name="visible">True</property>
|
| 180 |
- <property name="can_focus">True</property>
|
|
| 181 |
- <property name="shadow_type">in</property>
|
|
| 193 |
+ <property name="can-focus">True</property>
|
|
| 194 |
+ <property name="shadow-type">in</property>
|
|
| 182 | 195 |
<child>
|
| 183 | 196 |
<object class="GtkTextView" id="textview">
|
| 184 | 197 |
<property name="visible">True</property>
|
| 185 |
- <property name="can_focus">True</property>
|
|
| 198 |
+ <property name="can-focus">True</property>
|
|
| 186 | 199 |
<property name="editable">False</property>
|
| 187 |
- <property name="left_margin">6</property>
|
|
| 188 |
- <property name="right_margin">6</property>
|
|
| 189 |
- <property name="top_margin">6</property>
|
|
| 190 |
- <property name="bottom_margin">6</property>
|
|
| 200 |
+ <property name="left-margin">6</property>
|
|
| 201 |
+ <property name="right-margin">6</property>
|
|
| 202 |
+ <property name="top-margin">6</property>
|
|
| 203 |
+ <property name="bottom-margin">6</property>
|
|
| 191 | 204 |
</object>
|
| 192 | 205 |
</child>
|
| 193 | 206 |
</object>
|
| ... | ... | @@ -205,14 +218,14 @@ |
| 205 | 218 |
</child>
|
| 206 | 219 |
<child>
|
| 207 | 220 |
<object class="GtkScrolledWindow" id="scrolled_input">
|
| 208 |
- <property name="height_request">150</property>
|
|
| 209 |
- <property name="can_focus">True</property>
|
|
| 210 |
- <property name="no_show_all">True</property>
|
|
| 211 |
- <property name="shadow_type">in</property>
|
|
| 221 |
+ <property name="height-request">150</property>
|
|
| 222 |
+ <property name="can-focus">True</property>
|
|
| 223 |
+ <property name="no-show-all">True</property>
|
|
| 224 |
+ <property name="shadow-type">in</property>
|
|
| 212 | 225 |
<child>
|
| 213 | 226 |
<object class="GtkTextView" id="input_entry">
|
| 214 | 227 |
<property name="visible">True</property>
|
| 215 |
- <property name="can_focus">True</property>
|
|
| 228 |
+ <property name="can-focus">True</property>
|
|
| 216 | 229 |
</object>
|
| 217 | 230 |
</child>
|
| 218 | 231 |
</object>
|
| ... | ... | @@ -232,19 +245,19 @@ |
| 232 | 245 |
<object class="GtkActionBar" id="actionbar">
|
| 233 | 246 |
<property name="name">actionbar</property>
|
| 234 | 247 |
<property name="visible">True</property>
|
| 235 |
- <property name="can_focus">False</property>
|
|
| 248 |
+ <property name="can-focus">False</property>
|
|
| 236 | 249 |
<child>
|
| 237 | 250 |
<object class="GtkButton">
|
| 238 | 251 |
<property name="visible">True</property>
|
| 239 |
- <property name="can_focus">True</property>
|
|
| 240 |
- <property name="receives_default">True</property>
|
|
| 241 |
- <property name="tooltip_text" translatable="yes">Filter</property>
|
|
| 252 |
+ <property name="can-focus">True</property>
|
|
| 253 |
+ <property name="receives-default">True</property>
|
|
| 254 |
+ <property name="tooltip-text" translatable="yes">Filter</property>
|
|
| 242 | 255 |
<signal name="clicked" handler="_on_filter_options" swapped="no"/>
|
| 243 | 256 |
<child>
|
| 244 | 257 |
<object class="GtkImage">
|
| 245 | 258 |
<property name="visible">True</property>
|
| 246 |
- <property name="can_focus">False</property>
|
|
| 247 |
- <property name="icon_name">applications-system-symbolic</property>
|
|
| 259 |
+ <property name="can-focus">False</property>
|
|
| 260 |
+ <property name="icon-name">applications-system-symbolic</property>
|
|
| 248 | 261 |
</object>
|
| 249 | 262 |
</child>
|
| 250 | 263 |
</object>
|
| ... | ... | @@ -255,15 +268,15 @@ |
| 255 | 268 |
<child>
|
| 256 | 269 |
<object class="GtkButton">
|
| 257 | 270 |
<property name="visible">True</property>
|
| 258 |
- <property name="can_focus">True</property>
|
|
| 259 |
- <property name="receives_default">True</property>
|
|
| 260 |
- <property name="tooltip_text" translatable="yes">Clear</property>
|
|
| 271 |
+ <property name="can-focus">True</property>
|
|
| 272 |
+ <property name="receives-default">True</property>
|
|
| 273 |
+ <property name="tooltip-text" translatable="yes">Clear</property>
|
|
| 261 | 274 |
<signal name="clicked" handler="_on_clear" swapped="no"/>
|
| 262 | 275 |
<child>
|
| 263 | 276 |
<object class="GtkImage">
|
| 264 | 277 |
<property name="visible">True</property>
|
| 265 |
- <property name="can_focus">False</property>
|
|
| 266 |
- <property name="icon_name">edit-clear-all-symbolic</property>
|
|
| 278 |
+ <property name="can-focus">False</property>
|
|
| 279 |
+ <property name="icon-name">edit-clear-all-symbolic</property>
|
|
| 267 | 280 |
</object>
|
| 268 | 281 |
</child>
|
| 269 | 282 |
</object>
|
| ... | ... | @@ -274,14 +287,14 @@ |
| 274 | 287 |
<child>
|
| 275 | 288 |
<object class="GtkToggleButton">
|
| 276 | 289 |
<property name="visible">True</property>
|
| 277 |
- <property name="can_focus">True</property>
|
|
| 278 |
- <property name="receives_default">True</property>
|
|
| 290 |
+ <property name="can-focus">True</property>
|
|
| 291 |
+ <property name="receives-default">True</property>
|
|
| 279 | 292 |
<signal name="toggled" handler="_on_input" swapped="no"/>
|
| 280 | 293 |
<child>
|
| 281 | 294 |
<object class="GtkImage">
|
| 282 | 295 |
<property name="visible">True</property>
|
| 283 |
- <property name="can_focus">False</property>
|
|
| 284 |
- <property name="icon_name">document-edit-symbolic</property>
|
|
| 296 |
+ <property name="can-focus">False</property>
|
|
| 297 |
+ <property name="icon-name">document-edit-symbolic</property>
|
|
| 285 | 298 |
</object>
|
| 286 | 299 |
</child>
|
| 287 | 300 |
</object>
|
| ... | ... | @@ -291,16 +304,16 @@ |
| 291 | 304 |
</child>
|
| 292 | 305 |
<child>
|
| 293 | 306 |
<object class="GtkButton" id="paste">
|
| 294 |
- <property name="can_focus">True</property>
|
|
| 295 |
- <property name="receives_default">True</property>
|
|
| 296 |
- <property name="no_show_all">True</property>
|
|
| 307 |
+ <property name="can-focus">True</property>
|
|
| 308 |
+ <property name="receives-default">True</property>
|
|
| 309 |
+ <property name="no-show-all">True</property>
|
|
| 297 | 310 |
<signal name="clicked" handler="_on_paste_last" swapped="no"/>
|
| 298 | 311 |
<child>
|
| 299 | 312 |
<object class="GtkImage">
|
| 300 | 313 |
<property name="visible">True</property>
|
| 301 |
- <property name="can_focus">False</property>
|
|
| 302 |
- <property name="tooltip_text" translatable="yes">Paste Last Input</property>
|
|
| 303 |
- <property name="icon_name">insert-text-symbolic</property>
|
|
| 314 |
+ <property name="can-focus">False</property>
|
|
| 315 |
+ <property name="tooltip-text" translatable="yes">Paste Last Input</property>
|
|
| 316 |
+ <property name="icon-name">insert-text-symbolic</property>
|
|
| 304 | 317 |
</object>
|
| 305 | 318 |
</child>
|
| 306 | 319 |
</object>
|
| ... | ... | @@ -310,10 +323,10 @@ |
| 310 | 323 |
</child>
|
| 311 | 324 |
<child>
|
| 312 | 325 |
<object class="GtkMenuButton" id="menubutton">
|
| 313 |
- <property name="can_focus">True</property>
|
|
| 314 |
- <property name="receives_default">True</property>
|
|
| 315 |
- <property name="no_show_all">True</property>
|
|
| 316 |
- <property name="tooltip_text" translatable="yes">Presets</property>
|
|
| 326 |
+ <property name="can-focus">True</property>
|
|
| 327 |
+ <property name="receives-default">True</property>
|
|
| 328 |
+ <property name="no-show-all">True</property>
|
|
| 329 |
+ <property name="tooltip-text" translatable="yes">Presets</property>
|
|
| 317 | 330 |
<property name="popover">popover</property>
|
| 318 | 331 |
<child>
|
| 319 | 332 |
<placeholder/>
|
| ... | ... | @@ -332,14 +345,14 @@ |
| 332 | 345 |
<child>
|
| 333 | 346 |
<object class="GtkButton" id="send">
|
| 334 | 347 |
<property name="label" translatable="yes">_Send</property>
|
| 335 |
- <property name="can_focus">True</property>
|
|
| 336 |
- <property name="receives_default">True</property>
|
|
| 337 |
- <property name="no_show_all">True</property>
|
|
| 338 |
- <property name="use_underline">True</property>
|
|
| 348 |
+ <property name="can-focus">True</property>
|
|
| 349 |
+ <property name="receives-default">True</property>
|
|
| 350 |
+ <property name="no-show-all">True</property>
|
|
| 351 |
+ <property name="use-underline">True</property>
|
|
| 339 | 352 |
<signal name="clicked" handler="_on_send" swapped="no"/>
|
| 340 | 353 |
</object>
|
| 341 | 354 |
<packing>
|
| 342 |
- <property name="pack_type">end</property>
|
|
| 355 |
+ <property name="pack-type">end</property>
|
|
| 343 | 356 |
<property name="position">0</property>
|
| 344 | 357 |
</packing>
|
| 345 | 358 |
</child>
|
| ... | ... | @@ -347,7 +360,7 @@ |
| 347 | 360 |
<packing>
|
| 348 | 361 |
<property name="expand">False</property>
|
| 349 | 362 |
<property name="fill">True</property>
|
| 350 |
- <property name="pack_type">end</property>
|
|
| 363 |
+ <property name="pack-type">end</property>
|
|
| 351 | 364 |
<property name="position">1</property>
|
| 352 | 365 |
</packing>
|
| 353 | 366 |
</child>
|
| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 |
|
| 32 | 32 |
from .const import DEFAULT_WORKSPACE_COLOR
|
| 33 | 33 |
from .util import load_pixbuf
|
| 34 |
+from .util import load_icon
|
|
| 34 | 35 |
from .util import text_to_color
|
| 35 | 36 |
from .util import scale_with_ratio
|
| 36 | 37 |
from .util import get_css_show_class
|
| ... | ... | @@ -148,6 +149,27 @@ def add_status_to_avatar(surface, show): |
| 148 | 149 |
return context.get_target()
|
| 149 | 150 |
|
| 150 | 151 |
|
| 152 |
+def get_icon_avatar(size, scale, icon_name):
|
|
| 153 |
+ if scale is not None:
|
|
| 154 |
+ size = size * scale
|
|
| 155 |
+ |
|
| 156 |
+ width = size
|
|
| 157 |
+ height = size
|
|
| 158 |
+ |
|
| 159 |
+ surface = cairo.ImageSurface(cairo.Format.ARGB32, width, height)
|
|
| 160 |
+ context = cairo.Context(surface)
|
|
| 161 |
+ |
|
| 162 |
+ pixbuf = load_icon(icon_name, scale=scale, size=size, pixbuf=True)
|
|
| 163 |
+ Gdk.cairo_set_source_pixbuf(
|
|
| 164 |
+ context,
|
|
| 165 |
+ pixbuf,
|
|
| 166 |
+ 0,
|
|
| 167 |
+ 0)
|
|
| 168 |
+ context.paint()
|
|
| 169 |
+ |
|
| 170 |
+ return context.get_target()
|
|
| 171 |
+ |
|
| 172 |
+ |
|
| 151 | 173 |
@lru_cache(maxsize=128)
|
| 152 | 174 |
def get_show_circle(show, size, scale):
|
| 153 | 175 |
if not isinstance(show, str):
|
| ... | ... | @@ -276,8 +298,10 @@ def get_pixbuf(self, |
| 276 | 298 |
scale,
|
| 277 | 299 |
show=None,
|
| 278 | 300 |
default=False,
|
| 301 |
+ transport_icon=None,
|
|
| 279 | 302 |
style='circle'):
|
| 280 |
- surface = self.get_surface(contact, size, scale, show, default, style)
|
|
| 303 |
+ surface = self.get_surface(
|
|
| 304 |
+ contact, size, scale, show, default, transport_icon, style)
|
|
| 281 | 305 |
return Gdk.pixbuf_get_from_surface(surface, 0, 0, size, size)
|
| 282 | 306 |
|
| 283 | 307 |
def get_surface(self,
|
| ... | ... | @@ -286,9 +310,18 @@ def get_surface(self, |
| 286 | 310 |
scale,
|
| 287 | 311 |
show=None,
|
| 288 | 312 |
default=False,
|
| 313 |
+ transport_icon=None,
|
|
| 289 | 314 |
style='circle'):
|
| 290 | 315 |
|
| 291 | 316 |
jid = contact.jid
|
| 317 |
+ |
|
| 318 |
+ if transport_icon is not None:
|
|
| 319 |
+ surface = get_icon_avatar(size, scale, transport_icon)
|
|
| 320 |
+ if show is not None:
|
|
| 321 |
+ surface = add_status_to_avatar(surface, show)
|
|
| 322 |
+ self._cache[jid][(size, scale, show)] = surface
|
|
| 323 |
+ return surface
|
|
| 324 |
+ |
|
| 292 | 325 |
if not default:
|
| 293 | 326 |
surface = self._cache[jid].get((size, scale, show))
|
| 294 | 327 |
if surface is not None:
|
| ... | ... | @@ -318,7 +351,14 @@ def get_muc_surface(self, |
| 318 | 351 |
size,
|
| 319 | 352 |
scale,
|
| 320 | 353 |
default=False,
|
| 354 |
+ transport_icon=None,
|
|
| 321 | 355 |
style='circle'):
|
| 356 |
+ |
|
| 357 |
+ if transport_icon is not None:
|
|
| 358 |
+ surface = get_icon_avatar(size, scale, transport_icon)
|
|
| 359 |
+ self._cache[jid][(size, scale)] = surface
|
|
| 360 |
+ return surface
|
|
| 361 |
+ |
|
| 322 | 362 |
if not default:
|
| 323 | 363 |
surface = self._cache[jid].get((size, scale))
|
| 324 | 364 |
if surface is not None:
|
| ... | ... | @@ -372,6 +372,7 @@ def __init__(self, workspace_id, account, jid, type_, pinned): |
| 372 | 372 |
self.contact.connect('presence-update', self._on_presence_update)
|
| 373 | 373 |
self.contact.connect('chatstate-update', self._on_chatstate_update)
|
| 374 | 374 |
self.contact.connect('nickname-update', self._on_nickname_update)
|
| 375 |
+ self.contact.connect('caps-update', self._on_avatar_update)
|
|
| 375 | 376 |
self.contact.connect('avatar-update', self._on_avatar_update)
|
| 376 | 377 |
|
| 377 | 378 |
self._timestamp = None
|
| ... | ... | @@ -79,7 +79,7 @@ def __init__(self, account, contact, page=None): |
| 79 | 79 |
if contact.is_in_roster:
|
| 80 | 80 |
self._ui.edit_name_button.show()
|
| 81 | 81 |
self._fill_groups_page()
|
| 82 |
- if contact.is_transport:
|
|
| 82 |
+ if contact.is_gateway:
|
|
| 83 | 83 |
side_bar_switcher.hide_row('settings')
|
| 84 | 84 |
side_bar_switcher.hide_row('devices')
|
| 85 | 85 |
else:
|
| ... | ... | @@ -161,9 +161,10 @@ def set_from_disco_info(self, info): |
| 161 | 161 |
self._ui.name.set_visible(True)
|
| 162 | 162 |
|
| 163 | 163 |
# Set avatar
|
| 164 |
- surface = app.interface.avatar_storage.get_muc_surface(
|
|
| 165 |
- self._account,
|
|
| 166 |
- info.jid,
|
|
| 164 |
+ client = app.get_client(self._account)
|
|
| 165 |
+ contact = client.get_module('Contacts').get_contact(
|
|
| 166 |
+ info.jid, groupchat=True)
|
|
| 167 |
+ surface = contact.get_avatar(
|
|
| 167 | 168 |
AvatarSize.GROUP_INFO,
|
| 168 | 169 |
self.get_scale_factor())
|
| 169 | 170 |
self._ui.avatar_image.set_from_surface(surface)
|
| ... | ... | @@ -277,7 +277,7 @@ def _on_block_contact(self, _action, param): |
| 277 | 277 |
def _on_remove_contact(self, _action, param):
|
| 278 | 278 |
jid = param.get_string()
|
| 279 | 279 |
selected_contact = self._client.get_module('Contacts').get_contact(jid)
|
| 280 |
- if selected_contact.is_transport:
|
|
| 280 |
+ if selected_contact.is_gateway:
|
|
| 281 | 281 |
# Check for transport users in roster and warn about removing the
|
| 282 | 282 |
# transport if there are any
|
| 283 | 283 |
has_transport_contacts = False
|
| ... | ... | @@ -346,7 +346,7 @@ def _on_focus_out(treeview, _param): |
| 346 | 346 |
def _show_contact_menu(self, jid, treeview, event):
|
| 347 | 347 |
contact = self._client.get_module('Contacts').get_contact(jid)
|
| 348 | 348 |
menu = get_roster_menu(
|
| 349 |
- self._account, jid, transport=contact.is_transport)
|
|
| 349 |
+ self._account, jid, transport=contact.is_gateway)
|
|
| 350 | 350 |
|
| 351 | 351 |
rectangle = Gdk.Rectangle()
|
| 352 | 352 |
rectangle.x = event.x
|
| ... | ... | @@ -573,9 +573,7 @@ def _draw_contact_row(self, ref, contact): |
| 573 | 573 |
self._store[iter_][Column.TEXT] = name
|
| 574 | 574 |
|
| 575 | 575 |
surface = contact.get_avatar(
|
| 576 |
- AvatarSize.ROSTER,
|
|
| 577 |
- self.get_scale_factor(),
|
|
| 578 |
- add_show=bool(not contact.is_transport))
|
|
| 576 |
+ AvatarSize.ROSTER, self.get_scale_factor())
|
|
| 579 | 577 |
self._store[iter_][Column.AVATAR] = surface
|
| 580 | 578 |
|
| 581 | 579 |
def _get_total_user_count(self):
|
| ... | ... | @@ -152,10 +152,7 @@ def _populate_grid(self, contact): |
| 152 | 152 |
scale = self._ui.tooltip_grid.get_scale_factor()
|
| 153 | 153 |
|
| 154 | 154 |
# Avatar
|
| 155 |
- surface = contact.get_avatar(
|
|
| 156 |
- AvatarSize.TOOLTIP,
|
|
| 157 |
- scale,
|
|
| 158 |
- add_show=bool(not contact.is_transport))
|
|
| 155 |
+ surface = contact.get_avatar(AvatarSize.TOOLTIP, scale)
|
|
| 159 | 156 |
self._ui.avatar.set_from_surface(surface)
|
| 160 | 157 |
self._ui.avatar.show()
|
| 161 | 158 |
|
| ... | ... | @@ -154,6 +154,11 @@ def _on_row_activated(self, _listbox, row): |
| 154 | 154 |
'<iq to="" type="" xmlns="jabber:client">\n'
|
| 155 | 155 |
'<query xmlns=""></query>\n'
|
| 156 | 156 |
'</iq>')
|
| 157 |
+ elif text == 'Disco Info':
|
|
| 158 |
+ input_text = (
|
|
| 159 |
+ '<iq to="" type="get" xmlns="jabber:client">\n'
|
|
| 160 |
+ '<query xmlns="http://jabber.org/protocol/disco#info"></query>\n'
|
|
| 161 |
+ '</iq>')
|
|
| 157 | 162 |
|
| 158 | 163 |
if input_text is not None:
|
| 159 | 164 |
buffer_ = self._ui.input_entry.get_buffer()
|