int main (int argc, char *argv[]) { GCompletion *cmp; GList *items; gchar *prefix; #ifdef SYMBIAN g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL); #endif cmp = g_completion_new (NULL); items = NULL; items = g_list_append (items, "Abcdef"); items = g_list_append (items, "AbcDEF"); items = g_list_append (items, "bc"); items = g_list_append (items, "bd"); g_completion_add_items (cmp, items); g_completion_set_compare(cmp,strncasecmp); items = g_completion_complete (cmp, "aB", &prefix); g_assert (!strcmp ("aBc", prefix)); g_free (prefix); g_completion_remove_items(cmp,items); items = g_completion_complete (cmp, "aB", &prefix); // g_assert(items == NULL); items = g_completion_complete (cmp, "b", &prefix); g_assert(!strcmp("b",prefix)); g_free(prefix); g_completion_clear_items(cmp); items = g_completion_complete (cmp, "b", &prefix); g_assert(items == NULL); #if SYMBIAN testResultXml("completion_test"); #endif /* EMULATOR */ return 0; }
static VALUE rg_remove_items(VALUE self, VALUE items) { gint i, len; GList* list = (GList*)NULL; VALUE items_internal = rb_ivar_get(self, id_items_internal); items = rb_ary_to_ary(items); len = RARRAY_LEN(items); for (i = 0; i < len; i ++){ VALUE data = RARRAY_PTR(items)[i]; VALUE item = rb_hash_aref(items_internal, data); list = g_list_append(list, (gpointer)item); rb_hash_delete(items_internal, data); } g_completion_remove_items(_SELF(self), list); return self; }