add a data parameter to the config foreach's callback function

This commit is contained in:
Vincent Hanquez 2005-04-26 22:17:47 +00:00
parent a27ab3f739
commit 8ed41802bf
2 changed files with 7 additions and 7 deletions

View File

@ -58,7 +58,7 @@ class Advanced_window:
iter = self.model.iter_next(iter)
return iter
def fill(self, name, parents, val):
def fill(self, data, name, parents, val):
iter = None
if parents:
for p in parents:
@ -110,5 +110,5 @@ class Advanced_window:
renderer_text, text = 2)
# add data to model
gajim.config.foreach(self.fill)
gajim.config.foreach(self.fill, None)

View File

@ -202,16 +202,16 @@ class Config:
'message_sent': [ True, 'sounds/sent.wav' ],
}
def foreach(self, func):
def foreach(self, cb, data):
for opt in self.__options:
func(opt, None, self.__options[opt])
cb(data, opt, None, self.__options[opt])
for opt in self.__options_per_key:
func(opt, None, None)
cb(data, opt, None, None)
dict = self.__options_per_key[opt][1]
for opt2 in dict.keys():
func(opt2, [opt], None)
cb(data, opt2, [opt], None)
for opt3 in dict[opt2]:
func(opt3, [opt, opt2], dict[opt2][opt3])
cb(data, opt3, [opt, opt2], dict[opt2][opt3])
def is_valid_int(self, val):
try: