Mercurial > pidgin.yaz
comparison libpurple/request.c @ 21229:0b67d509a305
merge of '1bcf84e26d11f259b3c5ec663e3fecc2f01aed33'
and 'ce13b5ca4994abbd4934b3bc568c8b115335c426'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 14 Oct 2007 02:41:00 +0000 |
parents | bd1426679f36 18cf8aa44f55 |
children | b9680933c2c6 |
comparison
equal
deleted
inserted
replaced
21098:7e200a629109 | 21229:0b67d509a305 |
---|---|
375 } | 375 } |
376 | 376 |
377 g_hash_table_destroy(field->u.list.item_data); | 377 g_hash_table_destroy(field->u.list.item_data); |
378 g_hash_table_destroy(field->u.list.selected_table); | 378 g_hash_table_destroy(field->u.list.selected_table); |
379 } | 379 } |
380 else if (field->type == PURPLE_REQUEST_FIELD_BLIST) | |
381 { | |
382 if (field->u.blist.default_nodes) | |
383 g_list_free(field->u.blist.default_nodes); | |
384 if (field->u.blist.selecteds) | |
385 g_list_free(field->u.blist.selecteds); | |
386 } | |
380 | 387 |
381 g_free(field); | 388 g_free(field); |
382 } | 389 } |
383 | 390 |
384 void | 391 void |
1131 return field->u.account.filter_func; | 1138 return field->u.account.filter_func; |
1132 } | 1139 } |
1133 | 1140 |
1134 /* -- */ | 1141 /* -- */ |
1135 | 1142 |
1143 PurpleRequestField *purple_request_field_blist_nodes_new(const char *id, | |
1144 const char *text, PurpleRequestBlistFlags flags, GList *selected) | |
1145 { | |
1146 PurpleRequestField *field; | |
1147 | |
1148 g_return_val_if_fail(id != NULL, NULL); | |
1149 g_return_val_if_fail(text != NULL, NULL); | |
1150 | |
1151 field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_BLIST); | |
1152 | |
1153 field->u.blist.flags = flags; | |
1154 field->u.blist.default_nodes = selected; | |
1155 purple_request_field_blist_set_selection_list(field, selected); | |
1156 | |
1157 return field; | |
1158 } | |
1159 | |
1160 PurpleFilterBlistFunc | |
1161 purple_request_field_blist_set_filter(PurpleRequestField *field, PurpleFilterBlistFunc filter) | |
1162 { | |
1163 PurpleFilterBlistFunc old; | |
1164 g_return_val_if_fail(field != NULL, NULL); | |
1165 g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BLIST, NULL); | |
1166 old = field->u.blist.filter; | |
1167 field->u.blist.filter = filter; | |
1168 return old; | |
1169 } | |
1170 | |
1171 PurpleFilterBlistFunc | |
1172 purple_request_field_blist_get_filter(const PurpleRequestField *field) | |
1173 { | |
1174 g_return_val_if_fail(field != NULL, NULL); | |
1175 g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BLIST, NULL); | |
1176 return field->u.blist.filter; | |
1177 } | |
1178 | |
1179 GList *purple_request_field_blist_get_selection_list(const PurpleRequestField *field) | |
1180 { | |
1181 g_return_val_if_fail(field != NULL, NULL); | |
1182 g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BLIST, NULL); | |
1183 return field->u.blist.selecteds; | |
1184 } | |
1185 | |
1186 gboolean purple_request_field_blist_add(PurpleRequestField *field, PurpleBlistNode *node) | |
1187 { | |
1188 g_return_val_if_fail(field != NULL, FALSE); | |
1189 g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BLIST, FALSE); | |
1190 if (!g_list_find(field->u.blist.selecteds, node)) { | |
1191 field->u.blist.selecteds = g_list_append(field->u.blist.selecteds, node); | |
1192 return TRUE; | |
1193 } else { | |
1194 return FALSE; | |
1195 } | |
1196 } | |
1197 | |
1198 gboolean purple_request_field_blist_remove(PurpleRequestField *field, PurpleBlistNode *node) | |
1199 { | |
1200 GList *search; | |
1201 g_return_val_if_fail(field != NULL, FALSE); | |
1202 g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BLIST, FALSE); | |
1203 if ((search = g_list_find(field->u.blist.selecteds, node)) != NULL) { | |
1204 field->u.blist.selecteds = g_list_delete_link(field->u.blist.selecteds, search); | |
1205 return TRUE; | |
1206 } else { | |
1207 return FALSE; | |
1208 } | |
1209 } | |
1210 | |
1211 void purple_request_field_blist_set_selection_list(PurpleRequestField *field, GList *selecteds) | |
1212 { | |
1213 g_return_if_fail(field != NULL); | |
1214 g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_BLIST); | |
1215 if (field->u.blist.selecteds) | |
1216 g_list_free(field->u.blist.selecteds); | |
1217 field->u.blist.selecteds = selecteds; | |
1218 } | |
1219 | |
1220 /* -- */ | |
1221 | |
1136 void * | 1222 void * |
1137 purple_request_input(void *handle, const char *title, const char *primary, | 1223 purple_request_input(void *handle, const char *title, const char *primary, |
1138 const char *secondary, const char *default_value, | 1224 const char *secondary, const char *default_value, |
1139 gboolean multiline, gboolean masked, gchar *hint, | 1225 gboolean multiline, gboolean masked, gchar *hint, |
1140 const char *ok_text, GCallback ok_cb, | 1226 const char *ok_text, GCallback ok_cb, |