changeset 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 aabeea8c6c40
children eec0d0202ffd
files finch/gntrequest.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntrequest.c	Mon Mar 19 00:20:29 2007 +0000
+++ b/finch/gntrequest.c	Mon Mar 19 06:34:51 2007 +0000
@@ -384,10 +384,21 @@
 			}
 			else if (type == GAIM_REQUEST_FIELD_STRING)
 			{
+				const char *hint = gaim_request_field_get_type_hint(field);
 				GntWidget *entry = gnt_entry_new(
 							gaim_request_field_string_get_default_value(field));
 				gnt_entry_set_masked(GNT_ENTRY(entry),
 						gaim_request_field_string_is_masked(field));
+				if (gaim_str_has_prefix(hint, "screenname")) {
+					GaimBlistNode *node = gaim_blist_get_root();
+					gboolean offline = gaim_str_has_suffix(hint, "all");
+					for (; node; node = gaim_blist_node_next(node, offline)) {
+						if (!GAIM_BLIST_NODE_IS_BUDDY(node))
+							continue;
+						gnt_entry_add_suggest(GNT_ENTRY(entry), gaim_buddy_get_name((GaimBuddy*)node));
+					}
+					gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE);
+				}
 				gnt_box_add_widget(GNT_BOX(hbox), entry);
 				field->ui_data = entry;
 			}