From ba7ef979b7079151c0e7627cf954b5b6536cf562 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 30 Mar 2006 21:35:43 +0000
Subject: [PATCH] common/gajim can't contain _()O so move it to helpers

prevent renaming of special groups
---
 src/common/gajim.py   |  1 -
 src/common/helpers.py |  2 ++
 src/dialogs.py        |  4 ++--
 src/roster_window.py  | 11 +++++++----
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/common/gajim.py b/src/common/gajim.py
index a61b95de8b..8edf75198d 100644
--- a/src/common/gajim.py
+++ b/src/common/gajim.py
@@ -122,7 +122,6 @@ status_before_autoaway = {}
 
 SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
 	'invisible']
-special_groups = (_('Transports'), _('Not in Roster'), _('Observers'))
 
 def get_nick_from_jid(jid):
 	pos = jid.find('@')
diff --git a/src/common/helpers.py b/src/common/helpers.py
index 1624fa3f67..534a223692 100644
--- a/src/common/helpers.py
+++ b/src/common/helpers.py
@@ -41,6 +41,8 @@ except:
 _ = i18n._
 Q_ = i18n.Q_
 
+special_groups = (_('Transports'), _('Not in Roster'), _('Observers'))
+
 class InvalidFormat(Exception):
 	pass
 
diff --git a/src/dialogs.py b/src/dialogs.py
index cef186bf3c..8b2cde0f1c 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -158,7 +158,7 @@ class EditGroupsDialog:
 		store = gtk.ListStore(str, bool)
 		self.list.set_model(store)
 		for g in gajim.groups[self.account].keys():
-			if g in gajim.special_groups:
+			if g in helpers.special_groups:
 				continue
 			iter = store.append()
 			store.set(iter, 0, g)
@@ -416,7 +416,7 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 		liststore = gtk.ListStore(str)
 		self.group_comboboxentry.set_model(liststore)
 		for g in gajim.groups[account].keys():
-			if g not in gajim.special_groups:
+			if g not in helpers.special_groups:
 				self.group_comboboxentry.append_text(g)
 
 		if not jid_agents:
diff --git a/src/roster_window.py b/src/roster_window.py
index a09eecc03f..92a4ae1fc9 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -1105,6 +1105,9 @@ class RosterWindow:
 			contact = gajim.contacts.get_first_contact_from_jid(account, jid)
 			name = contact.name
 			model[iter][C_NAME] = gtkgui_helpers.escape_for_pango_markup(name)
+		elif row_type == 'group':
+			if jid in helpers.special_groups:
+				return
 
 		model[iter][C_EDITABLE] = True # set 'editable' to True
 		self.tree.set_cursor(path, self.tree.get_column(0), True)
@@ -2524,7 +2527,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 			# in C_JID column, we hold the group name (which is not escaped)
 			old_name = model[iter][C_JID].decode('utf-8')
 			# Groups may not change name from or to a special groups
-			for g in gajim.special_groups:
+			for g in helpers.special_groups:
 				if g in (new_text, old_name):
 					return
 			# get all contacts in that group
@@ -2990,7 +2993,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 			it = model.iter_parent(it)
 		iter_group_source = it
 		grp_source = model[it][C_JID].decode('utf-8')
-		if grp_source in gajim.special_groups:
+		if grp_source in helpers.special_groups:
 			return
 		jid_source = data.decode('utf-8')
 		c_source = gajim.contacts.get_contact_with_highest_priority(account,
@@ -2998,7 +3001,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 		# Get destination group
 		if type_dest == 'group':
 			grp_dest = model[iter_dest][C_JID].decode('utf-8')
-			if grp_dest in gajim.special_groups:
+			if grp_dest in helpers.special_groups:
 				return
 			if context.action == gtk.gdk.ACTION_COPY:
 				self.on_drop_in_group(None, account, c_source, grp_dest, context,
@@ -3012,7 +3015,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 			while model[it][C_TYPE] != 'group':
 				it = model.iter_parent(it)
 			grp_dest = model[it][C_JID].decode('utf-8')
-		if grp_dest in gajim.special_groups:
+		if grp_dest in helpers.special_groups:
 			return
 		if jid_source == jid_dest:
 			if grp_source == grp_dest:
-- 
GitLab