Updated notify_cbs.pxd.
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 21:05:41 +0000 (21:05 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:17 +0000 (17:11 -0400)
FIXES:
 - Replace try/except with has_key.
 - Added comments for each callback.
 - Cosmetics.

Signed-off-by: Bruno Abinader <bruno.abinader@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1403 596f6dd7-e928-0410-a184-9e12fd12cf7e

notify_cbs.pxd

index 11ee894..6180ed9 100644 (file)
 
 cimport purple
 
 
 cimport purple
 
-notify_cbs = {}
-
 cdef extern from *:
     ctypedef char const_char "const char"
     ctypedef int size_t
 
 cdef extern from *:
     ctypedef char const_char "const char"
     ctypedef int size_t
 
-cdef void *notify_message (notify.PurpleNotifyMsgType type, const_char *title,
-                           const_char *primary, const_char *secondary):
+notify_cbs = {}
+
+cdef void *notify_message(notify.PurpleNotifyMsgType type, \
+        const_char *title, const_char *primary, const_char *secondary):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-message\n")
     debug.c_purple_debug_info("notify", "%s", "notify-message\n")
-    try:
-        (<object>notify_cbs["notify-message"])("notify-message: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notif-message"):
+        (<object> notify_cbs["notify-message"])("notify-message: TODO")
 
 
-cdef void *notify_email (connection.PurpleConnection *gc, const_char *subject,
-                         const_char *_from, const_char *to, const_char *url):
+cdef void *notify_email(connection.PurpleConnection *gc, \
+        const_char *subject, const_char *_from, const_char *to, \
+        const_char *url):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-email\n")
     debug.c_purple_debug_info("notify", "%s", "notify-email\n")
-    try:
-        (<object>notify_cbs["notify-email"])("notify-email: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-email"):
+        (<object> notify_cbs["notify-email"])("notify-email: TODO")
 
 
-cdef void *notify_emails (connection.PurpleConnection *gc, size_t count,
-                          glib.gboolean detailed, const_char **subjects,
-                          const_char **froms, const_char **tos,
-                          const_char **urls):
+cdef void *notify_emails(connection.PurpleConnection *gc, size_t count, \
+        glib.gboolean detailed, const_char **subjects, \
+        const_char **froms, const_char **tos, const_char **urls):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-emails\n")
     debug.c_purple_debug_info("notify", "%s", "notify-emails\n")
-    try:
-        (<object>notify_cbs["notify-emails"])("notify-emails: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-emails"):
+        (<object> notify_cbs["notify-emails"])("notify-emails: TODO")
 
 
-cdef void *notify_formatted (const_char *title, const_char *primary,
-                             const_char *secondary, const_char *text):
+cdef void *notify_formatted(const_char *title, const_char *primary, \
+        const_char *secondary, const_char *text):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-formatted\n")
     debug.c_purple_debug_info("notify", "%s", "notify-formatted\n")
-    try:
-        (<object>notify_cbs["notify-formatted"])("notify-formatted: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-formatted"):
+        (<object> notify_cbs["notify-formatted"])("notify-formatted: TODO")
 
 
-cdef void *notify_searchresults (connection.PurpleConnection *gc,
-                                 const_char *title, const_char *primary,
-                                 const_char *secondary,
-                                 notify.PurpleNotifySearchResults *results,
-                                 glib.gpointer user_data):
+cdef void *notify_searchresults(connection.PurpleConnection *gc, \
+        const_char *title, const_char *primary, const_char *secondary, \
+        notify.PurpleNotifySearchResults *results, glib.gpointer user_data):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-searchresults\n")
     debug.c_purple_debug_info("notify", "%s", "notify-searchresults\n")
-    try:
-        (<object>notify_cbs["notify-searchresults"])("notify-searchresults: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-searchresults"):
+        (<object> notify_cbs["notify-searchresults"])("notify-searchresults: TODO")
 
 
-cdef void notify_searchresults_new_rows (connection.PurpleConnection *gc,
-                            notify.PurpleNotifySearchResults *results,
-                            void *data):
+cdef void notify_searchresults_new_rows(connection.PurpleConnection *gc, \
+        notify.PurpleNotifySearchResults *results, void *data):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-searchresults-new-rows\n")
     debug.c_purple_debug_info("notify", "%s", "notify-searchresults-new-rows\n")
-    try:
-        (<object>notify_cbs["notify-searchresults-new-rows"])("notify-searchresults-new-rows: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-searchresults-new-rows"):
+        (<object> notify_cbs["notify-searchresults-new-rows"])("notify-searchresults-new-rows: TODO")
 
 
-cdef void *notify_userinfo (connection.PurpleConnection *gc, const_char *who,
-                            notify.PurpleNotifyUserInfo *user_info):
+cdef void *notify_userinfo(connection.PurpleConnection *gc, const_char *who, \
+        notify.PurpleNotifyUserInfo *user_info):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-userinfo\n")
     debug.c_purple_debug_info("notify", "%s", "notify-userinfo\n")
-    try:
-        (<object>notify_cbs["notify-userinfo"])("notify-userinfo: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-userinfo"):
+        (<object> notify_cbs["notify-userinfo"])("notify-userinfo: TODO")
 
 
-cdef void *notify_uri (const_char *uri):
+cdef void *notify_uri(const_char *uri):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "notify-uri\n")
     debug.c_purple_debug_info("notify", "%s", "notify-uri\n")
-    try:
-        (<object>notify_cbs["notify-uri"])("notify-uri: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("notify-uri"):
+        (<object> notify_cbs["notify-uri"])("notify-uri: TODO")
 
 
-cdef void close_notify (notify.PurpleNotifyType type, void *ui_handle):
+cdef void close_notify(notify.PurpleNotifyType type, void *ui_handle):
+    """
+    TODO
+    """
     debug.c_purple_debug_info("notify", "%s", "close-notify\n")
     debug.c_purple_debug_info("notify", "%s", "close-notify\n")
-    try:
-        (<object>notify_cbs["close-notify"])("close-notify: TODO")
-    except KeyError:
-        pass
+    if notify_cbs.has_key("close-notify"):
+        (<object> notify_cbs["close-notify"])("close-notify: TODO")