static VALUE rg_clear_items(VALUE self) { VALUE items_internal = rb_ivar_get(self, id_items_internal); rb_funcall(items_internal, id_clear, 0); g_completion_clear_items(_SELF(self)); return self; }
void g_completion_free (GCompletion* cmp) { g_return_if_fail (cmp != NULL); g_completion_clear_items (cmp); g_free (cmp); }
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 void free_completion_list(void) { GList *walk; if (!g_completion_list) return; clear_completion_cache(); if (g_completion) g_completion_clear_items(g_completion); walk = g_list_first(g_completion_list); for (; walk != NULL; walk = g_list_next(walk)) { completion_entry *ce = (completion_entry *) walk->data; g_free(ce->string); g_free(walk->data); } g_list_free(g_completion_list); g_completion_list = NULL; }