Mercurial > pidgin
comparison src/notify.h @ 12624:851b0bd7eb52
[gaim-migrate @ 14960]
busy busy busy...
* fixed some unused variable warnings in a few places
* fixed memleak in the searchresults notify
* added more button types to the searchresults notify (IM, Info, Invite,
Join, and arbitrary labels)
* added a conversation ui op to present a conversation, since there
appears to be no way to actually initiate an IM without breaking the
core/ui split. gaim_conversation_present now ends up calling
gaim_gtkconv_present_conversation
* changed sametime prpl to use the searchresults notify instead of the
requests API for its "ambiguous user" dialog
* it should be possible to use the searchresults notify for room listing,
if anyone is thusly interested
committer: Tailor Script <tailor@pidgin.im>
author | Christopher O'Brien <siege@pidgin.im> |
---|---|
date | Thu, 22 Dec 2005 17:16:57 +0000 |
parents | fc464a0abccc |
children | ba47bcf7c6eb |
comparison
equal
deleted
inserted
replaced
12623:70f18c73da9d | 12624:851b0bd7eb52 |
---|---|
29 #include <glib-object.h> | 29 #include <glib-object.h> |
30 #include <glib.h> | 30 #include <glib.h> |
31 | 31 |
32 #include "connection.h" | 32 #include "connection.h" |
33 | 33 |
34 | |
34 /** | 35 /** |
35 * Notification close callbacks. | 36 * Notification close callbacks. |
36 */ | 37 */ |
37 typedef void (*GaimNotifyCloseCallback) (gpointer user_data); | 38 typedef void (*GaimNotifyCloseCallback) (gpointer user_data); |
39 | |
38 | 40 |
39 /** | 41 /** |
40 * Notification types. | 42 * Notification types. |
41 */ | 43 */ |
42 typedef enum | 44 typedef enum |
49 GAIM_NOTIFY_USERINFO, /**< Formatted userinfo text. */ | 51 GAIM_NOTIFY_USERINFO, /**< Formatted userinfo text. */ |
50 GAIM_NOTIFY_URI /**< URI notification or display. */ | 52 GAIM_NOTIFY_URI /**< URI notification or display. */ |
51 | 53 |
52 } GaimNotifyType; | 54 } GaimNotifyType; |
53 | 55 |
56 | |
54 /** | 57 /** |
55 * Notification message types. | 58 * Notification message types. |
56 */ | 59 */ |
57 typedef enum | 60 typedef enum |
58 { | 61 { |
60 GAIM_NOTIFY_MSG_WARNING, /**< Warning notification. */ | 63 GAIM_NOTIFY_MSG_WARNING, /**< Warning notification. */ |
61 GAIM_NOTIFY_MSG_INFO /**< Information notification. */ | 64 GAIM_NOTIFY_MSG_INFO /**< Information notification. */ |
62 | 65 |
63 } GaimNotifyMsgType; | 66 } GaimNotifyMsgType; |
64 | 67 |
68 | |
65 /** | 69 /** |
66 * The types of buttons | 70 * The types of buttons |
67 */ | 71 */ |
68 typedef enum | 72 typedef enum |
69 { | 73 { |
70 GAIM_NOTIFY_BUTTON_CONTINUE = 0, | 74 GAIM_NOTIFY_BUTTON_LABELED = 0, /**< special use, see _button_add_labeled */ |
71 GAIM_NOTIFY_BUTTON_ADD_BUDDY | 75 GAIM_NOTIFY_BUTTON_CONTINUE = 1, |
72 | 76 GAIM_NOTIFY_BUTTON_ADD, |
77 GAIM_NOTIFY_BUTTON_INFO, | |
78 GAIM_NOTIFY_BUTTON_IM, | |
79 GAIM_NOTIFY_BUTTON_JOIN, | |
80 GAIM_NOTIFY_BUTTON_INVITE | |
73 } GaimNotifySearchButtonType; | 81 } GaimNotifySearchButtonType; |
82 | |
74 | 83 |
75 /** | 84 /** |
76 * Search results object. | 85 * Search results object. |
77 */ | 86 */ |
78 typedef struct | 87 typedef struct |
81 GList *rows; /**< List of rows in the result. */ | 90 GList *rows; /**< List of rows in the result. */ |
82 GList *buttons; /**< List of buttons to display. */ | 91 GList *buttons; /**< List of buttons to display. */ |
83 | 92 |
84 } GaimNotifySearchResults; | 93 } GaimNotifySearchResults; |
85 | 94 |
95 | |
86 /** | 96 /** |
87 * Single column of a search result. | 97 * Single column of a search result. |
88 */ | 98 */ |
89 typedef struct | 99 typedef struct |
90 { | 100 { |
91 char *title; /**< Title of the column. */ | 101 char *title; /**< Title of the column. */ |
92 | 102 |
93 } GaimNotifySearchColumn; | 103 } GaimNotifySearchColumn; |
94 | 104 |
95 typedef void (*GaimNotifySearchResultsCallback)(GaimConnection *, GList *); | 105 |
106 /** | |
107 * Callback for a button in a search result. | |
108 * | |
109 * @param c the GaimConnection passed to gaim_notify_searchresults | |
110 * @param c the list of selected rows, each a GList in itself. | |
111 */ | |
112 typedef void (*GaimNotifySearchResultsCallback)(GaimConnection *c, GList *l); | |
96 | 113 |
97 | 114 |
98 /** | 115 /** |
99 * Definition of a button. | 116 * Definition of a button. |
100 */ | 117 */ |
101 typedef struct | 118 typedef struct |
102 { | 119 { |
103 GaimNotifySearchButtonType type; | 120 GaimNotifySearchButtonType type; |
104 GaimNotifySearchResultsCallback callback; /**< Function to be called when clicked. */ | 121 GaimNotifySearchResultsCallback callback; /**< Function to be called when clicked. */ |
105 | 122 char *label; /**< only for GAIM_NOTIFY_BUTTON_LABELED */ |
106 } GaimNotifySearchButton; | 123 } GaimNotifySearchButton; |
107 | 124 |
125 | |
108 /** | 126 /** |
109 * Notification UI operations. | 127 * Notification UI operations. |
110 */ | 128 */ |
111 typedef struct | 129 typedef struct |
112 { | 130 { |
113 void *(*notify_message)(GaimNotifyMsgType type, const char *title, | 131 void *(*notify_message)(GaimNotifyMsgType type, const char *title, |
114 const char *primary, const char *secondary); | 132 const char *primary, const char *secondary); |
133 | |
115 void *(*notify_email)(const char *subject, const char *from, | 134 void *(*notify_email)(const char *subject, const char *from, |
116 const char *to, const char *url); | 135 const char *to, const char *url); |
136 | |
117 void *(*notify_emails)(size_t count, gboolean detailed, | 137 void *(*notify_emails)(size_t count, gboolean detailed, |
118 const char **subjects, const char **froms, | 138 const char **subjects, const char **froms, |
119 const char **tos, const char **urls); | 139 const char **tos, const char **urls); |
140 | |
120 void *(*notify_formatted)(const char *title, const char *primary, | 141 void *(*notify_formatted)(const char *title, const char *primary, |
121 const char *secondary, const char *text); | 142 const char *secondary, const char *text); |
143 | |
122 void *(*notify_searchresults)(GaimConnection *gc, const char *title, | 144 void *(*notify_searchresults)(GaimConnection *gc, const char *title, |
123 const char *primary, const char *secondary, | 145 const char *primary, const char *secondary, |
124 GaimNotifySearchResults *results); | 146 GaimNotifySearchResults *results); |
147 | |
125 void (*notify_searchresults_new_rows)(GaimConnection *gc, | 148 void (*notify_searchresults_new_rows)(GaimConnection *gc, |
126 GaimNotifySearchResults *results, | 149 GaimNotifySearchResults *results, |
127 void *data, gpointer user_data); | 150 void *data, gpointer user_data); |
151 | |
128 void *(*notify_userinfo)(GaimConnection *gc, const char *who, | 152 void *(*notify_userinfo)(GaimConnection *gc, const char *who, |
129 const char *text); | 153 const char *text); |
154 | |
130 void *(*notify_uri)(const char *uri); | 155 void *(*notify_uri)(const char *uri); |
131 | 156 |
132 void (*close_notify)(GaimNotifyType type, void *ui_handle); | 157 void (*close_notify)(GaimNotifyType type, void *ui_handle); |
133 | 158 |
134 } GaimNotifyUiOps; | 159 } GaimNotifyUiOps; |
160 | |
135 | 161 |
136 #ifdef __cplusplus | 162 #ifdef __cplusplus |
137 extern "C" { | 163 extern "C" { |
138 #endif | 164 #endif |
165 | |
139 | 166 |
140 /**************************************************************************/ | 167 /**************************************************************************/ |
141 /** Search results notification API */ | 168 /** Search results notification API */ |
142 /**************************************************************************/ | 169 /**************************************************************************/ |
143 /*@{*/ | 170 /*@{*/ |
176 */ | 203 */ |
177 void gaim_notify_searchresults_new_rows(GaimConnection *gc, | 204 void gaim_notify_searchresults_new_rows(GaimConnection *gc, |
178 GaimNotifySearchResults *results, | 205 GaimNotifySearchResults *results, |
179 void *data, gpointer user_data); | 206 void *data, gpointer user_data); |
180 | 207 |
181 /** | 208 |
182 * Adds a button that will be displayed in the search results dialog. | 209 /** |
210 * Adds a stock button that will be displayed in the search results dialog. | |
183 * | 211 * |
184 * @param results The search results object. | 212 * @param results The search results object. |
185 * @param type Type of the button. (TODO: Only one button of a given type can be displayed.) | 213 * @param type Type of the button. (TODO: Only one button of a given type can be displayed.) |
186 * @param cb Function that will be called on the click event. | 214 * @param cb Function that will be called on the click event. |
187 */ | 215 */ |
188 void gaim_notify_searchresults_button_add(GaimNotifySearchResults *results, | 216 void gaim_notify_searchresults_button_add(GaimNotifySearchResults *results, |
189 GaimNotifySearchButtonType type, | 217 GaimNotifySearchButtonType type, |
190 GaimNotifySearchResultsCallback cb); | 218 GaimNotifySearchResultsCallback cb); |
219 | |
220 | |
221 /** | |
222 * Adds a plain labelled button that will be displayed in the search results dialog. | |
223 * | |
224 * @param results The search results object | |
225 * @param label The label to display | |
226 * @param cb Function that will be called on the click event | |
227 */ | |
228 void gaim_notify_searchresults_button_add_labeled(GaimNotifySearchResults *results, | |
229 const char *label, | |
230 GaimNotifySearchResultsCallback cb); | |
231 | |
191 | 232 |
192 /** | 233 /** |
193 * Returns a newly created search results object. | 234 * Returns a newly created search results object. |
194 * | 235 * |
195 * @return The new search results object. | 236 * @return The new search results object. |