From 050afed55391ac32d0d96ab922689de9b6c4b38c Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 18 Sep 2006 21:19:02 +0000
Subject: [PATCH] set a text in avatar button instead of a fake avatar when no
 avatar is set in profile window. For #1840

---
 data/pixmaps/person.png | Bin 594 -> 0 bytes
 src/profile_window.py   |  32 +++++++++++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)
 delete mode 100644 data/pixmaps/person.png

diff --git a/data/pixmaps/person.png b/data/pixmaps/person.png
deleted file mode 100644
index f2169a8a2cc0cf1375fec0f73a552c2f9c80681a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 594
zcmV-Y0<HatP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00009a7bBm000XT
z000XT0n*)m`~Uy|2XskIMF-Xa4HGN?;ONqL0000TbVXQnLvL+uWo~o;Lvm$dbY)~9
zcWHEJAXI2&AV*0}Q14_VZU6uQ$Vo&&R5;6xlEG>dQ51&1tDOmS8asJ_7Md8;b;;6f
zk}Q0LD7fqch(y74Aco)rh+t7r5ki97Bpaoxu8X$sAWbqElY8&Xy)NuPl1^I>cX2qJ
z|Kt4UTtP~-+RZv}0F*9D$H3c{jaQ$!DO&Ajr`PY=AedTXj5WsCAeh=-ziV6VX6Ghx
zz1QzrV~kxa=2l8+wboWjX^k-nq`s`VwZ=H8R%(QQLbTQ(00FUynJ?y4D>W{xT?r_8
z-WH3+oY=%fN}-e@iXx<xc-|IEdjVi0%}N|c02pHs2#kq|j7hb<KEZJq&TyR!N-Lz2
zNF`BP;cPgB;VijGIzR|<G8_%?{TvxLL!>o2Qn*eAf7@p`8X$x?S<xg(=gsSfuIqlk
zfA0Zd7*eg&63>L;jNxd2=Xv}({fSbl{QTLAAL~14JbC<-U^e0G?36EGKQSJU0r0nd
zc6N6u7K`lfmw12pt^r&ElyiQL^Yh;n@&)pH1uT|-&jO&eBIoA-%2!??o6W8k?Dao)
z8L$bUlv-8WRK{i+;5LAi5+T4Qqc2&&+LhjQKroq(@8tLHUOVz+ItB<X0UXCU`tb4a
g5&sd6<9ti<zv)TcH|YW&$p8QV07*qoM6N<$f)Mus7XSbN

diff --git a/src/profile_window.py b/src/profile_window.py
index 41bbd8de3c..edb39b974e 100644
--- a/src/profile_window.py
+++ b/src/profile_window.py
@@ -67,6 +67,9 @@ class ProfileWindow:
 		self.avatar_mime_type = None
 		self.avatar_encoded = None
 
+		# Create Image for avatar button
+		image = gtk.Image()
+		self.xml.get_widget('PHOTO_button').set_image(image)
 		self.xml.signal_autoconnect(self)
 		self.window.show_all()
 
@@ -79,8 +82,10 @@ class ProfileWindow:
 
 	def on_clear_button_clicked(self, widget):
 		# empty the image
-		self.xml.get_widget('PHOTO_image').set_from_icon_name('stock_person',
-			gtk.ICON_SIZE_DIALOG)
+		button = self.xml.get_widget('PHOTO_button')
+		image = button.get_image()
+		image.set_from_pixbuf(None)
+		button.set_label(_('Click to set your avatar'))
 		self.avatar_encoded = None
 		self.avatar_mime_type = None
 
@@ -124,8 +129,10 @@ class ProfileWindow:
 			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')
+			button = self.xml.get_widget('PHOTO_button')
+			image = button.get_image()
 			image.set_from_pixbuf(pixbuf)
+			button.set_label('')
 			self.avatar_encoded = base64.encodestring(data)
 			# returns None if unknown type
 			self.avatar_mime_type = mimetypes.guess_type(path_to_file)[0]
@@ -162,18 +169,23 @@ class ProfileWindow:
 	def set_values(self, vcard):
 		if not 'PHOTO' in vcard:
 			# set default image
-			image = self.xml.get_widget('PHOTO_image')
-			image.set_from_icon_name('stock_person', gtk.ICON_SIZE_DIALOG)
+			button = self.xml.get_widget('PHOTO_button')
+			image = button.get_image()
+			image.set_from_pixbuf(None)
+			button.set_label(_('Click to set your avatar'))
 		for i in vcard.keys():
 			if i == 'PHOTO':
 				pixbuf, self.avatar_encoded, self.avatar_mime_type = \
 					get_avatar_pixbuf_encoded_mime(vcard[i])
-				image = self.xml.get_widget('PHOTO_image')
+				button = self.xml.get_widget('PHOTO_button')
+				image = button.get_image()
 				if not pixbuf:
-					image.set_from_icon_name('stock_person', gtk.ICON_SIZE_DIALOG)
+					image.set_from_pixbuf(None)
+					button.set_label(_('Click to set your avatar'))
 					continue
 				pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard')
 				image.set_from_pixbuf(pixbuf)
+				button.set_label('')
 				continue
 			if i == 'ADR' or i == 'TEL' or i == 'EMAIL':
 				for entry in vcard[i]:
@@ -275,8 +287,10 @@ class ProfileWindow:
 			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_icon_name('stock_person',
-				gtk.ICON_SIZE_DIALOG)
+			button = self.xml.get_widget('PHOTO_button')
+			image = button.get_image()
+			image.set_from_pixbuf(None)
+			button.set_label(_('Click to set your avatar'))
 			gajim.connections[self.account].request_vcard(self.jid)
 		else:
 			dialogs.ErrorDialog(_('You are not connected to the server'),
-- 
GitLab