-gtk_timeout_remove (guint tag)
-{
- GtkTimeoutFunction *timeoutf;
- GList *tmp_list;
-
- /* Remove a timeout function.
- * (Which, basically, involves searching the
- * list for the tag).
- */
- tmp_list = timeout_functions;
- while (tmp_list)
- {
- timeoutf = tmp_list->data;
-
- if (timeoutf->tag == tag)
- {
- timeout_functions = g_list_remove_link (timeout_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_timeout_destroy (timeoutf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = current_timeouts;
- while (tmp_list)
- {
- timeoutf = tmp_list->data;
-
- if (timeoutf->tag == tag)
- {
- current_timeouts = g_list_remove_link (current_timeouts, tmp_list);
- g_list_free (tmp_list);
- gtk_timeout_destroy (timeoutf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-/* We rely on some knowledge of how g_list_insert_sorted works to make
- * sure that we insert at the _end_ of the idles of this priority
- */
-static gint
-gtk_idle_compare (gpointer a, gpointer b)
-{
- return (((GtkIdleFunction *)a)->priority < ((GtkIdleFunction *)b)->priority)
- ? -1 : 1;
-}
-
-guint
-gtk_quit_add_full (guint main_level,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- static guint quit_id = 1;
- GtkQuitFunction *quitf;
-
- g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
-
- if (!quit_mem_chunk)
- quit_mem_chunk = g_mem_chunk_new ("quit mem chunk", sizeof (GtkQuitFunction),
- 512, G_ALLOC_AND_FREE);
-
- quitf = g_chunk_new (GtkQuitFunction, quit_mem_chunk);
-
- quitf->id = quit_id++;
- quitf->main_level = main_level;
- quitf->function = function;
- quitf->marshal = marshal;
- quitf->data = data;
- quitf->destroy = destroy;
-
- quit_functions = g_list_prepend (quit_functions, quitf);
-
- return quitf->id;
-}
-
-guint
-gtk_idle_add_full (gint priority,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- static guint idle_tag = 1;
- GtkIdleFunction *idlef;
-
- g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
-
- if (!idle_mem_chunk)
- idle_mem_chunk = g_mem_chunk_new ("idle mem chunk", sizeof (GtkIdleFunction),
- 1024, G_ALLOC_AND_FREE);
-
- idlef = g_chunk_new (GtkIdleFunction, idle_mem_chunk);
-
- idlef->tag = idle_tag++;
- idlef->priority = priority;
- idlef->function = function;
- idlef->marshal = marshal;
- idlef->data = data;
- idlef->destroy = destroy;
-
- idle_functions = g_list_insert_sorted (idle_functions, idlef, gtk_idle_compare);
-
- return idlef->tag;
-}
-
-guint
-gtk_idle_add_interp (GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- return gtk_idle_add_full (GTK_PRIORITY_DEFAULT, NULL, marshal, data, destroy);
-}
-
-static void
-gtk_idle_destroy (GtkIdleFunction *idlef)
-{
- if (idlef->destroy)
- idlef->destroy (idlef->data);
- g_mem_chunk_free (idle_mem_chunk, idlef);
-}
-
-static void
-gtk_quit_destroy (GtkQuitFunction *quitf)
-{
- if (quitf->destroy)
- quitf->destroy (quitf->data);
- g_mem_chunk_free (quit_mem_chunk, quitf);
-}
-
-static gint
-gtk_quit_destructor (GtkObject **object_p)
-{
- if (*object_p)
- gtk_object_destroy (*object_p);
- g_free (object_p);
-
- return FALSE;
-}
-
-void
-gtk_quit_add_destroy (guint main_level,
- GtkObject *object)