notify.h

Go to the documentation of this file.
00001 
00007 /* purple
00008  *
00009  * Purple is the legal property of its developers, whose names are too numerous
00010  * to list here.  Please refer to the COPYRIGHT file distributed with this
00011  * source distribution.
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00026  */
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 
00221 void purple_notify_searchresults_free(PurpleNotifySearchResults *results);
00222 
00230 void purple_notify_searchresults_new_rows(PurpleConnection *gc,
00231                                         PurpleNotifySearchResults *results,
00232                                         void *data);
00233 
00234 
00243 void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results,
00244                                           PurpleNotifySearchButtonType type,
00245                                           PurpleNotifySearchResultsCallback cb);
00246 
00247 
00256 void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results,
00257                                                   const char *label,
00258                                                   PurpleNotifySearchResultsCallback cb);
00259 
00260 
00266 PurpleNotifySearchResults *purple_notify_searchresults_new(void);
00267 
00275 PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
00276 
00283 void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results,
00284                                           PurpleNotifySearchColumn *column);
00285 
00292 void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
00293                                        GList *row);
00294 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00295 
00312 guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
00313 #endif
00314 
00315 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00316 
00333 guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
00334 #endif
00335 
00336 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00337 
00355 GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
00356                                          unsigned int row_id);
00357 #endif
00358 
00359 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
00360 
00376 char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
00377                                                  unsigned int column_id);
00378 #endif
00379 
00382 /**************************************************************************/
00384 /**************************************************************************/
00401 void *purple_notify_message(void *handle, PurpleNotifyMsgType type,
00402                           const char *title, const char *primary,
00403                           const char *secondary, PurpleNotifyCloseCallback cb,
00404                           gpointer user_data);
00405 
00420 void *purple_notify_email(void *handle, const char *subject,
00421                         const char *from, const char *to,
00422                         const char *url, PurpleNotifyCloseCallback cb,
00423                         gpointer user_data);
00424 
00442 void *purple_notify_emails(void *handle, size_t count, gboolean detailed,
00443                          const char **subjects, const char **froms,
00444                          const char **tos, const char **urls,
00445                          PurpleNotifyCloseCallback cb, gpointer user_data);
00446 
00464 void *purple_notify_formatted(void *handle, const char *title,
00465                             const char *primary, const char *secondary,
00466                             const char *text, PurpleNotifyCloseCallback cb, gpointer user_data);
00467 
00483 void *purple_notify_userinfo(PurpleConnection *gc, const char *who,
00484                            PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb,
00485                            gpointer user_data);
00486 
00493 PurpleNotifyUserInfo *purple_notify_user_info_new(void);
00494 
00500 void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info);
00501 
00519 GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
00520 
00528 char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline);
00529 
00544 void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00545 
00559 void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00560 
00568 void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry);
00569 
00589 PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value);
00590 
00596 void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info);
00597 
00604 void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info);
00605 
00613 void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label);
00614 
00623 void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label);
00624 
00629 void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info);
00630 
00638 const gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry);
00639 
00646 void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label);
00647 
00655 const gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry);
00656 
00663 void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value);
00664 
00665 
00673 PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry);
00674 
00681 void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry,
00682                                           PurpleNotifyUserInfoEntryType type);
00683 
00694 void *purple_notify_uri(void *handle, const char *uri);
00695 
00705 void purple_notify_close(PurpleNotifyType type, void *ui_handle);
00706 
00712 void purple_notify_close_with_handle(void *handle);
00713 
00717 #define purple_notify_info(handle, title, primary, secondary) \
00718     purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \
00719                         (primary), (secondary), NULL, NULL)
00720 
00724 #define purple_notify_warning(handle, title, primary, secondary) \
00725     purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \
00726                         (primary), (secondary), NULL, NULL)
00727 
00731 #define purple_notify_error(handle, title, primary, secondary) \
00732     purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \
00733                         (primary), (secondary), NULL, NULL)
00734 
00737 /**************************************************************************/
00739 /**************************************************************************/
00748 void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops);
00749 
00756 PurpleNotifyUiOps *purple_notify_get_ui_ops(void);
00757 
00760 /**************************************************************************/
00762 /**************************************************************************/
00770 void *purple_notify_get_handle(void);
00771 
00775 void purple_notify_init(void);
00776 
00780 void purple_notify_uninit(void);
00781 
00785 #ifdef __cplusplus
00786 }
00787 #endif
00788 
00789 #endif /* _PURPLE_NOTIFY_H_ */