From 3642aa81f988d2880a7b08db680200697ec2df3d Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:52:57 +0000 Subject: [PATCH] Adding function __get_protocol_labels Adding function __get_protocol_labels to return the config's labels to account's protocol Signed-off-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1365 596f6dd7-e928-0410-a184-9e12fd12cf7e --- account.pyx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/account.pyx b/account.pyx index b81947a..97374ea 100644 --- a/account.pyx +++ b/account.pyx @@ -179,6 +179,33 @@ cdef class Account: protocol_options = property(_get_protocol_options) + def _get_protocol_labels(self): + cdef glib.GList *iter + cdef accountopt.PurpleAccountOption *option + cdef const_char *label_name + cdef const_char *setting + + if self.c_account == NULL: + return None + + po = {} + + iter = self.c_prpl_info.protocol_options + + while iter: + + option = iter.data + label_name = accountopt.c_purple_account_option_get_text(option) + setting = accountopt.c_purple_account_option_get_setting(option) + + sett = str( setting) + label = str( label_name) + + po[sett] = label + + return po + + protocol_labels = property(_get_protocol_labels) def get_protocol_name(self): if self.c_account: -- 1.7.9.5