From 38b0754c903aa7d90de02f432a88782a6326ae5c Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 12 Nov 2019 10:11:22 +0000 Subject: [PATCH] GDateTime etc have been available since 2.26, we require min 2.28, no need for these checks --- src/common/session.c | 46 -------------------------------------------- src/common/session.h | 4 ---- src/inc.c | 30 +---------------------------- src/inc.h | 5 ----- 4 files changed, 1 insertion(+), 84 deletions(-) diff --git a/src/common/session.c b/src/common/session.c index c7a42f084..7ef085d1f 100644 --- a/src/common/session.c +++ b/src/common/session.c @@ -75,11 +75,7 @@ void session_init(Session *session, const void *prefs_account, gboolean is_smtp) session->state = SESSION_READY; session->last_access_time = time(NULL); -#if GLIB_CHECK_VERSION(2,61,2) session->tv_prev = g_date_time_new_now_local(); -#else - g_get_current_time(&session->tv_prev); -#endif session->conn_id = 0; @@ -268,9 +264,7 @@ void session_destroy(Session *session) #ifdef USE_GNUTLS g_free(session->gnutls_priority); #endif -#if GLIB_CHECK_VERSION(2,61,2) g_date_time_unref(session->tv_prev); -#endif debug_print("session (%p): destroyed\n", session); g_free(session); @@ -506,12 +500,8 @@ gint session_send_data(Session *session, const guchar *data, guint size) session->write_data = data; session->write_data_p = session->write_data; session->write_data_len = size; -#if GLIB_CHECK_VERSION(2,61,2) g_date_time_unref(session->tv_prev); session->tv_prev = g_date_time_new_now_local(); -#else - g_get_current_time(&session->tv_prev); -#endif ret = session_write_data_cb(session->sock, G_IO_OUT, session); @@ -533,12 +523,8 @@ gint session_recv_data(Session *session, guint size, const gchar *terminator) g_free(session->read_data_terminator); session->read_data_terminator = g_strdup(terminator); -#if GLIB_CHECK_VERSION(2,61,2) g_date_time_unref(session->tv_prev); session->tv_prev = g_date_time_new_now_local(); -#else - g_get_current_time(&session->tv_prev); -#endif if (session->read_buf_len > 0) g_idle_add(session_recv_data_idle_cb, session); @@ -727,7 +713,6 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition, /* incomplete read */ if (!complete) { -#if GLIB_CHECK_VERSION(2,61,2) GDateTime *tv_cur = g_date_time_new_now_local(); GTimeSpan ts = g_date_time_difference(tv_cur, session->tv_prev); @@ -739,19 +724,6 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition, session->tv_prev = g_date_time_new_now_local(); } g_date_time_unref(tv_cur); -#else - GTimeVal tv_cur; - - g_get_current_time(&tv_cur); - if (tv_cur.tv_sec - session->tv_prev.tv_sec > 0 || - tv_cur.tv_usec - session->tv_prev.tv_usec > - UI_REFRESH_INTERVAL) { - session->recv_data_progressive_notify - (session, data_buf->len, 0, - session->recv_data_progressive_notify_data); - g_get_current_time(&session->tv_prev); - } -#endif return TRUE; } @@ -912,7 +884,6 @@ static gboolean session_write_data_cb(SockInfo *source, session->state = SESSION_ERROR; return FALSE; } else if (ret > 0) { -#if GLIB_CHECK_VERSION(2,61,2) GDateTime *tv_cur = g_date_time_new_now_local(); GTimeSpan ts = g_date_time_difference(tv_cur, session->tv_prev); @@ -927,23 +898,6 @@ static gboolean session_write_data_cb(SockInfo *source, session->tv_prev = g_date_time_new_now_local(); } g_date_time_unref(tv_cur); -#else - GTimeVal tv_cur; - - g_get_current_time(&tv_cur); - if (tv_cur.tv_sec - session->tv_prev.tv_sec > 0 || - tv_cur.tv_usec - session->tv_prev.tv_usec > - UI_REFRESH_INTERVAL) { - session_set_timeout(session, session->timeout_interval); - session->send_data_progressive_notify - (session, - session->write_data_p - session->write_data, - write_data_len, - session->send_data_progressive_notify_data); - g_get_current_time(&session->tv_prev); - } - -#endif return TRUE; } diff --git a/src/common/session.h b/src/common/session.h index d24e75030..f72270c88 100644 --- a/src/common/session.h +++ b/src/common/session.h @@ -88,11 +88,7 @@ struct _Session SessionState state; time_t last_access_time; -#if GLIB_CHECK_VERSION(2,61,2) GDateTime *tv_prev; -#else - GTimeVal tv_prev; -#endif gint conn_id; gint io_tag; diff --git a/src/inc.c b/src/inc.c index 48098c614..01e49c51f 100644 --- a/src/inc.c +++ b/src/inc.c @@ -508,13 +508,8 @@ static IncProgressDialog *inc_progress_dialog_create(gboolean autocheck) } dialog->dialog = progress; -#if GLIB_CHECK_VERSION(2,61,2) dialog->progress_tv = g_date_time_new_now_local(); dialog->folder_tv = g_date_time_new_now_local(); -#else - g_get_current_time(&dialog->progress_tv); - g_get_current_time(&dialog->folder_tv); -#endif dialog->queue_list = NULL; dialog->cur_row = 0; @@ -558,7 +553,7 @@ static void inc_progress_dialog_destroy(IncProgressDialog *inc_dialog) main_window_progress_off(inc_dialog->mainwin); progress_dialog_destroy(inc_dialog->dialog); -#if GLIB_CHECK_VERSION(2,61,2) +#if GLIB_CHECK_VERSION(2,26,1) g_date_time_unref(inc_dialog->progress_tv); g_date_time_unref(inc_dialog->folder_tv); #endif @@ -1091,7 +1086,6 @@ static void inc_progress_dialog_set_progress(IncProgressDialog *inc_dialog, static void inc_progress_dialog_update_periodic(IncProgressDialog *inc_dialog, IncSession *inc_session) { -#if GLIB_CHECK_VERSION(2,61,2) GDateTime *tv_cur = g_date_time_new_now_local(); GTimeSpan tv_result; @@ -1107,28 +1101,6 @@ static void inc_progress_dialog_update_periodic(IncProgressDialog *inc_dialog, g_date_time_unref(inc_dialog->progress_tv); inc_dialog->progress_tv = tv_cur; } -#else - GTimeVal tv_cur; - GTimeVal tv_result; - - gint msec; - - g_get_current_time(&tv_cur); - - tv_result.tv_sec = tv_cur.tv_sec - inc_dialog->progress_tv.tv_sec; - tv_result.tv_usec = tv_cur.tv_usec - inc_dialog->progress_tv.tv_usec; - if (tv_result.tv_usec < 0) { - tv_result.tv_sec--; - tv_result.tv_usec += G_USEC_PER_SEC; - } - - msec = tv_result.tv_sec * 1000 + tv_result.tv_usec / 1000; - if (msec > PROGRESS_UPDATE_INTERVAL) { - inc_progress_dialog_update(inc_dialog, inc_session); - inc_dialog->progress_tv.tv_sec = tv_cur.tv_sec; - inc_dialog->progress_tv.tv_usec = tv_cur.tv_usec; - } -#endif } static gint inc_recv_data_progressive(Session *session, guint cur_len, diff --git a/src/inc.h b/src/inc.h index c8d38b620..13f10c1cb 100644 --- a/src/inc.h +++ b/src/inc.h @@ -58,13 +58,8 @@ struct _IncProgressDialog gboolean show_dialog; -#if GLIB_CHECK_VERSION(2,61,2) GDateTime *progress_tv; GDateTime *folder_tv; -#else - GTimeVal progress_tv; - GTimeVal folder_tv; -#endif GList *queue_list; /* list of IncSession */ gint cur_row; -- 2.25.1