comparison libpurple/notify.h @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents 98520ee78f12
children
comparison
equal deleted inserted replaced
32818:01ff09d4a463 32819:2c6510167895
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <glib-object.h> 31 #include <glib-object.h>
32 #include <glib.h> 32 #include <glib.h>
33 33
34 typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry; 34 typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry;
35 typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo; 35 typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo;
36 /** @copydoc _PurpleNotifySearchColumn */
37 typedef struct _PurpleNotifySearchColumn PurpleNotifySearchColumn;
36 38
37 #include "connection.h" 39 #include "connection.h"
40
38 41
39 /** 42 /**
40 * Notification close callbacks. 43 * Notification close callbacks.
41 */ 44 */
42 typedef void (*PurpleNotifyCloseCallback) (gpointer user_data); 45 typedef void (*PurpleNotifyCloseCallback) (gpointer user_data);
104 PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0, 107 PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0,
105 PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK, 108 PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK,
106 PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER 109 PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
107 } PurpleNotifyUserInfoEntryType; 110 } PurpleNotifyUserInfoEntryType;
108 111
109 /**
110 * Single column of a search result.
111 */
112 typedef struct
113 {
114 char *title; /**< Title of the column. */
115
116 } PurpleNotifySearchColumn;
117 112
118 113
119 /** 114 /**
120 * Callback for a button in a search result. 115 * Callback for a button in a search result.
121 * 116 *
178 void (*_purple_reserved3)(void); 173 void (*_purple_reserved3)(void);
179 void (*_purple_reserved4)(void); 174 void (*_purple_reserved4)(void);
180 } PurpleNotifyUiOps; 175 } PurpleNotifyUiOps;
181 176
182 177
183 #ifdef __cplusplus 178 G_BEGIN_DECLS
184 extern "C" {
185 #endif
186 179
187 180
188 /**************************************************************************/ 181 /**************************************************************************/
189 /** Search results notification API */ 182 /** Search results notification API */
190 /**************************************************************************/ 183 /**************************************************************************/
264 * @return The new search results object. 257 * @return The new search results object.
265 */ 258 */
266 PurpleNotifySearchResults *purple_notify_searchresults_new(void); 259 PurpleNotifySearchResults *purple_notify_searchresults_new(void);
267 260
268 /** 261 /**
269 * Returns a newly created search result column object. 262 * Returns a newly created search result column object. The column defaults
263 * to being visible.
270 * 264 *
271 * @param title Title of the column. NOTE: Title will get g_strdup()ed. 265 * @param title Title of the column. NOTE: Title will get g_strdup()ed.
272 * 266 *
273 * @return The new search column object. 267 * @return The new search column object.
274 */ 268 */
275 PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title); 269 PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
270
271 /**
272 * Returns the title of the column
273 *
274 * @param column The search column object.
275 *
276 * @return The title of the column
277 */
278 const char *purple_notify_searchresult_column_get_title(const PurpleNotifySearchColumn *column);
279
280 /**
281 * Sets whether or not a search result column is visible.
282 *
283 * @param column The search column object.
284 * @param visible TRUE if visible, or FALSE if not.
285 */
286 void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible);
287
288 /**
289 * Returns whether or not a search result column is visible.
290 *
291 * @param column The search column object.
292 *
293 * @return TRUE if the search result column is visible. FALSE otherwise.
294 */
295 gboolean purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn *column);
276 296
277 /** 297 /**
278 * Adds a new column to the search result object. 298 * Adds a new column to the search result object.
279 * 299 *
280 * @param results The result object to which the column will be added. 300 * @param results The result object to which the column will be added.
289 * @param results The search results object. 309 * @param results The search results object.
290 * @param row The row of the results. 310 * @param row The row of the results.
291 */ 311 */
292 void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, 312 void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
293 GList *row); 313 GList *row);
294
295 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
296 /**
297 * Returns a number of the rows in the search results object.
298 *
299 * @deprecated This function will be removed in Pidgin 3.0.0 unless
300 * there is sufficient demand to keep it. Using this
301 * function encourages looping through the results
302 * inefficiently. Instead of using this function you
303 * should iterate through the results using a loop
304 * similar to this:
305 * for (l = results->rows; l != NULL; l = l->next)
306 * If you really need to get the number of rows you
307 * can use g_list_length(results->rows).
308 *
309 * @param results The search results object.
310 *
311 * @return Number of the result rows.
312 */
313 guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
314 #endif
315
316 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
317 /**
318 * Returns a number of the columns in the search results object.
319 *
320 * @deprecated This function will be removed in Pidgin 3.0.0 unless
321 * there is sufficient demand to keep it. Using this
322 * function encourages looping through the columns
323 * inefficiently. Instead of using this function you
324 * should iterate through the columns using a loop
325 * similar to this:
326 * for (l = results->columns; l != NULL; l = l->next)
327 * If you really need to get the number of columns you
328 * can use g_list_length(results->columns).
329 *
330 * @param results The search results object.
331 *
332 * @return Number of the columns.
333 */
334 guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
335 #endif
336
337 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
338 /**
339 * Returns a row of the results from the search results object.
340 *
341 * @deprecated This function will be removed in Pidgin 3.0.0 unless
342 * there is sufficient demand to keep it. Using this
343 * function encourages looping through the results
344 * inefficiently. Instead of using this function you
345 * should iterate through the results using a loop
346 * similar to this:
347 * for (l = results->rows; l != NULL; l = l->next)
348 * If you really need to get the data for a particular
349 * row you can use g_list_nth_data(results->rows, row_id).
350 *
351 * @param results The search results object.
352 * @param row_id Index of the row to be returned.
353 *
354 * @return Row of the results.
355 */
356 GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
357 unsigned int row_id);
358 #endif
359
360 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
361 /**
362 * Returns a title of the search results object's column.
363 *
364 * @deprecated This function will be removed in Pidgin 3.0.0 unless
365 * there is sufficient demand to keep it. Using this
366 * function encourages looping through the columns
367 * inefficiently. Instead of using this function you
368 * should iterate through the name of a particular
369 * column you can use
370 * g_list_nth_data(results->columns, row_id).
371 *
372 * @param results The search results object.
373 * @param column_id Index of the column.
374 *
375 * @return Title of the column.
376 */
377 char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
378 unsigned int column_id);
379 #endif
380 314
381 /*@}*/ 315 /*@}*/
382 316
383 /**************************************************************************/ 317 /**************************************************************************/
384 /** @name Notification API */ 318 /** @name Notification API */
504 438
505 /** 439 /**
506 * Retrieve the array of PurpleNotifyUserInfoEntry objects from a 440 * Retrieve the array of PurpleNotifyUserInfoEntry objects from a
507 * PurpleNotifyUserInfo 441 * PurpleNotifyUserInfo
508 * 442 *
509 * This GList may be manipulated directly with normal GList functions such 443 * This GQueue may be manipulated directly with normal GQueue functions such
510 * as g_list_insert(). Only PurpleNotifyUserInfoEntry are allowed in the 444 * as g_queue_push_tail(). Only PurpleNotifyUserInfoEntry are allowed in the
511 * list. If a PurpleNotifyUserInfoEntry item is added to the list, it 445 * queue. If a PurpleNotifyUserInfoEntry item is added to the queue, it
512 * should not be g_free()'d by the caller; PurpleNotifyUserInfo will g_free 446 * should not be freed by the caller; PurpleNotifyUserInfo will free it when
513 * it when destroyed. 447 * destroyed.
514 * 448 *
515 * To remove a PurpleNotifyUserInfoEntry, use 449 * To remove a PurpleNotifyUserInfoEntry, use
516 * purple_notify_user_info_remove_entry(). Do not use the GList directly. 450 * purple_notify_user_info_remove_entry(). Do not use the GQueue directly.
517 * 451 *
518 * @param user_info The PurpleNotifyUserInfo 452 * @param user_info The PurpleNotifyUserInfo
519 * 453 *
520 * @constreturn A GList of PurpleNotifyUserInfoEntry objects 454 * @constreturn A GQueue of PurpleNotifyUserInfoEntry objects.
521 */ 455 */
522 GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info); 456 GQueue *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
523 457
524 /** 458 /**
525 * Create a textual representation of a PurpleNotifyUserInfo, separating 459 * Create a textual representation of a PurpleNotifyUserInfo, separating
526 * entries with newline 460 * entries with newline
527 * 461 *
545 * purple_notify_user_info_add_pair_plaintext(), instead. 479 * purple_notify_user_info_add_pair_plaintext(), instead.
546 * If this is NULL the label will still be displayed; 480 * If this is NULL the label will still be displayed;
547 * the UI should treat label as independent and not 481 * the UI should treat label as independent and not
548 * include a colon if it would otherwise. 482 * include a colon if it would otherwise.
549 */ 483 */
550 /* 484 void purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
551 * TODO: In 3.0.0 this function should be renamed to 485
552 * purple_notify_user_info_add_pair_html(). And optionally 486 /**
553 * purple_notify_user_info_add_pair_plaintext() could be renamed to 487 * Like purple_notify_user_info_add_pair_html, but value should be plaintext
554 * purple_notify_user_info_add_pair().
555 */
556 void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
557
558 /**
559 * Like purple_notify_user_info_add_pair, but value should be plaintext
560 * and will be escaped using g_markup_escape_text(). 488 * and will be escaped using g_markup_escape_text().
561 */ 489 */
562 void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value); 490 void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
563 491
564 /** 492 /**
565 * Prepend a label/value pair to a PurpleNotifyUserInfo object 493 * Like purple_notify_user_info_add_pair_html, but the pair is inserted
566 * 494 * at the beginning of the list.
567 * @param user_info The PurpleNotifyUserInfo 495 */
568 * @param label A label, which for example might be displayed by a 496 void purple_notify_user_info_prepend_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
569 * UI with a colon after it ("Status:"). Do not include 497
570 * a colon. If NULL, value will be displayed without a 498 /**
571 * label. 499 * Like purple_notify_user_info_prepend_pair_html, but value should be plaintext
572 * @param value The value, which might be displayed by a UI after 500 * and will be escaped using g_markup_escape_text().
573 * the label. If NULL, label will still be displayed; 501 */
574 * the UI should then treat label as independent and not 502 void purple_notify_user_info_prepend_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
575 * include a colon if it would otherwise.
576 */
577 void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
578 503
579 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) 504 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
580 /** 505 /**
581 * Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object 506 * Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object
582 * without freeing the entry. 507 * without freeing the entry.
595 /** 520 /**
596 * Create a new PurpleNotifyUserInfoEntry 521 * Create a new PurpleNotifyUserInfoEntry
597 * 522 *
598 * If added to a PurpleNotifyUserInfo object, this should not be free()'d, 523 * If added to a PurpleNotifyUserInfo object, this should not be free()'d,
599 * as PurpleNotifyUserInfo will do so when destroyed. 524 * as PurpleNotifyUserInfo will do so when destroyed.
600 * purple_notify_user_info_add_pair() and 525 * purple_notify_user_info_add_pair_html(),
601 * purple_notify_user_info_prepend_pair() are convenience methods for 526 * purple_notify_user_info_add_pair_plaintext(),
602 * creating entries and adding them to a PurpleNotifyUserInfo. 527 * purple_notify_user_info_prepend_pair_html() and
528 * purple_notify_user_info_prepend_pair_plaintext() are convenience
529 * methods for creating entries and adding them to a PurpleNotifyUserInfo.
603 * 530 *
604 * @param label A label, which for example might be displayed by a UI 531 * @param label A label, which for example might be displayed by a UI
605 * with a colon after it ("Status:"). Do not include a 532 * with a colon after it ("Status:"). Do not include a
606 * colon. If NULL, value will be displayed without a label. 533 * colon. If NULL, value will be displayed without a label.
607 * @param value The value, which might be displayed by a UI after the 534 * @param value The value, which might be displayed by a UI after the
622 549
623 /** 550 /**
624 * Prepend a section break. A UI might display this as a horizontal line. 551 * Prepend a section break. A UI might display this as a horizontal line.
625 * 552 *
626 * @param user_info The PurpleNotifyUserInfo 553 * @param user_info The PurpleNotifyUserInfo
627 * @since 2.5.0
628 */ 554 */
629 void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info); 555 void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info);
630 556
631 /** 557 /**
632 * Add a section header. A UI might display this in a different font 558 * Add a section header. A UI might display this in a different font
641 * Prepend a section header. A UI might display this in a different font 567 * Prepend a section header. A UI might display this in a different font
642 * from other text. 568 * from other text.
643 * 569 *
644 * @param user_info The PurpleNotifyUserInfo 570 * @param user_info The PurpleNotifyUserInfo
645 * @param label The name of the section 571 * @param label The name of the section
646 * @since 2.5.0
647 */ 572 */
648 void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label); 573 void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label);
649 574
650 /** 575 /**
651 * Remove the last item which was added to a PurpleNotifyUserInfo. This 576 * Remove the last item which was added to a PurpleNotifyUserInfo. This
805 void purple_notify_uninit(void); 730 void purple_notify_uninit(void);
806 731
807 /*@}*/ 732 /*@}*/
808 733
809 734
810 #ifdef __cplusplus 735 G_END_DECLS
811 }
812 #endif
813 736
814 #endif /* _PURPLE_NOTIFY_H_ */ 737 #endif /* _PURPLE_NOTIFY_H_ */