00001
00025 #ifndef _PURPLE_NOTIFY_H_
00026 #define _PURPLE_NOTIFY_H_
00027
00028 #include <stdlib.h>
00029 #include <glib-object.h>
00030 #include <glib.h>
00031
00032 typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry;
00033 typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo;
00034
00035 #include "connection.h"
00036
00040 typedef void (*PurpleNotifyCloseCallback) (gpointer user_data);
00041
00042
00046 typedef enum
00047 {
00048 PURPLE_NOTIFY_MESSAGE = 0,
00049 PURPLE_NOTIFY_EMAIL,
00050 PURPLE_NOTIFY_EMAILS,
00051 PURPLE_NOTIFY_FORMATTED,
00052 PURPLE_NOTIFY_SEARCHRESULTS,
00053 PURPLE_NOTIFY_USERINFO,
00054 PURPLE_NOTIFY_URI
00056 } PurpleNotifyType;
00057
00058
00062 typedef enum
00063 {
00064 PURPLE_NOTIFY_MSG_ERROR = 0,
00065 PURPLE_NOTIFY_MSG_WARNING,
00066 PURPLE_NOTIFY_MSG_INFO
00068 } PurpleNotifyMsgType;
00069
00070
00074 typedef enum
00075 {
00076 PURPLE_NOTIFY_BUTTON_LABELED = 0,
00077 PURPLE_NOTIFY_BUTTON_CONTINUE = 1,
00078 PURPLE_NOTIFY_BUTTON_ADD,
00079 PURPLE_NOTIFY_BUTTON_INFO,
00080 PURPLE_NOTIFY_BUTTON_IM,
00081 PURPLE_NOTIFY_BUTTON_JOIN,
00082 PURPLE_NOTIFY_BUTTON_INVITE
00083 } PurpleNotifySearchButtonType;
00084
00085
00089 typedef struct
00090 {
00091 GList *columns;
00092 GList *rows;
00093 GList *buttons;
00095 } PurpleNotifySearchResults;
00096
00100 typedef enum
00101 {
00102 PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0,
00103 PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK,
00104 PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
00105 } PurpleNotifyUserInfoEntryType;
00106
00110 typedef struct
00111 {
00112 char *title;
00114 } PurpleNotifySearchColumn;
00115
00116
00124 typedef void (*PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row,
00125 gpointer user_data);
00126
00127
00131 typedef struct
00132 {
00133 PurpleNotifySearchButtonType type;
00134 PurpleNotifySearchResultsCallback callback;
00135 char *label;
00136 } PurpleNotifySearchButton;
00137
00138
00142 typedef struct
00143 {
00144 void *(*notify_message)(PurpleNotifyMsgType type, const char *title,
00145 const char *primary, const char *secondary);
00146
00147 void *(*notify_email)(PurpleConnection *gc,
00148 const char *subject, const char *from,
00149 const char *to, const char *url);
00150
00151 void *(*notify_emails)(PurpleConnection *gc,
00152 size_t count, gboolean detailed,
00153 const char **subjects, const char **froms,
00154 const char **tos, const char **urls);
00155
00156 void *(*notify_formatted)(const char *title, const char *primary,
00157 const char *secondary, const char *text);
00158
00159 void *(*notify_searchresults)(PurpleConnection *gc, const char *title,
00160 const char *primary, const char *secondary,
00161 PurpleNotifySearchResults *results, gpointer user_data);
00162
00163 void (*notify_searchresults_new_rows)(PurpleConnection *gc,
00164 PurpleNotifySearchResults *results,
00165 void *data);
00166
00167 void *(*notify_userinfo)(PurpleConnection *gc, const char *who,
00168 PurpleNotifyUserInfo *user_info);
00169
00170 void *(*notify_uri)(const char *uri);
00171
00172 void (*close_notify)(PurpleNotifyType type, void *ui_handle);
00173
00174 void (*_purple_reserved1)(void);
00175 void (*_purple_reserved2)(void);
00176 void (*_purple_reserved3)(void);
00177 void (*_purple_reserved4)(void);
00178 } PurpleNotifyUiOps;
00179
00180
00181 #ifdef __cplusplus
00182 extern "C" {
00183 #endif
00184
00185
00186
00188
00209 void *purple_notify_searchresults(PurpleConnection *gc, const char *title,
00210 const char *primary, const char *secondary,
00211 PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb,
00212 gpointer user_data);
00213
00214 void purple_notify_searchresults_free(PurpleNotifySearchResults *results);
00215
00223 void purple_notify_searchresults_new_rows(PurpleConnection *gc,
00224 PurpleNotifySearchResults *results,
00225 void *data);
00226
00227
00235 void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results,
00236 PurpleNotifySearchButtonType type,
00237 PurpleNotifySearchResultsCallback cb);
00238
00239
00247 void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results,
00248 const char *label,
00249 PurpleNotifySearchResultsCallback cb);
00250
00251
00257 PurpleNotifySearchResults *purple_notify_searchresults_new(void);
00258
00266 PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title);
00267
00274 void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results,
00275 PurpleNotifySearchColumn *column);
00276
00283 void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results,
00284 GList *row);
00285
00293 guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results);
00294
00302 guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results);
00303
00312 GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results,
00313 unsigned int row_id);
00314
00323 char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results,
00324 unsigned int column_id);
00325
00328
00330
00347 void *purple_notify_message(void *handle, PurpleNotifyMsgType type,
00348 const char *title, const char *primary,
00349 const char *secondary, PurpleNotifyCloseCallback cb,
00350 gpointer user_data);
00351
00366 void *purple_notify_email(void *handle, const char *subject,
00367 const char *from, const char *to,
00368 const char *url, PurpleNotifyCloseCallback cb,
00369 gpointer user_data);
00370
00388 void *purple_notify_emails(void *handle, size_t count, gboolean detailed,
00389 const char **subjects, const char **froms,
00390 const char **tos, const char **urls,
00391 PurpleNotifyCloseCallback cb, gpointer user_data);
00392
00410 void *purple_notify_formatted(void *handle, const char *title,
00411 const char *primary, const char *secondary,
00412 const char *text, PurpleNotifyCloseCallback cb, gpointer user_data);
00413
00430 void *purple_notify_userinfo(PurpleConnection *gc, const char *who,
00431 PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb,
00432 gpointer user_data);
00433
00439 PurpleNotifyUserInfo *purple_notify_user_info_new(void);
00440
00446 void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info);
00447
00461 GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info);
00462
00469 char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline);
00470
00482 void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00483
00494 void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
00495
00502 void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry);
00518 PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value);
00519
00525 void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info);
00526
00533 void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label);
00534
00538 void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info);
00539
00547 gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry);
00548
00555 void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label);
00556
00564 gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry);
00565
00572 void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value);
00573
00574
00582 PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry);
00583
00590 void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry,
00591 PurpleNotifyUserInfoEntryType type);
00592
00603 void *purple_notify_uri(void *handle, const char *uri);
00604
00614 void purple_notify_close(PurpleNotifyType type, void *ui_handle);
00615
00621 void purple_notify_close_with_handle(void *handle);
00622
00626 #define purple_notify_info(handle, title, primary, secondary) \
00627 purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \
00628 (primary), (secondary), NULL, NULL)
00629
00633 #define purple_notify_warning(handle, title, primary, secondary) \
00634 purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \
00635 (primary), (secondary), NULL, NULL)
00636
00640 #define purple_notify_error(handle, title, primary, secondary) \
00641 purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \
00642 (primary), (secondary), NULL, NULL)
00643
00646
00648
00657 void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops);
00658
00665 PurpleNotifyUiOps *purple_notify_get_ui_ops(void);
00666
00669
00671
00679 void *purple_notify_get_handle(void);
00680
00684 void purple_notify_init(void);
00685
00689 void purple_notify_uninit(void);
00690
00694 #ifdef __cplusplus
00695 }
00696 #endif
00697
00698 #endif