Tracking the first idle callback

This commit is contained in:
Pierre Pronchery 2013-07-01 21:54:00 -04:00
parent c2fa286ec3
commit c6d0f26bdd
2 changed files with 8 additions and 2 deletions

View File

@ -278,6 +278,7 @@ Browser * browser_new(char const * directory)
browser_error(NULL, (directory != NULL) ? directory : ".", 1);
return NULL;
}
browser->source = 0;
browser->window = NULL;
browser->theme = gtk_icon_theme_get_default();
#if GTK_CHECK_VERSION(2, 6, 0)
@ -509,7 +510,7 @@ Browser * browser_new(char const * directory)
browser->history = g_list_append(browser->history, p);
browser->current = browser->history;
}
g_idle_add(_new_idle, browser);
browser->source = g_idle_add(_new_idle, browser);
gtk_container_add(GTK_CONTAINER(browser->window), vbox);
gtk_widget_show_all(browser->window);
@ -522,6 +523,7 @@ static gboolean _new_idle(gpointer data)
Browser * browser = data;
char const * location;
browser->source = 0;
_idle_load_plugins(browser);
if((location = browser_get_location(browser)) == NULL)
browser_go_home(browser);
@ -626,6 +628,8 @@ static void _delete_plugins(Browser * browser);
void browser_delete(Browser * browser)
{
if(browser->source != 0)
g_source_remove(browser->source);
_delete_plugins(browser);
if(browser->config != NULL)
config_delete(browser->config);

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2006-2012 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2006-2013 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Browser */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -89,6 +89,8 @@ typedef struct _BrowserPrefs
struct _Browser
{
guint source;
/* config */
Config * config;
BrowserPrefs prefs;