| 30 * @short_description: <filename>util.h</filename> |
30 * @short_description: <filename>util.h</filename> |
| 31 * @title: Utility Functions |
31 * @title: Utility Functions |
| 32 */ |
32 */ |
| 33 |
33 |
| 34 #include <stdio.h> |
34 #include <stdio.h> |
| 35 |
|
| 36 /** |
|
| 37 * PurpleKeyValuePair: |
|
| 38 * @key: The key |
|
| 39 * @value: The value |
|
| 40 * |
|
| 41 * A key-value pair. |
|
| 42 * |
|
| 43 * This is used by, among other things, purple_gtk_combo* functions to pass in a |
|
| 44 * list of key-value pairs so it can display a user-friendly value. |
|
| 45 */ |
|
| 46 typedef struct _PurpleKeyValuePair PurpleKeyValuePair; |
|
| 47 |
35 |
| 48 #include "account.h" |
36 #include "account.h" |
| 49 #include "signals.h" |
37 #include "signals.h" |
| 50 #include "xmlnode.h" |
38 #include "xmlnode.h" |
| 51 #include "notify.h" |
39 #include "notify.h" |
| 52 #include "protocols.h" |
40 #include "protocols.h" |
| 53 |
41 |
| 54 |
42 |
| 55 typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); |
43 typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); |
| 56 |
44 |
| 57 struct _PurpleKeyValuePair |
|
| 58 { |
|
| 59 gchar *key; |
|
| 60 void *value; |
|
| 61 GDestroyNotify value_destroy_func; |
|
| 62 }; |
|
| 63 |
|
| 64 G_BEGIN_DECLS |
45 G_BEGIN_DECLS |
| 65 |
46 |
| 66 /** |
47 /** |
| 67 * purple_util_set_current_song: |
48 * purple_util_set_current_song: |
| 68 * @title: The title of the song, %NULL to unset the value. |
49 * @title: The title of the song, %NULL to unset the value. |
| 85 * |
66 * |
| 86 * Returns: The formatted string. The caller must g_free the returned string. |
67 * Returns: The formatted string. The caller must g_free the returned string. |
| 87 */ |
68 */ |
| 88 char * purple_util_format_song_info(const char *title, const char *artist, |
69 char * purple_util_format_song_info(const char *title, const char *artist, |
| 89 const char *album, gpointer unused); |
70 const char *album, gpointer unused); |
| 90 |
|
| 91 /** |
|
| 92 * purple_key_value_pair_new: |
|
| 93 * @key: The key part of PurpleKeyValuePair |
|
| 94 * @value: The value part of PurpleKeyValuePair |
|
| 95 * |
|
| 96 * Creates a new PurpleKeyValuePair allocating memory for @key, |
|
| 97 * free value function is NULL. |
|
| 98 * |
|
| 99 * Returns: The created PurpleKeyValuePair |
|
| 100 * |
|
| 101 * Since: 3.0.0 |
|
| 102 */ |
|
| 103 PurpleKeyValuePair *purple_key_value_pair_new(const char *key, gpointer value); |
|
| 104 |
|
| 105 /** |
|
| 106 * purple_key_value_pair_new_full: |
|
| 107 * @key: The key part of PurpleKeyValuePair |
|
| 108 * @value: The value part of PurpleKeyValuePair |
|
| 109 * @value_destroy_func: a function to free the memory for the @value |
|
| 110 * |
|
| 111 * Creates a new PurpleKeyValuePair allocating memory for @key, |
|
| 112 * set free value function to @value_destroy_func. |
|
| 113 * |
|
| 114 * Returns: The created PurpleKeyValuePair |
|
| 115 * |
|
| 116 * Since: 3.0.0 |
|
| 117 */ |
|
| 118 PurpleKeyValuePair *purple_key_value_pair_new_full(const char *key, gpointer value, GDestroyNotify value_destroy_func); |
|
| 119 |
|
| 120 /** |
|
| 121 * purple_key_value_pair_free: |
|
| 122 * @kvp: The PurpleKeyValuePair to free. |
|
| 123 * |
|
| 124 * Frees @kvp. |
|
| 125 * |
|
| 126 * Since: 3.0.0 |
|
| 127 */ |
|
| 128 void purple_key_value_pair_free(PurpleKeyValuePair *kvp); |
|
| 129 |
71 |
| 130 /**************************************************************************/ |
72 /**************************************************************************/ |
| 131 /* Utility Subsystem */ |
73 /* Utility Subsystem */ |
| 132 /**************************************************************************/ |
74 /**************************************************************************/ |
| 133 |
75 |