diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2011-03-15 13:10:11 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2011-03-15 13:10:11 -0400 |
commit | 934c602751618019c79d592e899bb028e62cbf6f (patch) | |
tree | c0ef91903bf1436a7d9f9cbe7f6383ee64c9c9ea /telepathy-logger | |
parent | 2cd78160f40fc43a79cc0c72bdb055cc61e5304b (diff) |
Move _tpl_entity_compare into TplEntity class
Diffstat (limited to 'telepathy-logger')
-rw-r--r-- | telepathy-logger/entity-internal.h | 2 | ||||
-rw-r--r-- | telepathy-logger/entity.c | 26 | ||||
-rw-r--r-- | telepathy-logger/log-manager-internal.h | 3 | ||||
-rw-r--r-- | telepathy-logger/log-manager.c | 27 |
4 files changed, 29 insertions, 29 deletions
diff --git a/telepathy-logger/entity-internal.h b/telepathy-logger/entity-internal.h index f8a3ade..c89d82c 100644 --- a/telepathy-logger/entity-internal.h +++ b/telepathy-logger/entity-internal.h @@ -37,5 +37,7 @@ typedef struct GObjectClass parent_class; } TplEntityClass; +gint _tpl_entity_compare (TplEntity *e1, TplEntity *e2); + G_END_DECLS #endif // __TPL_ENTITY_INTERNAL_H__ diff --git a/telepathy-logger/entity.c b/telepathy-logger/entity.c index e22239d..1f74cd7 100644 --- a/telepathy-logger/entity.c +++ b/telepathy-logger/entity.c @@ -346,3 +346,29 @@ tpl_entity_get_avatar_token (TplEntity *self) return self->priv->avatar_token; } + + +/* + * _tpl_entity_compare: + * @a: a #TplEntity + * @b: a #TplEntity + * + * Compares @a and @b. + * + * Returns: 0 if a == b, -1 if a < b, 1 otherwise. + */ +gint +_tpl_entity_compare (TplEntity *a, + TplEntity *b) +{ + g_return_val_if_fail (TPL_IS_ENTITY (a), TPL_IS_ENTITY (b) ? -1 : 0); + g_return_val_if_fail (TPL_IS_ENTITY (b), 1); + + if (tpl_entity_get_entity_type (a) == tpl_entity_get_entity_type (b)) + return g_strcmp0 (tpl_entity_get_identifier (a), + tpl_entity_get_identifier (b)); + else if (tpl_entity_get_entity_type (a) < tpl_entity_get_entity_type (b)) + return -1; + else + return 1; +} diff --git a/telepathy-logger/log-manager-internal.h b/telepathy-logger/log-manager-internal.h index 5ea9718..937f360 100644 --- a/telepathy-logger/log-manager-internal.h +++ b/telepathy-logger/log-manager-internal.h @@ -73,9 +73,6 @@ TplLogSearchHit * _tpl_log_manager_search_hit_new (TpAccount *account, void _tpl_log_manager_search_hit_free (TplLogSearchHit *hit); -gint _tpl_entity_compare (TplEntity *e1, - TplEntity *e2); - TplLogSearchHit * _tpl_log_manager_search_hit_copy (TplLogSearchHit *hit); #endif /* __TPL_LOG_MANAGER_PRIV_H__ */ diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c index 00229c4..dbe748c 100644 --- a/telepathy-logger/log-manager.c +++ b/telepathy-logger/log-manager.c @@ -35,6 +35,7 @@ #include <telepathy-glib/util.h> #include <telepathy-logger/conf-internal.h> +#include <telepathy-logger/entity-internal.h> #include <telepathy-logger/event.h> #include <telepathy-logger/event-internal.h> #include <telepathy-logger/log-store-internal.h> @@ -641,32 +642,6 @@ _tpl_log_manager_get_filtered_events (TplLogManager *manager, /* - * _tpl_entity_compare: - * @a: a #TplEntity - * @b: a #TplEntity - * - * Compares @a and @b. - * - * Returns: 0 if a == b, -1 if a < b, 1 otherwise. - */ -gint -_tpl_entity_compare (TplEntity *a, - TplEntity *b) -{ - g_return_val_if_fail (TPL_IS_ENTITY (a), TPL_IS_ENTITY (b) ? -1 : 0); - g_return_val_if_fail (TPL_IS_ENTITY (b), 1); - - if (tpl_entity_get_entity_type (a) == tpl_entity_get_entity_type (b)) - return g_strcmp0 (tpl_entity_get_identifier (a), - tpl_entity_get_identifier (b)); - else if (tpl_entity_get_entity_type (a) < tpl_entity_get_entity_type (b)) - return -1; - else - return 1; -} - - -/* * _tpl_log_manager_get_entities * @manager: the log manager * @account: a TpAccount the query will return data related to |