2 # Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
4 # This file is part of python-purple.
6 # python-purple is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # python-purple is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY = None without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 cdef extern from "libpurple/core.h":
21 ctypedef struct PurpleCoreUiOps:
22 void (*ui_prefs_init) ()
23 void (*debug_ui_init) ()
26 GHashTable* (*get_ui_info) ()
28 cdef gboolean c_purple_core_init "purple_core_init" (const_char_ptr ui)
29 cdef void c_purple_core_quit "purple_core_quit" ()
30 cdef gboolean c_purple_core_migrate "purple_core_migrate" ()
31 cdef void c_purple_core_set_ui_ops "purple_core_set_ui_ops" (PurpleCoreUiOps *ops)
33 """ CoreUiOps class """
36 cdef void ui_prefs_init():
38 if __core_uiops and __core_uiops.ui_prefs_init:
39 __core_uiops.ui_prefs_init()
41 cdef void debug_ui_init():
43 if __core_uiops and __core_uiops.debug_ui_init:
44 __core_uiops.debug_ui_init()
48 if __core_uiops and __core_uiops.ui_init:
49 __core_uiops.ui_init()
53 if __core_uiops and __core_uiops.quit:
56 cdef GHashTable *get_ui_info():
58 if __core_uiops and __core_uiops.get_ui_info:
59 __core_uiops.get_ui_info()
62 class CoreUiOps(object):
64 self.ui_prefs_init = None
65 self.debug_ui_init = None
68 self.get_ui_info = None
71 def core_set_ui_ops(core_uiops):
73 cdef PurpleCoreUiOps c_core_uiops
75 c_core_uiops.ui_prefs_init = ui_prefs_init
76 c_core_uiops.debug_ui_init = debug_ui_init
77 c_core_uiops.ui_init = ui_init
78 c_core_uiops.quit = quit
79 c_core_uiops.get_ui_info = get_ui_info
81 __core_uiops = core_uiops
83 c_purple_core_set_ui_ops(&c_core_uiops)
86 c_purple_core_init(ui)