mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-17 15:04:18 +03:00
![Daniel Silverstone](/assets/img/avatar_default.png)
NetSurf includes are now done with ""s and other system includes with <>s as C intended. The scandeps tool has been updated to only look for ""ed includes, and to verify that the files exist in the tree before adding them to the dependency lines. The depend rule has therefore been augmented to make sure the autogenerated files are built before it is run. This is untested under self-hosted RISC OS builds. All else tested and works. svn path=/trunk/netsurf/; revision=3307
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
/*
|
|
* This file is part of NetSurf, http://netsurf-browser.org/
|
|
* Licensed under the GNU General Public License,
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
* Copyright 2006 Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
*/
|
|
|
|
#include <glib.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "desktop/browser.h"
|
|
|
|
typedef struct {
|
|
void (*callback)(void *);
|
|
void *p;
|
|
int die;
|
|
} _nsgtkcallback;
|
|
|
|
static GList *callbacks;
|
|
|
|
static gboolean ns_generic_gtk_callback(gpointer data)
|
|
{
|
|
_nsgtkcallback *cb = (_nsgtkcallback*)(data);
|
|
if(cb->die) {
|
|
/* We got removed before we got fired off */
|
|
free(cb);
|
|
return FALSE;
|
|
}
|
|
cb->callback(cb->p);
|
|
callbacks = g_list_remove(callbacks, cb);
|
|
free(cb);
|
|
return FALSE;
|
|
}
|
|
|
|
void schedule_remove(void (*callback)(void *p), void *p)
|
|
{
|
|
_nsgtkcallback *cb;
|
|
GList *l;
|
|
l = callbacks;
|
|
while(l) {
|
|
cb = (_nsgtkcallback*)(l->data);
|
|
if(cb->callback == callback && cb->p == p) {
|
|
l = callbacks = g_list_remove(callbacks, cb);
|
|
cb->die = 1;
|
|
} else
|
|
l = g_list_next(l);
|
|
}
|
|
}
|
|
|
|
void schedule(int t, void (*callback)(void *p), void *p)
|
|
{
|
|
_nsgtkcallback *cb = (_nsgtkcallback*)malloc(sizeof(_nsgtkcallback));
|
|
schedule_remove(callback, p);
|
|
cb->callback = callback;
|
|
cb->p = p;
|
|
cb->die = 0;
|
|
callbacks = g_list_prepend(callbacks, cb);
|
|
g_timeout_add(t * 10, ns_generic_gtk_callback, cb);
|
|
}
|
|
|
|
void schedule_run(void)
|
|
{
|
|
/* Nothing to do, the running is done via the gtk mainloop of joy */
|
|
}
|
|
|