notify.h

Go to the documentation of this file.
00001 
00027 #ifndef _PURPLE_NOTIFY_H_
00028 #define _PURPLE_NOTIFY_H_
00029 
00030 #include <stdlib.h>
00031 #include <glib-object.h>
00032 #include <glib.h>
00033 
00034 typedef struct _PurpleNotifyUserInfoEntry   PurpleNotifyUserInfoEntry;
00035 typedef struct _PurpleNotifyUserInfo    PurpleNotifyUserInfo;
00036 
00037 #include "connection.h"
00038 
00042 typedef void  (*PurpleNotifyCloseCallback) (gpointer user_data);
00043 
00044 
00048 typedef enum
00049 {
00050     PURPLE_NOTIFY_MESSAGE = 0,   
00051     PURPLE_NOTIFY_EMAIL,         
00052     PURPLE_NOTIFY_EMAILS,        
00053     PURPLE_NOTIFY_FORMATTED,     
00054     PURPLE_NOTIFY_SEARCHRESULTS, 
00055     PURPLE_NOTIFY_USERINFO,      
00056     PURPLE_NOTIFY_URI            
00058 } PurpleNotifyType;
00059 
00060 
00064 typedef enum
00065 {
00066     PURPLE_NOTIFY_MSG_ERROR   = 0, 
00067     PURPLE_NOTIFY_MSG_WARNING,     
00068     PURPLE_NOTIFY_MSG_INFO         
00070 } PurpleNotifyMsgType;
00071 
00072 
00076 typedef enum
00077 {
00078     PURPLE_NOTIFY_BUTTON_LABELED = 0,  
00079     PURPLE_NOTIFY_BUTTON_CONTINUE = 1,
00080     PURPLE_NOTIFY_BUTTON_ADD,
00081     PURPLE_NOTIFY_BUTTON_INFO,
00082     PURPLE_NOTIFY_BUTTON_IM,
00083     PURPLE_NOTIFY_BUTTON_JOIN,
00084     PURPLE_NOTIFY_BUTTON_INVITE
00085 } PurpleNotifySearchButtonType;
00086 
00087 
00091 typedef struct
00092 {
00093     GList *columns;        
00094     GList *rows;           
00095     GList *buttons;        
00097 } PurpleNotifySearchResults;
00098 
00102 typedef enum
00103 {
00104     PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0,
00105     PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK,
00106     PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
00107 } PurpleNotifyUserInfoEntryType;
00108 
00112 typedef struct
00113 {
00114     char *title; 
00116 } PurpleNotifySearchColumn;
00117 
00118 
00126 typedef void (*PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row,
00127                                                 gpointer user_data);
00128 
00129 
00133 typedef struct
00134 {
00135     PurpleNotifySearchButtonType type;
00136     PurpleNotifySearchResultsCallback callback; 
00137     char *label;                              
00138 } PurpleNotifySearchButton;
00139 
00140 
00144 typedef struct
00145 {
00146     void *(*notify_message)(PurpleNotifyMsgType type, const char *title,
00147                             const char *primary, const char *secondary);
00148 
00149     void *(*notify_email)(PurpleConnection *gc,
00150                           const char *subject, const char *from,
00151                           const char *to, const char *url);
00152 
00153     void *(*notify_emails)(PurpleConnection *gc,
00154                            size_t count, gboolean detailed,
00155                            const char **subjects, const char **froms,
00156                            const char **tos, const char **urls);
00157 
00158     void *(*notify_formatted)(const char *title, const char *primary,
00159                               const char *secondary, const char *text);
00160 
00161     void *(*notify_searchresults)(PurpleConnection *gc, const char *title,
00162                                   const char *primary, const char *secondary,
00163                                   PurpleNotifySearchResults *results, gpointer user_data);
00164 
00165     void (*notify_searchresults_new_rows)(PurpleConnection *gc,
00166                                           PurpleNotifySearchResults *results,
00167                                           void *data);
00168 
00169     void *(*notify_userinfo)(PurpleConnection *gc, const char *who,
00170                              PurpleNotifyUserInfo *user_info);
00171 
00172     void *(*notify_uri)(const char *uri);
00173 
00174     void (*close_notify)(PurpleNotifyType type, void *ui_handle);
00175 
00176     void (*_purple_reserved1)(void);
00177     void (*_purple_reserved2)(void);
00178     void (*_purple_reserved3)(void);
00179     void (*_purple_reserved4)(void);
00180 } PurpleNotifyUiOps;
00181 
00182 
00183 #ifdef __cplusplus
00184 extern "C" {
00185 #endif
00186 
00187 
00188 /**************************************************************************/
00190 /**************************************************************************/
00211 void *purple_notify_searchresults(PurpleConnection *gc, const char *title,
00212                                 const char *primary, const char *secondary,
00213                                 PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb,
00214                                 gpointer user_data);
00215 
00216 void purple_notify_searchresults_free(PurpleNotifySearchResults *results);
00217 
00225 void purple_notify_searchresults_new_rows(PurpleConnection *gc,
00226                                         PurpleNotifySearchResults *results,
00227                                         void *data);
00228 
00229 
00237 void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results,
00238                                           PurpleNotifySearchButtonType type,
00239                                           PurpleNotifySearchResultsCallback cb);
00240 
00241 
00249 void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results,
00250                                                   const char *label,
00251                                                   PurpleNotifySearchResultsCallback cb);
00252 
00253 
00259 PurpleNotifySearchResults *purple_notify_searchresults_new(void);
00260 
00268 PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
00269 
00276 void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results,
00277                                           PurpleNotifySearchColumn *column);
00278 
00285 void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
00286                                        GList *row);
00287 
00295 guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
00296 
00304 guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
00305 
00314 GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
00315                                          unsigned int row_id);
00316 
00325 char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
00326                                                  unsigned int column_id);
00327 
00330 /**************************************************************************/
00332 /**************************************************************************/
00349 void *purple_notify_message(void *handle, PurpleNotifyMsgType type,
00350                           const char *title, const char *primary,
00351                           const char *secondary, PurpleNotifyCloseCallback cb,
00352                           gpointer user_data);
00353 
00368 void *purple_notify_email(void *handle, const char *subject,
00369                         const char *from, const char *to,
00370                         const char *url, PurpleNotifyCloseCallback cb,
00371                         gpointer user_data);
00372 
00390 void *purple_notify_emails(void *handle, size_t count, gboolean detailed,
00391                          const char **subjects, const char **froms,
00392                          const char **tos, const char **urls,
00393                          PurpleNotifyCloseCallback cb, gpointer user_data);
00394 
00412 void *purple_notify_formatted(void *handle, const char *title,
00413                             const char *primary, const char *secondary,
00414                             const char *text, PurpleNotifyCloseCallback cb, gpointer user_data);
00415 
00432 void *purple_notify_userinfo(PurpleConnection *gc, const char *who,
00433                            PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb,
00434                            gpointer user_data);
00435 
00441 PurpleNotifyUserInfo *purple_notify_user_info_new(void);
00442 
00448 void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info);
00449 
00463 GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
00464 
00471 char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline);
00472 
00484 void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00485 
00496 void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00497 
00504 void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry);
00520 PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value);
00521 
00527 void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info);
00528 
00535 void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label);
00536 
00540 void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info);
00541 
00549 gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry);
00550 
00557 void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label);
00558 
00566 gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry);
00567 
00574 void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value);
00575 
00576 
00584 PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry);
00585 
00592 void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry,
00593                                           PurpleNotifyUserInfoEntryType type);
00594 
00605 void *purple_notify_uri(void *handle, const char *uri);
00606 
00616 void purple_notify_close(PurpleNotifyType type, void *ui_handle);
00617 
00623 void purple_notify_close_with_handle(void *handle);
00624 
00628 #define purple_notify_info(handle, title, primary, secondary) \
00629     purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \
00630                         (primary), (secondary), NULL, NULL)
00631 
00635 #define purple_notify_warning(handle, title, primary, secondary) \
00636     purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \
00637                         (primary), (secondary), NULL, NULL)
00638 
00642 #define purple_notify_error(handle, title, primary, secondary) \
00643     purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \
00644                         (primary), (secondary), NULL, NULL)
00645 
00648 /**************************************************************************/
00650 /**************************************************************************/
00659 void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops);
00660 
00667 PurpleNotifyUiOps *purple_notify_get_ui_ops(void);
00668 
00671 /**************************************************************************/
00673 /**************************************************************************/
00681 void *purple_notify_get_handle(void);
00682 
00686 void purple_notify_init(void);
00687 
00691 void purple_notify_uninit(void);
00692 
00696 #ifdef __cplusplus
00697 }
00698 #endif
00699 
00700 #endif /* _PURPLE_NOTIFY_H_ */