diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2010-07-19 13:50:56 +0100 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2010-08-06 19:14:17 +1000 |
commit | 3398e2f2f6cd6645ff862da717185fdd9f591989 (patch) | |
tree | 594e037395a9955923fd11e264d98e550344d3c2 | |
parent | f0d5ae23e52e45a5eb2a20d95135309065d9238d (diff) | |
download | telepathy-logger-3398e2f2f6cd6645ff862da717185fdd9f591989.tar.gz |
Remove ignore-accounts
Based on feedback from Simon and Guillaume.
-rw-r--r-- | data/org.freedesktop.Telepathy.Logger.gschema.xml.in | 8 | ||||
-rw-r--r-- | telepathy-logger/conf.c | 144 | ||||
-rw-r--r-- | telepathy-logger/observer.c | 8 | ||||
-rw-r--r-- | telepathy-logger/tpl-marshal.list | 2 |
4 files changed, 1 insertions, 161 deletions
diff --git a/data/org.freedesktop.Telepathy.Logger.gschema.xml.in b/data/org.freedesktop.Telepathy.Logger.gschema.xml.in index a7ecac6..ddb4c15 100644 --- a/data/org.freedesktop.Telepathy.Logger.gschema.xml.in +++ b/data/org.freedesktop.Telepathy.Logger.gschema.xml.in @@ -8,13 +8,5 @@ "false" will completely disable all logging. </_description> </key> - <key name="ignore-accounts" type="ao"> - <default>[]</default> - <_summary>Accounts for which logging is disabled</_summary> - <_description> - Disables logging for the named accounts, even when logging is globally - enabled. Object paths are Telepathy Account objects. - </_description> - </key> </schema> </schemalist> diff --git a/telepathy-logger/conf.c b/telepathy-logger/conf.c index 86ccda4..1f094c5 100644 --- a/telepathy-logger/conf.c +++ b/telepathy-logger/conf.c @@ -22,7 +22,6 @@ #include "config.h" #include "conf-internal.h" -#include "tpl-marshal.h" #include <glib.h> #include <gio/gio.h> @@ -36,77 +35,17 @@ #define GSETTINGS_SCHEMA "org.freedesktop.Telepathy.Logger" #define KEY_ENABLED "enabled" -#define KEY_IGNORE_ACCOUNTS "ignore-accounts" G_DEFINE_TYPE (TplConf, _tpl_conf, G_TYPE_OBJECT) static TplConf *conf_singleton = NULL; -enum /* signals */ -{ - IGNORE_ACCOUNTS_CHANGED, - LAST_SIGNAL -}; - -static guint _signals[LAST_SIGNAL] = { 0, }; - typedef struct { GSettings *gsettings; - - GHashTable *ignore_accounts; /* char * -> NULL */ } TplConfPriv; static void -_ignore_accounts_changed (GSettings *gsettings, - gchar *key, - TplConf *self) -{ - TplConfPriv *priv = GET_PRIV (self); - GVariant *v, *child; - GVariantIter iter; - GList *added = NULL, *removed; - GHashTable *new_ignore_accounts, *old_ignore_accounts; - - new_ignore_accounts = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, NULL); - - /* walk the new ignore list, work out what's been added */ - v = g_settings_get_value (priv->gsettings, KEY_IGNORE_ACCOUNTS); - g_variant_iter_init (&iter, v); - while ((child = g_variant_iter_next_value (&iter))) - { - const gchar *o = g_variant_get_string (child, NULL); - - if (!g_hash_table_remove (priv->ignore_accounts, o)) - { - /* account is not in list */ - added = g_list_prepend (added, (gpointer) o); - } - - g_hash_table_insert (new_ignore_accounts, g_strdup (o), - GUINT_TO_POINTER (TRUE)); - - g_variant_unref (child); - } - - /* get the remaining keys */ - removed = g_hash_table_get_keys (priv->ignore_accounts); - - /* swap priv->ignore_accounts over before emitting the signal */ - old_ignore_accounts = priv->ignore_accounts; - priv->ignore_accounts = new_ignore_accounts; - - g_signal_emit (self, _signals[IGNORE_ACCOUNTS_CHANGED], 0, added, removed); - - g_variant_unref (v); - g_list_free (added); - g_list_free (removed); - g_hash_table_destroy (old_ignore_accounts); -} - - -static void tpl_conf_finalize (GObject *obj) { TplConfPriv *priv; @@ -141,7 +80,6 @@ tpl_conf_constructor (GType type, conf_singleton = TPL_CONF (retval); g_object_add_weak_pointer (retval, (gpointer *) &conf_singleton); } - return retval; } @@ -154,15 +92,6 @@ _tpl_conf_class_init (TplConfClass *klass) object_class->finalize = tpl_conf_finalize; object_class->constructor = tpl_conf_constructor; - _signals[IGNORE_ACCOUNTS_CHANGED] = g_signal_new ("ignore-accounts-changed", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - tpl_marshal_VOID__POINTER_POINTER, - G_TYPE_NONE, - 2, G_TYPE_POINTER, G_TYPE_POINTER); - g_type_class_add_private (object_class, sizeof (TplConfPriv)); } @@ -174,12 +103,6 @@ _tpl_conf_init (TplConf *self) TPL_TYPE_CONF, TplConfPriv); priv->gsettings = g_settings_new (GSETTINGS_SCHEMA); - - priv->ignore_accounts = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, NULL); - - g_signal_connect (priv->gsettings, "changed::" KEY_IGNORE_ACCOUNTS, - G_CALLBACK (_ignore_accounts_changed), self); } @@ -239,70 +162,3 @@ _tpl_conf_globally_enable (TplConf *self, g_settings_set_boolean (GET_PRIV (self)->gsettings, KEY_ENABLED, enable); } - - -#if 0 -/** - * _tpl_conf_get_accounts_ignorelist - * @self: a TplConf instance - * - * The list of ignored accounts. If an account is ignored, no signals for this - * account will be logged. - * - * Returns: a GList of (gchar *) contaning ignored accounts' object paths - */ -GSList * -_tpl_conf_get_accounts_ignorelist (TplConf *self) -{ - GSList *ret = NULL; - GVariant *v; - - g_return_val_if_fail (TPL_IS_CONF (self), NULL); - - v = g_settings_get_value (GET_PRIV (self)->gsettings, KEY_IGNORE_ACCOUNTS); - - return ret; -} - - -/** - * _tpl_conf_set_accounts_ignorelist - * @self: a TplConf instance - * @newlist: a new GList containing account's object paths (gchar *) to be - * ignored - * - * Globally disables logging for @newlist account's path. If an account is - * disabled, no signals for such account will be logged. - * - * Note that this will change the global TPL configuration, affecting all the - * TPL instances, including the TPL logging process and all the clients using - * libtelepathy-logger. - */ -void -_tpl_conf_set_accounts_ignorelist (TplConf *self, - GSList *newlist) -{ - g_return_if_fail (TPL_IS_CONF (self)); -} -#endif - - -/** - * _tpl_conf_is_account_ignored - * @self: a TplConf instance - * @account_path: a TpAccount object-path - * - * Whether @account_path is enabled or disabled (aka ignored). - * - * Returns: %TRUE if @account_path is ignored, %FALSE otherwise - */ -gboolean -_tpl_conf_is_account_ignored (TplConf *self, - const gchar *account_path) -{ - g_return_val_if_fail (TPL_IS_CONF (self), FALSE); - g_return_val_if_fail (!TPL_STR_EMPTY (account_path), FALSE); - - return g_hash_table_lookup (GET_PRIV (self)->ignore_accounts, account_path) - != NULL; -} diff --git a/telepathy-logger/observer.c b/telepathy-logger/observer.c index a01f665..be710c2 100644 --- a/telepathy-logger/observer.c +++ b/telepathy-logger/observer.c @@ -146,14 +146,6 @@ tpl_observer_observe_channels (TpBaseClient *client, goto error; } - if (_tpl_conf_is_account_ignored (conf, tp_proxy_get_object_path (account))) - { - DEBUG ("Logging is disabled for account %s. " - "Channel associated to this account. " - "Skipping this channel logging.", tp_proxy_get_object_path (account)); - - goto error; - } g_object_unref (conf); /* Parallelize TplChannel preparations, when the last one will be ready, the diff --git a/telepathy-logger/tpl-marshal.list b/telepathy-logger/tpl-marshal.list index cd48853..71e2781 100644 --- a/telepathy-logger/tpl-marshal.list +++ b/telepathy-logger/tpl-marshal.list @@ -1 +1 @@ -VOID:POINTER,POINTER +# add marshallers here |