X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account.pyx;h=4b3af4bf0e07831b11b96539cd3baa5e4e91ff59;hp=97374eaa6ed7f7aa9ae9ab6c1a47782ae95311ec;hb=7b3a84e1d328964d372cd4d3f891ab0d4619adfd;hpb=3642aa81f988d2880a7b08db680200697ec2df3d diff --git a/account.pyx b/account.pyx index 97374ea..4b3af4b 100644 --- a/account.pyx +++ b/account.pyx @@ -177,7 +177,53 @@ cdef class Account: return po - protocol_options = property(_get_protocol_options) + def _set_protocol_options(self, po): + cdef glib.GList *iter + cdef accountopt.PurpleAccountOption *option + cdef prefs.PurplePrefType type + cdef const_char *str_value + cdef const_char *setting + cdef int int_value + cdef glib.gboolean bool_value + + if self.c_account == NULL: + return + + po = {} + + iter = self.c_prpl_info.protocol_options + + while iter: + + option = iter.data + type = accountopt.c_purple_account_option_get_type(option) + setting = accountopt.c_purple_account_option_get_setting(option) + + sett = str( setting) + + if type == prefs.PURPLE_PREF_STRING: + + str_value = po[sett] + account.c_purple_account_set_string(self.c_account, setting, str_value) + + elif type == prefs.PURPLE_PREF_INT: + + int_value = int(po[sett]) + account.c_purple_account_set_int(self.c_account, setting, int_value) + + elif type == prefs.PURPLE_PREF_BOOLEAN: + + bool_value = bool(po[sett]) + account.c_purple_account_set_bool(self.c_account, setting, bool_value) + + elif type == prefs.PURPLE_PREF_STRING_LIST: + + str_value = po[sett] + account.c_purple_account_set_string(self.c_account, setting, str_value) + + iter = iter.next + + protocol_options = property(_get_protocol_options, _set_protocol_options) def _get_protocol_labels(self): cdef glib.GList *iter