comparison libpurple/core.h @ 23369:09697d94160f

Document PurpleCoreUiOps and purple_core_get_ui_info(), tweaking other core documentation while I'm there.
author Will Thompson <will.thompson@collabora.co.uk>
date Sun, 15 Jun 2008 12:53:16 +0000
parents 7e5ecf03b69d
children c6b29adc22d1
comparison
equal deleted inserted replaced
23368:23498a6244f3 23369:09697d94160f
1 /** 1 /**
2 * @file core.h Startup and shutdown of libpurple
2 * @defgroup core libpurple 3 * @defgroup core libpurple
3 * @see @ref core-signals 4 * @see @ref core-signals
4 */ 5 */
5 6
6 /* purple 7 /* purple
26 #ifndef _PURPLE_CORE_H_ 27 #ifndef _PURPLE_CORE_H_
27 #define _PURPLE_CORE_H_ 28 #define _PURPLE_CORE_H_
28 29
29 typedef struct PurpleCore PurpleCore; 30 typedef struct PurpleCore PurpleCore;
30 31
32 /** Callbacks that fire at different points of the initialization and teardown
33 * of libpurple, along with a hook to return descriptive information about the
34 * UI.
35 */
31 typedef struct 36 typedef struct
32 { 37 {
38 /** Called just after the preferences subsystem is initialized; the UI
39 * could use this callback to add some preferences it needs to be in
40 * place when other subsystems are initialized.
41 */
33 void (*ui_prefs_init)(void); 42 void (*ui_prefs_init)(void);
34 void (*debug_ui_init)(void); /* Unfortunate necessity. */ 43 /** Called just after the debug subsystem is initialized, but before
44 * just about every other component's initialization. The UI should
45 * use this hook to call purple_debug_set_ui_ops() so that debugging
46 * information for other components can be logged during their
47 * initialization.
48 */
49 void (*debug_ui_init)(void);
50 /** Called after all of libpurple has been initialized. The UI should
51 * use this hook to set all other necessary UiOps structures.
52 *
53 * @see @ref ui-ops
54 */
35 void (*ui_init)(void); 55 void (*ui_init)(void);
56 /** Called after most of libpurple has been uninitialized. */
36 void (*quit)(void); 57 void (*quit)(void);
58
59 /** Called by purple_core_get_ui_info(); should return the information
60 * documented there.
61 */
37 GHashTable* (*get_ui_info)(void); 62 GHashTable* (*get_ui_info)(void);
38 63
39 void (*_purple_reserved1)(void); 64 void (*_purple_reserved1)(void);
40 void (*_purple_reserved2)(void); 65 void (*_purple_reserved2)(void);
41 void (*_purple_reserved3)(void); 66 void (*_purple_reserved3)(void);
62 * application using the purple core. 87 * application using the purple core.
63 */ 88 */
64 void purple_core_quit(void); 89 void purple_core_quit(void);
65 90
66 /** 91 /**
92 * <p>
67 * Calls purple_core_quit(). This can be used as the function 93 * Calls purple_core_quit(). This can be used as the function
68 * passed to purple_timeout_add() when you want to shutdown Purple 94 * passed to purple_timeout_add() when you want to shutdown Purple
69 * in a specified amount of time. When shutting down Purple 95 * in a specified amount of time. When shutting down Purple
70 * from a plugin, you must use this instead of purple_core_quit(); 96 * from a plugin, you must use this instead of purple_core_quit();
71 * for an immediate exit, use a timeout value of 0: 97 * for an immediate exit, use a timeout value of 0:
72 * purple_timeout_add(0, purple_core_quitcb, NULL); 98 * </p>
99 *
100 * <code>purple_timeout_add(0, purple_core_quitcb, NULL);</code>
101 *
102 * <p>
73 * This is ensures that code from your plugin is not being 103 * This is ensures that code from your plugin is not being
74 * executed when purple_core_quit() is called. If the plugin 104 * executed when purple_core_quit() is called. If the plugin
75 * called purple_core_quit() directly, you would get a core dump 105 * called purple_core_quit() directly, you would get a core dump
76 * after purple_core_quit() executes and control returns to your 106 * after purple_core_quit() executes and control returns to your
77 * plugin because purple_core_quit() frees all plugins. 107 * plugin because purple_core_quit() frees all plugins.
108 * </p>
78 */ 109 */
79 gboolean purple_core_quit_cb(gpointer unused); 110 gboolean purple_core_quit_cb(gpointer unused);
80 111
81 /** 112 /**
82 * Returns the version of the core library. 113 * Returns the version of the core library.
84 * @return The version of the core library. 115 * @return The version of the core library.
85 */ 116 */
86 const char *purple_core_get_version(void); 117 const char *purple_core_get_version(void);
87 118
88 /** 119 /**
89 * Returns the ID of the UI that is using the core. 120 * Returns the ID of the UI that is using the core, as passed to
121 * purple_core_init().
90 * 122 *
91 * @return The ID of the UI that is currently using the core. 123 * @return The ID of the UI that is currently using the core.
92 */ 124 */
93 const char *purple_core_get_ui(void); 125 const char *purple_core_get_ui(void);
94 126
95 /** 127 /**
96 * Returns a handle to the purple core. 128 * Returns a handle to the purple core.
97 * 129 *
98 * This is used for such things as signals. 130 * This is used to connect to @ref core-signals "core signals".
99 */ 131 */
100 PurpleCore *purple_get_core(void); 132 PurpleCore *purple_get_core(void);
101 133
102 /** 134 /**
103 * Sets the UI ops for the core. 135 * Sets the UI ops for the core.
112 * @return The core's UI ops structure. 144 * @return The core's UI ops structure.
113 */ 145 */
114 PurpleCoreUiOps *purple_core_get_ui_ops(void); 146 PurpleCoreUiOps *purple_core_get_ui_ops(void);
115 147
116 /** 148 /**
117 * Migrates from .gaim to .purple. 149 * Migrates from <tt>.gaim</tt> to <tt>.purple</tt>.
118 * 150 *
119 * UIs MUST NOT call this if they have been told to use a custom 151 * UIs <strong>must not</strong> call this if they have been told to use a
120 * user directory. 152 * custom user directory.
121 * 153 *
122 * @return A boolean indicating success or migration failure. On failure, 154 * @return A boolean indicating success or migration failure. On failure,
123 * the application must display an error to the user and then exit. 155 * the application must display an error to the user and then exit.
124 */ 156 */
125 gboolean purple_core_migrate(void); 157 gboolean purple_core_migrate(void);
126 158
127 /** 159 /**
128 * Ensures that only one instance is running. 160 * Ensures that only one instance is running. If libpurple is built with D-Bus
129 * 161 * support, this checks if another process owns the libpurple bus name and if
130 * @return A boolean such that @c TRUE indicates that this is the first instance, 162 * so whether that process is using the same configuration directory as this
131 * whereas @c FALSE indicates that there is another instance running. 163 * process.
164 *
165 * @return @c TRUE if this is the first instance of libpurple running;
166 * @c FALSE if there is another instance running.
132 * 167 *
133 * @since 2.1.0 168 * @since 2.1.0
134 */ 169 */
135 gboolean purple_core_ensure_single_instance(void); 170 gboolean purple_core_ensure_single_instance(void);
136 171
137 /** 172 /**
138 * Returns a hashtable containing various information about the UI 173 * Returns a hash table containing various information about the UI. The
174 * following well-known entries may be in the table (along with any others the
175 * UI might choose to include):
176 *
177 * <dl>
178 * <dt><tt>name</tt></dt>
179 * <dd>the user-readable name for the UI.</dd>
180 *
181 * <dt><tt>version</tt></dt>
182 * <dd>a user-readable description of the current version of the UI.</dd>
183 * </dl>
139 * 184 *
140 * @return A GHashTable with strings for keys and values. This 185 * @return A GHashTable with strings for keys and values. This
141 * hash table must not be freed. 186 * hash table must not be freed and should not be modified.
142 * 187 *
143 * @since 2.1.0 188 * @since 2.1.0
144 * 189 *
145 */ 190 */
146 GHashTable* purple_core_get_ui_info(void); 191 GHashTable* purple_core_get_ui_info(void);