+/* testtreemodel.c
+ * Copyright (C) 2004 Red Hat, Inc., Matthias Clasen <mclasen@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#ifdef HAVE_MALLINFO
#include <malloc.h>
+#endif
+
#include <gtk/gtk.h>
static gint repeats = 2;
GtkTreeIter iter;
gchar *text;
FindData data;
- gint n;
text = g_strdup_printf ("row %d", i);
data.n = g_random_int_range (0, items);
data.found = FALSE;
if (data.n < i)
gtk_tree_model_foreach (model, find_nth, &data);
- gtk_tree_store_insert (store, &iter, data.found ? &(data.iter) : NULL, n);
+ gtk_tree_store_insert (store, &iter, data.found ? &(data.iter) : NULL, data.n);
gtk_tree_store_set (store, &iter, 0, i, 1, text, -1);
g_free (text);
}
ClearFunc *clear,
InsertFunc *insert)
{
- GtkTreeIter iter;
gint i, k, d, items;
- gchar *text;
GTimer *timer;
gdouble elapsed;
- int uordblks_before, memused;
+ int uordblks_before = 0, memused;
g_print ("%s (average over %d runs, time in milliseconds)\n"
"items \ttime \ttime/item \tused memory\n", title, repeats);
main (int argc, char *argv[])
{
GtkTreeModel *model;
- GOptionContext *context;
- gtk_init (&argc, &argv);
-
- context = g_option_context_new ("");
- g_option_context_add_main_entries (context, entries, "");
- g_option_context_parse (context, &argc, &argv, NULL);
- g_option_context_free (context);
+ gtk_init_with_args (&argc, &argv, NULL, entries, NULL, NULL);
model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING));