| 54 GAIM_NOTIFY_MSG_ERROR = 0, /**< Error notification. */ |
54 GAIM_NOTIFY_MSG_ERROR = 0, /**< Error notification. */ |
| 55 GAIM_NOTIFY_MSG_WARNING, /**< Warning notification. */ |
55 GAIM_NOTIFY_MSG_WARNING, /**< Warning notification. */ |
| 56 GAIM_NOTIFY_MSG_INFO /**< Information notification. */ |
56 GAIM_NOTIFY_MSG_INFO /**< Information notification. */ |
| 57 |
57 |
| 58 } GaimNotifyMsgType; |
58 } GaimNotifyMsgType; |
| |
59 |
| |
60 /** |
| |
61 * The types of buttons |
| |
62 */ |
| |
63 typedef enum |
| |
64 { |
| |
65 GAIM_NOTIFY_BUTTON_CONTINUE = 0, |
| |
66 GAIM_NOTIFY_BUTTON_ADD_BUDDY |
| |
67 |
| |
68 } GaimNotifySearchButtonType; |
| |
69 |
| |
70 /** |
| |
71 * Search results object. |
| |
72 */ |
| |
73 typedef struct |
| |
74 { |
| |
75 GList *columns; /**< List of the search column objects. */ |
| |
76 GList *rows; /**< List of rows in the result. */ |
| |
77 GList *buttons; /**< List of buttons to display. */ |
| |
78 |
| |
79 } GaimNotifySearchResults; |
| |
80 |
| |
81 /** |
| |
82 * Single column of a search result. |
| |
83 */ |
| |
84 typedef struct |
| |
85 { |
| |
86 char *title; /**< Title of the column. */ |
| |
87 |
| |
88 } GaimNotifySearchColumn; |
| |
89 |
| |
90 typedef void (*GaimNotifySearchResultsCallback)(GaimConnection *, GList *); |
| |
91 |
| |
92 |
| |
93 /** |
| |
94 * Definition of a button. |
| |
95 */ |
| |
96 typedef struct |
| |
97 { |
| |
98 GaimNotifySearchButtonType type; |
| |
99 GaimNotifySearchResultsCallback callback; /**< Function to be called when clicked. */ |
| |
100 |
| |
101 } GaimNotifySearchButton; |
| 59 |
102 |
| 60 /** |
103 /** |
| 61 * Notification UI operations. |
104 * Notification UI operations. |
| 62 */ |
105 */ |
| 63 typedef struct |
106 typedef struct |
| 75 void *(*notify_formatted)(const char *title, const char *primary, |
118 void *(*notify_formatted)(const char *title, const char *primary, |
| 76 const char *secondary, const char *text, |
119 const char *secondary, const char *text, |
| 77 GCallback cb, void *user_data); |
120 GCallback cb, void *user_data); |
| 78 void *(*notify_searchresults)(GaimConnection *gc, const char *title, |
121 void *(*notify_searchresults)(GaimConnection *gc, const char *title, |
| 79 const char *primary, const char *secondary, |
122 const char *primary, const char *secondary, |
| 80 const char **results, GCallback cb, |
123 GaimNotifySearchResults *results, GCallback cb, |
| 81 void *user_data); |
124 void *user_data); |
| |
125 void (*notify_searchresults_new_rows)(GaimConnection *gc, |
| |
126 GaimNotifySearchResults *results, |
| |
127 void *data, void *user_data); |
| 82 void *(*notify_userinfo)(GaimConnection *gc, const char *who, |
128 void *(*notify_userinfo)(GaimConnection *gc, const char *who, |
| 83 const char *title, const char *primary, |
129 const char *title, const char *primary, |
| 84 const char *secondary, const char *text, |
130 const char *secondary, const char *text, |
| 85 GCallback cb, void *user_data); |
131 GCallback cb, void *user_data); |
| 86 void *(*notify_uri)(const char *uri); |
132 void *(*notify_uri)(const char *uri); |
| 87 |
133 |
| 88 void (*close_notify)(GaimNotifyType type, void *ui_handle); |
134 void (*close_notify)(GaimNotifyType type, void *ui_handle); |
| 89 |
135 |
| 90 } GaimNotifyUiOps; |
136 } GaimNotifyUiOps; |
| 91 |
137 |
| 92 |
|
| 93 #ifdef __cplusplus |
138 #ifdef __cplusplus |
| 94 extern "C" { |
139 extern "C" { |
| 95 #endif |
140 #endif |
| |
141 |
| |
142 /**************************************************************************/ |
| |
143 /** Search results notification API */ |
| |
144 /**************************************************************************/ |
| |
145 /*@{*/ |
| |
146 |
| |
147 /** |
| |
148 * Displays results from a buddy search. This can be, for example, |
| |
149 * a window with a list of all found buddies, where you are given the |
| |
150 * option of adding buddies to your buddy list. |
| |
151 * |
| |
152 * @param gc The GaimConnection handle associated with the information. |
| |
153 * @param title The title of the message. If this is NULL, the title |
| |
154 * will be "Search Results." |
| |
155 * @param primary The main point of the message. |
| |
156 * @param secondary The secondary information. |
| |
157 * @param results The GaimNotifySearchResults instance. |
| |
158 * @param cb The callback to call when the user closes |
| |
159 * the notification. |
| |
160 * @param user_data The data to pass to the callback. |
| |
161 * |
| |
162 * @return A UI-specific handle. |
| |
163 */ |
| |
164 void *gaim_notify_searchresults(GaimConnection *gc, const char *title, |
| |
165 const char *primary, const char *secondary, |
| |
166 GaimNotifySearchResults *results, GCallback cb, |
| |
167 void *user_data); |
| |
168 |
| |
169 void gaim_notify_searchresults_free(GaimNotifySearchResults *results); |
| |
170 |
| |
171 /** |
| |
172 * Replace old rows with the new. Reuse an existing window. |
| |
173 * |
| |
174 * @param gc The GaimConnection structure. |
| |
175 * @param results The GaimNotifySearchResults structure. |
| |
176 * @param data Data returned by the gaim_notify_searchresults(). |
| |
177 * @param user_data User defined data. |
| |
178 */ |
| |
179 void gaim_notify_searchresults_new_rows(GaimConnection *gc, |
| |
180 GaimNotifySearchResults *results, |
| |
181 void *data, void *user_data); |
| |
182 |
| |
183 /** |
| |
184 * Adds a button that will be displayed in the search results dialog. |
| |
185 * |
| |
186 * @param results The search results object. |
| |
187 * @param type Type of the button. (TODO: Only one button of a given type can be displayed.) |
| |
188 * @param cb Function that will be called on the click event. |
| |
189 */ |
| |
190 void gaim_notify_searchresults_button_add(GaimNotifySearchResults *results, |
| |
191 GaimNotifySearchButtonType type, |
| |
192 GaimNotifySearchResultsCallback cb); |
| |
193 |
| |
194 /** |
| |
195 * Returns a newly created search results object. |
| |
196 * |
| |
197 * @return The new search results object. |
| |
198 */ |
| |
199 GaimNotifySearchResults *gaim_notify_searchresults_new(); |
| |
200 |
| |
201 /** |
| |
202 * Returns a newly created search result column object. |
| |
203 * |
| |
204 * @param title Title of the column. NOTE: Title will get g_strdup()ed. |
| |
205 * |
| |
206 * @return The new search column object. |
| |
207 */ |
| |
208 GaimNotifySearchColumn *gaim_notify_searchresults_column_new(const char *title); |
| |
209 |
| |
210 /** |
| |
211 * Adds a new column to the search result object. |
| |
212 * |
| |
213 * @param results The result object to which the column will be added. |
| |
214 * @param columnt The column that will be added to the result object. |
| |
215 */ |
| |
216 void gaim_notify_searchresults_column_add(GaimNotifySearchResults *results, |
| |
217 GaimNotifySearchColumn *column); |
| |
218 |
| |
219 /** |
| |
220 * Adds a new row of the results to the search results object. |
| |
221 * |
| |
222 * @param results The search results object. |
| |
223 * @param row The row of the results. |
| |
224 */ |
| |
225 void gaim_notify_searchresults_row_add(GaimNotifySearchResults *results, |
| |
226 GList *row); |
| |
227 |
| |
228 /** |
| |
229 * Returns a number of the rows in the search results object. |
| |
230 * |
| |
231 * @param results The search results object. |
| |
232 * |
| |
233 * @return Number of the result rows. Or -1 if an error occurrs. |
| |
234 */ |
| |
235 int gaim_notify_searchresults_get_rows_count(GaimNotifySearchResults *results); |
| |
236 |
| |
237 /** |
| |
238 * Returns a number of the columns in the search results object. |
| |
239 * |
| |
240 * @param results The search results object. |
| |
241 * |
| |
242 * @return Number of the columns. Or -1 if an error occurrs. |
| |
243 */ |
| |
244 int gaim_notify_searchresults_get_columns_count(GaimNotifySearchResults *results); |
| |
245 |
| |
246 /** |
| |
247 * Returns a row of the results from the search results object. |
| |
248 * |
| |
249 * @param results The search results object. |
| |
250 * @param row_id Index of the row to be returned. |
| |
251 * |
| |
252 * @return Row of the results. |
| |
253 */ |
| |
254 GList *gaim_notify_searchresults_row_get(GaimNotifySearchResults *results, |
| |
255 unsigned int row_id); |
| |
256 |
| |
257 /** |
| |
258 * Returns a title of the search results object's column. |
| |
259 * |
| |
260 * @param results The search results object. |
| |
261 * @param column_id Index of the column. |
| |
262 * |
| |
263 * @return Title of the column. |
| |
264 */ |
| |
265 char *gaim_notify_searchresults_column_get_title(GaimNotifySearchResults *results, |
| |
266 unsigned int column_id); |
| |
267 |
| |
268 /*@}*/ |
| 96 |
269 |
| 97 /**************************************************************************/ |
270 /**************************************************************************/ |
| 98 /** @name Notification API */ |
271 /** @name Notification API */ |
| 99 /**************************************************************************/ |
272 /**************************************************************************/ |
| 100 /*@{*/ |
273 /*@{*/ |
| 179 void *gaim_notify_formatted(void *handle, const char *title, |
352 void *gaim_notify_formatted(void *handle, const char *title, |
| 180 const char *primary, const char *secondary, |
353 const char *primary, const char *secondary, |
| 181 const char *text, GCallback cb, void *user_data); |
354 const char *text, GCallback cb, void *user_data); |
| 182 |
355 |
| 183 /** |
356 /** |
| 184 * Displays results from a buddy search. This can be, for example, |
|
| 185 * a window with a list of all found buddies, where you are given the |
|
| 186 * option of adding buddies to your buddy list. |
|
| 187 * |
|
| 188 * @param gc The GaimConnection handle associated with the information. |
|
| 189 * @param title The title of the message. If this is NULL, the title |
|
| 190 * will be "Search Results." |
|
| 191 * @param primary The main point of the message. |
|
| 192 * @param secondary The secondary information. |
|
| 193 * @param results An null-terminated array of null-terminated buddy names. |
|
| 194 * @param cb The callback to call when the user closes |
|
| 195 * the notification. |
|
| 196 * @param user_data The data to pass to the callback. |
|
| 197 * |
|
| 198 * @return A UI-specific handle. |
|
| 199 */ |
|
| 200 void *gaim_notify_searchresults(GaimConnection *gc, const char *title, |
|
| 201 const char *primary, const char *secondary, |
|
| 202 const char **results, GCallback cb, |
|
| 203 void *user_data); |
|
| 204 |
|
| 205 /** |
|
| 206 * Displays user information with formatted text, passing information giving |
357 * Displays user information with formatted text, passing information giving |
| 207 * the connection and username from which the user information came. |
358 * the connection and username from which the user information came. |
| 208 * |
359 * |
| 209 * The text is essentially a stripped-down format of HTML, the same that |
360 * The text is essentially a stripped-down format of HTML, the same that |
| 210 * IMs may send. |
361 * IMs may send. |