From f159e4e85c40eec62070f297af3fd54646dba4b0 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:18:29 +0000 Subject: [PATCH 1/1] Added missing UI operation structures. FIXES: - Added missing UI operation structures. - Initial support for application initialization/deinitialization. Signed-off-by: Bruno Abinader git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1292 596f6dd7-e928-0410-a184-9e12fd12cf7e --- glib.pxd | 1 + libpurple/account.pxd | 4 ++++ libpurple/blist.pxd | 4 ++++ libpurple/connection.pxd | 5 +++++ libpurple/conversation.pxd | 1 + libpurple/ft.pxd | 24 ++++++++++++++++++++++++ libpurple/notify.pxd | 24 ++++++++++++++++++++++++ libpurple/request.pxd | 24 ++++++++++++++++++++++++ libpurple/roomlist.pxd | 24 ++++++++++++++++++++++++ purple.pyx | 18 +++++++++++++++++- 10 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 libpurple/ft.pxd create mode 100644 libpurple/notify.pxd create mode 100644 libpurple/request.pxd create mode 100644 libpurple/roomlist.pxd diff --git a/glib.pxd b/glib.pxd index 97664ce..e651a95 100644 --- a/glib.pxd +++ b/glib.pxd @@ -52,6 +52,7 @@ cdef extern from "glib.h": GHashTable *g_hash_table_new (GHashFunc, GEqualFunc) void g_hash_table_insert (GHashTable*, gpointer, gpointer) + void g_hash_table_destroy (GHashTable*) guint g_timeout_add(guint interval, GSourceFunc function, gpointer data) guint g_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data) diff --git a/libpurple/account.pxd b/libpurple/account.pxd index 059ee6f..841f0c6 100644 --- a/libpurple/account.pxd +++ b/libpurple/account.pxd @@ -21,9 +21,13 @@ cdef extern from "libpurple/account.h": ctypedef struct PurpleAccount: pass + ctypedef struct PurpleAccountUiOps: + pass + PurpleAccount *c_purple_account_new "purple_account_new" (const_char_ptr username, const_char_ptr protocol_id) void c_purple_account_set_password "purple_account_set_password" (PurpleAccount *account, const_char_ptr password) const_char_ptr c_purple_account_get_password "purple_account_get_password" (PurpleAccount *account) void c_purple_account_set_enabled "purple_account_set_enabled" (PurpleAccount *account, const_char_ptr ui, gboolean value) const_char_ptr c_purple_account_get_username "purple_account_get_username" (PurpleAccount *account) GList *c_purple_accounts_get_all_active "purple_accounts_get_all_active" () + void c_purple_accounts_set_ui_ops "purple_accounts_set_ui_ops" (PurpleAccountUiOps *ops) diff --git a/libpurple/blist.pxd b/libpurple/blist.pxd index 8b523d1..d21f3de 100644 --- a/libpurple/blist.pxd +++ b/libpurple/blist.pxd @@ -21,6 +21,9 @@ cdef extern from "libpurple/blist.h": ctypedef struct PurpleBlistNode: pass + ctypedef struct PurpleBlistUiOps: + pass + ctypedef struct PurpleBuddy: pass @@ -30,6 +33,7 @@ cdef extern from "libpurple/blist.h": void *c_purple_blist_get_handle "purple_blist_get_handle" () void c_purple_blist_load "purple_blist_load" () PurpleBuddyList* c_purple_blist_new "purple_blist_new" () + void c_purple_blist_set_ui_ops "purple_blist_set_ui_ops" (PurpleBlistUiOps *ops) PurpleBuddy *c_purple_buddy_new "purple_buddy_new" (PurpleAccount *account, const_char_ptr screenname, const_char_ptr alias) diff --git a/libpurple/connection.pxd b/libpurple/connection.pxd index d0632b3..d0a3633 100644 --- a/libpurple/connection.pxd +++ b/libpurple/connection.pxd @@ -20,3 +20,8 @@ cdef extern from "libpurple/connection.h": ctypedef struct PurpleConnection: pass + + ctypedef struct PurpleConnectionUiOps: + pass + + void c_purple_connections_set_ui_ops "purple_connections_set_ui_ops" (PurpleConnectionUiOps *ops) diff --git a/libpurple/conversation.pxd b/libpurple/conversation.pxd index 32320ee..e4710b7 100644 --- a/libpurple/conversation.pxd +++ b/libpurple/conversation.pxd @@ -62,6 +62,7 @@ cdef extern from "libpurple/conversation.h": void *c_purple_conversations_get_handle "purple_conversations_get_handle" () PurpleConversation *c_purple_conversation_new "purple_conversation_new" (int type, PurpleAccount *account, const_char_ptr name) void c_purple_conversation_set_ui_ops "purple_conversation_set_ui_ops" (PurpleConversation *conv, PurpleConversationUiOps *ops) + void c_purple_conversations_set_ui_ops "purple_conversations_set_ui_ops" (PurpleConversationUiOps *ops) PurpleConvIm *c_purple_conversation_get_im_data "purple_conversation_get_im_data" (PurpleConversation *conv) void c_purple_conv_im_send "purple_conv_im_send" (PurpleConvIm *im, const_char_ptr message) void c_purple_conversation_destroy "purple_conversation_destroy" (PurpleConversation *conv) diff --git a/libpurple/ft.pxd b/libpurple/ft.pxd new file mode 100644 index 0000000..f7994e6 --- /dev/null +++ b/libpurple/ft.pxd @@ -0,0 +1,24 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +cdef extern from "libpurple/ft.h": + ctypedef struct PurpleXferUiOps: + pass + + void c_purple_xfers_set_ui_ops "purple_xfers_set_ui_ops" (PurpleXferUiOps *ops) diff --git a/libpurple/notify.pxd b/libpurple/notify.pxd new file mode 100644 index 0000000..c45c60a --- /dev/null +++ b/libpurple/notify.pxd @@ -0,0 +1,24 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +cdef extern from "libpurple/notify.h": + ctypedef struct PurpleNotifyUiOps: + pass + + void c_purple_notify_set_ui_ops "purple_notify_set_ui_ops" (PurpleNotifyUiOps *ops) diff --git a/libpurple/request.pxd b/libpurple/request.pxd new file mode 100644 index 0000000..f575125 --- /dev/null +++ b/libpurple/request.pxd @@ -0,0 +1,24 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +cdef extern from "libpurple/request.h": + ctypedef struct PurpleRequestUiOps: + pass + + void c_purple_request_set_ui_ops "purple_request_set_ui_ops" (PurpleRequestUiOps *ops) diff --git a/libpurple/roomlist.pxd b/libpurple/roomlist.pxd new file mode 100644 index 0000000..271dbc8 --- /dev/null +++ b/libpurple/roomlist.pxd @@ -0,0 +1,24 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +cdef extern from "libpurple/roomlist.h": + ctypedef struct PurpleRoomlistUiOps: + pass + + void c_purple_roomlist_set_ui_ops "purple_roomlist_set_ui_ops" (PurpleRoomlistUiOps *ops) diff --git a/purple.pyx b/purple.pyx index 35f5a09..9d87b67 100644 --- a/purple.pyx +++ b/purple.pyx @@ -34,11 +34,15 @@ include "libpurple/conversation.pxd" include "libpurple/core.pxd" include "libpurple/debug.pxd" include "libpurple/eventloop.pxd" +include "libpurple/ft.pxd" include "libpurple/idle.pxd" +include "libpurple/notify.pxd" include "libpurple/plugin.pxd" include "libpurple/pounce.pxd" include "libpurple/prefs.pxd" include "libpurple/proxy.pxd" +include "libpurple/request.pxd" +include "libpurple/roomlist.pxd" include "libpurple/signals.pxd" include "libpurple/status.pxd" include "libpurple/savedstatuses.pxd" @@ -90,7 +94,6 @@ cdef class Purple: c_purple_prefs_load() c_purple_prefs_add_none("/carman") - c_purple_prefs_add_none("/carman/plugins") # __core_ui_ops_ui_prefs_init cdef void __core_ui_ops_debug_init(self): @@ -99,10 +102,23 @@ cdef class Purple: cdef void __core_ui_ops_ui_init(self): c_purple_debug(PURPLE_DEBUG_INFO, "core_ui_ops", "ui_init\n") + + # FIXME: Add core ui initialization here # __core_ui_ops_ui_init cdef void __core_ui_ops_quit(self): c_purple_debug(PURPLE_DEBUG_INFO, "core_ui_ops", "quit\n") + c_purple_accounts_set_ui_ops(NULL) + c_purple_connections_set_ui_ops(NULL) + c_purple_blist_set_ui_ops(NULL) + c_purple_conversations_set_ui_ops(NULL) + c_purple_notify_set_ui_ops(NULL) + c_purple_request_set_ui_ops(NULL) + c_purple_xfers_set_ui_ops(NULL) + c_purple_roomlist_set_ui_ops(NULL) + + if self.c_ui_info: + g_hash_table_destroy(self.c_ui_info) # __core_ui_ops_quit cdef GHashTable *__core_ui_ops_get_ui_info(self): -- 1.7.9.5