[evolution-data-server] Bug 710808 - Name all the timeouts added with g_timeout_add()
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 710808 - Name all the timeouts added with g_timeout_add()
- Date: Tue, 29 Oct 2013 16:26:23 +0000 (UTC)
commit 69f4915dc039a22e465d40bbdf01beb86b16ce38
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 29 12:18:32 2013 -0400
Bug 710808 - Name all the timeouts added with g_timeout_add()
addressbook/backends/ldap/e-book-backend-ldap.c | 20 ++++++++-----
addressbook/libedata-book/e-book-backend-summary.c | 5 ++-
addressbook/libedata-book/e-data-book-view.c | 2 +-
calendar/backends/weather/e-cal-backend-weather.c | 26 ++++++++++--------
calendar/libedata-cal/e-cal-backend-store.c | 2 +-
calendar/libedata-cal/e-data-cal-view.c | 9 +++---
camel/camel-db.c | 3 ++
camel/camel-folder-summary.c | 3 ++
camel/camel-operation.c | 28 ++++++++++++++-----
camel/camel-store-summary.c | 6 +++-
libebackend/e-authentication-mediator.c | 7 +++--
libebackend/e-dbus-server.c | 28 +++++++++++++------
libebackend/e-sqlite3-vfs.c | 9 +++---
modules/cache-reaper/module-cache-reaper.c | 7 +++--
14 files changed, 99 insertions(+), 56 deletions(-)
---
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index 0cff453..8aa1b70 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -260,7 +260,7 @@ static void ldap_op_add (LDAPOp *op, EBookBackend *backend, EDataBook *book,
EDataBookView *view, gint opid, gint msgid, LDAPOpHandler handler, LDAPOpDtor
dtor);
static void ldap_op_finished (LDAPOp *op);
-static gboolean poll_ldap (EBookBackendLDAP *bl);
+static gboolean poll_ldap (gpointer user_data);
static EContact *build_contact_from_entry (EBookBackendLDAP *bl, LDAPMessage *e, GList
**existing_objectclasses, gchar **ldap_uid);
@@ -1154,10 +1154,11 @@ ldap_op_add (LDAPOp *op,
bl->priv->active_ops++;
- if (bl->priv->poll_timeout == 0)
- bl->priv->poll_timeout = g_timeout_add (
- LDAP_POLL_INTERVAL,
- (GSourceFunc) poll_ldap, bl);
+ if (bl->priv->poll_timeout == 0) {
+ bl->priv->poll_timeout = e_named_timeout_add (
+ LDAP_POLL_INTERVAL, poll_ldap, bl);
+ }
+
g_rec_mutex_unlock (&bl->priv->op_hash_mutex);
g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
@@ -4157,14 +4158,17 @@ build_contact_from_entry (EBookBackendLDAP *bl,
}
static gboolean
-poll_ldap (EBookBackendLDAP *bl)
+poll_ldap (gpointer user_data)
{
- gint rc;
- LDAPMessage *res;
+ EBookBackendLDAP *bl;
+ gint rc;
+ LDAPMessage *res;
struct timeval timeout;
const gchar *ldap_timeout_string;
gboolean again;
+ bl = E_BOOK_BACKEND_LDAP (user_data);
+
g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap || !bl->priv->poll_timeout) {
bl->priv->poll_timeout = 0;
diff --git a/addressbook/libedata-book/e-book-backend-summary.c
b/addressbook/libedata-book/e-book-backend-summary.c
index ce9dec1..c29f72d 100644
--- a/addressbook/libedata-book/e-book-backend-summary.c
+++ b/addressbook/libedata-book/e-book-backend-summary.c
@@ -862,10 +862,11 @@ e_book_backend_summary_touch (EBookBackendSummary *summary)
summary->priv->dirty = TRUE;
if (!summary->priv->flush_timeout
- && summary->priv->flush_timeout_millis)
- summary->priv->flush_timeout = g_timeout_add (
+ && summary->priv->flush_timeout_millis) {
+ summary->priv->flush_timeout = e_named_timeout_add (
summary->priv->flush_timeout_millis,
summary_flush_func, summary);
+ }
}
/**
diff --git a/addressbook/libedata-book/e-data-book-view.c b/addressbook/libedata-book/e-data-book-view.c
index b8d670c..df4970c 100644
--- a/addressbook/libedata-book/e-data-book-view.c
+++ b/addressbook/libedata-book/e-data-book-view.c
@@ -203,7 +203,7 @@ ensure_pending_flush_timeout (EDataBookView *view)
if (view->priv->flush_id > 0)
return;
- view->priv->flush_id = g_timeout_add_seconds (
+ view->priv->flush_id = e_named_timeout_add_seconds (
THRESHOLD_SECONDS, pending_flush_timeout_cb, view);
}
diff --git a/calendar/backends/weather/e-cal-backend-weather.c
b/calendar/backends/weather/e-cal-backend-weather.c
index 69ba23d..52b6a7c 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -41,7 +41,7 @@
G_DEFINE_TYPE (ECalBackendWeather, e_cal_backend_weather, E_TYPE_CAL_BACKEND_SYNC)
-static gboolean reload_cb (ECalBackendWeather *cbw);
+static gboolean reload_cb (gpointer user_data);
static gboolean begin_retrieval_cb (ECalBackendWeather *cbw);
static ECalComponent *
create_weather (ECalBackendWeather *cbw,
@@ -79,18 +79,19 @@ struct _ECalBackendWeatherPrivate {
};
static gboolean
-reload_cb (ECalBackendWeather *cbw)
+reload_cb (gpointer user_data)
{
- ECalBackendWeatherPrivate *priv;
+ ECalBackendWeather *cbw;
- priv = cbw->priv;
+ cbw = E_CAL_BACKEND_WEATHER (user_data);
- if (priv->is_loading)
+ if (cbw->priv->is_loading)
return TRUE;
- priv->reload_timeout_id = 0;
- priv->opened = TRUE;
+ cbw->priv->reload_timeout_id = 0;
+ cbw->priv->opened = TRUE;
begin_retrieval_cb (cbw);
+
return FALSE;
}
@@ -124,10 +125,10 @@ maybe_start_reload_timeout (ECalBackendWeather *cbw)
interval_in_minutes = 240;
}
- if (interval_in_minutes > 0)
- priv->reload_timeout_id = g_timeout_add_seconds (
- interval_in_minutes * 60,
- (GSourceFunc) reload_cb, cbw);
+ if (interval_in_minutes > 0) {
+ priv->reload_timeout_id = e_named_timeout_add_seconds (
+ interval_in_minutes * 60, reload_cb, cbw);
+ }
}
/* TODO Do not replicate this in every backend */
@@ -547,7 +548,8 @@ e_cal_backend_weather_refresh (ECalBackendSync *backend,
priv->reload_timeout_id = 0;
/* wait a second, then start reloading */
- priv->reload_timeout_id = g_timeout_add (1000, (GSourceFunc) reload_cb, cbw);
+ priv->reload_timeout_id =
+ e_named_timeout_add_seconds (1, reload_cb, cbw);
}
static void
diff --git a/calendar/libedata-cal/e-cal-backend-store.c b/calendar/libedata-cal/e-cal-backend-store.c
index a9f0459..5296713 100644
--- a/calendar/libedata-cal/e-cal-backend-store.c
+++ b/calendar/libedata-cal/e-cal-backend-store.c
@@ -416,7 +416,7 @@ cal_backend_store_save_cache (ECalBackendStore *store)
if (store->priv->save_timeout_id > 0)
g_source_remove (store->priv->save_timeout_id);
- store->priv->save_timeout_id = g_timeout_add_seconds (
+ store->priv->save_timeout_id = e_named_timeout_add_seconds (
IDLE_SAVE_TIMEOUT_SECONDS,
cal_backend_store_save_cache_timeout_cb, store);
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index 5b3f4ba..e2e14af 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -694,12 +694,13 @@ ensure_pending_flush_timeout (EDataCalView *view)
if (view->priv->flush_id > 0)
return;
- if (e_data_cal_view_is_completed (view))
- view->priv->flush_id = g_timeout_add (
+ if (e_data_cal_view_is_completed (view)) {
+ view->priv->flush_id = e_named_timeout_add (
10 /* ms */, pending_flush_timeout_cb, view);
- else
- view->priv->flush_id = g_timeout_add_seconds (
+ } else {
+ view->priv->flush_id = e_named_timeout_add_seconds (
THRESHOLD_SECONDS, pending_flush_timeout_cb, view);
+ }
}
static void
diff --git a/camel/camel-db.c b/camel/camel-db.c
index 6aebd61..54d6cd5 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -288,6 +288,9 @@ camel_sqlite3_file_xSync (sqlite3_file *pFile,
cFile->timeout_id = g_timeout_add_seconds (
SYNC_TIMEOUT_SECONDS, (GSourceFunc)
sync_push_request_timeout, cFile);
+ g_source_set_name_by_id (
+ cFile->timeout_id,
+ "[camel] sync_push_request_timeout");
g_rec_mutex_unlock (&cFile->sync_mutex);
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 0cbb540..b54d276 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -2113,6 +2113,9 @@ cfs_schedule_info_release_timer (CamelFolderSummary *summary)
SUMMARY_CACHE_DROP,
(GSourceFunc) cfs_try_release_memory,
g_object_ref (summary));
+ g_source_set_name_by_id (
+ summary->priv->timeout_handle,
+ "[camel] cfs_try_release_memory");
}
}
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index 968fd89..e07aab3 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -108,8 +108,9 @@ status_node_unref (StatusNode *node)
}
static gboolean
-operation_emit_status_cb (StatusNode *node)
+operation_emit_status_cb (gpointer user_data)
{
+ StatusNode *node = user_data;
StatusNode *head_node;
gboolean emit_status;
@@ -271,18 +272,22 @@ camel_operation_push_message (GCancellable *cancellable,
node->message = g_strdup_vprintf (format, ap);
node->operation = g_object_ref (operation);
- if (g_queue_is_empty (&operation->priv->status_stack))
+ if (g_queue_is_empty (&operation->priv->status_stack)) {
node->source_id = g_idle_add_full (
G_PRIORITY_DEFAULT_IDLE,
- (GSourceFunc) operation_emit_status_cb,
+ operation_emit_status_cb,
status_node_ref (node),
(GDestroyNotify) status_node_unref);
- else
+ } else {
node->source_id = g_timeout_add_full (
G_PRIORITY_DEFAULT, TRANSIENT_DELAY,
- (GSourceFunc) operation_emit_status_cb,
+ operation_emit_status_cb,
status_node_ref (node),
(GDestroyNotify) status_node_unref);
+ g_source_set_name_by_id (
+ node->source_id,
+ "[camel] operation_emit_status_cb");
+ }
g_queue_push_head (&operation->priv->status_stack, node);
@@ -336,9 +341,12 @@ camel_operation_pop_message (GCancellable *cancellable)
node->source_id = g_timeout_add_full (
G_PRIORITY_DEFAULT, POP_MESSAGE_DELAY,
- (GSourceFunc) operation_emit_status_cb,
+ operation_emit_status_cb,
status_node_ref (node),
(GDestroyNotify) status_node_unref);
+ g_source_set_name_by_id (
+ node->source_id,
+ "[camel] operation_emit_status_cb");
}
UNLOCK ();
@@ -380,12 +388,16 @@ camel_operation_progress (GCancellable *cancellable,
node->percent = percent;
/* Rate limit progress updates. */
- if (node->source_id == 0)
+ if (node->source_id == 0) {
node->source_id = g_timeout_add_full (
G_PRIORITY_DEFAULT, PROGRESS_DELAY,
- (GSourceFunc) operation_emit_status_cb,
+ operation_emit_status_cb,
status_node_ref (node),
(GDestroyNotify) status_node_unref);
+ g_source_set_name_by_id (
+ node->source_id,
+ "[camel] operation_emit_status_cb");
+ }
}
UNLOCK ();
diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c
index bc57184..c933140 100644
--- a/camel/camel-store-summary.c
+++ b/camel/camel-store-summary.c
@@ -899,7 +899,11 @@ store_summary_schedule_save (CamelStoreSummary *summary)
if (summary->priv->scheduled_save_id != 0)
g_source_remove (summary->priv->scheduled_save_id);
- summary->priv->scheduled_save_id = g_timeout_add_seconds (5, store_summary_save_timeout, summary);
+ summary->priv->scheduled_save_id = g_timeout_add_seconds (
+ 5, store_summary_save_timeout, summary);
+ g_source_set_name_by_id (
+ summary->priv->scheduled_save_id,
+ "[camel] store_summary_save_timeout");
}
static void
diff --git a/libebackend/e-authentication-mediator.c b/libebackend/e-authentication-mediator.c
index 92b53eb..4a7e36f 100644
--- a/libebackend/e-authentication-mediator.c
+++ b/libebackend/e-authentication-mediator.c
@@ -844,7 +844,7 @@ authentication_mediator_try_password (ESourceAuthenticator *auth,
simple, (GDestroyNotify) NULL);
}
- async_context->timeout_id = g_timeout_add_seconds (
+ async_context->timeout_id = e_named_timeout_add_seconds (
INACTIVITY_TIMEOUT,
authentication_mediator_timeout_cb, simple);
@@ -1178,8 +1178,9 @@ e_authentication_mediator_wait_for_client (EAuthenticationMediator *mediator,
simple, (GDestroyNotify) NULL);
}
- async_context->timeout_id = g_timeout_add_seconds (
- INACTIVITY_TIMEOUT, authentication_mediator_timeout_cb, simple);
+ async_context->timeout_id = e_named_timeout_add_seconds (
+ INACTIVITY_TIMEOUT,
+ authentication_mediator_timeout_cb, simple);
g_mutex_lock (&mediator->priv->shared_data_lock);
diff --git a/libebackend/e-dbus-server.c b/libebackend/e-dbus-server.c
index d7c8ff5..9df4370 100644
--- a/libebackend/e-dbus-server.c
+++ b/libebackend/e-dbus-server.c
@@ -30,6 +30,8 @@
#include <glib-unix.h>
#endif
+#include <libedataserver/libedataserver.h>
+
#include <libebackend/e-module.h>
#include <libebackend/e-extensible.h>
#include <libebackend/e-backend-enumtypes.h>
@@ -95,8 +97,10 @@ dbus_server_name_lost_cb (GDBusConnection *connection,
}
static gboolean
-dbus_server_inactivity_timeout_cb (EDBusServer *server)
+dbus_server_inactivity_timeout_cb (gpointer user_data)
{
+ EDBusServer *server = E_DBUS_SERVER (user_data);
+
e_dbus_server_quit (server, E_DBUS_SERVER_EXIT_NORMAL);
return FALSE;
@@ -104,8 +108,10 @@ dbus_server_inactivity_timeout_cb (EDBusServer *server)
#ifdef G_OS_UNIX
static gboolean
-dbus_server_hang_up_cb (EDBusServer *server)
+dbus_server_hang_up_cb (gpointer user_data)
{
+ EDBusServer *server = E_DBUS_SERVER (user_data);
+
g_print ("Received hang up signal.\n");
e_dbus_server_quit (server, E_DBUS_SERVER_EXIT_RELOAD);
@@ -113,8 +119,10 @@ dbus_server_hang_up_cb (EDBusServer *server)
}
static gboolean
-dbus_server_terminate_cb (EDBusServer *server)
+dbus_server_terminate_cb (gpointer user_data)
{
+ EDBusServer *server = E_DBUS_SERVER (user_data);
+
g_print ("Received terminate signal.\n");
e_dbus_server_quit (server, E_DBUS_SERVER_EXIT_NORMAL);
@@ -162,12 +170,13 @@ static void
dbus_server_bus_acquired (EDBusServer *server,
GDBusConnection *connection)
{
- if (server->priv->use_count == 0 && !server->priv->wait_for_client)
+ if (server->priv->use_count == 0 && !server->priv->wait_for_client) {
server->priv->inactivity_timeout_id =
- g_timeout_add_seconds (
+ e_named_timeout_add_seconds (
INACTIVITY_TIMEOUT, (GSourceFunc)
dbus_server_inactivity_timeout_cb,
server);
+ }
}
static void
@@ -367,9 +376,9 @@ e_dbus_server_init (EDBusServer *server)
#ifdef G_OS_UNIX
server->priv->hang_up_id = g_unix_signal_add (
- SIGHUP, (GSourceFunc) dbus_server_hang_up_cb, server);
+ SIGHUP, dbus_server_hang_up_cb, server);
server->priv->terminate_id = g_unix_signal_add (
- SIGTERM, (GSourceFunc) dbus_server_terminate_cb, server);
+ SIGTERM, dbus_server_terminate_cb, server);
#endif
}
@@ -479,12 +488,13 @@ e_dbus_server_release (EDBusServer *server)
server->priv->use_count--;
- if (server->priv->use_count == 0)
+ if (server->priv->use_count == 0) {
server->priv->inactivity_timeout_id =
- g_timeout_add_seconds (
+ e_named_timeout_add_seconds (
INACTIVITY_TIMEOUT, (GSourceFunc)
dbus_server_inactivity_timeout_cb,
server);
+ }
}
/**
diff --git a/libebackend/e-sqlite3-vfs.c b/libebackend/e-sqlite3-vfs.c
index b5bce58..c2e8fe4 100644
--- a/libebackend/e-sqlite3-vfs.c
+++ b/libebackend/e-sqlite3-vfs.c
@@ -125,8 +125,10 @@ sync_push_request (ESqlite3File *cFile,
}
static gboolean
-sync_push_request_timeout (ESqlite3File *cFile)
+sync_push_request_timeout (gpointer user_data)
{
+ ESqlite3File *cFile = user_data;
+
g_rec_mutex_lock (&cFile->sync_mutex);
if (cFile->timeout_id != 0) {
@@ -242,9 +244,8 @@ e_sqlite3_file_xSync (sqlite3_file *pFile,
g_source_remove (cFile->timeout_id);
/* Wait SYNC_TIMEOUT_SECONDS before we actually sync. */
- cFile->timeout_id = g_timeout_add_seconds (
- SYNC_TIMEOUT_SECONDS, (GSourceFunc)
- sync_push_request_timeout, cFile);
+ cFile->timeout_id = e_named_timeout_add_seconds (
+ SYNC_TIMEOUT_SECONDS, sync_push_request_timeout, cFile);
g_rec_mutex_unlock (&cFile->sync_mutex);
diff --git a/modules/cache-reaper/module-cache-reaper.c b/modules/cache-reaper/module-cache-reaper.c
index 08472be..4f90a07 100644
--- a/modules/cache-reaper/module-cache-reaper.c
+++ b/modules/cache-reaper/module-cache-reaper.c
@@ -185,7 +185,7 @@ cache_reaper_reap_trash_directories (gpointer user_data)
/* Always explicitly reschedule since the initial
* interval is different than the regular interval. */
extension->reaping_timeout_id =
- g_timeout_add_seconds (
+ e_named_timeout_add_seconds (
REGULAR_INTERVAL_SECONDS,
cache_reaper_reap_trash_directories,
extension);
@@ -414,12 +414,13 @@ cache_reaper_files_loaded_cb (ESourceRegistryServer *server,
cache_reaper_scan_cache_directories (extension);
/* Schedule the initial reaping. */
- if (extension->reaping_timeout_id == 0)
+ if (extension->reaping_timeout_id == 0) {
extension->reaping_timeout_id =
- g_timeout_add_seconds (
+ e_named_timeout_add_seconds (
INITIAL_INTERVAL_SECONDS,
cache_reaper_reap_trash_directories,
extension);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]