diff --git a/data/glade/vcard_information_window.glade b/data/glade/vcard_information_window.glade
index 702118f4c..79215a8c5 100644
--- a/data/glade/vcard_information_window.glade
+++ b/data/glade/vcard_information_window.glade
@@ -71,44 +71,176 @@
True
- 8
+ 7
2
False
6
12
-
+
True
- False
- False
+ Jabber ID:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 0
+ 1
+ fill
+
+
+
-
-
- True
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- False
- True
- 0
- 0
- 5
- 5
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
+
+
+ True
+ Resource:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 1
+ 2
+ fill
+
+
+
+
+
+
+ True
+ Status:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 2
+ 3
+ fill
+
+
+
+
+
+
+ True
+ Client:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 3
+ 4
+ fill
+
+
+
+
+
+
+ True
+ OS:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 4
+ 5
+ fill
+
+
+
+
+
+
+ True
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ True
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
2
- 3
- 4
+ 0
+ 1
@@ -143,8 +275,86 @@
1
2
- 2
- 3
+ 1
+ 2
+
+
+
+
+
+
+ True
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ True
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 1
+ 2
+ 3
+ 4
+
+
+
+
+
+
+ True
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ True
+ True
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 1
+ 2
+ 4
+ 5
+
+
+
+
+
+
+ True
+ True
+ _Log conversation history
+ True
+ GTK_RELIEF_NORMAL
+ True
+ True
+ False
+ True
+
+
+ 0
+ 2
+ 5
+ 6
+ fill
@@ -317,307 +527,49 @@
-
- 0
- 2
- 7
- 8
-
-
-
-
-
-
- True
- True
- True
- True
- 0
-
- True
- *
- False
-
-
- 1
- 2
- 0
- 1
-
-
-
-
-
-
- True
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- False
- True
- 0
- 0
- 5
- 5
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
-
- True
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- False
- True
- 0
- 0
- 5
- 5
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 1
- 2
- 4
- 5
-
-
-
-
-
-
- True
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- True
- True
- 0
- 0
- 5
- 5
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 1
- 2
- 5
- 6
-
-
-
-
-
-
- True
- True
- _Log conversation history
- True
- GTK_RELIEF_NORMAL
- True
- True
- False
- True
-
0
2
6
7
- fill
-
+
True
- Nickname:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- 1
- 0
- 1
- fill
-
-
-
+ True
+ False
-
-
- True
- Jabber ID:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
+
+
+ True
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ True
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
- 0
- 1
- 1
- 2
- fill
-
-
-
-
-
-
- True
- Resource:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- 1
+ 1
+ 2
2
3
fill
-
-
-
-
-
-
- True
- Status:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- 1
- 3
- 4
- fill
-
-
-
-
-
-
- True
- Client:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- 1
- 4
- 5
- fill
-
-
-
-
-
-
- True
- OS:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- 1
- 5
- 6
- fill
-
+ fill
@@ -715,48 +667,6 @@
6
12
-
-
- True
- True
- False
- True
- 0
-
- True
- *
- False
-
-
- 1
- 2
- 0
- 1
-
-
-
-
-
-
- True
- True
- False
- True
- 0
-
- True
- *
- False
-
-
- 1
- 4
- 4
- 5
-
-
-
-
True
@@ -775,16 +685,23 @@
12
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -796,16 +713,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -817,16 +741,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -838,16 +769,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -859,16 +797,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1053,27 +998,6 @@
-
-
- True
- True
- False
- True
- 0
-
- True
- *
- False
-
-
- 3
- 4
- 0
- 1
-
-
-
-
True
@@ -1092,16 +1016,23 @@
5
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1113,16 +1044,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1134,16 +1072,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1155,16 +1100,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1176,16 +1128,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1197,16 +1156,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1419,27 +1385,6 @@
-
-
- True
- True
- False
- True
- 0
-
- True
- *
- False
-
-
- 3
- 4
- 5
- 6
-
-
-
-
True
@@ -1468,48 +1413,6 @@
-
-
- True
- True
- False
- True
- 0
-
- True
- *
- False
-
-
- 1
- 4
- 3
- 4
-
-
-
-
-
-
- True
- True
- False
- True
- 0
-
- True
- *
- False
-
-
- 1
- 2
- 5
- 6
-
-
-
-
True
@@ -1658,6 +1561,168 @@
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 3
+ 4
+ 0
+ 1
+
+
+
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 1
+ 2
+ 0
+ 1
+
+
+
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 1
+ 4
+ 4
+ 5
+
+
+
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 1
+ 4
+ 3
+ 4
+
+
+
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 1
+ 2
+ 5
+ 6
+
+
+
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 3
+ 4
+ 5
+ 6
+
+
+
False
@@ -1699,16 +1764,23 @@
12
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1720,16 +1792,22 @@
-
+
True
- True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1741,16 +1819,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1762,16 +1847,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1783,16 +1875,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1821,16 +1920,23 @@
5
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1842,16 +1948,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1863,16 +1976,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1884,16 +2004,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -1905,16 +2032,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -1926,16 +2060,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
3
@@ -2149,16 +2290,23 @@
-
+
True
True
- False
- True
- 0
-
- True
- *
- False
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 5
+ 5
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -2432,169 +2580,6 @@
True
-
-
-
- True
- GTK_BUTTONBOX_END
- 12
-
-
-
- True
- True
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
-
- True
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
- True
- False
- 2
-
-
-
- True
- gtk-go-up
- 4
- 0
- 0
- 0
- 0
-
-
- 0
- False
- False
-
-
-
-
-
- True
- _Publish
- True
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
-
- True
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
- True
- False
- 2
-
-
-
- True
- gtk-go-down
- 4
- 0
- 0
- 0
- 0
-
-
- 0
- False
- False
-
-
-
-
-
- True
- _Retrieve
- True
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
-
-
-
-
-
-
- 0
- False
- True
-
-
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index c877d0d76..1b2356e8d 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1356,7 +1356,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
user_nick = msg.getTagData('nick')
if not user_nick:
user_nick = ''
-
+
if encTag and GnuPG.USE_GPG:
#decrypt
encmsg = encTag.getData()
diff --git a/src/gajim.py b/src/gajim.py
index c562f529c..a01a6ee89 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -185,7 +185,7 @@ parser = optparser.OptionsParser(config_filename)
import roster_window
import systray
-import vcard
+import profile_window
import config
class GlibIdleQueue(idlequeue.IdleQueue):
@@ -339,9 +339,9 @@ class Interface:
def edit_own_details(self, account):
jid = gajim.get_jid_from_account(account)
- if not self.instances[account]['infos'].has_key(jid):
- self.instances[account]['infos'][jid] = \
- vcard.VcardWindow(jid, account, True)
+ if not self.instances[account].has_key('profile'):
+ self.instances[account]['profile'] = \
+ profile_window.ProfileWindow(account)
gajim.connections[account].request_vcard(jid)
def handle_event_notify(self, account, array):
@@ -764,8 +764,8 @@ class Interface:
nick = array['NICKNAME']
if nick:
gajim.nicks[account] = nick
- if self.instances[account]['infos'].has_key(array['jid']):
- win = self.instances[account]['infos'][array['jid']]
+ if self.instances[account].has_key('profile'):
+ win = self.instances[account]['profile']
win.set_values(array)
if account in self.show_vcard_when_connect:
self.show_vcard_when_connect.remove(account)
diff --git a/src/vcard.py b/src/vcard.py
index e1ddbec12..2281ab827 100644
--- a/src/vcard.py
+++ b/src/vcard.py
@@ -57,55 +57,32 @@ def get_avatar_pixbuf_encoded_mime(photo):
class VcardWindow:
'''Class for contact's information window'''
- def __init__(self, contact, account, vcard = False, is_fake = False):
+ def __init__(self, contact, account, is_fake = False):
# the contact variable is the jid if vcard is true
self.xml = gtkgui_helpers.get_glade('vcard_information_window.glade')
self.window = self.xml.get_widget('vcard_information_window')
- self.publish_button = self.xml.get_widget('publish_button')
- self.retrieve_button = self.xml.get_widget('retrieve_button')
- self.nickname_entry = self.xml.get_widget('nickname_entry')
- if not vcard: # Maybe gc_vcard ?
- self.nickname_entry.set_property('editable', False)
-
- self.publish_button.set_no_show_all(True)
- self.retrieve_button.set_no_show_all(True)
-
- self.contact = contact # don't use it if vcard is true
+ self.contact = contact
self.account = account
- self.vcard = vcard
self.is_fake = is_fake
+
self.avatar_mime_type = None
self.avatar_encoded = None
self.avatar_save_as_id = None
- if vcard: # we view/edit our own vcard
- self.jid = contact
- # remove Jabber tab & show publish/retrieve/close/set_avatar buttons
- # and make entries and textview editable
- self.change_to_vcard()
- else: # we see someone else's vcard
- self.publish_button.hide()
- self.retrieve_button.hide()
- self.jid = contact.jid
- self.fill_jabber_page()
-
- # if we are editing our own vcard publish button should publish
- # vcard data we have typed including nickname, it's why we connect only
- # here (when we see someone else's vcard)
- self.nickname_entry.connect('focus-out-event',
- self.on_nickname_entry_focus_out_event)
- button = self.xml.get_widget('set_avatar_button')
- button.set_no_show_all(True)
- button.connect('clicked',
- gtkgui_helpers.on_avatar_save_as_menuitem_activate,
- self.jid, self.account, self.contact.name + '.jpeg')
+ self.fill_jabber_page()
+
+ button = self.xml.get_widget('set_avatar_button')
+ button.set_no_show_all(True)
+ button.connect('clicked',
+ gtkgui_helpers.on_avatar_save_as_menuitem_activate,
+ self.contact.jid, self.account, self.contact.name + '.jpeg')
self.xml.signal_autoconnect(self)
self.window.show_all()
def on_vcard_information_window_destroy(self, widget):
- del gajim.interface.instances[self.account]['infos'][self.jid]
+ del gajim.interface.instances[self.account]['infos'][self.contact.jid]
def on_vcard_information_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape:
@@ -126,115 +103,16 @@ class VcardWindow:
if oldlog != log:
gajim.config.set_per('accounts', self.account, 'no_log_for',
' '.join(no_log_for))
-
- def on_nickname_entry_focus_out_event(self, widget, event):
- '''Save contact information and update
- the roster item on the Jabber server'''
- new_name = self.nickname_entry.get_text().decode('utf-8')
- # update contact.name with new nickname if that is not ''
- if new_name != self.contact.name and new_name != '':
- self.contact.name = new_name
- # update roster model
- model = gajim.interface.roster.tree.get_model()
- for iter_ in gajim.interface.roster.get_contact_iter(self.contact.jid,
- self.account):
- model[iter_][1] = new_name
- gajim.connections[self.account].update_contact(self.contact.jid,
- self.contact.name, self.contact.groups)
- # update opened chat window
- ctrl = gajim.interface.msg_win_mgr.get_control(self.contact.jid,
- self.account)
- if ctrl:
- ctrl.update_ui()
- win = gajim.interface.msg_win_mgr.get_window(self.contact.jid,
- self.account)
- win.redraw_tab(ctrl)
- win.show_title()
-
- def on_close_button_clicked(self, widget):
- self.window.destroy()
-
- def on_clear_button_clicked(self, widget):
- # empty the image
- path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'person.png')
- self.xml.get_widget('PHOTO_image').set_from_file(path)
- self.avatar_encoded = None
- if self.avatar_save_as_id:
- self.xml.get_widget('set_avatar_button').disconnect(
- self.avatar_save_as_id)
- self.avatar_save_as_id = None
-
- def on_set_avatar_button_clicked(self, widget):
- f = None
- def on_ok(widget, path_to_file):
- filesize = os.path.getsize(path_to_file) # in bytes
- #FIXME: use messages for invalid file for 0.11
- invalid_file = False
- msg = ''
- if os.path.isfile(path_to_file):
- stat = os.stat(path_to_file)
- if stat[6] == 0:
- invalid_file = True
- else:
- invalid_file = True
- if not invalid_file and filesize > 16384: # 16 kb
- try:
- pixbuf = gtk.gdk.pixbuf_new_from_file(path_to_file)
- # get the image at 'notification size'
- # and use that user did not specify in ACE crazy size
- scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf,
- 'tooltip')
- except gobject.GError, msg: # unknown format
- # msg should be string, not object instance
- msg = str(msg)
- invalid_file = True
- if invalid_file:
- if True: # keep identation
- dialogs.ErrorDialog(_('Could not load image'), msg)
- return
- if filesize > 16384:
- if scaled_pixbuf:
- path_to_file = os.path.join(gajim.TMP,
- 'avatar_scaled.png')
- scaled_pixbuf.save(path_to_file, 'png')
- self.dialog.destroy()
-
- fd = open(path_to_file, 'rb')
- data = fd.read()
- pixbuf = gtkgui_helpers.get_pixbuf_from_data(data)
- # rescale it
- pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard')
- image = self.xml.get_widget('PHOTO_image')
- image.set_from_pixbuf(pixbuf)
- self.avatar_encoded = base64.encodestring(data)
- # returns None if unknown type
- self.avatar_mime_type = mimetypes.guess_type(path_to_file)[0]
-
- self.dialog = dialogs.ImageChooserDialog(on_response_ok = on_ok)
def on_PHOTO_button_press_event(self, widget, event):
'''If right-clicked, show popup'''
if event.button == 3: # right click
- if self.vcard:
- # our own avatar
- account = None
- nick = gajim.config.get_per('accounts', self.account, 'name')
- else:
- account = self.account
- nick = self.contact.name
menu = gtk.Menu()
menuitem = gtk.ImageMenuItem(gtk.STOCK_SAVE_AS)
menuitem.connect('activate',
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
- self.jid, account, nick + '.jpeg')
+ self.contact.jid, self.account, self.contact.name + '.jpeg')
menu.append(menuitem)
- # show clear for own avatar
- if self.vcard:
- menuitem = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
- menuitem.connect('activate',
- self.on_clear_button_clicked)
- menu.append(menuitem)
- menu.show_all()
menu.connect('selection-done', lambda w:w.destroy())
# show the menu
menu.show_all()
@@ -269,16 +147,16 @@ class VcardWindow:
if 'WORK' in entry:
add_on = '_WORK'
for j in entry.keys():
- self.set_value(i + add_on + '_' + j + '_entry', entry[j])
+ self.set_value(i + add_on + '_' + j + '_label', entry[j])
if isinstance(vcard[i], dict):
for j in vcard[i].keys():
- self.set_value(i + '_' + j + '_entry', vcard[i][j])
+ self.set_value(i + '_' + j + '_label', vcard[i][j])
else:
if i == 'DESC':
self.xml.get_widget('DESC_textview').get_buffer().set_text(
vcard[i], 0)
else:
- self.set_value(i + '_entry', vcard[i])
+ self.set_value(i + '_label', vcard[i])
def set_last_status_time(self):
self.fill_status_label()
@@ -365,7 +243,6 @@ class VcardWindow:
if self.contact.ask == 'subscribe':
tooltips.set_tip(eb,
_("You are waiting contact's answer about your subscription request"))
- self.nickname_entry.set_text(self.contact.name)
log = True
if self.contact.jid in gajim.config.get_per('accounts', self.account,
'no_log_for').split(' '):
@@ -417,124 +294,3 @@ class VcardWindow:
self.fill_status_label()
gajim.connections[self.account].request_vcard(self.contact.jid, self.is_fake)
-
- def add_to_vcard(self, vcard, entry, txt):
- '''Add an information to the vCard dictionary'''
- entries = entry.split('_')
- loc = vcard
- if len(entries) == 3: # We need to use lists
- if not loc.has_key(entries[0]):
- loc[entries[0]] = []
- found = False
- for e in loc[entries[0]]:
- if entries[1] in e:
- found = True
- break
- if found:
- e[entries[2]] = txt
- else:
- loc[entries[0]].append({entries[1]: '', entries[2]: txt})
- return vcard
- while len(entries) > 1:
- if not loc.has_key(entries[0]):
- loc[entries[0]] = {}
- loc = loc[entries[0]]
- del entries[0]
- loc[entries[0]] = txt
- return vcard
-
- def make_vcard(self):
- '''make the vCard dictionary'''
- entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_HOME_USERID', 'URL',
- 'TEL_HOME_NUMBER', 'N_FAMILY', 'N_GIVEN', 'N_MIDDLE', 'N_PREFIX',
- 'N_SUFFIX', 'ADR_HOME_STREET', 'ADR_HOME_EXTADR', 'ADR_HOME_LOCALITY',
- 'ADR_HOME_REGION', 'ADR_HOME_PCODE', 'ADR_HOME_CTRY', 'ORG_ORGNAME',
- 'ORG_ORGUNIT', 'TITLE', 'ROLE', 'TEL_WORK_NUMBER', 'EMAIL_WORK_USERID',
- 'ADR_WORK_STREET', 'ADR_WORK_EXTADR', 'ADR_WORK_LOCALITY',
- 'ADR_WORK_REGION', 'ADR_WORK_PCODE', 'ADR_WORK_CTRY']
- vcard = {}
- for e in entries:
- txt = self.xml.get_widget(e + '_entry').get_text().decode('utf-8')
- if txt != '':
- vcard = self.add_to_vcard(vcard, e, txt)
-
- # DESC textview
- buff = self.xml.get_widget('DESC_textview').get_buffer()
- start_iter = buff.get_start_iter()
- end_iter = buff.get_end_iter()
- txt = buff.get_text(start_iter, end_iter, 0)
- if txt != '':
- vcard['DESC'] = txt.decode('utf-8')
-
- # Avatar
- if self.avatar_encoded:
- vcard['PHOTO'] = {'BINVAL': self.avatar_encoded}
- if self.avatar_mime_type:
- vcard['PHOTO']['TYPE'] = self.avatar_mime_type
- return vcard
-
- def on_publish_button_clicked(self, widget):
- if gajim.connections[self.account].connected < 2:
- dialogs.ErrorDialog(_('You are not connected to the server'),
- _('Without a connection you can not publish your contact '
- 'information.'))
- return
- vcard = self.make_vcard()
- nick = ''
- if vcard.has_key('NICKNAME'):
- nick = vcard['NICKNAME']
- if nick == '':
- nick = gajim.config.get_per('accounts', self.account, 'name')
- gajim.nicks[self.account] = nick
- gajim.connections[self.account].send_vcard(vcard)
-
- def on_retrieve_button_clicked(self, widget):
- entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_HOME_USERID', 'URL',
- 'TEL_HOME_NUMBER', 'N_FAMILY', 'N_GIVEN', 'N_MIDDLE', 'N_PREFIX',
- 'N_SUFFIX', 'ADR_HOME_STREET', 'ADR_HOME_EXTADR', 'ADR_HOME_LOCALITY',
- 'ADR_HOME_REGION', 'ADR_HOME_PCODE', 'ADR_HOME_CTRY', 'ORG_ORGNAME',
- 'ORG_ORGUNIT', 'TITLE', 'ROLE', 'ADR_WORK_STREET', 'ADR_WORK_EXTADR',
- 'ADR_WORK_LOCALITY', 'ADR_WORK_REGION', 'ADR_WORK_PCODE',
- 'ADR_WORK_CTRY']
- if gajim.connections[self.account].connected > 1:
- # clear all entries
- for e in entries:
- self.xml.get_widget(e + '_entry').set_text('')
- self.xml.get_widget('DESC_textview').get_buffer().set_text('')
- self.xml.get_widget('PHOTO_image').set_from_pixbuf(None)
- if self.avatar_save_as_id:
- self.xml.get_widget('set_avatar_button').disconnect(
- self.avatar_save_as_id)
- self.avatar_save_as_id = None
- gajim.connections[self.account].request_vcard(self.jid)
- else:
- dialogs.ErrorDialog(_('You are not connected to the server'),
- _('Without a connection, you can not get your contact information.'))
-
- def change_to_vcard(self):
- self.xml.get_widget('information_notebook').remove_page(0)
- self.xml.get_widget('nickname_label').set_markup(
- '' +
- _('Personal details') +
- '')
- self.xml.get_widget('set_avatar_button').connect('clicked',
- self.on_set_avatar_button_clicked)
-
- self.xml.get_widget('set_avatar_button').show()
- self.publish_button.show()
- self.retrieve_button.show()
-
- #make all entries editable
- entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_HOME_USERID', 'URL',
- 'TEL_HOME_NUMBER', 'N_FAMILY', 'N_GIVEN', 'N_MIDDLE', 'N_PREFIX',
- 'N_SUFFIX', 'ADR_HOME_STREET', 'ADR_HOME_EXTADR', 'ADR_HOME_LOCALITY',
- 'ADR_HOME_REGION', 'ADR_HOME_PCODE', 'ADR_HOME_CTRY', 'ORG_ORGNAME',
- 'ORG_ORGUNIT', 'TITLE', 'ROLE', 'TEL_WORK_NUMBER', 'EMAIL_WORK_USERID',
- 'ADR_WORK_STREET', 'ADR_WORK_EXTADR', 'ADR_WORK_LOCALITY',
- 'ADR_WORK_REGION', 'ADR_WORK_PCODE', 'ADR_WORK_CTRY']
- for e in entries:
- self.xml.get_widget(e + '_entry').set_property('editable', True)
-
- description_textview = self.xml.get_widget('DESC_textview')
- description_textview.set_editable(True)
- description_textview.set_cursor_visible(True)