[gnome-calendar] manager: cleaner way of returning enabled sources
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] manager: cleaner way of returning enabled sources
- Date: Wed, 24 Dec 2014 20:17:53 +0000 (UTC)
commit bc1560c609d2f96db3aa14e2926e4d0f85385f49
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Wed Dec 24 15:12:20 2014 -0500
manager: cleaner way of returning enabled sources
src/gcal-manager.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index f26656f..7ae8d0b 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -645,20 +645,21 @@ GList*
gcal_manager_get_sources (GcalManager *manager)
{
GcalManagerPrivate *priv;
- GList *l, *l2, *aux = NULL;
- ESource *source;
+ GHashTableIter iter;
+ gpointer key, value;
+ GList *aux = NULL;
priv = gcal_manager_get_instance_private (manager);
- l = g_hash_table_get_keys (priv->clients);
- for (l2 = l; l2 != NULL; l2 = g_list_next (l2))
+
+ g_hash_table_iter_init (&iter, priv->clients);
+ while (g_hash_table_iter_next (&iter, &key, &value))
{
- source = l2->data;
- if (g_strv_contains ((const gchar * const *) priv->disabled_sources, e_source_get_uid (source)))
+ GcalManagerUnit *unit = value;
+ if (!unit->enabled)
continue;
- aux = g_list_append (aux, source);
- }
+ aux = g_list_append (aux, key);
- g_list_free (l);
+ }
return aux;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]