From e3a6e53112e0200c052c67a6b4ec8bf2039ad2ac Mon Sep 17 00:00:00 2001
From: Nikos Kouremenos <kourem@gmail.com>
Date: Fri, 3 Jun 2005 17:35:48 +0000
Subject: [PATCH] we now use our icon in all windows. icon is not status (show)
 at last

---
 src/gajim.py         | 18 ++++++------------
 src/roster_window.py | 21 +++------------------
 2 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/src/gajim.py b/src/gajim.py
index 29c42e6c2d..3cba134c03 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -760,19 +760,13 @@ class Interface:
 												#2:autoaway and use sleeper
 												#3:autoxa and use sleeper
 
-		iconset = gajim.config.get('iconset')
-		path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/')
-		files = [path + 'online.gif', path + 'online.png', path + 'online.xpm']
-		pix = None
-		for fname in files:
-			if os.path.exists(fname):
-				pix = gtk.gdk.pixbuf_new_from_file(fname)
-				break
-		if pix:
-			gtk.window_set_default_icon(pix)
 		self.roster = roster_window.Roster_window(self)
-		self.sleeper = common.sleepy.Sleepy( \
-			gajim.config.get('autoawaytime') * 60, \
+		path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png')
+		pix = gtk.gdk.pixbuf_new_from_file(path_to_file)
+		gtk.window_set_default_icon(pix) # set the icon to all newly opened windows
+		self.roster.window.set_icon_from_file(path_to_file) # and to roster window
+		self.sleeper = common.sleepy.Sleepy(
+			gajim.config.get('autoawaytime') * 60,
 			gajim.config.get('autoxatime') * 60)
 		self.systray_enabled = False
 		try:
diff --git a/src/roster_window.py b/src/roster_window.py
index d590ccf61f..d95f7bdafa 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -813,8 +813,8 @@ class Roster_window:
 					if accountIter:
 						model.set_value(accountIter, 0, self.jabber_state_images['offline'])
 #					gajim.connections[account].connected = 0
-					#FIXME: what if no systray? this TBs!!
-					self.plugin.systray.set_status('offline')
+					if self.plugin.systray_enabled:
+						self.plugin.systray.set_status('offline')
 					self.update_status_comboxbox()
 					return
 				gajim.connections[account].password = passphrase
@@ -917,12 +917,6 @@ class Roster_window:
 						'xa', 'dnd', 'invisible']
 		if self.plugin.systray_enabled:
 			self.plugin.systray.set_status(statuss[maxi])
-		image = self.jabber_state_images[statuss[maxi]]
-		if image.get_storage_type() == gtk.IMAGE_ANIMATION:
-			pixbuf = image.get_animation().get_static_image()
-			self.window.set_icon(pixbuf)
-		elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
-			self.window.set_icon(image.get_pixbuf())
 
 	def on_status_changed(self, account, status):
 		'''the core tells us that our status has changed'''
@@ -1137,7 +1131,7 @@ class Roster_window:
 				dialog = dialogs.Confirmation_dialog(_('You have unread messages.\nAre you sure you want to quit Gajim?'))
 				if dialog.get_response() != gtk.RESPONSE_YES:
 					return
-			#FIXME: do we keep that ?
+
 			if recent:
 				dialog = dialogs.Confirmation_dialog(_('You received a message in the last two seconds.\nAre you sure you want to quit Gajim?'))
 				if dialog.get_response() != gtk.RESPONSE_YES:
@@ -1303,15 +1297,6 @@ class Roster_window:
 			for jid in self.plugin.windows[account]['gc']:
 				if jid != 'tabbed':
 					self.plugin.windows[account]['gc'][jid].update_state_images()
-		# Update windows icons
-		image = self.jabber_state_images['online'] # FIXME: we need an icon
-		if image.get_storage_type() == gtk.IMAGE_ANIMATION:
-			pixbuf = image.get_animation().get_static_image()
-		elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
-			pixbuf = image.get_pixbuf()
-		for win in gtk.window_list_toplevels():
-			win.set_icon(pixbuf)
-		# Update roster_window icon with the status image
 		self.update_status_comboxbox()
 
 	def on_show_offline_contacts_menuitem_activate(self, widget):
-- 
GitLab