comparison finch/gntrequest.c @ 15826:f59cfcce68a8

Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 19 Mar 2007 06:34:51 +0000
parents 0e3a8505ebbe
children 2edbd4fede72
comparison
equal deleted inserted replaced
15825:aabeea8c6c40 15826:f59cfcce68a8
382 gnt_box_add_widget(GNT_BOX(hbox), check); 382 gnt_box_add_widget(GNT_BOX(hbox), check);
383 field->ui_data = check; 383 field->ui_data = check;
384 } 384 }
385 else if (type == GAIM_REQUEST_FIELD_STRING) 385 else if (type == GAIM_REQUEST_FIELD_STRING)
386 { 386 {
387 const char *hint = gaim_request_field_get_type_hint(field);
387 GntWidget *entry = gnt_entry_new( 388 GntWidget *entry = gnt_entry_new(
388 gaim_request_field_string_get_default_value(field)); 389 gaim_request_field_string_get_default_value(field));
389 gnt_entry_set_masked(GNT_ENTRY(entry), 390 gnt_entry_set_masked(GNT_ENTRY(entry),
390 gaim_request_field_string_is_masked(field)); 391 gaim_request_field_string_is_masked(field));
392 if (gaim_str_has_prefix(hint, "screenname")) {
393 GaimBlistNode *node = gaim_blist_get_root();
394 gboolean offline = gaim_str_has_suffix(hint, "all");
395 for (; node; node = gaim_blist_node_next(node, offline)) {
396 if (!GAIM_BLIST_NODE_IS_BUDDY(node))
397 continue;
398 gnt_entry_add_suggest(GNT_ENTRY(entry), gaim_buddy_get_name((GaimBuddy*)node));
399 }
400 gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE);
401 }
391 gnt_box_add_widget(GNT_BOX(hbox), entry); 402 gnt_box_add_widget(GNT_BOX(hbox), entry);
392 field->ui_data = entry; 403 field->ui_data = entry;
393 } 404 }
394 else if (type == GAIM_REQUEST_FIELD_INTEGER) 405 else if (type == GAIM_REQUEST_FIELD_INTEGER)
395 { 406 {