3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 static PurpleNotifyUiOps
*notify_ui_ops
= NULL
;
26 static GList
*handles
= NULL
;
30 PurpleNotifyType type
;
33 PurpleNotifyCloseCallback cb
;
34 gpointer cb_user_data
;
38 * Definition of a user info entry
40 struct _PurpleNotifyUserInfoEntry
44 PurpleNotifyUserInfoEntryType type
;
47 struct _PurpleNotifyUserInfo
53 * Single column of a search result.
55 struct _PurpleNotifySearchColumn
57 char *title
; /* Title of the column. */
58 gboolean visible
; /* Should the column be visible to the user. Defaults to TRUE. */
63 purple_notify_message(void *handle
, PurpleNotifyMessageType type
, const char *title
,
64 const char *primary
, const char *secondary
,
65 PurpleRequestCommonParameters
*cpar
, PurpleNotifyCloseCallback cb
,
68 PurpleNotifyUiOps
*ops
;
70 g_return_val_if_fail(primary
!= NULL
, NULL
);
72 ops
= purple_notify_get_ui_ops();
74 if (ops
!= NULL
&& ops
->notify_message
!= NULL
) {
75 void *ui_handle
= ops
->notify_message(type
, title
, primary
,
77 if (ui_handle
!= NULL
) {
79 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
80 info
->type
= PURPLE_NOTIFY_MESSAGE
;
81 info
->handle
= handle
;
82 info
->ui_handle
= ui_handle
;
84 info
->cb_user_data
= user_data
;
86 handles
= g_list_append(handles
, info
);
88 return info
->ui_handle
;
100 purple_notify_email(void *handle
, const char *subject
, const char *from
,
101 const char *to
, const char *url
, PurpleNotifyCloseCallback cb
,
104 PurpleNotifyUiOps
*ops
;
106 ops
= purple_notify_get_ui_ops();
108 if (ops
!= NULL
&& ops
->notify_email
!= NULL
) {
111 purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification",
112 subject
, from
, to
, url
);
114 ui_handle
= ops
->notify_email(handle
, subject
, from
, to
, url
);
116 if (ui_handle
!= NULL
) {
118 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
119 info
->type
= PURPLE_NOTIFY_EMAIL
;
120 info
->handle
= handle
;
121 info
->ui_handle
= ui_handle
;
123 info
->cb_user_data
= user_data
;
125 handles
= g_list_append(handles
, info
);
127 return info
->ui_handle
;
138 purple_notify_emails(void *handle
, size_t count
, gboolean detailed
,
139 const char **subjects
, const char **froms
,
140 const char **tos
, const char **urls
,
141 PurpleNotifyCloseCallback cb
, gpointer user_data
)
143 PurpleNotifyUiOps
*ops
;
146 return purple_notify_email(handle
,
147 (subjects
== NULL
? NULL
: *subjects
),
148 (froms
== NULL
? NULL
: *froms
),
149 (tos
== NULL
? NULL
: *tos
),
150 (urls
== NULL
? NULL
: *urls
),
154 ops
= purple_notify_get_ui_ops();
156 if (ops
!= NULL
&& ops
->notify_emails
!= NULL
) {
159 purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification",
160 subjects
, froms
, tos
, urls
, count
);
162 ui_handle
= ops
->notify_emails(handle
, count
, detailed
, subjects
,
165 if (ui_handle
!= NULL
) {
166 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
167 info
->type
= PURPLE_NOTIFY_EMAILS
;
168 info
->handle
= handle
;
169 info
->ui_handle
= ui_handle
;
171 info
->cb_user_data
= user_data
;
173 handles
= g_list_append(handles
, info
);
175 return info
->ui_handle
;
187 purple_notify_formatted(void *handle
, const char *title
, const char *primary
,
188 const char *secondary
, const char *text
,
189 PurpleNotifyCloseCallback cb
, gpointer user_data
)
191 PurpleNotifyUiOps
*ops
;
193 g_return_val_if_fail(primary
!= NULL
, NULL
);
195 ops
= purple_notify_get_ui_ops();
197 if (ops
!= NULL
&& ops
->notify_formatted
!= NULL
) {
198 void *ui_handle
= ops
->notify_formatted(title
, primary
, secondary
, text
);
200 if (ui_handle
!= NULL
) {
202 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
203 info
->type
= PURPLE_NOTIFY_FORMATTED
;
204 info
->handle
= handle
;
205 info
->ui_handle
= ui_handle
;
207 info
->cb_user_data
= user_data
;
209 handles
= g_list_append(handles
, info
);
211 return info
->ui_handle
;
221 purple_notify_searchresults(PurpleConnection
*gc
, const char *title
,
222 const char *primary
, const char *secondary
,
223 PurpleNotifySearchResults
*results
, PurpleNotifyCloseCallback cb
,
226 PurpleNotifyUiOps
*ops
;
228 ops
= purple_notify_get_ui_ops();
230 if (ops
!= NULL
&& ops
->notify_searchresults
!= NULL
) {
231 void *ui_handle
= ops
->notify_searchresults(gc
, title
, primary
,
232 secondary
, results
, user_data
);
233 if (ui_handle
!= NULL
) {
235 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
236 info
->type
= PURPLE_NOTIFY_SEARCHRESULTS
;
238 info
->ui_handle
= ui_handle
;
240 info
->cb_user_data
= user_data
;
242 handles
= g_list_append(handles
, info
);
244 return info
->ui_handle
;
255 purple_notify_searchresults_free(PurpleNotifySearchResults
*results
)
259 g_return_if_fail(results
!= NULL
);
261 for (l
= results
->buttons
; l
; l
= g_list_delete_link(l
, l
)) {
262 PurpleNotifySearchButton
*button
= l
->data
;
263 g_free(button
->label
);
267 for (l
= results
->rows
; l
; l
= g_list_delete_link(l
, l
)) {
268 GList
*row
= l
->data
;
269 g_list_free_full(row
, g_free
);
272 for (l
= results
->columns
; l
; l
= g_list_delete_link(l
, l
)) {
273 PurpleNotifySearchColumn
*column
= l
->data
;
274 g_free(column
->title
);
282 purple_notify_searchresults_new_rows(PurpleConnection
*gc
,
283 PurpleNotifySearchResults
*results
,
286 PurpleNotifyUiOps
*ops
;
288 ops
= purple_notify_get_ui_ops();
290 if (ops
!= NULL
&& ops
->notify_searchresults
!= NULL
) {
291 ops
->notify_searchresults_new_rows(gc
, results
, data
);
296 purple_notify_searchresults_button_add(PurpleNotifySearchResults
*results
,
297 PurpleNotifySearchButtonType type
,
298 PurpleNotifySearchResultsCallback cb
)
300 PurpleNotifySearchButton
*button
;
302 g_return_if_fail(results
!= NULL
);
303 g_return_if_fail(cb
!= NULL
);
305 button
= g_new0(PurpleNotifySearchButton
, 1);
306 button
->callback
= cb
;
309 results
->buttons
= g_list_append(results
->buttons
, button
);
314 purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults
*results
,
316 PurpleNotifySearchResultsCallback cb
) {
317 PurpleNotifySearchButton
*button
;
319 g_return_if_fail(results
!= NULL
);
320 g_return_if_fail(cb
!= NULL
);
321 g_return_if_fail(label
!= NULL
);
322 g_return_if_fail(*label
!= '\0');
324 button
= g_new0(PurpleNotifySearchButton
, 1);
325 button
->callback
= cb
;
326 button
->type
= PURPLE_NOTIFY_BUTTON_LABELED
;
327 button
->label
= g_strdup(label
);
329 results
->buttons
= g_list_append(results
->buttons
, button
);
333 PurpleNotifySearchResults
*
334 purple_notify_searchresults_new()
336 PurpleNotifySearchResults
*rs
= g_new0(PurpleNotifySearchResults
, 1);
342 purple_notify_searchresults_column_add(PurpleNotifySearchResults
*results
,
343 PurpleNotifySearchColumn
*column
)
345 g_return_if_fail(results
!= NULL
);
346 g_return_if_fail(column
!= NULL
);
348 results
->columns
= g_list_append(results
->columns
, column
);
351 void purple_notify_searchresults_row_add(PurpleNotifySearchResults
*results
,
354 g_return_if_fail(results
!= NULL
);
355 g_return_if_fail(row
!= NULL
);
357 results
->rows
= g_list_append(results
->rows
, row
);
360 PurpleNotifySearchColumn
*
361 purple_notify_searchresults_column_new(const char *title
)
363 PurpleNotifySearchColumn
*sc
;
365 g_return_val_if_fail(title
!= NULL
, NULL
);
367 sc
= g_new0(PurpleNotifySearchColumn
, 1);
368 sc
->title
= g_strdup(title
);
374 const char *purple_notify_searchresult_column_get_title(const PurpleNotifySearchColumn
*column
)
376 g_return_val_if_fail(column
!= NULL
, NULL
);
378 return column
->title
;
381 void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn
*column
, gboolean visible
)
383 g_return_if_fail(column
!= NULL
);
385 column
->visible
= visible
;
389 purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn
*column
)
391 g_return_val_if_fail(column
!= NULL
, FALSE
);
393 return column
->visible
;
397 purple_notify_userinfo(PurpleConnection
*gc
, const char *who
,
398 PurpleNotifyUserInfo
*user_info
, PurpleNotifyCloseCallback cb
, gpointer user_data
)
400 PurpleNotifyUiOps
*ops
;
402 g_return_val_if_fail(who
!= NULL
, NULL
);
404 ops
= purple_notify_get_ui_ops();
406 if (ops
!= NULL
&& ops
->notify_userinfo
!= NULL
) {
409 purple_signal_emit(purple_notify_get_handle(), "displaying-userinfo",
410 purple_connection_get_account(gc
), who
, user_info
);
412 ui_handle
= ops
->notify_userinfo(gc
, who
, user_info
);
414 if (ui_handle
!= NULL
) {
416 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
417 info
->type
= PURPLE_NOTIFY_USERINFO
;
419 info
->ui_handle
= ui_handle
;
421 info
->cb_user_data
= user_data
;
423 handles
= g_list_append(handles
, info
);
425 return info
->ui_handle
;
435 PurpleNotifyUserInfoEntry
*
436 purple_notify_user_info_entry_new(const char *label
, const char *value
)
438 PurpleNotifyUserInfoEntry
*user_info_entry
;
440 user_info_entry
= g_new0(PurpleNotifyUserInfoEntry
, 1);
441 user_info_entry
->label
= g_strdup(label
);
442 user_info_entry
->value
= g_strdup(value
);
443 user_info_entry
->type
= PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR
;
445 return user_info_entry
;
449 purple_notify_user_info_entry_destroy(PurpleNotifyUserInfoEntry
*user_info_entry
)
451 g_return_if_fail(user_info_entry
!= NULL
);
453 g_free(user_info_entry
->label
);
454 g_free(user_info_entry
->value
);
455 g_free(user_info_entry
);
458 PurpleNotifyUserInfo
*
459 purple_notify_user_info_new()
461 PurpleNotifyUserInfo
*user_info
;
463 user_info
= g_new0(PurpleNotifyUserInfo
, 1);
464 g_queue_init(&user_info
->entries
);
470 purple_notify_user_info_destroy(PurpleNotifyUserInfo
*user_info
)
474 for (l
= user_info
->entries
.head
; l
!= NULL
; l
= l
->next
) {
475 PurpleNotifyUserInfoEntry
*user_info_entry
= l
->data
;
477 purple_notify_user_info_entry_destroy(user_info_entry
);
480 g_queue_clear(&user_info
->entries
);
485 purple_notify_user_info_get_entries(PurpleNotifyUserInfo
*user_info
)
487 g_return_val_if_fail(user_info
!= NULL
, NULL
);
489 return &user_info
->entries
;
493 purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo
*user_info
, const char *newline
)
498 text
= g_string_new("");
500 for (l
= user_info
->entries
.head
; l
!= NULL
; l
= l
->next
) {
501 PurpleNotifyUserInfoEntry
*user_info_entry
= l
->data
;
502 /* Add a newline before a section header */
503 if (user_info_entry
->type
== PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
)
504 g_string_append(text
, newline
);
506 /* Handle the label/value pair itself */
507 /* XXX Todo: Use a larger size for a section header? */
508 if (user_info_entry
->label
)
509 g_string_append_printf(text
, "<b>%s</b>", user_info_entry
->label
);
510 if (user_info_entry
->label
&& user_info_entry
->value
)
511 g_string_append(text
, ": ");
512 if (user_info_entry
->value
)
513 g_string_append(text
, user_info_entry
->value
);
515 /* Display a section break as a horizontal line */
516 if (user_info_entry
->type
== PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK
)
517 g_string_append(text
, "<HR>");
519 /* Don't insert a new line before or after a section break; <HR> does that for us */
520 if ((user_info_entry
->type
!= PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK
) &&
521 (l
->next
&& ((((PurpleNotifyUserInfoEntry
*)(l
->next
->data
))->type
!= PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK
))))
522 g_string_append(text
, newline
);
524 /* Add an extra newline after a section header */
525 if (user_info_entry
->type
== PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
)
526 g_string_append(text
, newline
);
529 return g_string_free(text
, FALSE
);
534 purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry
*user_info_entry
)
536 g_return_val_if_fail(user_info_entry
!= NULL
, NULL
);
538 return user_info_entry
->label
;
542 purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry
*user_info_entry
, const char *label
)
544 g_return_if_fail(user_info_entry
!= NULL
);
546 g_free(user_info_entry
->label
);
547 user_info_entry
->label
= g_strdup(label
);
551 purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry
*user_info_entry
)
553 g_return_val_if_fail(user_info_entry
!= NULL
, NULL
);
555 return user_info_entry
->value
;
559 purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry
*user_info_entry
, const char *value
)
561 g_return_if_fail(user_info_entry
!= NULL
);
563 g_free(user_info_entry
->value
);
564 user_info_entry
->value
= g_strdup(value
);
567 PurpleNotifyUserInfoEntryType
568 purple_notify_user_info_entry_get_entry_type(PurpleNotifyUserInfoEntry
*user_info_entry
)
570 g_return_val_if_fail(user_info_entry
!= NULL
, PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR
);
572 return user_info_entry
->type
;
576 purple_notify_user_info_entry_set_entry_type(PurpleNotifyUserInfoEntry
*user_info_entry
,
577 PurpleNotifyUserInfoEntryType type
)
579 g_return_if_fail(user_info_entry
!= NULL
);
581 user_info_entry
->type
= type
;
585 purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo
*user_info
, const char *label
, const char *value
)
587 PurpleNotifyUserInfoEntry
*entry
;
589 entry
= purple_notify_user_info_entry_new(label
, value
);
590 g_queue_push_tail(&user_info
->entries
, entry
);
594 purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo
*user_info
, const char *label
, const char *value
)
598 escaped
= g_markup_escape_text(value
, -1);
599 purple_notify_user_info_add_pair_html(user_info
, label
, escaped
);
604 purple_notify_user_info_prepend_pair_html(PurpleNotifyUserInfo
*user_info
, const char *label
, const char *value
)
606 PurpleNotifyUserInfoEntry
*entry
;
608 entry
= purple_notify_user_info_entry_new(label
, value
);
609 g_queue_push_head(&user_info
->entries
, entry
);
613 purple_notify_user_info_prepend_pair_plaintext(PurpleNotifyUserInfo
*user_info
, const char *label
, const char *value
)
617 escaped
= g_markup_escape_text(value
, -1);
618 purple_notify_user_info_prepend_pair_html(user_info
, label
, escaped
);
623 purple_notify_user_info_remove_entry(PurpleNotifyUserInfo
*user_info
, PurpleNotifyUserInfoEntry
*entry
)
625 g_return_if_fail(user_info
!= NULL
);
626 g_return_if_fail(entry
!= NULL
);
628 g_queue_remove(&user_info
->entries
, entry
);
632 purple_notify_user_info_add_section_header(PurpleNotifyUserInfo
*user_info
, const char *label
)
634 PurpleNotifyUserInfoEntry
*entry
;
636 entry
= purple_notify_user_info_entry_new(label
, NULL
);
637 entry
->type
= PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
;
639 g_queue_push_tail(&user_info
->entries
, entry
);
643 purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo
*user_info
, const char *label
)
645 PurpleNotifyUserInfoEntry
*entry
;
647 entry
= purple_notify_user_info_entry_new(label
, NULL
);
648 entry
->type
= PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER
;
650 g_queue_push_head(&user_info
->entries
, entry
);
654 purple_notify_user_info_add_section_break(PurpleNotifyUserInfo
*user_info
)
656 PurpleNotifyUserInfoEntry
*entry
;
658 entry
= purple_notify_user_info_entry_new(NULL
, NULL
);
659 entry
->type
= PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK
;
661 g_queue_push_tail(&user_info
->entries
, entry
);
665 purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo
*user_info
)
667 PurpleNotifyUserInfoEntry
*entry
;
669 entry
= purple_notify_user_info_entry_new(NULL
, NULL
);
670 entry
->type
= PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK
;
672 g_queue_push_head(&user_info
->entries
, entry
);
676 purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo
*user_info
)
678 PurpleNotifyUserInfoEntry
*entry
;
680 entry
= g_queue_pop_tail(&user_info
->entries
);
682 purple_notify_user_info_entry_destroy(entry
);
685 static PurpleNotifyUserInfo
*
686 purple_notify_user_info_copy(PurpleNotifyUserInfo
*user_info
)
688 PurpleNotifyUserInfo
*user_info_copy
;
691 g_return_val_if_fail(user_info
!= NULL
, NULL
);
693 user_info_copy
= purple_notify_user_info_new();
695 for (l
= user_info
->entries
.head
; l
!= NULL
; l
= l
->next
) {
696 PurpleNotifyUserInfoEntry
*new_entry
, *user_info_entry
= l
->data
;
698 new_entry
= purple_notify_user_info_entry_new(user_info_entry
->label
,
699 user_info_entry
->value
);
700 new_entry
->type
= user_info_entry
->type
;
701 g_queue_push_tail(&user_info_copy
->entries
, new_entry
);
704 return user_info_copy
;
708 purple_notify_user_info_get_type(void)
710 static GType type
= 0;
713 type
= g_boxed_type_register_static("PurpleNotifyUserInfo",
714 (GBoxedCopyFunc
)purple_notify_user_info_copy
,
715 (GBoxedFreeFunc
)purple_notify_user_info_destroy
);
722 purple_notify_uri(void *handle
, const char *uri
)
724 PurpleNotifyUiOps
*ops
;
726 g_return_val_if_fail(uri
!= NULL
, NULL
);
728 ops
= purple_notify_get_ui_ops();
730 if (ops
!= NULL
&& ops
->notify_uri
!= NULL
) {
732 void *ui_handle
= ops
->notify_uri(uri
);
734 if (ui_handle
!= NULL
) {
736 PurpleNotifyInfo
*info
= g_new0(PurpleNotifyInfo
, 1);
737 info
->type
= PURPLE_NOTIFY_URI
;
738 info
->handle
= handle
;
739 info
->ui_handle
= ui_handle
;
741 handles
= g_list_append(handles
, info
);
743 return info
->ui_handle
;
751 purple_notify_is_valid_ui_handle(void *ui_handle
, PurpleNotifyType
*type
)
755 if (ui_handle
== NULL
)
758 for (it
= handles
; it
!= NULL
; it
= g_list_next(it
)) {
759 PurpleNotifyInfo
*info
= it
->data
;
761 if (info
->ui_handle
!= ui_handle
)
773 purple_notify_close(PurpleNotifyType type
, void *ui_handle
)
776 PurpleNotifyUiOps
*ops
;
778 g_return_if_fail(ui_handle
!= NULL
);
780 ops
= purple_notify_get_ui_ops();
782 for (l
= handles
; l
!= NULL
; l
= l
->next
) {
783 PurpleNotifyInfo
*info
= l
->data
;
785 if (info
->ui_handle
== ui_handle
) {
786 handles
= g_list_remove(handles
, info
);
788 if (ops
!= NULL
&& ops
->close_notify
!= NULL
)
789 ops
->close_notify(info
->type
, ui_handle
);
791 if (info
->cb
!= NULL
)
792 info
->cb(info
->cb_user_data
);
802 purple_notify_close_with_handle(void *handle
)
804 GList
*l
, *prev
= NULL
;
805 PurpleNotifyUiOps
*ops
;
807 g_return_if_fail(handle
!= NULL
);
809 ops
= purple_notify_get_ui_ops();
811 for (l
= handles
; l
!= NULL
; l
= prev
? prev
->next
: handles
) {
812 PurpleNotifyInfo
*info
= l
->data
;
814 if (info
->handle
== handle
) {
815 handles
= g_list_remove(handles
, info
);
817 if (ops
!= NULL
&& ops
->close_notify
!= NULL
)
818 ops
->close_notify(info
->type
, info
->ui_handle
);
820 if (info
->cb
!= NULL
)
821 info
->cb(info
->cb_user_data
);
829 static PurpleNotifyUiOps
*
830 purple_notify_ui_ops_copy(PurpleNotifyUiOps
*ops
)
832 PurpleNotifyUiOps
*ops_new
;
834 g_return_val_if_fail(ops
!= NULL
, NULL
);
836 ops_new
= g_new(PurpleNotifyUiOps
, 1);
843 purple_notify_ui_ops_get_type(void)
845 static GType type
= 0;
848 type
= g_boxed_type_register_static("PurpleNotifyUiOps",
849 (GBoxedCopyFunc
)purple_notify_ui_ops_copy
,
850 (GBoxedFreeFunc
)g_free
);
856 static PurpleNotifySearchButton
*
857 purple_notify_search_button_copy(PurpleNotifySearchButton
*button
)
859 PurpleNotifySearchButton
*button_new
;
861 g_return_val_if_fail(button
!= NULL
, NULL
);
863 button_new
= g_new(PurpleNotifySearchButton
, 1);
864 *button_new
= *button
;
870 purple_notify_search_button_get_type(void)
872 static GType type
= 0;
875 type
= g_boxed_type_register_static("PurpleNotifySearchButton",
876 (GBoxedCopyFunc
)purple_notify_search_button_copy
,
877 (GBoxedFreeFunc
)g_free
);
884 purple_notify_set_ui_ops(PurpleNotifyUiOps
*ops
)
890 purple_notify_get_ui_ops(void)
892 return notify_ui_ops
;
896 purple_notify_get_handle(void)
904 purple_notify_init(void)
906 gpointer handle
= purple_notify_get_handle();
908 purple_signal_register(handle
, "displaying-email-notification",
909 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER
,
910 G_TYPE_NONE
, 4, G_TYPE_STRING
, G_TYPE_STRING
,
911 G_TYPE_STRING
, G_TYPE_STRING
);
913 purple_signal_register(handle
, "displaying-emails-notification",
914 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT
,
915 G_TYPE_NONE
, 5, G_TYPE_POINTER
, G_TYPE_POINTER
,
916 G_TYPE_POINTER
, G_TYPE_POINTER
, G_TYPE_UINT
);
918 purple_signal_register(handle
, "displaying-emails-clear",
919 purple_marshal_VOID
, G_TYPE_NONE
, 0);
921 purple_signal_register(handle
, "displaying-userinfo",
922 purple_marshal_VOID__POINTER_POINTER_POINTER
,
923 G_TYPE_NONE
, 3, PURPLE_TYPE_ACCOUNT
, G_TYPE_STRING
,
924 PURPLE_TYPE_NOTIFY_USER_INFO
);
928 purple_notify_uninit(void)
930 purple_signals_unregister_by_instance(purple_notify_get_handle());