Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
b8e51144
by wurstsalat at 2023-05-23T21:20:34+02:00
3 changed files:
Changes:
| ... | ... | @@ -10,6 +10,23 @@ |
| 10 | 10 | <property name="can-focus">False</property>
|
| 11 | 11 | <property name="orientation">vertical</property>
|
| 12 | 12 | <property name="spacing">12</property>
|
| 13 | + <child>
|
|
| 14 | + <object class="GtkLabel" id="share_instructions">
|
|
| 15 | + <property name="visible">True</property>
|
|
| 16 | + <property name="can-focus">False</property>
|
|
| 17 | + <property name="justify">center</property>
|
|
| 18 | + <property name="wrap">True</property>
|
|
| 19 | + <property name="max-width-chars">24</property>
|
|
| 20 | + <style>
|
|
| 21 | + <class name="dim-label"/>
|
|
| 22 | + </style>
|
|
| 23 | + </object>
|
|
| 24 | + <packing>
|
|
| 25 | + <property name="expand">False</property>
|
|
| 26 | + <property name="fill">True</property>
|
|
| 27 | + <property name="position">0</property>
|
|
| 28 | + </packing>
|
|
| 29 | + </child>
|
|
| 13 | 30 | <child>
|
| 14 | 31 | <object class="GtkImage" id="qr_code_image">
|
| 15 | 32 | <property name="visible">True</property>
|
| ... | ... | @@ -23,8 +40,18 @@ |
| 23 | 40 | <packing>
|
| 24 | 41 | <property name="expand">False</property>
|
| 25 | 42 | <property name="fill">True</property>
|
| 26 | - <property name="pack-type">end</property>
|
|
| 27 | - <property name="position">0</property>
|
|
| 43 | + <property name="position">1</property>
|
|
| 44 | + </packing>
|
|
| 45 | + </child>
|
|
| 46 | + <child>
|
|
| 47 | + <object class="GtkSeparator">
|
|
| 48 | + <property name="visible">True</property>
|
|
| 49 | + <property name="can-focus">False</property>
|
|
| 50 | + </object>
|
|
| 51 | + <packing>
|
|
| 52 | + <property name="expand">False</property>
|
|
| 53 | + <property name="fill">True</property>
|
|
| 54 | + <property name="position">2</property>
|
|
| 28 | 55 | </packing>
|
| 29 | 56 | </child>
|
| 30 | 57 | <child>
|
| ... | ... | @@ -74,7 +101,7 @@ |
| 74 | 101 | <packing>
|
| 75 | 102 | <property name="expand">False</property>
|
| 76 | 103 | <property name="fill">True</property>
|
| 77 | - <property name="position">1</property>
|
|
| 104 | + <property name="position">3</property>
|
|
| 78 | 105 | </packing>
|
| 79 | 106 | </child>
|
| 80 | 107 | <style>
|
| ... | ... | @@ -188,8 +188,9 @@ class CertificateBuilder(Builder): |
| 188 | 188 | |
| 189 | 189 | class ChatBannerBuilder(Builder):
|
| 190 | 190 | share_popover: Gtk.Popover
|
| 191 | - qr_code_image: Gtk.Image
|
|
| 192 | 191 | jid_label: Gtk.Label
|
| 192 | + share_instructions: Gtk.Label
|
|
| 193 | + qr_code_image: Gtk.Image
|
|
| 193 | 194 | banner_box: Gtk.Box
|
| 194 | 195 | avatar_image: Gtk.Image
|
| 195 | 196 | chat_menu_button: Gtk.MenuButton
|
| ... | ... | @@ -343,6 +343,13 @@ def _get_share_uri(self) -> str: |
| 343 | 343 | return self._client.get_module('OMEMO').compose_trust_uri(jid)
|
| 344 | 344 | |
| 345 | 345 | def _on_share_clicked(self, _button: Gtk.Button) -> None:
|
| 346 | + assert self._contact is not None
|
|
| 347 | + if self._contact.is_groupchat:
|
|
| 348 | + share_text = _('Scan this QR code to join %s.')
|
|
| 349 | + else:
|
|
| 350 | + share_text = _('Scan this QR code to add %s to your contact list.')
|
|
| 351 | + self._ui.share_instructions.set_text(share_text % self._contact.name)
|
|
| 352 | + |
|
| 346 | 353 | # Generate QR code on demand (i.e. not when switching chats)
|
| 347 | 354 | self._ui.qr_code_image.set_from_pixbuf(
|
| 348 | 355 | generate_qr_code(self._get_share_uri()))
|