/* Returns: (array zero-terminated=1) (transfer full): array of strings with possible completions for @initial_text. This array must be freed by g_strfreev() when finished.  */
char** g_filename_completer_get_completions(GFilenameCompleter *completer, const char *initial_text)
/* Returns: (array zero-terminated=1) (transfer full): array of strings with possible completions for @initial_text. This array must be freed by g_strfreev() when finished.  */
char** g_filename_completer_get_completions(GFilenameCompleter *completer, const char *initial_text)
{
  GList *possible_matches, *l;
  char *prefix;
  char *possible_match;
  GPtrArray *res;
  g_return_val_if_fail (G_IS_FILENAME_COMPLETER (completer), NULL);
  g_return_val_if_fail (initial_text != NULL, NULL);
  possible_matches = init_completion (completer, initial_text, &prefix);
  res = g_ptr_array_new ();
  for (l = possible_matches; l != NULL; l = l->next)
    {
      possible_match = l->data;
      if (g_str_has_prefix (possible_match, prefix))
	g_ptr_array_add (res,
			 g_strconcat (initial_text, possible_match + strlen (prefix), NULL));
    }
  g_free (prefix);
  g_ptr_array_add (res, NULL);
  return (char**)g_ptr_array_free (res, FALSE);
}