Introduce and use fe_timeout_add_seconds

This should allow the operating system to be a bit more lax about
timeouts, allowing more efficient power management.
This commit is contained in:
Ben Gamari 2016-05-08 21:51:38 +02:00 committed by Patrick Griffis
parent 25e197a6c8
commit bcbe42dd7a
8 changed files with 21 additions and 8 deletions

View File

@ -2234,7 +2234,7 @@ new_dcc (void)
dcc_list = g_slist_prepend (dcc_list, dcc);
if (timeout_timer == 0)
{
timeout_timer = fe_timeout_add (1000, dcc_check_timeouts, NULL);
timeout_timer = fe_timeout_add_seconds (1, dcc_check_timeouts, NULL);
}
return dcc;
}

View File

@ -50,6 +50,7 @@ void fe_main (void);
void fe_cleanup (void);
void fe_exit (void);
int fe_timeout_add (int interval, void *callback, void *userdata);
int fe_timeout_add_seconds (int interval, void *callback, void *userdata);
void fe_timeout_remove (int tag);
void fe_new_window (struct session *sess, int focus);
void fe_new_server (struct server *serv);

View File

@ -395,14 +395,14 @@ irc_init (session *sess)
#endif
if (prefs.hex_notify_timeout)
notify_tag = fe_timeout_add (prefs.hex_notify_timeout * 1000,
notify_tag = fe_timeout_add_seconds (prefs.hex_notify_timeout,
notify_checklist, NULL);
fe_timeout_add (prefs.hex_away_timeout * 1000, away_check, NULL);
fe_timeout_add_seconds (prefs.hex_away_timeout, away_check, NULL);
if (prefs.hex_gui_lagometer)
{
fe_timeout_add (500, hexchat_lag_check_update, NULL);
fe_timeout_add (30000, hexchat_lag_check, NULL);
fe_timeout_add_seconds (30, hexchat_lag_check, NULL);
}
if (arg_url != NULL)

View File

@ -410,7 +410,7 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
{
prefs.hex_gui_autoopen_dialog = 0;
/* turn it back on in 30 secs */
fe_timeout_add (30000, flood_autodialog_timeout, NULL);
fe_timeout_add_seconds (30, flood_autodialog_timeout, NULL);
}
return 0;
}

View File

@ -1594,7 +1594,7 @@ inbound_login_end (session *sess, char *text, const message_tags_data *tags_data
&& ((((ircnet *)serv->network)->pass && inbound_nickserv_login (serv))
|| ((ircnet *)serv->network)->commandlist))
{
serv->joindelay_tag = fe_timeout_add (prefs.hex_irc_join_delay * 1000, check_autojoin_channels, serv);
serv->joindelay_tag = fe_timeout_add_seconds (prefs.hex_irc_join_delay, check_autojoin_channels, serv);
}
else
{

View File

@ -249,7 +249,7 @@ static void
close_socket (int sok)
{
/* close the socket in 5 seconds so the QUIT message is not lost */
fe_timeout_add (5000, close_socket_cb, GINT_TO_POINTER (sok));
fe_timeout_add_seconds (5, close_socket_cb, GINT_TO_POINTER (sok));
}
/* handle 1 line of text received from the server */

View File

@ -345,6 +345,12 @@ fe_timeout_add (int interval, void *callback, void *userdata)
return g_timeout_add (interval, (GSourceFunc) callback, userdata);
}
int
fe_timeout_add_seconds (int interval, void *callback, void *userdata)
{
return g_timeout_add_seconds (interval, (GSourceFunc) callback, userdata);
}
void
fe_timeout_remove (int tag)
{

View File

@ -415,6 +415,12 @@ fe_timeout_add (int interval, void *callback, void *userdata)
return g_timeout_add (interval, (GSourceFunc) callback, userdata);
}
int
fe_timeout_add_seconds (int interval, void *callback, void *userdata)
{
return g_timeout_add_seconds (interval, (GSourceFunc) callback, userdata);
}
void
fe_input_remove (int tag)
{