annotate libgaim/notify.c @ 15289:fbc9a92547d8

[gaim-migrate @ 18079] I'm not sure if relying on gaim_account_get_buddy_icon_path() here is right; using libgaim from Adium, I've only ever called gaim_account_set_buddy_icon(), which doesn't appear to update the the buddy_icon_path for the account. In any case, this no longer crashes if gaim_account_get_buddy_icon_path() returns NULL. committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Sat, 06 Jan 2007 17:36:48 +0000
parents 132db06150ca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
1 /**
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
2 * @file notify.c Notification API
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
3 * @ingroup core
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
4 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
5 * gaim
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
6 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
9 * source distribution.
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
10 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
14 * (at your option) any later version.
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
15 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
19 * GNU General Public License for more details.
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
20 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
24 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
25 #include "notify.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
26
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
27 static GaimNotifyUiOps *notify_ui_ops = NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
28 static GList *handles = NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
29
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
30 typedef struct
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
31 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
32 GaimNotifyType type;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
33 void *handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
34 void *ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
35 GaimNotifyCloseCallback cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
36 gpointer cb_user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
37 } GaimNotifyInfo;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
38
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
39 /**
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
40 * Definition of a user info entry
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
41 */
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
42 struct _GaimNotifyUserInfoEntry
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
43 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
44 char *label;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
45 char *value;
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
46 GaimNotifyUserInfoEntryType type;
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
47 };
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
48
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
49 struct _GaimNotifyUserInfo
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
50 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
51 GList *user_info_entries;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
52 };
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
53
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
54 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
55 gaim_notify_message(void *handle, GaimNotifyMsgType type,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
56 const char *title, const char *primary,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
57 const char *secondary, GaimNotifyCloseCallback cb, gpointer user_data)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
58 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
59 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
60
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
61 g_return_val_if_fail(primary != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
62
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
63 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
64
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
65 if (ops != NULL && ops->notify_message != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
66 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
67
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
68 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
69 info->type = GAIM_NOTIFY_MESSAGE;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
70 info->handle = handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
71 info->ui_handle = ops->notify_message(type, title, primary,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
72 secondary);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
73 info->cb = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
74 info->cb_user_data = user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
75
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
76 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
77 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
78
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
79 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
80
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
81 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
82 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
83 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
84
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
85 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
86
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
87 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
88 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
89
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
90 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
91 if (cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
92 cb(user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
93 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
94
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
95 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
96 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
97
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
98 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
99 gaim_notify_email(void *handle, const char *subject, const char *from,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
100 const char *to, const char *url, GaimNotifyCloseCallback cb,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
101 gpointer user_data)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
102 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
103 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
104
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
105 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
106
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
107 if (ops != NULL && ops->notify_email != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
108 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
109
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
110 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
111 info->type = GAIM_NOTIFY_EMAIL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
112 info->handle = handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
113 info->ui_handle = ops->notify_email(handle, subject, from, to, url);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
114 info->cb = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
115 info->cb_user_data = user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
116
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
117 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
118 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
119
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
120 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
121
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
122 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
123 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
124 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
125
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
126 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
127
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
128 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
129 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
130 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
131 if (cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
132 cb(user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
133 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
134
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
135 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
136 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
137
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
138 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
139 gaim_notify_emails(void *handle, size_t count, gboolean detailed,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
140 const char **subjects, const char **froms,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
141 const char **tos, const char **urls,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
142 GaimNotifyCloseCallback cb, gpointer user_data)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
143 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
144 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
145
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
146 g_return_val_if_fail(count != 0, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
147
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
148 if (count == 1) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
149 return gaim_notify_email(handle,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
150 (subjects == NULL ? NULL : *subjects),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
151 (froms == NULL ? NULL : *froms),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
152 (tos == NULL ? NULL : *tos),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
153 (urls == NULL ? NULL : *urls),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
154 cb, user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
155 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
156
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
157 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
158
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
159 if (ops != NULL && ops->notify_emails != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
160 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
161
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
162 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
163 info->type = GAIM_NOTIFY_EMAILS;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
164 info->handle = handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
165 info->ui_handle = ops->notify_emails(handle, count, detailed, subjects,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
166 froms, tos, urls);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
167 info->cb = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
168 info->cb_user_data = user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
169
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
170 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
171 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
172
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
173 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
174
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
175 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
176 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
177 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
178
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
179 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
180
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
181 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
182 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
183
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
184 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
185 if (cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
186 cb(user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
187 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
188
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
189 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
190 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
191
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
192 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
193 gaim_notify_formatted(void *handle, const char *title, const char *primary,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
194 const char *secondary, const char *text,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
195 GaimNotifyCloseCallback cb, gpointer user_data)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
196 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
197 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
198
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
199 g_return_val_if_fail(primary != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
200
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
201 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
202
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
203 if (ops != NULL && ops->notify_formatted != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
204 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
205
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
206 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
207 info->type = GAIM_NOTIFY_FORMATTED;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
208 info->handle = handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
209 info->ui_handle = ops->notify_formatted(title, primary, secondary, text);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
210 info->cb = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
211 info->cb_user_data = user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
212
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
213 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
214 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
215
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
216 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
217
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
218 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
219 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
220 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
221
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
222 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
223
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
224 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
225 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
226
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
227 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
228 if (cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
229 cb(user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
230 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
231
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
232 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
233 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
234
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
235 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
236 gaim_notify_searchresults(GaimConnection *gc, const char *title,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
237 const char *primary, const char *secondary,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
238 GaimNotifySearchResults *results, GaimNotifyCloseCallback cb,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
239 gpointer user_data)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
240 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
241 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
242
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
243 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
244
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
245 if (ops != NULL && ops->notify_searchresults != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
246 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
247
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
248 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
249 info->type = GAIM_NOTIFY_SEARCHRESULTS;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
250 info->handle = gc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
251 info->ui_handle = ops->notify_searchresults(gc, title, primary,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
252 secondary, results, user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
253 info->cb = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
254 info->cb_user_data = user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
255
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
256 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
257 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
258
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
259 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
260
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
261 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
262 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
263 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
264
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
265 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
266
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
267 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
268 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
269
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
270 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
271 if (cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
272 cb(user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
273 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
274
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
275 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
276 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
277
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
278 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
279 gaim_notify_searchresults_free(GaimNotifySearchResults *results)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
280 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
281 GList *l;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
282
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
283 g_return_if_fail(results != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
284
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
285 for (l = results->buttons; l; l = g_list_delete_link(l, l)) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
286 GaimNotifySearchButton *button = l->data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
287 g_free(button->label);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
288 g_free(button);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
289 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
290
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
291 for (l = results->rows; l; l = g_list_delete_link(l, l)) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
292 GList *row = l->data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
293 g_list_foreach(row, (GFunc)g_free, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
294 g_list_free(row);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
295 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
296
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
297 for (l = results->columns; l; l = g_list_delete_link(l, l)) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
298 GaimNotifySearchColumn *column = l->data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
299 g_free(column->title);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
300 g_free(column);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
301 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
302
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
303 g_free(results);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
304 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
305
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
306 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
307 gaim_notify_searchresults_new_rows(GaimConnection *gc,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
308 GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
309 void *data)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
310 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
311 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
312
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
313 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
314
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
315 if (ops != NULL && ops->notify_searchresults != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
316 ops->notify_searchresults_new_rows(gc, results, data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
317 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
318 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
319
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
320 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
321 gaim_notify_searchresults_button_add(GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
322 GaimNotifySearchButtonType type,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
323 GaimNotifySearchResultsCallback cb)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
324 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
325 GaimNotifySearchButton *button;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
326
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
327 g_return_if_fail(results != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
328 g_return_if_fail(cb != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
329
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
330 button = g_new0(GaimNotifySearchButton, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
331 button->callback = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
332 button->type = type;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
333
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
334 results->buttons = g_list_append(results->buttons, button);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
335 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
336
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
337
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
338 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
339 gaim_notify_searchresults_button_add_labeled(GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
340 const char *label,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
341 GaimNotifySearchResultsCallback cb) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
342 GaimNotifySearchButton *button;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
343
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
344 g_return_if_fail(results != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
345 g_return_if_fail(cb != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
346 g_return_if_fail(label != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
347 g_return_if_fail(*label != '\0');
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
348
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
349 button = g_new0(GaimNotifySearchButton, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
350 button->callback = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
351 button->type = GAIM_NOTIFY_BUTTON_LABELED;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
352 button->label = g_strdup(label);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
353
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
354 results->buttons = g_list_append(results->buttons, button);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
355 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
356
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
357
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
358 GaimNotifySearchResults *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
359 gaim_notify_searchresults_new()
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
360 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
361 GaimNotifySearchResults *rs = g_new0(GaimNotifySearchResults, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
362
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
363 return rs;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
364 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
365
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
366 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
367 gaim_notify_searchresults_column_add(GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
368 GaimNotifySearchColumn *column)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
369 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
370 g_return_if_fail(results != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
371 g_return_if_fail(column != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
372
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
373 results->columns = g_list_append(results->columns, column);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
374 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
375
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
376 void gaim_notify_searchresults_row_add(GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
377 GList *row)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
378 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
379 g_return_if_fail(results != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
380 g_return_if_fail(row != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
381
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
382 results->rows = g_list_append(results->rows, row);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
383 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
384
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
385 GaimNotifySearchColumn *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
386 gaim_notify_searchresults_column_new(const char *title)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
387 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
388 GaimNotifySearchColumn *sc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
389
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
390 g_return_val_if_fail(title != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
391
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
392 sc = g_new0(GaimNotifySearchColumn, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
393 sc->title = g_strdup(title);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
394
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
395 return sc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
396 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
397
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
398 guint
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
399 gaim_notify_searchresults_get_columns_count(GaimNotifySearchResults *results)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
400 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
401 g_return_val_if_fail(results != NULL, 0);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
402
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
403 return g_list_length(results->columns);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
404 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
405
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
406 guint
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
407 gaim_notify_searchresults_get_rows_count(GaimNotifySearchResults *results)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
408 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
409 g_return_val_if_fail(results != NULL, 0);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
410
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
411 return g_list_length(results->rows);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
412 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
413
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
414 char *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
415 gaim_notify_searchresults_column_get_title(GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
416 unsigned int column_id)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
417 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
418 g_return_val_if_fail(results != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
419
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
420 return ((GaimNotifySearchColumn *)g_list_nth_data(results->columns, column_id))->title;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
421 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
422
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
423 GList *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
424 gaim_notify_searchresults_row_get(GaimNotifySearchResults *results,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
425 unsigned int row_id)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
426 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
427 g_return_val_if_fail(results != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
428
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
429 return g_list_nth_data(results->rows, row_id);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
430 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
431
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
432 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
433 gaim_notify_userinfo(GaimConnection *gc, const char *who,
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
434 GaimNotifyUserInfo *user_info, GaimNotifyCloseCallback cb, gpointer user_data)
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
435 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
436 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
437
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
438 g_return_val_if_fail(who != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
439
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
440 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
441
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
442 if (ops != NULL && ops->notify_userinfo != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
443 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
444
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
445 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
446 info->type = GAIM_NOTIFY_USERINFO;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
447 info->handle = gc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
448
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
449 gaim_signal_emit(gaim_notify_get_handle(), "displaying-userinfo",
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
450 gaim_connection_get_account(gc), who, user_info);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
451
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
452 info->ui_handle = ops->notify_userinfo(gc, who, user_info);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
453 info->cb = cb;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
454 info->cb_user_data = user_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
455
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
456 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
457 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
458
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
459 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
460
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
461 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
462 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
463 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
464
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
465 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
466
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
467 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
468 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
469
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
470 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
471 if (cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
472 cb(user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
473 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
474
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
475 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
476 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
477
15266
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
478 GaimNotifyUserInfoEntry *
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
479 gaim_notify_user_info_entry_new(const char *label, const char *value)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
480 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
481 GaimNotifyUserInfoEntry *user_info_entry;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
482
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
483 user_info_entry = g_new0(GaimNotifyUserInfoEntry, 1);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
484 user_info_entry->label = g_strdup(label);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
485 user_info_entry->value = g_strdup(value);
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
486 user_info_entry->type = GAIM_NOTIFY_USER_INFO_ENTRY_PAIR;
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
487
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
488 return user_info_entry;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
489 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
490
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
491 static void
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
492 gaim_notify_user_info_entry_destroy(GaimNotifyUserInfoEntry *user_info_entry)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
493 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
494 g_return_if_fail(user_info_entry != NULL);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
495
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
496 g_free(user_info_entry->label);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
497 g_free(user_info_entry->value);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
498 g_free(user_info_entry);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
499 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
500
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
501 GaimNotifyUserInfo *
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
502 gaim_notify_user_info_new()
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
503 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
504 GaimNotifyUserInfo *user_info;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
505
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
506 user_info = g_new0(GaimNotifyUserInfo, 1);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
507 user_info->user_info_entries = NULL;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
508
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
509 return user_info;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
510 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
511
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
512 void
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
513 gaim_notify_user_info_destroy(GaimNotifyUserInfo *user_info)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
514 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
515 GList *l;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
516
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
517 for (l = user_info->user_info_entries; l != NULL; l = l->next) {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
518 GaimNotifyUserInfoEntry *user_info_entry = l->data;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
519
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
520 gaim_notify_user_info_entry_destroy(user_info_entry);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
521 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
522
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
523 g_list_free(user_info->user_info_entries);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
524 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
525
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
526 GList *
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
527 gaim_notify_user_info_get_entries(GaimNotifyUserInfo *user_info)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
528 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
529 g_return_val_if_fail(user_info != NULL, NULL);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
530
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
531 return user_info->user_info_entries;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
532 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
533
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
534 char *
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
535 gaim_notify_user_info_get_text_with_newline(GaimNotifyUserInfo *user_info, const char *newline)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
536 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
537 GList *l;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
538 GString *text;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
539
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
540 text = g_string_new("");
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
541
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
542 for (l = user_info->user_info_entries; l != NULL; l = l->next) {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
543 GaimNotifyUserInfoEntry *user_info_entry = l->data;
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
544 /* Add a newline before a section header */
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
545 if (user_info_entry->type == GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER)
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
546 g_string_append(text, newline);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
547
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
548 /* Handle the label/value pair itself */
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
549 /* XXX Todo: Use a larger size for a section header? */
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
550 if (user_info_entry->label)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
551 g_string_append_printf(text, "<b>%s</b>", user_info_entry->label);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
552 if (user_info_entry->label && user_info_entry->value)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
553 g_string_append(text, ": ");
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
554 if (user_info_entry->value)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
555 g_string_append(text, user_info_entry->value);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
556
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
557 /* Display a section break as a horizontal line */
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
558 if (user_info_entry->type == GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK)
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
559 g_string_append(text, "<HR>");
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
560
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
561 /* Don't insert a new line before or after a section break; <HR> does that for us */
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
562 if ((user_info_entry->type != GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) &&
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
563 (l->next && ((((GaimNotifyUserInfoEntry *)(l->next->data))->type != GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK))))
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
564 g_string_append(text, newline);
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
565
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
566 /* Add an extra newline after a section header */
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
567 if (user_info_entry->type == GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER)
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
568 g_string_append(text, newline);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
569 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
570
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
571 return g_string_free(text, FALSE);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
572 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
573
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
574
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
575 gchar *
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
576 gaim_notify_user_info_entry_get_label(GaimNotifyUserInfoEntry *user_info_entry)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
577 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
578 g_return_val_if_fail(user_info_entry != NULL, NULL);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
579
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
580 return user_info_entry->label;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
581 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
582
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
583 void
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
584 gaim_notify_user_info_entry_set_label(GaimNotifyUserInfoEntry *user_info_entry, const char *label)
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
585 {
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
586 g_return_if_fail(user_info_entry != NULL);
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
587
15268
132db06150ca [gaim-migrate @ 18058]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15267
diff changeset
588 g_free(user_info_entry->label);
132db06150ca [gaim-migrate @ 18058]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15267
diff changeset
589 user_info_entry->label = g_strdup(label);
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
590 }
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
591
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
592 gchar *
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
593 gaim_notify_user_info_entry_get_value(GaimNotifyUserInfoEntry *user_info_entry)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
594 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
595 g_return_val_if_fail(user_info_entry != NULL, NULL);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
596
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
597 return user_info_entry->value;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
598 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
599
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
600 void
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
601 gaim_notify_user_info_entry_set_value(GaimNotifyUserInfoEntry *user_info_entry, const char *value)
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
602 {
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
603 g_return_if_fail(user_info_entry != NULL);
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
604
15268
132db06150ca [gaim-migrate @ 18058]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15267
diff changeset
605 g_free(user_info_entry->value);
132db06150ca [gaim-migrate @ 18058]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15267
diff changeset
606 user_info_entry->value = g_strdup(value);
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
607 }
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
608
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
609 GaimNotifyUserInfoEntryType
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
610 gaim_notify_user_info_entry_get_type(GaimNotifyUserInfoEntry *user_info_entry)
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
611 {
15268
132db06150ca [gaim-migrate @ 18058]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15267
diff changeset
612 g_return_val_if_fail(user_info_entry != NULL, GAIM_NOTIFY_USER_INFO_ENTRY_PAIR);
132db06150ca [gaim-migrate @ 18058]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15267
diff changeset
613
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
614 return user_info_entry->type;
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
615 }
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
616
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
617 void
15266
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
618 gaim_notify_user_info_entry_set_type(GaimNotifyUserInfoEntry *user_info_entry, GaimNotifyUserInfoEntryType type)
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
619 {
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
620 g_return_if_fail(user_info_entry != NULL);
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
621
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
622 user_info_entry->type = type;
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
623 }
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
624
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
625 void
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
626 gaim_notify_user_info_add_pair(GaimNotifyUserInfo *user_info, const char *label, const char *value)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
627 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
628 GaimNotifyUserInfoEntry *entry;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
629
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
630 entry = gaim_notify_user_info_entry_new(label, value);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
631 user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
632 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
633
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
634 void
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
635 gaim_notify_user_info_prepend_pair(GaimNotifyUserInfo *user_info, const char *label, const char *value)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
636 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
637 GaimNotifyUserInfoEntry *entry;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
638
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
639 entry = gaim_notify_user_info_entry_new(label, value);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
640 user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
641 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
642
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
643 void
15267
6388c384bfac [gaim-migrate @ 18057]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15266
diff changeset
644 gaim_notify_user_info_remove_entry(GaimNotifyUserInfo *user_info, GaimNotifyUserInfoEntry *entry)
15266
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
645 {
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
646 g_return_if_fail(user_info != NULL);
15267
6388c384bfac [gaim-migrate @ 18057]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15266
diff changeset
647 g_return_if_fail(entry != NULL);
15266
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
648
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
649 user_info->user_info_entries = g_list_remove(user_info->user_info_entries, entry);
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
650 }
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
651
c95a05393dc3 [gaim-migrate @ 18056]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15263
diff changeset
652 void
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
653 gaim_notify_user_info_add_section_header(GaimNotifyUserInfo *user_info, const char *label)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
654 {
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
655 GaimNotifyUserInfoEntry *entry;
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
656
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
657 entry = gaim_notify_user_info_entry_new(label, NULL);
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
658 entry->type = GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER;
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
659
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
660 user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry);
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
661 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
662
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
663 void
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
664 gaim_notify_user_info_add_section_break(GaimNotifyUserInfo *user_info)
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
665 {
15149
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
666 GaimNotifyUserInfoEntry *entry;
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
667
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
668 entry = gaim_notify_user_info_entry_new(NULL, NULL);
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
669 entry->type = GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK;
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
670
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
671 user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry);
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
672 }
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
673
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
674 void
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
675 gaim_notify_user_info_remove_last_item(GaimNotifyUserInfo *user_info)
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
676 {
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
677 user_info->user_info_entries = g_list_remove(user_info->user_info_entries,
a56c93f12f8f [gaim-migrate @ 17935]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15143
diff changeset
678 g_list_last(user_info->user_info_entries)->data);
15143
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
679 }
b81e4e44b509 [gaim-migrate @ 17929]
Evan Schoenberg <evan.s@dreskin.net>
parents: 14192
diff changeset
680
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
681 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
682 gaim_notify_uri(void *handle, const char *uri)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
683 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
684 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
685
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
686 g_return_val_if_fail(uri != NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
687
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
688 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
689
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
690 if (ops != NULL && ops->notify_uri != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
691 GaimNotifyInfo *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
692
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
693 info = g_new0(GaimNotifyInfo, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
694 info->type = GAIM_NOTIFY_URI;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
695 info->handle = handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
696 info->ui_handle = ops->notify_uri(uri);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
697
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
698 if (info->ui_handle != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
699 handles = g_list_append(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
700
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
701 return info->ui_handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
702
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
703 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
704 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
705
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
706 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
707 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
708 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
709
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
710 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
711 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
712
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
713 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
714 gaim_notify_close(GaimNotifyType type, void *ui_handle)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
715 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
716 GList *l;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
717 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
718
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
719 g_return_if_fail(ui_handle != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
720
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
721 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
722
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
723 for (l = handles; l != NULL; l = l->next) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
724 GaimNotifyInfo *info = l->data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
725
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
726 if (info->ui_handle == ui_handle) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
727 handles = g_list_remove(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
728
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
729 if (ops != NULL && ops->close_notify != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
730 ops->close_notify(info->type, ui_handle);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
731
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
732 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
733 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
734
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
735 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
736
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
737 break;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
738 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
739 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
740 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
741
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
742 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
743 gaim_notify_close_with_handle(void *handle)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
744 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
745 GList *l, *l_next;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
746 GaimNotifyUiOps *ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
747
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
748 g_return_if_fail(handle != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
749
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
750 ops = gaim_notify_get_ui_ops();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
751
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
752 for (l = handles; l != NULL; l = l_next) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
753 GaimNotifyInfo *info = l->data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
754
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
755 l_next = l->next;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
756
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
757 if (info->handle == handle) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
758 handles = g_list_remove(handles, info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
759
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
760 if (ops != NULL && ops->close_notify != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
761 ops->close_notify(info->type, info->ui_handle);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
762
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
763 if (info->cb != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
764 info->cb(info->cb_user_data);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
765
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
766 g_free(info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
767 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
768 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
769 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
770
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
771 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
772 gaim_notify_set_ui_ops(GaimNotifyUiOps *ops)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
773 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
774 notify_ui_ops = ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
775 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
776
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
777 GaimNotifyUiOps *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
778 gaim_notify_get_ui_ops(void)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
779 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
780 return notify_ui_ops;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
781 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
782
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
783 void *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
784 gaim_notify_get_handle(void)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
785 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
786 static int handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
787
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
788 return &handle;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
789 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
790
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
791 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
792 gaim_notify_init(void)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
793 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
794 gpointer handle = gaim_notify_get_handle();
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
795
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
796 gaim_signal_register(handle, "displaying-userinfo",
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
797 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
798 gaim_value_new(GAIM_TYPE_SUBTYPE,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
799 GAIM_SUBTYPE_ACCOUNT),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
800 gaim_value_new(GAIM_TYPE_STRING),
15263
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
801 gaim_value_new(GAIM_TYPE_SUBTYPE,
a46c40c7a0e9 [gaim-migrate @ 18053]
Evan Schoenberg <evan.s@dreskin.net>
parents: 15149
diff changeset
802 GAIM_SUBTYPE_USERINFO));
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
803 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
804
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
805 void
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
806 gaim_notify_uninit(void)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
807 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
808 gaim_signals_unregister_by_instance(gaim_notify_get_handle());
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
809 }