# HG changeset patch # User Will Thompson # Date 1213534396 0 # Node ID 09697d94160f3bcf8b8f5d22506d65abe715a5e9 # Parent 23498a6244f3ddee44bd371ff684bcd2ad725fcb Document PurpleCoreUiOps and purple_core_get_ui_info(), tweaking other core documentation while I'm there. diff -r 23498a6244f3 -r 09697d94160f libpurple/core.h --- a/libpurple/core.h Sun Jun 15 12:50:23 2008 +0000 +++ b/libpurple/core.h Sun Jun 15 12:53:16 2008 +0000 @@ -1,4 +1,5 @@ /** + * @file core.h Startup and shutdown of libpurple * @defgroup core libpurple * @see @ref core-signals */ @@ -28,12 +29,36 @@ typedef struct PurpleCore PurpleCore; +/** Callbacks that fire at different points of the initialization and teardown + * of libpurple, along with a hook to return descriptive information about the + * UI. + */ typedef struct { + /** Called just after the preferences subsystem is initialized; the UI + * could use this callback to add some preferences it needs to be in + * place when other subsystems are initialized. + */ void (*ui_prefs_init)(void); - void (*debug_ui_init)(void); /* Unfortunate necessity. */ + /** Called just after the debug subsystem is initialized, but before + * just about every other component's initialization. The UI should + * use this hook to call purple_debug_set_ui_ops() so that debugging + * information for other components can be logged during their + * initialization. + */ + void (*debug_ui_init)(void); + /** Called after all of libpurple has been initialized. The UI should + * use this hook to set all other necessary UiOps structures. + * + * @see @ref ui-ops + */ void (*ui_init)(void); + /** Called after most of libpurple has been uninitialized. */ void (*quit)(void); + + /** Called by purple_core_get_ui_info(); should return the information + * documented there. + */ GHashTable* (*get_ui_info)(void); void (*_purple_reserved1)(void); @@ -64,17 +89,23 @@ void purple_core_quit(void); /** + *

* Calls purple_core_quit(). This can be used as the function * passed to purple_timeout_add() when you want to shutdown Purple * in a specified amount of time. When shutting down Purple * from a plugin, you must use this instead of purple_core_quit(); * for an immediate exit, use a timeout value of 0: - * purple_timeout_add(0, purple_core_quitcb, NULL); + *

+ * + * purple_timeout_add(0, purple_core_quitcb, NULL); + * + *

* This is ensures that code from your plugin is not being * executed when purple_core_quit() is called. If the plugin * called purple_core_quit() directly, you would get a core dump * after purple_core_quit() executes and control returns to your * plugin because purple_core_quit() frees all plugins. + *

*/ gboolean purple_core_quit_cb(gpointer unused); @@ -86,7 +117,8 @@ const char *purple_core_get_version(void); /** - * Returns the ID of the UI that is using the core. + * Returns the ID of the UI that is using the core, as passed to + * purple_core_init(). * * @return The ID of the UI that is currently using the core. */ @@ -95,7 +127,7 @@ /** * Returns a handle to the purple core. * - * This is used for such things as signals. + * This is used to connect to @ref core-signals "core signals". */ PurpleCore *purple_get_core(void); @@ -114,10 +146,10 @@ PurpleCoreUiOps *purple_core_get_ui_ops(void); /** - * Migrates from .gaim to .purple. + * Migrates from .gaim to .purple. * - * UIs MUST NOT call this if they have been told to use a custom - * user directory. + * UIs must not call this if they have been told to use a + * custom user directory. * * @return A boolean indicating success or migration failure. On failure, * the application must display an error to the user and then exit. @@ -125,20 +157,33 @@ gboolean purple_core_migrate(void); /** - * Ensures that only one instance is running. + * Ensures that only one instance is running. If libpurple is built with D-Bus + * support, this checks if another process owns the libpurple bus name and if + * so whether that process is using the same configuration directory as this + * process. * - * @return A boolean such that @c TRUE indicates that this is the first instance, - * whereas @c FALSE indicates that there is another instance running. + * @return @c TRUE if this is the first instance of libpurple running; + * @c FALSE if there is another instance running. * * @since 2.1.0 */ gboolean purple_core_ensure_single_instance(void); /** - * Returns a hashtable containing various information about the UI + * Returns a hash table containing various information about the UI. The + * following well-known entries may be in the table (along with any others the + * UI might choose to include): + * + *
+ *
name
+ *
the user-readable name for the UI.
+ * + *
version
+ *
a user-readable description of the current version of the UI.
+ *
* * @return A GHashTable with strings for keys and values. This - * hash table must not be freed. + * hash table must not be freed and should not be modified. * * @since 2.1.0 *