mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-24 05:06:22 +00:00
Introduce our own shutdown callback mechanism.
Instead of adding stuff to `_shutdown()`, we can now register a shutdown routine from the respective `init()` function of our modules. This also has the advantage, that we're sure they're called in reverse order from how the initialization happened. I didn't simply use `atexit()` because POSIX says that the number of possible callbacks is limited (min 32) and I was not sure whether we will maybe extend this number at one point. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -153,9 +153,21 @@ _tray_change_icon(gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_tray_shutdown(void)
|
||||
{
|
||||
if (gtk_ready && prefs_get_boolean(PREF_TRAY)) {
|
||||
tray_disable();
|
||||
}
|
||||
g_string_free(icon_filename, TRUE);
|
||||
g_string_free(icon_msg_filename, TRUE);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void
|
||||
tray_init(void)
|
||||
{
|
||||
prof_add_shutdown_routine(_tray_shutdown);
|
||||
_get_icons();
|
||||
gtk_ready = gtk_init_check(0, NULL);
|
||||
log_debug("Env is GTK-ready: %s", gtk_ready ? "true" : "false");
|
||||
@@ -179,17 +191,6 @@ tray_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tray_shutdown(void)
|
||||
{
|
||||
if (gtk_ready && prefs_get_boolean(PREF_TRAY)) {
|
||||
tray_disable();
|
||||
}
|
||||
g_string_free(icon_filename, TRUE);
|
||||
g_string_free(icon_msg_filename, TRUE);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void
|
||||
tray_set_timer(int interval)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user