diff options
author | Mikhail Zabaluev <mikhail.zabaluev@nokia.com> | 2007-07-23 12:26:35 +0000 |
---|---|---|
committer | Mikhail Zabaluev <mikhail.zabaluev@nokia.com> | 2007-07-23 12:26:35 +0000 |
commit | 64cb00852f89adc02f9ff95ef4cea4c2dfc3a76b (patch) | |
tree | 71ea1b3887dec9db162054fe44b42884d33df8f6 /telepathy-glib | |
parent | 0838e367eb24473753b04b3639e867f0041b1b5c (diff) | |
download | telepathy-glib-64cb00852f89adc02f9ff95ef4cea4c2dfc3a76b.tar.gz |
Introduced the persistent mode API orthogonal to the debug flags
20070723122635-5b6ca-1a7269b72092345220146027e5fb539e56e81b5e.gz
Diffstat (limited to 'telepathy-glib')
-rw-r--r-- | telepathy-glib/debug.c | 35 | ||||
-rw-r--r-- | telepathy-glib/debug.h | 1 | ||||
-rw-r--r-- | telepathy-glib/internal-debug.h | 1 | ||||
-rw-r--r-- | telepathy-glib/run.c | 2 |
4 files changed, 37 insertions, 2 deletions
diff --git a/telepathy-glib/debug.c b/telepathy-glib/debug.c index 1adfaf28d..41d48b6c3 100644 --- a/telepathy-glib/debug.c +++ b/telepathy-glib/debug.c @@ -73,6 +73,8 @@ static TpDebugFlags flags = 0; +static gboolean tp_debug_persistent = FALSE; + /** * tp_debug_set_all_flags: * @@ -88,7 +90,6 @@ static GDebugKey keys[] = { { "groups", TP_DEBUG_GROUPS }, { "properties", TP_DEBUG_PROPERTIES }, { "connection", TP_DEBUG_CONNECTION }, - { "persist", TP_DEBUG_PERSIST }, { "im", TP_DEBUG_IM }, { "params", TP_DEBUG_PARAMS }, { "presence", TP_DEBUG_PRESENCE }, @@ -130,6 +131,21 @@ tp_debug_set_flags_from_env (const gchar *var) tp_debug_set_flags_from_string (g_getenv (var)); } +/** + * tp_debug_set_persistent: + * @persistent: TRUE prevents the connection manager mainloop from exiting, + * FALSE enables exiting if there are no connections + * (the default behavior). + * + * Used to enable persistent operation of the connection manager process for + * debugging purposes. + */ +void +tp_debug_set_persistent (gboolean persistent) +{ + tp_debug_persistent = persistent; +} + /* * _tp_debug_set_flags: * @new_flags More flags to set @@ -175,6 +191,18 @@ void _tp_debug (TpDebugFlags flag, } } +/* + * _tp_debug_is_persistent: + * + * Returns: %TRUE if persistent mainloop behavior has been enabled with + * tp_debug_set_persistent(). + */ +gboolean +_tp_debug_is_persistent (void) +{ + return tp_debug_persistent; +} + #else /* !ENABLE_DEBUG */ void @@ -192,4 +220,9 @@ tp_debug_set_flags_from_env (const gchar *var) { } +void +tp_debug_set_persistent (gboolean persistent) +{ +} + #endif /* !ENABLE_DEBUG */ diff --git a/telepathy-glib/debug.h b/telepathy-glib/debug.h index b5ed39880..aaac79a32 100644 --- a/telepathy-glib/debug.h +++ b/telepathy-glib/debug.h @@ -8,6 +8,7 @@ G_BEGIN_DECLS void tp_debug_set_flags_from_string (const gchar *flags_string); void tp_debug_set_flags_from_env (const gchar *var); void tp_debug_set_all_flags (void); +void tp_debug_set_persistent (gboolean persistent); G_END_DECLS diff --git a/telepathy-glib/internal-debug.h b/telepathy-glib/internal-debug.h index ed4794ef4..0d4e28d3f 100644 --- a/telepathy-glib/internal-debug.h +++ b/telepathy-glib/internal-debug.h @@ -28,6 +28,7 @@ gboolean _tp_debug_flag_is_set (TpDebugFlags flag); void _tp_debug_set_flags (TpDebugFlags flags); void _tp_debug (TpDebugFlags flag, const gchar *format, ...) G_GNUC_PRINTF (2, 3); +gboolean _tp_debug_is_persistent (void); G_END_DECLS diff --git a/telepathy-glib/run.c b/telepathy-glib/run.c index a594c95d6..2aa22745d 100644 --- a/telepathy-glib/run.c +++ b/telepathy-glib/run.c @@ -63,7 +63,7 @@ static gboolean kill_connection_manager (gpointer data) { #ifdef ENABLE_DEBUG - if (!_tp_debug_flag_is_set (TP_DEBUG_PERSIST) && !connections_exist) + if (!_tp_debug_is_persistent () && !connections_exist) #else if (!connections_exist) #endif |