comparison src/notify.c @ 5476:9bcd8cd625ae

[gaim-migrate @ 5872] Some little tidy-ups. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 22 May 2003 05:23:14 +0000
parents 0031a613a87d
children a3e6a5ef49b5
comparison
equal deleted inserted replaced
5475:ad9887c91a59 5476:9bcd8cd625ae
27 27
28 typedef struct 28 typedef struct
29 { 29 {
30 GaimNotifyType type; 30 GaimNotifyType type;
31 void *handle; 31 void *handle;
32 void *ptr; 32 void *ui_handle;
33 33
34 } GaimNotifyInfo; 34 } GaimNotifyInfo;
35 35
36 void * 36 void *
37 gaim_notify_message(void *handle, GaimNotifyType type, 37 gaim_notify_message(void *handle, GaimNotifyType type,
45 ops = gaim_get_notify_ui_ops(); 45 ops = gaim_get_notify_ui_ops();
46 46
47 if (ops != NULL && ops->notify_message != NULL) { 47 if (ops != NULL && ops->notify_message != NULL) {
48 GaimNotifyInfo *info; 48 GaimNotifyInfo *info;
49 49
50 info = g_new0(GaimNotifyInfo, 1); 50 info = g_new0(GaimNotifyInfo, 1);
51 info->type = GAIM_NOTIFY_MESSAGE; 51 info->type = GAIM_NOTIFY_MESSAGE;
52 info->handle = handle; 52 info->handle = handle;
53 info->ptr = ops->notify_message(type, title, primary, secondary, 53 info->ui_handle = ops->notify_message(type, title, primary,
54 cb, user_data); 54 secondary, cb, user_data);
55 55
56 handles = g_list_append(handles, info); 56 handles = g_list_append(handles, info);
57 57
58 return info->ptr; 58 return info->ui_handle;
59 } 59 }
60 60
61 return NULL; 61 return NULL;
62 } 62 }
63 63
71 ops = gaim_get_notify_ui_ops(); 71 ops = gaim_get_notify_ui_ops();
72 72
73 if (ops != NULL && ops->notify_email != NULL) { 73 if (ops != NULL && ops->notify_email != NULL) {
74 GaimNotifyInfo *info; 74 GaimNotifyInfo *info;
75 75
76 info = g_new0(GaimNotifyInfo, 1); 76 info = g_new0(GaimNotifyInfo, 1);
77 info->type = GAIM_NOTIFY_EMAIL; 77 info->type = GAIM_NOTIFY_EMAIL;
78 info->handle = handle; 78 info->handle = handle;
79 info->ptr = ops->notify_email(subject, from, to, url, cb, 79 info->ui_handle = ops->notify_email(subject, from, to, url, cb,
80 user_data); 80 user_data);
81 81
82 handles = g_list_append(handles, info); 82 handles = g_list_append(handles, info);
83 83
84 return info->ptr; 84 return info->ui_handle;
85 } 85 }
86 86
87 return NULL; 87 return NULL;
88 } 88 }
89 89
99 ops = gaim_get_notify_ui_ops(); 99 ops = gaim_get_notify_ui_ops();
100 100
101 if (ops != NULL && ops->notify_emails != NULL) { 101 if (ops != NULL && ops->notify_emails != NULL) {
102 GaimNotifyInfo *info; 102 GaimNotifyInfo *info;
103 103
104 info = g_new0(GaimNotifyInfo, 1); 104 info = g_new0(GaimNotifyInfo, 1);
105 info->type = GAIM_NOTIFY_EMAILS; 105 info->type = GAIM_NOTIFY_EMAILS;
106 info->handle = handle; 106 info->handle = handle;
107 info->ptr = ops->notify_emails(count, subjects, froms, tos, urls, 107 info->ui_handle = ops->notify_emails(count, subjects, froms, tos,
108 cb, user_data); 108 urls, cb, user_data);
109 109
110 handles = g_list_append(handles, info); 110 handles = g_list_append(handles, info);
111 111
112 return info->ptr; 112 return info->ui_handle;
113 } 113 }
114 114
115 return NULL; 115 return NULL;
116 } 116 }
117 117
118 void 118 void
119 gaim_notify_close(GaimNotifyType type, void *ptr) 119 gaim_notify_close(GaimNotifyType type, void *ui_handle)
120 { 120 {
121 GList *l; 121 GList *l;
122 GaimNotifyUiOps *ops; 122 GaimNotifyUiOps *ops;
123 123
124 g_return_if_fail(ptr != NULL); 124 g_return_if_fail(ui_handle != NULL);
125 125
126 ops = gaim_get_notify_ui_ops(); 126 ops = gaim_get_notify_ui_ops();
127 127
128 for (l = handles; l != NULL; l = l->next) { 128 for (l = handles; l != NULL; l = l->next) {
129 GaimNotifyInfo *info = l->data; 129 GaimNotifyInfo *info = l->data;
130 130
131 if (info->ptr == ptr) { 131 if (info->ui_handle == ui_handle) {
132 handles = g_list_remove(handles, info); 132 handles = g_list_remove(handles, info);
133 133
134 if (ops != NULL && ops->close_notify != NULL) 134 if (ops != NULL && ops->close_notify != NULL)
135 ops->close_notify(info->type, ptr); 135 ops->close_notify(info->type, ui_handle);
136 136
137 g_free(info); 137 g_free(info);
138 138
139 break; 139 break;
140 } 140 }
158 158
159 if (info->handle == handle) { 159 if (info->handle == handle) {
160 handles = g_list_remove(handles, info); 160 handles = g_list_remove(handles, info);
161 161
162 if (ops != NULL && ops->close_notify != NULL) 162 if (ops != NULL && ops->close_notify != NULL)
163 ops->close_notify(info->type, info->ptr); 163 ops->close_notify(info->type, info->ui_handle);
164 164
165 g_free(info); 165 g_free(info);
166 } 166 }
167 } 167 }
168 } 168 }