- gtk_timeout_insert (timeoutf);
-
- return timeoutf->tag;
-}
-
-static void
-gtk_timeout_destroy (GtkTimeoutFunction *timeoutf)
-{
- if (timeoutf->destroy)
- (timeoutf->destroy) (timeoutf->data);
- g_mem_chunk_free (timeout_mem_chunk, timeoutf);
-}
-
-guint
-gtk_timeout_add (guint32 interval,
- GtkFunction function,
- gpointer data)
-{
- return gtk_timeout_add_full (interval, function, FALSE, data, NULL);
-}
-
-guint
-gtk_timeout_add_interp (guint32 interval,
- GtkCallbackMarshal function,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- return gtk_timeout_add_full (interval, NULL, function, data, destroy);
-}
-
-/* Search for the specified tag in a list of timeouts. If it
- * is found, destroy the timeout, and either remove the link
- * or set link->data to NULL depending on remove_link
- */
-static gint
-gtk_timeout_remove_from_list (GList **list, guint tag, gint remove_link)
-{
- GList *tmp_list;
- GtkTimeoutFunction *timeoutf;
-
- tmp_list = *list;
- while (tmp_list)
- {
- timeoutf = tmp_list->data;
-
- if (timeoutf->tag == tag)
- {
- if (remove_link)
- {
- *list = g_list_remove_link (*list, tmp_list);
- g_list_free (tmp_list);
- }
- else
- tmp_list->data = NULL;
-
- gtk_timeout_destroy (timeoutf);
-
- return TRUE;
- }
-
- tmp_list = tmp_list->next;
- }
- return FALSE;
-}
-
-void
-gtk_timeout_remove (guint tag)
-{
-
- /* Remove a timeout function.
- * (Which, basically, involves searching the
- * list for the tag).
- */
-
- if (gtk_timeout_remove_from_list (&timeout_functions, tag, TRUE))
- return;
- if (gtk_timeout_remove_from_list (¤t_timeouts, tag, TRUE))
- return;
- if (gtk_timeout_remove_from_list (&running_timeouts, tag, FALSE))
- return;
-}
-
-/* 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);