Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
de790f5e
by Daniel Brötzmann at 2019-04-09T19:53:34Z
2 changed files:
Changes:
| ... | ... | @@ -16,6 +16,11 @@ |
| 16 | 16 |
<column type="gchararray"/>
|
| 17 | 17 |
</columns>
|
| 18 | 18 |
</object>
|
| 19 |
+ <object class="GtkImage" id="image1">
|
|
| 20 |
+ <property name="visible">True</property>
|
|
| 21 |
+ <property name="can_focus">False</property>
|
|
| 22 |
+ <property name="icon_name">user-info-symbolic</property>
|
|
| 23 |
+ </object>
|
|
| 19 | 24 |
<object class="GtkTextBuffer" id="message_textbuffer">
|
| 20 | 25 |
<property name="text" translatable="yes">I would like to add you to my contact list.</property>
|
| 21 | 26 |
<signal name="end-user-action" handler="on_message_textbuffer_changed" swapped="no"/>
|
| ... | ... | @@ -144,6 +149,7 @@ |
| 144 | 149 |
<packing>
|
| 145 | 150 |
<property name="left_attach">1</property>
|
| 146 | 151 |
<property name="top_attach">3</property>
|
| 152 |
+ <property name="width">2</property>
|
|
| 147 | 153 |
</packing>
|
| 148 | 154 |
</child>
|
| 149 | 155 |
<child>
|
| ... | ... | @@ -163,6 +169,7 @@ |
| 163 | 169 |
<packing>
|
| 164 | 170 |
<property name="left_attach">1</property>
|
| 165 | 171 |
<property name="top_attach">4</property>
|
| 172 |
+ <property name="width">2</property>
|
|
| 166 | 173 |
</packing>
|
| 167 | 174 |
</child>
|
| 168 | 175 |
<child>
|
| ... | ... | @@ -254,6 +261,7 @@ |
| 254 | 261 |
<packing>
|
| 255 | 262 |
<property name="left_attach">1</property>
|
| 256 | 263 |
<property name="top_attach">1</property>
|
| 264 |
+ <property name="width">2</property>
|
|
| 257 | 265 |
</packing>
|
| 258 | 266 |
</child>
|
| 259 | 267 |
<child>
|
| ... | ... | @@ -275,6 +283,22 @@ |
| 275 | 283 |
<packing>
|
| 276 | 284 |
<property name="left_attach">1</property>
|
| 277 | 285 |
<property name="top_attach">0</property>
|
| 286 |
+ <property name="width">2</property>
|
|
| 287 |
+ </packing>
|
|
| 288 |
+ </child>
|
|
| 289 |
+ <child>
|
|
| 290 |
+ <object class="GtkButton" id="show_contact_info_button">
|
|
| 291 |
+ <property name="visible">True</property>
|
|
| 292 |
+ <property name="sensitive">False</property>
|
|
| 293 |
+ <property name="can_focus">True</property>
|
|
| 294 |
+ <property name="receives_default">True</property>
|
|
| 295 |
+ <property name="tooltip_text" translatable="yes">Query Contact Info</property>
|
|
| 296 |
+ <property name="image">image1</property>
|
|
| 297 |
+ <signal name="clicked" handler="on_show_contact_info_button_clicked" swapped="no"/>
|
|
| 298 |
+ </object>
|
|
| 299 |
+ <packing>
|
|
| 300 |
+ <property name="left_attach">2</property>
|
|
| 301 |
+ <property name="top_attach">2</property>
|
|
| 278 | 302 |
</packing>
|
| 279 | 303 |
</child>
|
| 280 | 304 |
</object>
|
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 |
from gi.repository import Gdk
|
| 16 | 16 |
from gi.repository import Gtk
|
| 17 | 17 |
|
| 18 |
+from gajim import vcard
|
|
| 18 | 19 |
from gajim.common import app
|
| 19 | 20 |
from gajim.common import ged
|
| 20 | 21 |
from gajim.common import helpers
|
| ... | ... | @@ -58,8 +59,9 @@ class AddNewContactWindow(Gtk.ApplicationWindow): |
| 58 | 59 |
self.xml.connect_signals(self)
|
| 59 | 60 |
|
| 60 | 61 |
for w in ('account_combobox', 'account_label', 'prompt_label',
|
| 61 |
- 'uid_label', 'uid_entry', 'protocol_combobox',
|
|
| 62 |
- 'protocol_jid_combobox', 'protocol_label', 'nickname_entry',
|
|
| 62 |
+ 'uid_label', 'uid_entry', 'show_contact_info_button',
|
|
| 63 |
+ 'protocol_combobox', 'protocol_jid_combobox',
|
|
| 64 |
+ 'protocol_label', 'nickname_entry',
|
|
| 63 | 65 |
'message_scrolledwindow', 'save_message_checkbutton',
|
| 64 | 66 |
'register_hbox', 'add_button', 'message_textview',
|
| 65 | 67 |
'connected_label', 'group_comboboxentry',
|
| ... | ... | @@ -68,6 +70,7 @@ class AddNewContactWindow(Gtk.ApplicationWindow): |
| 68 | 70 |
self.__dict__[w] = self.xml.get_object(w)
|
| 69 | 71 |
|
| 70 | 72 |
self.subscription_table = [self.uid_label, self.uid_entry,
|
| 73 |
+ self.show_contact_info_button,
|
|
| 71 | 74 |
self.nickname_label, self.nickname_entry,
|
| 72 | 75 |
self.group_label, self.group_comboboxentry]
|
| 73 | 76 |
|
| ... | ... | @@ -191,6 +194,7 @@ class AddNewContactWindow(Gtk.ApplicationWindow): |
| 191 | 194 |
self.account))
|
| 192 | 195 |
message_buffer.set_text(msg)
|
| 193 | 196 |
|
| 197 |
+ self.uid_entry.connect('changed', self.on_uid_entry_changed)
|
|
| 194 | 198 |
self.show_all()
|
| 195 | 199 |
|
| 196 | 200 |
app.ged.register_event_handler('gateway-prompt-received', ged.GUI1,
|
| ... | ... | @@ -204,6 +208,26 @@ class AddNewContactWindow(Gtk.ApplicationWindow): |
| 204 | 208 |
app.ged.remove_event_handler('gateway-prompt-received', ged.GUI1,
|
| 205 | 209 |
self._nec_gateway_prompt_received)
|
| 206 | 210 |
|
| 211 |
+ def on_uid_entry_changed(self, widget):
|
|
| 212 |
+ is_empty = bool(not self.uid_entry.get_text() == '')
|
|
| 213 |
+ self.show_contact_info_button.set_sensitive(is_empty)
|
|
| 214 |
+ |
|
| 215 |
+ def on_show_contact_info_button_clicked(self, widget):
|
|
| 216 |
+ """
|
|
| 217 |
+ Ask for vCard
|
|
| 218 |
+ """
|
|
| 219 |
+ jid = self.uid_entry.get_text().strip()
|
|
| 220 |
+ |
|
| 221 |
+ if jid in app.interface.instances[self.account]['infos']:
|
|
| 222 |
+ app.interface.instances[self.account]['infos'][jid].window.present()
|
|
| 223 |
+ else:
|
|
| 224 |
+ contact = app.contacts.create_contact(jid=jid, account=self.account)
|
|
| 225 |
+ app.interface.instances[self.account]['infos'][jid] = \
|
|
| 226 |
+ vcard.VcardWindow(contact, self.account)
|
|
| 227 |
+ # Remove xmpp page
|
|
| 228 |
+ app.interface.instances[self.account]['infos'][jid].xml.\
|
|
| 229 |
+ get_object('information_notebook').remove_page(0)
|
|
| 230 |
+ |
|
| 207 | 231 |
def on_register_button_clicked(self, widget):
|
| 208 | 232 |
model = self.protocol_jid_combobox.get_model()
|
| 209 | 233 |
row = self.protocol_jid_combobox.get_active()
|