save avatar from our own vcard
This commit is contained in:
parent
22e2341ba9
commit
5b019e9341
|
@ -691,10 +691,9 @@ default_name = ''):
|
|||
# Get pixbuf
|
||||
pixbuf = None
|
||||
is_fake = False
|
||||
if gajim.contacts.is_pm_from_jid(account, jid):
|
||||
if account and gajim.contacts.is_pm_from_jid(account, jid):
|
||||
is_fake = True
|
||||
pixbuf = get_avatar_pixbuf_from_cache(jid, is_fake)
|
||||
|
||||
ext = file_path.split('.')[-1]
|
||||
type_ = ''
|
||||
if not ext:
|
||||
|
@ -710,6 +709,7 @@ default_name = ''):
|
|||
try:
|
||||
pixbuf.save(file_path, type_)
|
||||
except:
|
||||
#XXX Check for permissions
|
||||
os.remove(file_path)
|
||||
new_file_path = '.'.join(file_path.split('.')[:-1]) + '.jpeg'
|
||||
dialog2 = dialogs.ConfirmationDialog(_('Extension not supported'),
|
||||
|
|
|
@ -216,11 +216,18 @@ class VcardWindow:
|
|||
def on_PHOTO_eventbox_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.contact.jid, self.account, self.contact.name + '.jpeg')
|
||||
self.jid, account, nick + '.jpeg')
|
||||
menu.append(menuitem)
|
||||
menu.show_all()
|
||||
menu.connect('selection-done', lambda w:w.destroy())
|
||||
|
|
Loading…
Reference in New Issue